Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MIPS数组工作,但打印0而不是预期的输出_Mips - Fatal编程技术网

MIPS数组工作,但打印0而不是预期的输出

MIPS数组工作,但打印0而不是预期的输出,mips,Mips,代码运行正常,但没有在我已经保存的数组中打印11个不同的数字。word只打印了0 11次,我想知道是否有人看到了原因?看起来$s5没有更新,idk为什么循环正确迭代,我没有崩溃或其他问题 la $s4, numbers lw $s5, 0($s4) la $t3, numbers_len lw $s7, 0($t3) li $t5, 0 swap: move $t3, $t1 move $t1, $

代码运行正常,但没有在我已经保存的数组中打印11个不同的数字。word只打印了0 11次,我想知道是否有人看到了原因?看起来$s5没有更新,idk为什么循环正确迭代,我没有崩溃或其他问题

    la    $s4, numbers
    lw    $s5, 0($s4)
    la    $t3, numbers_len
    lw    $s7, 0($t3)

    li    $t5, 0

    swap:
    move $t3, $t1
    move $t1, $t2
    move $t2, $t3
        slt   $s1, $t1, $t2
    beq   $s1, 1, forloop1
    sub   $t4, $t2, $t1
    beq   $t4, 0, forloop1

    forloop1:
        slt   $s2, $t5, $t0
    beq   $s2, 0, print
      
    slt   $s3, $t5, $s7
    beq   $s3, 0, print
    
    slt   $t6, $t1, $s5   
   
    
    beq   $t6, 0, print

  
   slt   $t7, $s5, $t2
       beq   $t7, 1, update 
   

   update:
   mul  $s5, $s5, $t1
       add  $s5, $s5, $t2
     
       add   $t5, $t5, 1
   j    forloop1
    

    print:
   la    $a0, msg4            # $a0 = address of msg4
       li    $v0, 4               # $v0 = 4  --- this is to call print_string()
   syscall


   printmessage:
    
 
       
    beq   $t5, 11, exit
    li    $v0, 1
    move  $a0, $s5
    syscall
    add   $t5, $t5, 1

    j     printmessage

    exit:
    li    $v0, 10
    syscall

为什么要更新?在进行打印的循环中,您从不使用
$s5
作为目标寄存器。