I have to write a program in assembly language that is to store in memory the first 256 integers from 0 to 255.
Here is the code I wrote (I am a beginner with the assembly language):
.data
memory: .space 256
.text
li $t0, 0
la $s0, memory
sb $s0, 0($t0)
loop:
add $t0, $t0, 1
sb $s0, 0($t0)
j loop
I tried to run the program with SPIM but does not work: SPIM says there is an error to instruction sb $s0, 0($t0)
.
Anyone can help me with this?