Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- B main
- array DEFW 6, 5, 8, 2, 1, 4, 3, 7, 9
- size DEFW 9
- ALIGN
- ;Inputs:R0: Address of the start of the array
- ; R1: Size of the array
- bubble STMFD SP!, {R4-R6}
- SUB R1, R1, #1
- ADD R2, R0, #4
- pas_lp MOV R6, #0
- MOV R3, #0
- B swp_lp_cnd
- swp_lp LDR R4, [R0, R3 ASL #2]
- LDR R5, [R2, R3 ASL #2]
- CMP R4, R5
- STRLT R4, [R2, R3 ASL #2]
- STRLT R5, [R0, R3 ASL #2]
- MOVLT R6, #1
- skip_swp ADD R3, R3, #1
- swp_lp_cnd CMP R3, R1
- BLT swp_lp
- SUB R1, R1, #1
- CMP R6, #0
- BNE pas_lp
- LDMFD SP!, {R4-R6}
- MOV PC, R14
- main MOV SP, #1000
- ADR R0, array
- LDR R1, size
- BL bubble
- ADR R1, array
- LDR R2, size
- ADD R2, R1, R2 LSL #2
- prt_lp LDR R0, [R1], #4
- SWI 4
- MOV R0, #10
- SWI 0
- prt_lp_cnd CMP R1, R2
- BLT prt_lp
- SWI 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement