0

If I had an immediate value like:

.data
sum:  .word  0

made some calculations in the code, and wanted to put the result back into "sum" in main memory, how would I do that? I've been going over the manual for the command, but I must not be understanding concepts as well as I should.

Any help for a newbie?

twoxmachine
  • 517
  • 2
  • 7
  • 16

1 Answers1

0

Use the Store Word instruction, sw. As usual, you have to use a register for the address, or let the assembler take care of that if it provides such support.

Suppose you want to write$t0 into sum:

la $t1, sum
sw $t0, ($t1)

or simply sw $t0, sum which your assembler will turn into equivalent code.

Jester
  • 56,577
  • 4
  • 81
  • 125