Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global _start
- start = 0
- max = 31
- sto = 1
- _start:
- /* holds loop counter */
- mov x9, start
- loop:
- /* getting the quotient and remainder */
- /* into registers 11 (left) and 12 (right) */
- mov x13,10
- udiv x11,x9,x13
- msub x12,x11,x13,x9
- add x11,x11,48
- add x12,x12,48
- /* shifting characters if < 10 */
- cmp x9,9
- b.gt continue
- mov x11,x12
- mov x12,32
- continue:
- /* recording the numbers in the string */
- adr x13,msg
- strb w11,[x13,6]
- strb w12,[x13,7]
- /* printing the string */
- mov x2,len
- adr x1,msg
- mov x0,sto
- mov x8,64
- svc 0
- /* incrementing and looping */
- add x9,x9,1
- mov x10,max
- cmp x9,x10
- b.ne loop
- /* exit 0 */
- mov x0,0
- mov x8,93
- svc 0
- .data
- msg: .ascii "Loop: \n"
- .set len, . - msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement