2016-06-07 06:10:18 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2016-06-07 06:10:18 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintPStrAX >STAX TmpPtr1
|
|
|
|
|
lda (TmpPtr1)
|
|
|
|
|
tax
|
|
|
|
|
beq .9
|
|
|
|
|
ldy #1
|
|
|
|
|
|
|
|
|
|
.1 lda (TmpPtr1),y
|
|
|
|
|
ora #$80
|
|
|
|
|
jsr $FDED COUT
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintCStrAX >STAX TmpPtr1
|
|
|
|
|
pla
|
2016-12-12 11:05:47 +00:00
|
|
|
|
sta .91+1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pla
|
2016-12-12 11:05:47 +00:00
|
|
|
|
sta .9+1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.1 stz X.b0Flag
|
|
|
|
|
stz X.DigitCount
|
|
|
|
|
|
|
|
|
|
lda (TmpPtr1),y
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #'%'
|
2016-12-13 16:32:37 +00:00
|
|
|
|
bne .5
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
|
|
|
|
.11 iny
|
|
|
|
|
lda (TmpPtr1),y
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #'0'
|
|
|
|
|
bne .22
|
|
|
|
|
ror X.b0Flag beq -> CS
|
|
|
|
|
bra .11
|
|
|
|
|
|
|
|
|
|
.22 bcc .21
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcs .21
|
|
|
|
|
and #$0f
|
|
|
|
|
sta X.DigitCount
|
|
|
|
|
bra .11
|
|
|
|
|
|
|
|
|
|
.21 cmp #'d'
|
|
|
|
|
bne .2
|
|
|
|
|
pla
|
|
|
|
|
jsr PrintADec
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.2 cmp #'D'
|
|
|
|
|
bne .3
|
|
|
|
|
plx
|
2016-12-12 11:05:47 +00:00
|
|
|
|
pla
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jsr PrintAXDec
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.3 cmp #'h'
|
|
|
|
|
bne .4
|
|
|
|
|
pla
|
|
|
|
|
jsr $FDDA PRBYTE
|
2016-12-12 11:05:47 +00:00
|
|
|
|
bra .8
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-12-12 11:05:47 +00:00
|
|
|
|
.4 cmp #'H'
|
|
|
|
|
bne .5
|
|
|
|
|
pla
|
|
|
|
|
jsr $FDDA PRBYTE
|
|
|
|
|
pla
|
|
|
|
|
jsr $FDDA PRBYTE
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.5 cmp #'\'
|
2016-06-07 06:10:18 +00:00
|
|
|
|
bne .7
|
|
|
|
|
iny
|
|
|
|
|
lda (TmpPtr1),y
|
|
|
|
|
beq .9
|
|
|
|
|
cmp #'n'
|
|
|
|
|
bne .9
|
|
|
|
|
lda #$0D
|
|
|
|
|
|
|
|
|
|
.7 ora #$80
|
|
|
|
|
jsr $FDED COUT
|
|
|
|
|
.8 iny
|
|
|
|
|
bne .1
|
|
|
|
|
|
2016-12-12 11:05:47 +00:00
|
|
|
|
.9 lda #$ff Self modified RTS HI
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pha
|
2016-12-12 11:05:47 +00:00
|
|
|
|
.91 lda #$ff Self modified RTS LO
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pha
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PrintADec ldx #0
|
|
|
|
|
PrintAXDec >STAX X.HexBuffer
|
|
|
|
|
stz X.BCDBuffer
|
|
|
|
|
stz X.BCDBuffer+1
|
|
|
|
|
stz X.BCDBuffer+2
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
|
|
|
|
|
ldx #16 let's roll 16 bits
|
|
|
|
|
sed
|
|
|
|
|
.2 asl X.HexBuffer
|
|
|
|
|
rol X.HexBuffer+1
|
|
|
|
|
php cpy will disturb carry while BCD adc
|
|
|
|
|
ldy #0
|
|
|
|
|
.3 plp
|
|
|
|
|
lda X.BCDBuffer,y
|
|
|
|
|
adc X.BCDBuffer,y
|
|
|
|
|
sta X.BCDBuffer,y
|
|
|
|
|
php
|
|
|
|
|
iny
|
|
|
|
|
cpy #3 Last byte of X.BCDBufferBUF?
|
|
|
|
|
bne .3
|
|
|
|
|
plp
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
cld
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
ldy #5
|
|
|
|
|
|
|
|
|
|
.4 lda X.BCDBuffer,x
|
|
|
|
|
pha
|
|
|
|
|
and #$0F
|
|
|
|
|
ora #$B0
|
|
|
|
|
sta X.DigitBuffer,y
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
ora #$B0
|
|
|
|
|
sta X.DigitBuffer,y
|
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bpl .4
|
|
|
|
|
|
|
|
|
|
lda X.DigitCount
|
|
|
|
|
beq .5
|
|
|
|
|
lda #6
|
|
|
|
|
sec
|
|
|
|
|
sbc X.DigitCount
|
|
|
|
|
.5 tay
|
|
|
|
|
.6 lda X.DigitBuffer,y
|
|
|
|
|
cmp #"0"
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
ror X.b0Flag
|
|
|
|
|
bra .8
|
|
|
|
|
|
|
|
|
|
.7 cpy #5
|
|
|
|
|
beq .8
|
|
|
|
|
lda #" "
|
|
|
|
|
bit X.b0Flag
|
|
|
|
|
bpl .81
|
|
|
|
|
lda #"0"
|
|
|
|
|
.8 jsr $FDED COUT
|
|
|
|
|
.81 iny
|
|
|
|
|
cpy #6
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
.9 ply
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-12 11:05:47 +00:00
|
|
|
|
|
|
|
|
|
*--------------------------------------
|
2016-06-07 06:10:18 +00:00
|
|
|
|
X.HexBuffer .BS 2
|
|
|
|
|
X.BCDBuffer .BS 3
|
|
|
|
|
X.b0Flag .BS 1
|
|
|
|
|
X.DigitCount .BS 1
|
|
|
|
|
X.DigitBuffer .BS 6
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/X.PRINTF.S
|