Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- #ori $4, $0, 30
- #ori $5, $0, 25
- #jal subroute
- #ori $4, $0, 25
- #ori $5, $0, 35
- #jal subroute
- #ori $4, $0, 210
- #ori $5, $0, 28
- #jal subroute
- #ori $4, $0, 49
- #ori $5, $0, 42
- #jal subroute
- ori $4, $0, 17
- ori $5, $0, 3
- jal subroute
- #ori $4, $0, 17
- #ori $5, $0, 51
- #jal subroute
- j exit #ends programm
- subroute:
- or $2, $0, $5
- beq $4, $0 end
- gt5: #start of the algorithm
- beq $5, $0, gt9
- slt $1, $5, $4 #r4 > r5
- beq $1, $0, ins2
- #if r4 > r5
- sub $4, $4, $5# $4 <- $4 - $5
- j gt5
- ins2: #else case
- sub $5, $5, $4 # $5 <- $5 -$4
- j gt5
- avoidgt10:
- j end #jump to end
- gt9:
- or $2, $4, $0
- end:
- jr $ra
- exit:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement