Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Simple MIPS functions that preserves registers
- .data
- .text
- .globl main
- main:
- li $a0, 9
- li $a1, 4
- li $a2, 1
- li $a3, 2
- jal leaf1
- nop
- j exit
- leaf1:
- # PROLOGUE
- addi $sp,$sp, -12
- sw $t1, 8($sp)
- sw $t0, 4($sp)
- sw $s0, 0($sp)
- #######################
- add $t0, $a0, $a1
- add $t1, $a2, $a3
- sub $v0, $t0, $t1 #return result is placed here
- #######################
- # EPILOGUE
- lw $s0, 0($sp)
- lw $t0, 4($sp)
- lw $t1, 8($sp)
- addi $sp,$sp, 12
- jr $ra
- exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement