Advertisement
math230

Simple Leaf function using jal and jr

Jul 20th, 2020
2,354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # leaf1.asm
  2. # Simple Leaf function using jal and jr
  3. .data
  4.  
  5. .text
  6.   nop
  7.   nop
  8.   nop
  9.  
  10.   li $a0, 9
  11.   li $a1, 4
  12.   li $a2, 1
  13.   li $a3, 2
  14.  
  15.   jal leaf1
  16.   nop
  17.    j exit  # do NOT drop down to leaf1. Jump over it
  18.  
  19. leaf1:
  20.   add $t0, $a0, $a1
  21.   add $t1, $a2, $a3
  22.   sub $v0, $t0, $t1
  23.   jr $ra
  24.  
  25.  
  26. exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement