mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-29 17:50:18 +00:00
144 lines
1.9 KiB
Plaintext
144 lines
1.9 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
.OP 65C02
|
||
*--------------------------------------
|
||
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
|
||
.1 lda (TmpPtr1),y
|
||
beq .9
|
||
cmp #'%'
|
||
bne .4
|
||
|
||
iny
|
||
lda (TmpPtr1),y
|
||
beq .9
|
||
cmp #'d'
|
||
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
|
||
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
|
||
|
||
stz bFlag
|
||
|
||
ldx #2
|
||
.4 lda BCD,x
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
bne .5
|
||
bit bFlag
|
||
bpl .6
|
||
.5 sec
|
||
ror bFlag
|
||
ora #$B0
|
||
jsr COUT
|
||
.6 lda BCD,x
|
||
and #$0F
|
||
bne .7
|
||
bit bFlag
|
||
bpl .8
|
||
.7 sec
|
||
ror bFlag
|
||
ora #$B0
|
||
jsr COUT
|
||
.8 dex
|
||
bpl .4
|
||
|
||
bit bFlag
|
||
bmi .9
|
||
lda #$B0
|
||
jsr COUT
|
||
|
||
.9 ply
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE A2OSX.S.TOOLS
|
||
LOAD A2OSX.S
|
||
ASM
|