mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-04 03:05:43 +00:00
248 lines
3.5 KiB
Plaintext
248 lines
3.5 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
S.DecOutA tay
|
||
lda #0
|
||
S.DecOutYA >STYA HEX
|
||
stz BCD
|
||
stz BCD+1
|
||
stz BCD+2
|
||
|
||
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 bL0Flag
|
||
ldx #2
|
||
|
||
.4 lda BCD,x
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
bne .5
|
||
bit bL0Flag
|
||
bpl .6
|
||
.5 sec
|
||
ror bL0Flag
|
||
ora #$30
|
||
jsr S.COutA
|
||
bcs .9
|
||
|
||
.6 lda BCD,x
|
||
and #$0F
|
||
bne .7
|
||
bit bL0Flag
|
||
bpl .8
|
||
.7 sec
|
||
ror bL0Flag
|
||
ora #$30
|
||
jsr S.COutA
|
||
bcs .9
|
||
|
||
.8 dex
|
||
bpl .4
|
||
|
||
bit bL0Flag
|
||
bmi .9
|
||
lda #$30
|
||
jsr S.COutA
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
S.HexOutYA phy
|
||
jsr S.HexOutA
|
||
bcs S.COutA.RTS
|
||
pla
|
||
*--------------------------------------
|
||
S.HexOutA pha
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
ora #$30
|
||
cmp #$3A
|
||
bcc .1
|
||
adc #6
|
||
.1 jsr S.COutA
|
||
bcs S.COutA.RTS
|
||
pla
|
||
and #$0F
|
||
ora #$30
|
||
cmp #$3A
|
||
bcc S.COutA
|
||
adc #6
|
||
*--------------------------------------
|
||
S.COutA phx
|
||
phy
|
||
cmp #13
|
||
bne .1
|
||
ldx #DEVMGR.COUT
|
||
jsr pDevJmp
|
||
bcs .2
|
||
lda #10
|
||
.1 ldx #DEVMGR.COUT
|
||
jsr pDevJmp
|
||
.2 ply
|
||
plx
|
||
S.COutA.RTS rts
|
||
*--------------------------------------
|
||
* Mini printf for PSTR
|
||
* %d : byte
|
||
* %D : word
|
||
* %h : hex byte
|
||
* %H : hex word
|
||
* %s : PSTRING
|
||
* \e : ESC
|
||
* \n : CR
|
||
*--------------------------------------
|
||
S.PSTROutA jsr S.GetMemPtrA
|
||
S.PSTROutYA >STYA ZPQuickPtr1
|
||
|
||
ldy #0
|
||
|
||
.1 jsr S.PSTROut.Next
|
||
bne .12
|
||
.8 clc
|
||
rts
|
||
|
||
.12 cmp #'\'
|
||
bne .2
|
||
jsr S.PSTROut.Next
|
||
beq .8
|
||
|
||
cmp #'e'
|
||
bne .11
|
||
lda #27
|
||
bra .6
|
||
|
||
.11 cmp #'n'
|
||
bne .6
|
||
lda #13
|
||
bra .6
|
||
|
||
.2 cmp #'%'
|
||
bne .6
|
||
|
||
jsr S.PSTROut.Next
|
||
beq .8
|
||
cmp #'d'
|
||
bne .3
|
||
phy
|
||
>PULLA
|
||
jsr S.DecOutA
|
||
ply
|
||
bcc .1
|
||
rts
|
||
|
||
.3 cmp #'D'
|
||
bne .4
|
||
phy
|
||
>PULLYA
|
||
jsr S.DecOutYA
|
||
ply
|
||
bcc .1
|
||
rts
|
||
|
||
.4 cmp #'h'
|
||
bne .5
|
||
phy
|
||
>PULLA
|
||
jsr S.HexOutA
|
||
ply
|
||
bcc .1
|
||
rts
|
||
|
||
.5 cmp #'H'
|
||
bne .51
|
||
phy
|
||
>PULLYA
|
||
jsr S.HexOutYA
|
||
ply
|
||
bcc .1
|
||
rts
|
||
|
||
.51 cmp #'s'
|
||
bne .52
|
||
jsr S.PSTROutYAS1
|
||
bcc .1
|
||
rts
|
||
|
||
.52 cmp #'S'
|
||
bne .53
|
||
jsr S.PSTROutYAS2
|
||
bcc .10
|
||
rts
|
||
|
||
.53 tax
|
||
lda #'%'
|
||
jsr S.COutA
|
||
bcs .9
|
||
txa
|
||
|
||
.6 jsr S.COutA
|
||
bcs .9
|
||
.10 jmp .1
|
||
.9 rts
|
||
*--------------------------------------
|
||
S.PSTROut.Next tya
|
||
eor (ZPQuickPtr1)
|
||
beq .8
|
||
iny
|
||
lda (ZPQuickPtr1),y
|
||
.8 rts
|
||
*--------------------------------------
|
||
S.PSTROutYAS1 phy
|
||
>PULLA
|
||
jsr S.GetMemPtrA
|
||
bra S.PSTROutYAS
|
||
|
||
S.PSTROutYAS2 phy
|
||
>PULLYA
|
||
S.PSTROutYAS >STYA ZPQuickPtr2
|
||
|
||
clc
|
||
lda (ZPQuickPtr2)
|
||
tax
|
||
beq .9
|
||
|
||
ldy #1
|
||
.1 lda (ZPQuickPtr2),y
|
||
jsr S.COutA
|
||
bcs .9
|
||
iny
|
||
dex
|
||
bne .1
|
||
|
||
.9 ply
|
||
rts
|
||
*--------------------------------------
|
||
HEX .BS 2
|
||
BCD .BS 3
|
||
bL0Flag .BS 1
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE SYS/KERNEL.S.CIO
|
||
LOAD SYS/KERNEL.S
|
||
ASM
|