A2osX/A2osX.S.KM.txt
2016-03-13 22:55:47 +01:00

154 lines
2.5 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

PR#3
PREFIX /A2OSX.BOOT
DELETE A2OSX.SYSTEM
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
.LIST OFF
*--------------------------------------
EnumKM.EPB .EQ $0D
EnumKM.EL .EQ $27
*--------------------------------------
EnumKM ldx #0
ldy Boot.Prefix
.1 inx
lda SYS,x
sta Boot.Prefix+1,y
iny
cpx SYS
bne .1
sty Boot.Prefix
jsr MLI
.DA #MLIOPEN
.DA MLIOPEN01
bcs .99
lda MLIOPEN01+5
sta MLIREAD01+1
sta MLICLOSE01+1
.2 jsr MLI
.DA #MLIREAD
.DA MLIREAD01
bcs .98
lda #EnumKM.EPB
sta EnumKM.EC
>LDYAI A2osX.ReadBuff+4
>STYA EnumKM.BPTR
.3 >LDYA EnumKM.BPTR
>STYA TmpPtr1
lda (TmpPtr1)
and #$F0 Empty ?
beq .5 yes, skip
and #$C0 anything out of type 1,2 or 3 ?
bne .5 yes, skip
lda (TmpPtr1)
and #$0F
cmp KM.PREFIX at least enough chars for KM.*?
bcc .5 no, skip
ldy #$10 file type
lda (TmpPtr1),y
cmp #$06 'BIN'?
bne .5 skip
ldy KM.PREFIX
.4 lda (TmpPtr1),y
cmp KM.PREFIX,y
bne .5
dey
bne .4
jsr LoadKM
.5 lda EnumKM.BPTR
clc
adc #EnumKM.EL
sta EnumKM.BPTR
bcc .6
inc EnumKM.BPTR+1
.6 dec EnumKM.EC
bne .3
bra .2
.8 jsr MLI
.DA #MLICLOSE
.DA MLICLOSE01
rts
.98 cmp #MLI.ERR.EOF
beq .8
pha
jsr .8
pla
.99 sec
rts
*--------------------------------------
EnumKM.EC .BS 1
EnumKM.BPTR .BS 2
*--------------------------------------
LoadKM ldx Boot.Prefix
.1 lda Boot.Prefix,x
sta KM.Filename,x
dex
bne .1
ldx Boot.Prefix
lda (TmpPtr1)
and #$0F
tay
clc
adc Boot.Prefix
sta KM.Filename
tax
.2 lda (TmpPtr1),y
sta KM.Filename,x
dex
dey
bne .2
>LDAXI MSG.KMLOAD
jsr PrintCStrAX
>LDAXI KM.Filename
jsr PrintPStrAX
jsr CROUT
jsr MLI
.DA #MLIOPEN
.DA MLIOPEN02
bcs .99
lda MLIOPEN02+5
sta MLIREAD02+1
sta MLICLOSE02+1
jsr MLI
.DA #MLIREAD
.DA MLIREAD02
bcs .98
jsr .9
jsr A2osX.KMLOAD
jsr CROUT
.98 pha
jsr .9
pla
sec
rts
.9 jsr MLI
.DA #MLICLOSE
.DA MLICLOSE02
.99 rts
*--------------------------------------
MAN
SAVE A2OSX.S.KM
LOAD A2OSX.S
ASM