2016-06-07 06:10:18 +00:00
|
|
|
|
NEW
|
2019-04-10 07:45:09 +00:00
|
|
|
|
AUTO 3,1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA sty PrintFYA.Next+1
|
|
|
|
|
sta PrintFYA.Next+2
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pla
|
2018-07-12 15:20:39 +00:00
|
|
|
|
sta PrintFYA.99+1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pla
|
2018-07-12 15:20:39 +00:00
|
|
|
|
sta PrintFYA.98+1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda $C011 RDLCBNK2
|
2018-07-12 15:20:39 +00:00
|
|
|
|
sta PrintFYA.91+1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda $C012 RDLCRAM
|
2018-07-12 15:20:39 +00:00
|
|
|
|
sta PrintFYA.90+1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda $C08A RROMBNK1, make sure $D000-$FFFF ROM selected
|
|
|
|
|
lda $CFFF get access to $C800-$CFFF internal ROM
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.1 stz X.b0Flag
|
2016-06-07 06:10:18 +00:00
|
|
|
|
stz X.DigitCount
|
2018-07-12 15:20:39 +00:00
|
|
|
|
jsr PrintFYA.Next
|
|
|
|
|
beq PrintFYA.90
|
2016-06-07 06:10:18 +00:00
|
|
|
|
cmp #'%'
|
2017-05-02 15:56:43 +00:00
|
|
|
|
bne .7
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.2 jsr PrintFYA.Next
|
|
|
|
|
beq PrintFYA.90
|
2016-06-07 06:10:18 +00:00
|
|
|
|
cmp #'0'
|
2017-05-02 15:56:43 +00:00
|
|
|
|
bne .3
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
ror X.b0Flag beq -> CS
|
|
|
|
|
bra .2
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
.3 bcc .4
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
cmp #'9'+1
|
2017-05-02 15:56:43 +00:00
|
|
|
|
bcs .4
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
and #$0f
|
|
|
|
|
sta X.DigitCount
|
2017-05-02 15:56:43 +00:00
|
|
|
|
bra .2
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.4 ldx #PrintFYA.Tbl-PrintFYA.Esc-1
|
2017-05-02 15:56:43 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.5 cmp PrintFYA.Esc,x
|
2017-05-02 15:56:43 +00:00
|
|
|
|
beq .6
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .5
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
bra PrintFYA.1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
.6 txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
2018-07-12 15:20:39 +00:00
|
|
|
|
jmp (PrintFYA.Tbl,x)
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2022-09-17 11:35:52 +00:00
|
|
|
|
.7 ora #$80
|
2016-06-07 06:10:18 +00:00
|
|
|
|
jsr $FDED COUT
|
2018-07-12 15:20:39 +00:00
|
|
|
|
bra PrintFYA.1
|
2017-05-02 15:56:43 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.90 lda #$ff
|
|
|
|
|
bpl PrintFYA.98 ROM was selected, nothing to do
|
|
|
|
|
PrintFYA.91 lda #$ff
|
|
|
|
|
bmi PrintFYA.92 RAM bank 2 was selected
|
2017-05-02 15:56:43 +00:00
|
|
|
|
ldx #$8B RRAMWRAMBNK1
|
|
|
|
|
.HS 2C bit abs
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.92 ldx #$83 RRAMWRAMBNK2
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda $C000,x
|
|
|
|
|
lda $C000,x
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.98 lda #$ff Self modified RTS HI
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pha
|
2024-01-17 21:04:13 +00:00
|
|
|
|
PrintFYA.99 lda #$ff Self modified RTS LO
|
2016-06-07 06:10:18 +00:00
|
|
|
|
pha
|
2017-05-02 15:56:43 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
rts
|
2016-06-07 06:10:18 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.Next lda $ffff
|
2017-04-26 14:54:24 +00:00
|
|
|
|
beq .8
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
inc PrintFYA.Next+1
|
2017-04-26 14:54:24 +00:00
|
|
|
|
bne .8
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
inc PrintFYA.Next+2 Always !=0
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.8 rts
|
2017-05-02 15:56:43 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.Esc .AS "dDhHS"
|
|
|
|
|
PrintFYA.Tbl .DA PrintFYA.D
|
|
|
|
|
.DA PrintFYA.DD
|
|
|
|
|
.DA PrintFYA.H
|
|
|
|
|
.DA PrintFYA.HH
|
|
|
|
|
.DA PrintFYA.S
|
2017-04-26 14:54:24 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.D ldx #0
|
2017-05-02 15:56:43 +00:00
|
|
|
|
.HS D0 bne
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.DD plx
|
2017-05-02 15:56:43 +00:00
|
|
|
|
pla
|
2017-10-12 15:28:59 +00:00
|
|
|
|
sta X.HexBuffer
|
|
|
|
|
stx X.HexBuffer+1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
stz X.BCDBuffer
|
|
|
|
|
stz X.BCDBuffer+1
|
|
|
|
|
stz X.BCDBuffer+2
|
|
|
|
|
ldx #16 let's roll 16 bits
|
|
|
|
|
sed
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.2 asl X.HexBuffer
|
|
|
|
|
rol X.HexBuffer+1
|
|
|
|
|
php cpy will disturb carry while BCD adc
|
|
|
|
|
ldy #0
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.3 plp
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda X.BCDBuffer,y
|
|
|
|
|
adc X.BCDBuffer,y
|
|
|
|
|
sta X.BCDBuffer,y
|
|
|
|
|
php
|
|
|
|
|
iny
|
|
|
|
|
cpy #3 Last byte of X.BCDBufferBUF?
|
|
|
|
|
bne .3
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
plp
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
cld
|
|
|
|
|
ldx #0
|
|
|
|
|
ldy #5
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.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
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda X.DigitCount
|
|
|
|
|
beq .5
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda #6
|
|
|
|
|
sec
|
|
|
|
|
sbc X.DigitCount
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.5 tay
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.6 lda X.DigitBuffer,y
|
|
|
|
|
cmp #"0"
|
|
|
|
|
beq .7
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
ror X.b0Flag
|
|
|
|
|
bra .8
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.7 cpy #5
|
|
|
|
|
beq .8
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda #" "
|
|
|
|
|
bit X.b0Flag
|
|
|
|
|
bpl .81
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
lda #"0"
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-04-30 11:42:15 +00:00
|
|
|
|
.8 phy
|
|
|
|
|
jsr $FDED COUT
|
|
|
|
|
ply
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2016-06-07 06:10:18 +00:00
|
|
|
|
.81 iny
|
|
|
|
|
cpy #6
|
|
|
|
|
bne .6
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.9 jmp PrintFYA.1
|
2017-05-02 15:56:43 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.HH pla
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr $FDDA PRBYTE
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.H pla
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr $FDDA PRBYTE
|
2018-07-12 15:20:39 +00:00
|
|
|
|
jmp PrintFYA.1
|
2017-05-02 15:56:43 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
PrintFYA.S pla
|
2017-05-02 15:56:43 +00:00
|
|
|
|
sta .1+2
|
|
|
|
|
sta .2+2
|
|
|
|
|
pla
|
|
|
|
|
sta .1+1
|
|
|
|
|
sta .2+1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
.1 lda $ffff
|
|
|
|
|
beq .9
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
tax
|
|
|
|
|
ldy #1
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
.2 lda $ffff,y
|
|
|
|
|
ora #$80
|
|
|
|
|
jsr $FDED COUT
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2021-05-22 21:05:12 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.9 jmp PrintFYA.1
|
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
|
2022-09-11 19:11:32 +00:00
|
|
|
|
SAVE usr/src/shared/x.printf.s
|