Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- reply: .asciiz "The sum is:"
- .text
- # call function sum(a, b)
- addi $a0, $0, 4
- addi $a1, $0, 3
- jal sum
- add $s0, $zero,$v0 #save returned value
- #print The Reply
- la $a0, reply
- li $v0, 4
- syscall
- #print the sum
- li $v0, 1 #v0= 1 will print $a0
- add $a0, $0, $s0 #$a0 = $s0
- syscall #print $a0
- #make a triumphant horn
- li $a0, 32
- li $a1, 5000
- li $a2, 40
- li $a3, 100
- li $v0, 31
- syscall
- j exit
- sum: addi $sp, $sp, -12
- sw $ra, 0($sp)
- sw $t0, 4($sp)
- add $v0, $a0,$a1
- jr $ra
- exit:
- li $v0, 10
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement