Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2.     ori $4, $0, 30
  3.     ori $5, $0, 15 
  4.     jal subroute
  5.     ori $4, $0, 25
  6.     ori $5, $0, 35
  7.     jal subroute
  8.         ori $4, $0, 210
  9.         ori $5, $0, 28
  10.         jal subroute
  11.         ori $4, $0, 49
  12.         ori $5, $0, 42
  13.         jal subroute
  14.         ori $4, $0, 17
  15.         ori $5, $0, 3
  16.         jal subroute
  17.         ori $4, $0, 17
  18.         ori $5, $0, 51
  19.         jal subroute
  20.     j exit #ends programm
  21. subroute:
  22.     or $2, $0, $5
  23.     ori $3, $0, 1
  24.  #start of the algorithm
  25.     beq $4, $0, end
  26.    
  27. gt5:
  28.     beq $5, $0, gt9
  29.     slt $1, $5, $4 #r4 > r5
  30.     beq $1, $3, ins1
  31.     j ins2
  32.  
  33. avoidgt10:
  34.     j end #jump to end
  35.  
  36. gt9
  37.     or $2, $0, $4
  38.  
  39. ins1:
  40.     sub $4, $4, $5
  41.     j gt5
  42.  
  43. ins2:
  44.     sub $5, $5, $4
  45.  
  46. end:
  47.     jr $ra
  48. exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement