Advertisement
Guest User

sefw4f2f2f2r2r

a guest
Sep 22nd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. .text
  2.  
  3. .global _start
  4.  
  5. start = 0
  6. max = 31
  7. sto = 1
  8.  
  9. _start:
  10. /* holds loop counter */
  11. mov x9, start
  12.  
  13. loop:
  14. /* getting the quotient and remainder */
  15. /* into registers 11 (left) and 12 (right) */
  16. mov x13,10
  17. udiv x11,x9,x13
  18. msub x12,x11,x13,x9
  19. add x11,x11,48
  20. add x12,x12,48
  21.  
  22. /* shifting characters if < 10 */
  23. cmp x9,9
  24. b.gt continue
  25. mov x11,x12
  26. mov x12,32
  27.  
  28. continue:
  29. /* recording the numbers in the string */
  30. adr x13,msg
  31. strb w11,[x13,6]
  32. strb w12,[x13,7]
  33.  
  34. /* printing the string */
  35. mov x2,len
  36. adr x1,msg
  37. mov x0,sto
  38. mov x8,64
  39. svc 0
  40.  
  41. /* incrementing and looping */
  42. add x9,x9,1
  43. mov x10,max
  44. cmp x9,x10
  45. b.ne loop
  46.  
  47. /* exit 0 */
  48. mov x0,0
  49. mov x8,93
  50. svc 0
  51.  
  52. .data
  53. msg: .ascii "Loop: \n"
  54. .set len, . - msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement