Advertisement
Guest User

arma3

a guest
Jan 22nd, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.89 KB | None | 0 0
  1.     ENTRY
  2.     B main
  3.     ;;  array   DEFW    4, 15, 47, 23, 18, 10, 22, 6, 37, 28
  4.  
  5. array   DEFW    8, 4, 17, 23, 40, 43, 35, 21, 4, 34
  6.    
  7. message DEFB    "Sorted list is \0"
  8. msg2    DEFB    " made up of \0"
  9. msg3    DEFB    " and \0"
  10. msg4    DEFB    "\n\0"
  11.     ALIGN
  12.  
  13.  
  14. main    ADR R0,array
  15.         SUB R1,R0,#4
  16.  
  17.         MOV R4,#1
  18.         B iLoopCond
  19. iLoop   LDR R6, [R0, R4 LSL #2]
  20.         MOV R5,R4               ; j is in r5
  21.  
  22.         B cLoopCond
  23.  
  24. cLoop   STR R7, [r0, r5 LSL #2]
  25.         sub r5,r5,#1
  26.  
  27. cLoopCond
  28.         CMP R5, #0
  29.         BLE cLoopEnd
  30.         LDR R7, [R1, R5 LSL #2]
  31.         CMP R7, R6
  32.         BGT cLoop
  33.  
  34. cLoopEnd
  35.         STR R6,[R0, R5 LSL #2]
  36.         ADD R4,R4,#1
  37.  
  38. iLoopCond
  39.         CMP R4,#10
  40.         BLT iLoop
  41.  
  42.         ADR R0, message
  43.         SWI 3
  44.  
  45.         ADR R0, array
  46.         MOV R1, #10
  47.         BL PrintArray
  48.  
  49.         ADR R0,msg4
  50.         SWI 3
  51.  
  52.  
  53.         SWI 2
  54.  
  55.  
  56. PrintArray
  57.         MOV R3,R0
  58.         B   ploopCond
  59. ploop   LDR R0, [R3], #4
  60.         SWI 4
  61.         MOV R0,#','
  62.         SWI 0
  63.         SUB R1,R1,#1
  64. ploopCond
  65.         CMP R1,#0
  66.         BGT ploop
  67.         MOV PC,R14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement