#store 1 to 10
#Since we use 0-9 as address offsets
#and 1-10 as values to be stored, 2 counters are used. (Kludgy)
#sll is used to multiply by 4.
#la puts base address of array into a register
.data 0x10000000 #Start storing here
.align 2 #Prevent word boundary problems
nums: .space 40
.text
.globl main
main:
la $t0, nums($zero) # Get base address into $t0
add $t1, $zero, $zero # Initialize $t1 to 0
addi $t2, $zero, 1 # Initialize $t2 to 1
loop:
sll $t4, $t1, 2 # Multiply by 4
sw $t2, nums($t4) # Number in $t2 stored
addi $t2, $t2, 1 # increment counter
addi $t1, $t1, 1 # increment counter
bne $t1, 10, loop # If not yet 10, loop
loopexit:
j $ra