Advertisement
Guest User

Untitled

a guest
Jun 10th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2. main:
  3.     li $v0,5
  4.     syscall
  5.     move $a0,$v0
  6.    
  7.     li $v0,5
  8.     syscall
  9.     move $a1,$v0
  10.    
  11.     jal funzione
  12.     move $a0,$v0
  13.    
  14.     li $v0,1
  15.     syscall
  16.    
  17.     li $v0,10
  18.     syscall
  19.    
  20. funzione:
  21.     add $t0,$a0,$a1
  22.     bgez $t0,caso_base
  23.    
  24.     subu $sp,$sp,24
  25.     sw $ra,0($sp)
  26.     sw $a0,4($sp)
  27.     sw $a1,8($sp)
  28.    
  29.     sub $a0,$a0,2
  30.     add $a1,$a1,3
  31.    
  32.     jal funzione
  33.    
  34.     lw $ra,0($sp)
  35.     lw $t1,4($sp)
  36.     lw $t2,8($sp)
  37.    
  38.     add $sp,$sp,24
  39.    
  40.     mul $t1,$t1,2
  41.     mul $t2,$t2,3
  42.    
  43.     sub $t3,$t1,$t2
  44.    
  45.     add $v0,$v0,$t3
  46.     j fine
  47.    
  48. fine:
  49.     jr $ra
  50.    
  51. caso_base:
  52.     li $v0,12
  53.     jr $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement