Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- A: .word 1, 3, 5, 7, 9, 10, 11, 12, 13, 15
- i: .word 10
- j: .word 14
- .text
- la $s1, A
- lw $s2, i
- lw $s3, j
- andi $s3, $s3, 3 # j = j & 3
- #print j (first part of task)
- li $v0,1
- move $a0, $s3
- syscall
- addi $t0, $s2, 1 # i + 1
- addi $t8, $zero, 2 # const 2
- div $s2, $t8 # i / 2
- mflo $t1 # $t1 = i / 2
- addi $t9, $zero, 4 # const 4
- div $s3, $t9 # j % 4
- mfhi $t2 # $t1 = j % 4
- add $t3, $s1, $t0 #A[i+1]
- add $t4, $s1, $t1 #A[i/2]
- lw $t5, 0($t3) #A[i+1]
- lw $t6, 0($t4) #A[i/2]
- add $t5, $t6, $t2 #A[i/2] + j%4
- #print A[i+1]
- li $v0, 1
- move $a1, $t5
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement