mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
422 lines
7.4 KiB
Plaintext
422 lines
7.4 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
ILDR.START jsr MLI check for file 'atinit'
|
||
.DA #MLIGETFILEINFO
|
||
.DA ILDR.GFINFO
|
||
bcs ILDR.ENUMPM
|
||
|
||
lda ILDR.GFINFO+S.FI.T
|
||
cmp #$E2 is 'atinit' correct file type?
|
||
bne ILDR.ENUMPM error - wrong file type
|
||
|
||
ldy #ILDR.ATINIT
|
||
lda /ILDR.ATINIT
|
||
jsr ILDR.LoadFile
|
||
bcc .1
|
||
|
||
.9 jmp ILDR.MLIERR
|
||
|
||
.1 lda RROMBNK2 enable ROM
|
||
jsr sysentry execute ATinit
|
||
*--------------------------------------
|
||
* BOOT block read 4 directory blocks at dbuf=$C00 -> $13FF
|
||
*--------------------------------------
|
||
ILDR.ENUMPM .DO READCAT=1
|
||
|
||
lda LDR.MLIOL.P+1 Boot unitnum
|
||
sta ILDR.MLIRB.P+1
|
||
|
||
stz dst
|
||
lda /dbuf
|
||
ldy #$02 read directory into buffer
|
||
ldx #0
|
||
|
||
.22 sta dst+1
|
||
sta ILDR.MLIRB.P+3 Data buf HI
|
||
sty ILDR.MLIRB.P+4 Blk Num LO
|
||
stx ILDR.MLIRB.P+5 Blk Num HI
|
||
|
||
jsr MLI
|
||
.DA #MLIREADBLOCK
|
||
.DA ILDR.MLIRB.P
|
||
bcs .99
|
||
|
||
ldy #$03 get next block# from link
|
||
lda (dst),y
|
||
tax
|
||
dey
|
||
ora (dst),y 00 00 -> Last Block
|
||
beq .28
|
||
|
||
lda (dst),y
|
||
tay
|
||
lda dst+1
|
||
inc
|
||
inc add $200 to buffer pointer
|
||
cmp /dbuf+$800 until it points past end of buffer.
|
||
bcc .22 if ok, read next block.
|
||
|
||
.28 .FIN
|
||
*--------------------------------------
|
||
.DO PM
|
||
|
||
jsr ILDR.EnumInit
|
||
|
||
.1 ldx #S.FI.T.BIN
|
||
ldy #ILDR.KMPFX
|
||
lda /ILDR.KMPFX
|
||
clc prefix
|
||
jsr ILDR.EnumNext
|
||
bcs .8
|
||
|
||
jsr ILDR.LoadFilePBuf
|
||
bcs .99
|
||
|
||
ldx #3
|
||
|
||
.2 lda idxl,x
|
||
pha
|
||
dex
|
||
bpl .2
|
||
|
||
jsr sysentry
|
||
|
||
bit RROMBNK2 enable ROM
|
||
|
||
ldx #0
|
||
|
||
.3 pla
|
||
sta idxl,x
|
||
inx
|
||
cpx #4
|
||
bne .3
|
||
|
||
>DEBUGOA
|
||
|
||
bra .1
|
||
|
||
.99 jmp ILDR.MLIERR
|
||
|
||
.8 .FIN
|
||
*--------------------------------------
|
||
jsr ILDR.EnumInit
|
||
|
||
ldx #S.FI.T.SYS
|
||
ldy #ILDR.SYSTEMSFX
|
||
lda /ILDR.SYSTEMSFX
|
||
sec suffix
|
||
jsr ILDR.EnumNext
|
||
bcs .9
|
||
|
||
jsr ILDR.LoadFilePBuf
|
||
bcs ILDR.MLIERR
|
||
|
||
bit RROMBNK2 enable ROM
|
||
|
||
bit RDIOUDIS
|
||
sta SETIOUDIS
|
||
sta CLRDHIRES
|
||
bmi .5
|
||
|
||
sta CLRIOUDIS
|
||
|
||
.5 sta CLR80DISP
|
||
sta CLR80STORE
|
||
sta SETTEXT
|
||
sta CLRMIXED
|
||
jsr init
|
||
jsr setvid
|
||
jsr setkbd
|
||
jsr home
|
||
jmp sysentry go run interpreter
|
||
|
||
.9 jsr MLI no .SYSTEM found, so quit.
|
||
.DA #MLIQUIT
|
||
.DA ILDR.QUIT
|
||
*--------------------------------------
|
||
ILDR.MLIERR cmp #MLI.E.BADBUF
|
||
bne .1
|
||
|
||
ldx #ILDR.MSG.SYSTOOLARG-ILDR.MSG
|
||
|
||
.HS 2C BIT ABS
|
||
.1 ldx #ILDR.MSG.SYSLOADERR-ILDR.MSG
|
||
|
||
bit RROMBNK2
|
||
jsr SETINV
|
||
|
||
.2 lda ILDR.MSG,x
|
||
pha
|
||
ora #$80
|
||
jsr COUT
|
||
inx
|
||
pla
|
||
bpl .2
|
||
|
||
lda #$A0
|
||
jsr COUT
|
||
|
||
ldy #0
|
||
|
||
.3 iny
|
||
lda pbuf,y
|
||
jsr COUT
|
||
cpy pbuf
|
||
bne .3
|
||
|
||
bra *
|
||
*--------------------------------------
|
||
ILDR.EnumInit lda /dbuf search directory buffer
|
||
sta idxl+1
|
||
lda #dbuf+4 skip Prev/next Block Ptr
|
||
sta idxl
|
||
|
||
lda dbuf+35 EL
|
||
sta ILDR.EL
|
||
|
||
lda dbuf+36 EPB
|
||
sta ILDR.EPB
|
||
sta ILDR.EITB
|
||
|
||
lda dbuf+37 FCLO
|
||
eor #$ff
|
||
sta ILDR.nFC
|
||
|
||
lda dbuf+38 FCHI
|
||
eor #$ff
|
||
sta ILDR.nFC+1
|
||
|
||
ILDR.EnumInit.RTS
|
||
rts
|
||
*--------------------------------------
|
||
* X = expected FileType
|
||
* Y,A = expected prefix/suffix
|
||
*--------------------------------------
|
||
ILDR.EnumNext stx ILDR.FT
|
||
sty src
|
||
sta src+1
|
||
|
||
ror ILDR.bPFXSFX
|
||
|
||
.1 inc ILDR.nFC
|
||
bne .2
|
||
|
||
inc ILDR.nFC+1
|
||
sec
|
||
beq ILDR.EnumInit.RTS
|
||
|
||
.2 dec ILDR.EITB
|
||
beq .3
|
||
|
||
lda idxl
|
||
clc
|
||
adc ILDR.EL
|
||
sta idxl
|
||
bcc .4 same page
|
||
|
||
inc idxl+1 512b block, 2nd page
|
||
bra .4
|
||
|
||
.3 inc idxl+1
|
||
lda idxl+1
|
||
cmp #$14 last block read at $0C00-$13FF
|
||
bcs ILDR.EnumInit.RTS
|
||
|
||
lda #4
|
||
sta idxl
|
||
|
||
lda ILDR.EPB
|
||
sta ILDR.EITB
|
||
|
||
.4 lda (idxl)
|
||
beq .2 deleted / empty
|
||
|
||
bmi .1 $D, $E, or $F...
|
||
|
||
and #$0F
|
||
sta pbuf filename Len
|
||
|
||
tay
|
||
|
||
.5 lda (idxl),y
|
||
sta pbuf,y
|
||
dey
|
||
bne .5
|
||
|
||
ldy #16
|
||
lda (idxl),y
|
||
|
||
cmp ILDR.FT expected file type
|
||
bne .1
|
||
|
||
lda (src) expected prefix/suffix len
|
||
cmp pbuf
|
||
bcs .1 filename LE prefix/suffix
|
||
|
||
bit ILDR.bPFXSFX
|
||
bpl .12 go check prefix
|
||
|
||
tay
|
||
ldx pbuf
|
||
|
||
.11 lda pbuf,x
|
||
eor (src),y
|
||
asl
|
||
bne .1
|
||
|
||
dex
|
||
dey
|
||
bne .11
|
||
bra .15
|
||
|
||
.12 lda (src) expected prefix/suffix len
|
||
tay
|
||
|
||
.13 lda pbuf,y
|
||
eor (src),y
|
||
asl
|
||
bne .1
|
||
|
||
dey
|
||
bne .13
|
||
|
||
.15 ldy #$1D MIN_VERSION
|
||
lda (idxl),y
|
||
bpl .10 no lowercase information
|
||
|
||
ldx pbuf
|
||
|
||
.6 cpx #8 CS if MIN_VERSION to use
|
||
bcs .7
|
||
|
||
ldy #$1D MIN_VERSION
|
||
lda (idxl),y
|
||
and ILDR.LCBits,x
|
||
bne .8
|
||
|
||
bra .9
|
||
|
||
.7 ldy #$1C VERSION
|
||
lda (idxl),y
|
||
|
||
and ILDR.LCBits-8,x
|
||
beq .9
|
||
|
||
.8 lda pbuf,x
|
||
eor #$20 to lowercase
|
||
sta pbuf,x
|
||
|
||
.9 dex
|
||
bne .6
|
||
|
||
.10 clc
|
||
rts
|
||
*--------------------------------------
|
||
ILDR.LoadFilePBuf
|
||
ldy #pbuf
|
||
lda /pbuf
|
||
|
||
ILDR.LoadFile sty ILDR.OPEN+1 Filename
|
||
sta ILDR.OPEN+2
|
||
|
||
jsr MLI
|
||
.DA #MLIOPEN
|
||
.DA ILDR.OPEN
|
||
bcs .9
|
||
|
||
jsr MLI
|
||
.DA #MLIGETEOF
|
||
.DA ILDR.GETEOF
|
||
bcs .9
|
||
|
||
lda ILDR.GETEOF+4
|
||
bne .99
|
||
|
||
lda ILDR.GETEOF+3
|
||
cmp #$9F
|
||
bcc .1
|
||
|
||
bne .99 more than $9Fxx
|
||
|
||
lda ILDR.GETEOF+2
|
||
bne .99 more than $9F00
|
||
|
||
.1 jsr MLI
|
||
.DA #MLIREAD
|
||
.DA ILDR.READ
|
||
bcs .9
|
||
|
||
jsr MLI
|
||
.DA #MLICLOSE
|
||
.DA ILDR.CLOSE
|
||
|
||
.9 rts
|
||
|
||
.99 lda #MLI.E.BADBUF
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
ILDR.MSG .EQ *
|
||
ILDR.MSG.SYSLOADERR .AT "Unable to load"
|
||
ILDR.MSG.SYSTOOLARG .AT "Too Large"
|
||
ILDR.LCBits .HS 8040201008040201
|
||
*--------------------------------------
|
||
ILDR.GFINFO .DA #10 PARAM CNT
|
||
.DA ILDR.ATINIT
|
||
.BS S.FI-3
|
||
*--------------------------------------
|
||
.DO READCAT=1
|
||
ILDR.MLIRB.P .DA #3
|
||
.DA #0 unit number
|
||
.DA 0 2 byte data buffer
|
||
.DA 0 2 byte block number
|
||
.FIN
|
||
*--------------------------------------
|
||
ILDR.OPEN .DA #3 PARAM CNT
|
||
.BS 2 Filename
|
||
.DA iobuf i/o buffer
|
||
.HS 01 REF
|
||
*--------------------------------------
|
||
ILDR.GETEOF .DA #2 PARAM CNT
|
||
.DA #01 REF
|
||
.HS 000000
|
||
*--------------------------------------
|
||
ILDR.READ .DA #4 PARAM CNT
|
||
.HS 01 REF
|
||
.DA sysentry
|
||
.DA $9F00 Max file size
|
||
.HS 0000
|
||
*--------------------------------------
|
||
ILDR.CLOSE .DA #1 PARAM CNT
|
||
.HS 01 REF
|
||
*--------------------------------------
|
||
ILDR.QUIT .DA #4 PARAM CNT
|
||
.HS 00
|
||
.HS 0000
|
||
.HS 00
|
||
.HS 0000
|
||
*--------------------------------------
|
||
ILDR.ATINIT .DA #6
|
||
.AS "ATINIT"
|
||
ILDR.KMPFX .DA #3
|
||
.AS "PM."
|
||
ILDR.SYSTEMSFX .DA #7
|
||
.AS ".SYSTEM"
|
||
*--------------------------------------
|
||
ILDR.LEN .EQ *-ILDR.START
|
||
*--------------------------------------
|
||
.DUMMY
|
||
ILDR.EPB .BS 1
|
||
ILDR.EL .BS 1
|
||
ILDR.nFC .BS 2
|
||
ILDR.FT .BS 1
|
||
ILDR.EITB .BS 1
|
||
ILDR.bPFXSFX .BS 1
|
||
.ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/prodos.fx/prodos.s.ildr
|
||
LOAD usr/src/prodos.fx/prodos.s
|
||
ASM
|