Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- .globl first
- first: .word 5, 4, 3
- .word 2
- .word 1
- .globl last
- last: .word 0
- .text
- .globl main
- main:
- la $t1, first #load address, $t1 = 0
- lw $t2, 0($t1) #load content from M[$t1+0] $t2 = 5
- lw $t5, 4($t1) #load content from M[$t1+4] $t5 = 4
- add $t2, $t2, $t5 #add contents of $t2 & $t5, store result in $t2
- lw $t5, 8($t1) #load content from M[$t1+8], $t5=3
- add $t2, $t2, $t5 #$t2 = $t2+$t5 ($t2 = 12)
- lw $t5, 12($t1) #load from M[$t1+12] $t5 = 2
- add $t2, $t2, $t5 #$t2 = $t2+$t5 ($t2 = 14)
- addi $t2, $t2, 1 #add immediate number (constant number) 1 to content of $t2, put result in $t2. $t2=$t2+1=15
- li $v0, 10 #load system call code 10 (exit) to $v0
- syscall #Make the system call $v0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement