Concorp
Concorp

Reputation: 33

Mips assembly save return value into specific adress

So I have a procedure (function) that returns a value in $v0, in the main I move it into $s0 to save it for later.

Now from $s0 if I want to save the value at adress 0xFFFF0010 how would I write that ? I seen that lui and ori can be used but i'm not sure how to implement it.

Thanks

Upvotes: 0

Views: 266

Answers (1)

Concorp
Concorp

Reputation: 33

Figured it out right after posting the question:

so lets say I have

li $s0, 4             # Value 4 saved in register $s0
lui $s1, 0xFFFF       # FFFF as first 16 bits
ori $s1, 0x0010       # 0010 as last 16 bits
sw $s0, ($s1)         # Saves the value 4 at address 0xFFFF0010

Upvotes: 1

Related Questions