1

としてメモリ アドレスを受け取る関数があり、を使用$a0して (可変) ワード数にアクセスします。MIPS アセンブリはまったく新しいので、ここにあるポインタが役に立ちます!x($a0)x$sp$a0

4

1 に答える 1

0

8 の倍数 mips-64 を使用していると仮定します

最初にループを作成し、毎回 a0 を 8 ずつ増やします。

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 $a0
于 2014-04-15T18:55:26.173 に答える