Advertisement
math230

branching procedure

Oct 21st, 2015
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # nonLeaf.asm
  2. # function branches off to another, clobbering $ra
  3. .data
  4.  
  5. .text
  6.  
  7. .globl main
  8. main:
  9.     nop
  10.     nop
  11.     nop
  12.     nop
  13.     nop
  14.     nop
  15.  
  16.     li $a0, 9
  17.     li $a1, 4
  18.     li $a2, 1
  19.     li $a3, 2
  20.  
  21.  
  22.     jal f1
  23.     nop
  24.  
  25. f1:
  26.  
  27.     add $t0, $a0, $a1
  28.     add $t1, $a2, $a3
  29.     jal joesJam
  30.     sub $v0, $t0, $t1
  31.     jr  $ra
  32.  
  33.  
  34. joesJam:
  35.     add $v0,$a0,$a1
  36.     jr $ra
  37.  
  38. exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement