ORG $6000 TOSTR MOVEM.L D0/A3,-(A7) ; print value in D0 as decimal LEA.L DATA,A3 ; get ptr to string buffer space LOOP TST.L D0 ; while not zero BEQ DONE DIVU #10,D0 ; next decimal character SWAP D0 ; get remainder ADDI.B #'0',D0 ; make it ascii MOVE.B D0,-(A3) ; output to string CLR.B D0 ; zero out the remainder SWAP D0 ; restore quotient value BRA LOOP DONE TRAP #3 MOVEM.L (A7)+,D0/A3 RTS DS.B 8 ; space for tostr output DATA DC.B 10 ; newline at end DC.B 0 ; null termination ORG $7000 LEA.L FOO,A3 TRAP #3 ; put some text before our test START MOVE.W #13728,D0 ; test TOSTR with a big number BSR TOSTR LEA.L FOO,A3 ; put some text after our test TRAP #3 TRAP #9 FOO DC.B 'blah blah ' DC.B 10,0 END