$\require{cancel}$
int ary[MAX_SIZE];
.data MAX_SIZE: .word 7 ARRAY: .space 28 # NAX_SIZE*4
for (i=0; i < MAX_SIZE; ++i) {
A[i] = i;
}
li $t0, 0
li $t1, 0
lw $t2, MAX_SIZE
TOP_OF_LOOP_1:
# while i < MAX_SIZE
beq $t0, $t2, OUT_OF_LOOP_1
# A[i] = i
sw $t0, ARRAY($t1)
# i = i + 1
addi $t0, $t0, 1
# but I also have to add 4 to the actual offset
addi $t1, $t1, 4
j TOP_OF_LOOP_1
OUT_OF_LOOP_1:
sw and lw
sw $rt, immediate($rs)
M[R[$rs] + SignExtend(immediate) ] = R[$rt]
lui (Load upper immediate) and addu (add unsigned) allow us to address ALL of memory.
lui $1, 4097
at which is the assembler temporary
addu $1, $1, $9
sw $8, 4($1)
move $t0, $t2
addu $t0, $zero, $t2
mult $t1, $t5
$lo, $hi.
mflo $t1 will move the low 32 bits to t1.
mfhi $t6 will move the high 32 bits to t6.
div $t1, $t2
$lo = $t1/$t2
$hi = $t1 % $t2