Advertisement
Garey

Marto_ARM_Assembly

May 8th, 2018
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.48 KB | None | 0 0
  1. .global main
  2.  
  3. .section .data
  4.   myNumbers: .byte 183, 374, -113, -1, 10, 101, -3, -54, 9, 7
  5.   myNumbersEnd:
  6.  
  7. .section .text
  8.   main:
  9.  
  10.   loop:
  11.     mov r4, #0
  12.     ldr r0, =myNumbers
  13.     ldr r3, =myNumbersEnd
  14.  
  15. inner_loop:
  16.     ldrsb r1, [r0], #1  
  17.     ldrsb r2, [r0]  
  18.     cmp r1, r2
  19.  
  20.     strgtb r1, [r0]
  21.     strgtb r2, [r0, #-1]
  22.     movgt r4, #1 @ r4 = swapped = true
  23.  
  24.     cmp r0, r3
  25.     bne inner_loop
  26.  
  27.     cmp r4, #1
  28.     beq loop @ keep going
  29. exit:
  30.     b exit
  31. .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement