A2osX/A2osX.S.TOOLS.txt

180 lines
2.4 KiB
Plaintext
Raw Normal View History

2015-03-15 22:00:40 +00:00
PR#3
2016-03-13 21:55:47 +00:00
PREFIX /A2OSX.BOOT
DELETE A2OSX.SYSTEM
2015-06-03 18:30:57 +00:00
PREFIX /A2OSX.SRC
2015-03-15 22:00:40 +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 COUT
iny
dex
bne .1
.9 rts
*--------------------------------------
PrintCStrAX >STAX TmpPtr1
pla
sta TmpPtr2
pla
sta TmpPtr2+1
ldy #0
2016-03-13 21:55:47 +00:00
.1 stz b0Flag
stz DigitCount
lda (TmpPtr1),y
2015-03-15 22:00:40 +00:00
beq .9
cmp #'%'
bne .4
2016-03-13 21:55:47 +00:00
.11 iny
2015-03-15 22:00:40 +00:00
lda (TmpPtr1),y
beq .9
2016-03-13 21:55:47 +00:00
cmp #'0'
bne .22
ror b0Flag beq -> CS
bra .11
.22 bcc .21
cmp #'9'+1
bcs .21
and #$0f
sta DigitCount
bra .11
.21 cmp #'d'
2015-03-15 22:00:40 +00:00
bne .2
pla
jsr PrintADec
bra .8
.2 cmp #'D'
bne .3
pla
plx
jsr PrintAXDec
bra .8
.3 cmp #'h'
bne .4
pla
jsr PRBYTE
.4 cmp #'\'
bne .7
iny
lda (TmpPtr1),y
beq .9
cmp #'n'
bne .9
lda #$0D
.7 ora #$80
jsr COUT
.8 iny
bne .1
.9 lda TmpPtr2+1
pha
lda TmpPtr2
pha
rts
*--------------------------------------
PrintADec ldx #0
PrintAXDec >STAX HEX
stz BCD
2015-03-15 22:00:40 +00:00
stz BCD+1
stz BCD+2
phy
ldx #16 let's roll 16 bits
sed
.2 asl HEX
rol HEX+1
php cpy will disturb carry while BCD adc
ldy #0
.3 plp
lda BCD,y
adc BCD,y
sta BCD,y
php
iny
cpy #3 Last byte of BCDBUF?
bne .3
plp
dex
bne .2
cld
2016-03-13 21:55:47 +00:00
ldx #0
ldy #5
2015-03-15 22:00:40 +00:00
.4 lda BCD,x
2016-03-13 21:55:47 +00:00
pha
and #$0F
ora #$B0
sta DigitBuffer,y
dey
pla
2015-03-15 22:00:40 +00:00
lsr
lsr
lsr
lsr
ora #$B0
2016-03-13 21:55:47 +00:00
sta DigitBuffer,y
inx
dey
2015-03-15 22:00:40 +00:00
bpl .4
2016-03-13 21:55:47 +00:00
lda DigitCount
beq .5
lda #6
sec
sbc DigitCount
.5 tay
.6 lda DigitBuffer,y
cmp #"0"
beq .7
sec
ror b0Flag
bra .8
.7 cpy #5
beq .8
lda #" "
bit b0Flag
bpl .81
lda #"0"
.8 jsr COUT
.81 iny
cpy #6
bne .6
2015-03-15 22:00:40 +00:00
.9 ply
rts
*--------------------------------------
2016-03-13 21:55:47 +00:00
HEX .BS 2
BCD .BS 3
b0Flag .BS 1
DigitCount .BS 1
DigitBuffer .BS 6
*--------------------------------------
2015-03-15 22:00:40 +00:00
MAN
SAVE A2OSX.S.TOOLS
LOAD A2OSX.S
ASM