【问题标题】:finding the minmum integer and its adress in mips在 mips 中找到最小整数及其地址
【发布时间】:2013-11-06 12:42:08
【问题描述】:

我正在学习汇编语言,我正在使用 mips。 我的代码工作正常,但数组完成后不会停止

这是我的代码 你能告诉我停止程序并继续存在的正确条件是什么(在 B: 中)?

.data
A: .word 12,31,5,72,4
E: .byte

.text 

la $t1,A        # t1 is the min
lw $s1,A
la $t2,E
subu $t5,$t2,$t1    # t5 to know the location of the last value and decreses it 

move $t6,$t1
move $t3,$t1        #adress of next value

srl $t4,$t5,2
addi $t7,$t4,0

outerloop:
#addiu $t1,$t1,4

x:
addiu $t3,$t3,4
lw $s2,0($t3)

bleu $s1,$s2,B
move $t6,$t3
lw $s6,0($t6)

subiu $t5,$t5,4
B: j x 

exit:
li $v0,10
syscall

【问题讨论】:

    标签: arrays assembly mips min minimum


    【解决方案1】:

    您需要为数组定义一个大小并测试检查元素的数量,或者定义数组的最后一个元素(例如零),并在遇到该元素时停止。

    【讨论】:

      猜你喜欢
      • 2016-11-21
      • 1970-01-01
      • 2018-01-29
      • 2021-10-03
      • 2018-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-07
      相关资源
      最近更新 更多