Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Re-uploaded
- ;Fixed it all, as far as I can tell.
- AREA ValToDec, CODE, READONLY
- IMPORT main
- EXPORT start
- start
- LDR R2, =101 ; val = 365;
- LDR R6, =deststr ; buffer = deststr;
- BL val2dec
- stop B stop
- ; val2dec subroutine
- ;
- ; < define the interface to your subroutine here >
- ;
- val2dec
- STMFD sp!, {LR}
- LDR R4, =0
- LDR R5, =0
- LDR R0, =1
- wh CMP R0, #0
- BEQ pop
- BL dividesub
- convert
- ADD R1, R1, #0x30
- STMFD sp!, {R1}
- ADD R5, R5, #1
- MOV R2, R0
- B wh
- pop
- LDMFD sp!, {R1}
- STRB R1, [R6], #1
- SUB R5, R5, #1
- CMP R5, #0
- BEQ end
- B pop
- end
- LDMFD sp!, {PC}
- dividesub
- STMFD sp!, {LR}
- MOV R0, #0
- MOV R1, R2
- MOV R3, #10
- wh1
- CMP R1, R3
- BLO endwh
- SUB R1, R1, R3
- ADD R0, R0, #1
- B wh1
- endwh
- LDMFD sp!, {PC}
- AREA Strings, DATA, READWRITE
- deststr SPACE 32
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement