Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. 21
  2. 22 .text
  3. 23 main:
  4. 24
  5. 25 # Read in the integer
  6. 26 li $v0 5 # service 5 is read integer
  7. 27 syscall # make call
  8. 28
  9. 29 # Prepare registers for loop
  10. 30 move $t3 $v0 # move inputed integer into $t3
  11. 31 li $t0 0 # set counter for loop
  12. 32 li $t1 4 # set condition for loop
  13. 33
  14. 34 loop:
  15. 35 beq $t0 $t1 done # if $t0 == $t1, goto done
  16. 36 addi $t0 1 # add 1 to counter
  17. 37 add $t4 $t3 0x00FF # mask last byte of $t3 into $t4
  18. 38 or $t5 $t5 $t4 # or $t4 and $t5 into $t5
  19. 39 sll $t5 $t5 8 # shift left $t5 by 8 bits
  20. 40 srl $t0 $t0 8 # shift right $t3 by 8 bits
  21. 41 j loop # jump to loop
  22. 42
  23. 43 done:
  24. 44 li $v0 1 # service 1 is print integer
  25. 45 move $a0 $t5 # move $t5 into $a0
  26. 46 syscall # make call
  27. 47 jr $ra # exit program
  28. 48
  29. 49
  30. 50
  31. 51
  32. ~
  33. 51,0-1 Bot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement