Reputation: 195
I need help with figuring out how do I store the value of a register (e.g. R0) on an address line that can be found on yet another register (e.g. R1):
AddressLine[R1] <- M[R0]
if R1 = x3400
then x3400 <- M[R0]
Upvotes: 1
Views: 1421
Reputation: 647
You're looking for the STR instruction
STR <source register> <base register> <immediate offset>
i.e.
AND r0,r0,#0 ; clear r0
ADD r0,r0,#10 ; r0 = 10
LEA r1,MEMSPACE ; address of MEMSPACE
STR r0,r1,#0 ; M[R1 + 0] = R0
MEMSPACE .word 0 ; will become 10
Upvotes: 1