Hi,
> More or less. I was really wondering why QDOS doesn't have a vector
> setting long words to ASCII
Perhaps this will help.
; on entry, D0 = long int to convert to ascii
; A0 = space for ascii chars
; D1-D3,D7 : smashed
cvtlong CMP.L #$80000000,D0
BEQ.S oor ; don't convert this
LEA table,A2
MOVEQ #11,D1
MOVEQ #0,D7
BTST #31,D0 ; is it minus?
BEQ.S binlop1
NEG.L D0
BSET #0,D7
binlop1 SUBQ.W #1,D1 ; get rid of excess 0s
CMP.L (A2)+,D0
BLT.S binlop1
SUBQ.L #4,A2
MOVE.W D1,(A0)+ ; this will be length of final
figure
TST.W D7 ; was it minus?
BEQ.S binlop2
ADDQ.W #1,-2(A0)
MOVE.B #'-',(A0)+
binlop2 MOVE.L (A2)+,D3 ; merci Thierry!
MOVEQ #-$30,D2
binlop3 SUB.L D3,D0
DBMI D2,binlop3 ; sub this until neg (i.e.
subbed too much)
NEG.B D2
MOVE.B D2,(A0)+ ; figure now
ADD.L D3,D0 ; overshot one
DBRA D1,binlop2 ; do it until no more...
cvtout MOVEQ #0,D0
RTS
oor MOVEQ #-4,D0
RTS
table dc.l 1000000000
dc.l 100000000
dc.l 10000000
dc.l 1000000
dc.l 100000
table2 dc.l 10000
dc.l 1000
dc.l 100 ; 64
dc.l 10
dc.l 1
Wolfgang
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm