Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ENTRY
- B main
- ;; array DEFW 4, 15, 47, 23, 18, 10, 22, 6, 37, 28
- array DEFW 8, 4, 17, 23, 40, 43, 35, 21, 4, 34
- message DEFB "Sorted list is \0"
- msg2 DEFB " made up of \0"
- msg3 DEFB " and \0"
- msg4 DEFB "\n\0"
- ALIGN
- main ADR R0,array
- SUB R1,R0,#4
- MOV R4,#1
- B iLoopCond
- iLoop LDR R6, [R0, R4 LSL #2]
- MOV R5,R4 ; j is in r5
- B cLoopCond
- cLoop STR R7, [r0, r5 LSL #2]
- sub r5,r5,#1
- cLoopCond
- CMP R5, #0
- BLE cLoopEnd
- LDR R7, [R1, R5 LSL #2]
- CMP R7, R6
- BGT cLoop
- cLoopEnd
- STR R6,[R0, R5 LSL #2]
- ADD R4,R4,#1
- iLoopCond
- CMP R4,#10
- BLT iLoop
- ADR R0, message
- SWI 3
- ADR R0, array
- MOV R1, #10
- BL PrintArray
- ADR R0,msg4
- SWI 3
- SWI 2
- PrintArray
- MOV R3,R0
- B ploopCond
- ploop LDR R0, [R3], #4
- SWI 4
- MOV R0,#','
- SWI 0
- SUB R1,R1,#1
- ploopCond
- CMP R1,#0
- BGT ploop
- MOV PC,R14
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement