我有一个函数,它将内存地址作为$a0,并使用x($a0)访问(变量)字数,其中x是8的倍数。我需要将它们存储在$sp寄存器中,以便可以使用$a0寄存器将参数传递给其他函数。全新的MIPS汇编,所以这里的任何指针都会有帮助!
发布于 2014-04-16 02:55:26
8的倍数,我假设您使用的是mips-64
首先,u做一个循环,每次递增8次a0:
loop: lw $t0, 0($a0) ;fetch data and store in t0
addi $sp,$sp,-8 ;increase stack
sw $t0, 0($sp) ;store data fetched
addi $a0,$a0,8 ;increment a0 to go to next entry
;here you check that you haven't reached x yet
;let's say 8*x+$a0(initial) is stored in $t1 (this is easy to do just use sll by 3 to multiply by 8 then add a0 before loop)
bne $a0,$t1,loop
;now you can use $a0https://stackoverflow.com/questions/23088327
复制相似问题