A2osX/ProDOS.FX/ProDOS.S.ILDR.txt

420 lines
7.3 KiB
Plaintext
Raw Normal View History

2019-10-31 06:54:28 +00:00
NEW
AUTO 3,1
*--------------------------------------
2019-11-01 20:06:04 +00:00
ILDR.START jsr MLI check for file 'atinit'
2019-10-31 06:54:28 +00:00
.DA #MLIGETFILEINFO
.DA ILDR.GFINFO
bcs ILDR.ENUMPM
2019-11-01 20:06:04 +00:00
lda ILDR.GFINFO+S.FI.T
2019-10-31 06:54:28 +00:00
cmp #$E2 is 'atinit' correct file type?
bne ILDR.ENUMPM error - wrong file type
2019-11-04 07:21:40 +00:00
ldy #ILDR.ATINIT
lda /ILDR.ATINIT
jsr ILDR.LoadFile
bcc .1
2019-12-02 07:09:58 +00:00
.9 jmp ILDR.MLIERR
2019-12-02 07:09:58 +00:00
.1 lda RROMBNK2 enable ROM
2019-10-31 06:54:28 +00:00
jsr sysentry execute ATinit
*--------------------------------------
.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
.2 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 .9
ldy #$03 get next block# from link
lda (dst),y
tax
dey
ora (dst),y 00 00 -> Last Block
beq .8
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 .2 if ok, read next block.
.8 .FIN
2019-11-04 07:21:40 +00:00
*--------------------------------------
* BOOT block read 4 directory blocks at dbuf=$C00 -> $13FF
*--------------------------------------
ILDR.ENUMPM .DO PM
2020-08-30 17:50:57 +00:00
jsr ILDR.EnumInit
2020-08-30 17:50:57 +00:00
.1 ldx #S.FI.T.BIN
2022-03-13 12:52:24 +00:00
ldy #ILDR.KMPFX
lda /ILDR.KMPFX
clc prefix
jsr ILDR.EnumNext
bcs .4
2020-08-30 17:50:57 +00:00
jsr ILDR.LoadFilePBuf
bcs ILDR.MLIERR
2020-08-30 17:50:57 +00:00
ldx #3
.2 lda idxl,x
pha
2019-10-31 06:54:28 +00:00
dex
bpl .2
2020-08-30 17:50:57 +00:00
jsr sysentry
2020-08-30 17:50:57 +00:00
bit RROMBNK2 enable ROM
ldx #0
.3 pla
sta idxl,x
inx
cpx #4
bne .3
>DEBUGOA
2020-08-30 17:50:57 +00:00
bra .1
2020-08-30 17:50:57 +00:00
.FIN
*--------------------------------------
.4 jsr ILDR.EnumInit
ldx #S.FI.T.SYS
ldy #ILDR.SYSTEMSFX
lda /ILDR.SYSTEMSFX
2022-03-13 12:52:24 +00:00
sec suffix
jsr ILDR.EnumNext
bcs .9
2020-08-30 17:50:57 +00:00
jsr ILDR.LoadFilePBuf
bcs ILDR.MLIERR
2020-08-30 17:50:57 +00:00
bit RROMBNK2 enable ROM
2020-08-30 17:50:57 +00:00
bit RDIOUDIS
sta SETIOUDIS
sta CLRDHIRES
bmi .5
2020-08-30 17:50:57 +00:00
sta CLRIOUDIS
2019-10-31 06:54:28 +00:00
.5 sta CLR80DISP
2020-08-30 17:50:57 +00:00
sta CLR80STORE
sta SETTEXT
sta CLRMIXED
2020-08-30 17:50:57 +00:00
jsr init
jsr setvid
jsr setkbd
jsr home
2019-10-31 06:54:28 +00:00
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
2019-10-31 06:54:28 +00:00
ldx #ILDR.MSG.SYSTOOLARG-ILDR.MSG
2020-08-30 17:50:57 +00:00
.HS 2C BIT ABS
.1 ldx #ILDR.MSG.SYSLOADERR-ILDR.MSG
2019-11-04 07:21:40 +00:00
bit RROMBNK2
2020-08-30 17:50:57 +00:00
jsr SETINV
.2 lda ILDR.MSG,x
2020-08-30 17:50:57 +00:00
pha
ora #$80
jsr COUT
inx
pla
bpl .2
2020-08-30 17:50:57 +00:00
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
2022-03-13 12:52:24 +00:00
* Y,A = expected prefix/suffix
*--------------------------------------
ILDR.EnumNext stx ILDR.FT
sty src
sta src+1
2022-03-13 12:52:24 +00:00
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
2020-08-30 17:50:57 +00:00
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
2022-03-13 12:52:24 +00:00
lda (src) expected prefix/suffix len
cmp pbuf
2022-03-13 12:52:24 +00:00
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
2022-03-13 12:52:24 +00:00
bra .15
.12 lda (src) expected prefix/suffix len
tay
2022-03-13 12:52:24 +00:00
.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
2020-08-30 17:50:57 +00:00
rts
*--------------------------------------
ILDR.MSG .EQ *
2020-08-30 17:50:57 +00:00
ILDR.MSG.SYSLOADERR .AT "Unable to load"
ILDR.MSG.SYSTOOLARG .AT "Too Large"
ILDR.LCBits .HS 8040201008040201
2020-08-30 17:50:57 +00:00
*--------------------------------------
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
2020-08-30 17:50:57 +00:00
*--------------------------------------
ILDR.OPEN .DA #3 PARAM CNT
.BS 2 Filename
2019-12-02 07:09:58 +00:00
.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
2019-10-31 06:54:28 +00:00
.DA sysentry
.DA $9F00 Max file size
2019-10-31 06:54:28 +00:00
.HS 0000
*--------------------------------------
ILDR.CLOSE .DA #1 PARAM CNT
.HS 01 REF
*--------------------------------------
ILDR.QUIT .DA #4 PARAM CNT
2019-10-31 06:54:28 +00:00
.HS 00
.HS 0000
.HS 00
.HS 0000
*--------------------------------------
ILDR.ATINIT .DA #6
.AS "ATINIT"
2022-03-13 12:52:24 +00:00
ILDR.KMPFX .DA #3
.AS "PM."
ILDR.SYSTEMSFX .DA #7
.AS ".SYSTEM"
2019-10-31 06:54:28 +00:00
*--------------------------------------
2019-11-01 20:06:04 +00:00
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
2022-03-13 12:52:24 +00:00
ILDR.bPFXSFX .BS 1
.ED
*--------------------------------------
2019-10-31 06:54:28 +00:00
MAN
2020-08-30 17:50:57 +00:00
SAVE usr/src/prodos.fx/prodos.s.ildr
LOAD usr/src/prodos.fx/prodos.s
2019-10-31 06:54:28 +00:00
ASM