2015-11-22 22:30:06 +00:00
|
|
|
|
PR#3
|
|
|
|
|
PREFIX /A2OSX.SRC
|
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
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
|
2015-12-10 18:53:30 +00:00
|
|
|
|
cmp #13
|
|
|
|
|
bne .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
ldx #DEVMGR.COUT
|
2015-12-10 18:53:30 +00:00
|
|
|
|
jsr pDevJmp
|
2015-12-10 20:15:55 +00:00
|
|
|
|
bcs .2
|
2015-12-10 18:53:30 +00:00
|
|
|
|
lda #10
|
|
|
|
|
.1 ldx #DEVMGR.COUT
|
2015-11-22 22:30:06 +00:00
|
|
|
|
jsr pDevJmp
|
2015-12-10 20:15:55 +00:00
|
|
|
|
.2 ply
|
2015-11-22 22:30:06 +00:00
|
|
|
|
plx
|
|
|
|
|
S.COutA.RTS rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Mini printf for PSTR
|
|
|
|
|
* %d : byte
|
|
|
|
|
* %D : word
|
|
|
|
|
* %h : hex byte
|
|
|
|
|
* %H : hex word
|
2015-11-29 22:19:10 +00:00
|
|
|
|
* %s : PSTRING
|
|
|
|
|
* \e : ESC
|
2015-11-22 22:30:06 +00:00
|
|
|
|
* \n : CR
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
S.PSTROutA jsr S.GetMemPtrA
|
|
|
|
|
S.PSTROutYA >STYA ZPQuickPtr1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
.1 jsr S.PSTROut.Next
|
|
|
|
|
bne .12
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.12 cmp #'\'
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .2
|
2015-11-29 22:19:10 +00:00
|
|
|
|
jsr S.PSTROut.Next
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .8
|
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
cmp #'e'
|
|
|
|
|
bne .11
|
|
|
|
|
lda #27
|
|
|
|
|
bra .6
|
|
|
|
|
|
|
|
|
|
.11 cmp #'n'
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .6
|
|
|
|
|
lda #13
|
|
|
|
|
bra .6
|
|
|
|
|
|
|
|
|
|
.2 cmp #'%'
|
|
|
|
|
bne .6
|
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
jsr S.PSTROut.Next
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .8
|
|
|
|
|
cmp #'d'
|
|
|
|
|
bne .3
|
|
|
|
|
phy
|
|
|
|
|
>PULLA
|
|
|
|
|
jsr S.DecOutA
|
|
|
|
|
ply
|
2015-11-29 22:19:10 +00:00
|
|
|
|
bcc .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 cmp #'D'
|
|
|
|
|
bne .4
|
|
|
|
|
phy
|
|
|
|
|
>PULLYA
|
|
|
|
|
jsr S.DecOutYA
|
|
|
|
|
ply
|
2015-11-29 22:19:10 +00:00
|
|
|
|
bcc .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.4 cmp #'h'
|
|
|
|
|
bne .5
|
|
|
|
|
phy
|
|
|
|
|
>PULLA
|
|
|
|
|
jsr S.HexOutA
|
|
|
|
|
ply
|
2015-11-29 22:19:10 +00:00
|
|
|
|
bcc .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.5 cmp #'H'
|
|
|
|
|
bne .51
|
|
|
|
|
phy
|
|
|
|
|
>PULLYA
|
|
|
|
|
jsr S.HexOutYA
|
|
|
|
|
ply
|
2015-11-29 22:19:10 +00:00
|
|
|
|
bcc .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
.51 cmp #'s'
|
|
|
|
|
bne .52
|
|
|
|
|
jsr S.PSTROutYAS1
|
|
|
|
|
bcc .1
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.52 cmp #'S'
|
|
|
|
|
bne .53
|
|
|
|
|
jsr S.PSTROutYAS2
|
|
|
|
|
bcc .10
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.53 tax
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda #'%'
|
|
|
|
|
jsr S.COutA
|
|
|
|
|
bcs .9
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
.6 jsr S.COutA
|
|
|
|
|
bcs .9
|
2015-11-29 22:19:10 +00:00
|
|
|
|
.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
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
S.PSTROutYAS2 phy
|
|
|
|
|
>PULLYA
|
|
|
|
|
S.PSTROutYAS >STYA ZPQuickPtr2
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPQuickPtr2),y
|
|
|
|
|
jsr S.COutA
|
|
|
|
|
bcs .9
|
|
|
|
|
tya
|
|
|
|
|
eor (ZPQuickPtr2) do not alter C
|
|
|
|
|
bne .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2015-11-29 22:19:10 +00:00
|
|
|
|
.9 ply
|
|
|
|
|
rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
HEX .BS 2
|
|
|
|
|
BCD .BS 3
|
|
|
|
|
bL0Flag .BS 1
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.CIO
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|