将字符串中的字符推入堆栈MIPS

时间:2017-07-21 14:02:58

标签: assembly mips

您可以告诉我这段代码的最后两行是什么意思吗? 功能"停止"。它应该是:

move $t0, $0  # put the terminator of the string (Why in $t0?)

lw $v0, 4($a0) # I don't know

谢谢

Input: li $t1, 0  #counter=0
Loop: addiu $a0, $a0, -4 #allocate a word into the stack
      addiu $t1, $t1, 1 
      li $v0,12      #read the character
      syscall
      sw $v0, ($a0)  #write it into the stack
      bgt $t1, 256, Stop  #if the counter is greater than the space allocated into the stack Stop
      beq $v0, '\n', Stop

      j Loop

Stop: move $t0, $0
      lw $v0, 4($a0)
      jr $ra

0 个答案:

没有答案