How to add a register 's content as an immediate argument in a mips instruction?

StackOverflow https://stackoverflow.com/questions/19798296

  •  04-07-2022
  •  | 
  •  

Domanda

I have a register called $offset which I can control. I would like to know how can I rewrite the lw command such that instead of the word off in

lw $a off($b) 

I have to the content of the $offset register.

È stato utile?

Soluzione

MIPS assembly doesn't support this.

What you will need to do instead is:

add $c $b $offset
lw  $a 0($c)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top