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

433 lines
7.8 KiB
Plaintext
Raw Normal View History

2019-10-31 06:54:28 +00:00
NEW
AUTO 3,1
*--------------------------------------
2023-11-04 14:42:28 +00:00
devid .EQ $12
src .EQ $12
dst .EQ $14
*--------------------------------------
ILDR.DBuf .EQ $0C00
ILDR.IOBuf .EQ $1400
*--------------------------------------
ILDR.START .PH ILDR
ILDR.START1 jsr MLI check for file 'atinit'
.DA #MLI.GFINFO
.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
2023-11-04 14:42:28 +00:00
.1 lda IO.RROMBNK2 enable ROM
jsr $2000 execute ATinit
*--------------------------------------
2022-05-25 18:46:02 +00:00
* BOOT block read 4 directory blocks at dbuf=$C00 -> $13FF
*--------------------------------------
ILDR.ENUMPM .DO READCAT=1
2023-11-04 14:42:28 +00:00
lda LDR.MLIOL.P+1 Boot ZP.UNITNUM
sta ILDR.MLIRB.P+1
stz dst
2023-11-04 14:42:28 +00:00
lda /ILDR.DBuf
ldy #$02 read directory into buffer
ldx #0
2022-05-25 18:46:02 +00:00
.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
2023-11-04 14:42:28 +00:00
.DA #MLI.READBLOCK
.DA ILDR.MLIRB.P
2023-11-04 14:42:28 +00:00
bcc .23
jmp ILDR.MLIERR
2023-11-04 14:42:28 +00:00
.23 ldy #$03 get next block# from link
lda (dst),y
tax
dey
ora (dst),y 00 00 -> Last Block
2022-05-25 18:46:02 +00:00
beq .28
lda (dst),y
tay
lda dst+1
inc
inc add $200 to buffer pointer
2023-11-04 14:42:28 +00:00
cmp /ILDR.DBuf+$800 until it points past end of buffer.
2022-05-25 18:46:02 +00:00
bcc .22 if ok, read next block.
2022-05-25 18:46:02 +00:00
.28 .FIN
2019-11-04 07:21:40 +00:00
*--------------------------------------
2023-11-04 14:42:28 +00:00
.DO M.PM=1
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
2023-11-04 14:42:28 +00:00
ldy #ILDR.PMPFX
lda /ILDR.PMPFX
2022-03-13 12:52:24 +00:00
clc prefix
jsr ILDR.EnumNext
2022-05-25 18:46:02 +00:00
bcs .8
2020-08-30 17:50:57 +00:00
jsr ILDR.LoadFilePBuf
2023-11-04 14:42:28 +00:00
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
2023-11-04 14:42:28 +00:00
jsr $2000
2020-08-30 17:50:57 +00:00
2023-11-04 14:42:28 +00:00
bit IO.RROMBNK2 enable ROM
ldx #0
.3 pla
sta idxl,x
inx
cpx #4
bne .3
2020-08-30 17:50:57 +00:00
2023-11-04 14:42:28 +00:00
>DEBUGOA
bra .1
2020-08-30 17:50:57 +00:00
2022-05-25 18:46:02 +00:00
.8 .FIN
*--------------------------------------
2022-05-25 18:46:02 +00:00
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
2023-11-04 14:42:28 +00:00
bit IO.RROMBNK2 enable ROM
2020-08-30 17:50:57 +00:00
2023-11-04 14:42:28 +00:00
bit IO.RDIOUDIS
sta IO.SETIOUDIS
sta IO.CLRDHIRES
bmi .5
2020-08-30 17:50:57 +00:00
2023-11-04 14:42:28 +00:00
sta IO.CLRIOUDIS
2019-10-31 06:54:28 +00:00
2023-11-04 14:42:28 +00:00
.5 sta IO.CLR80DISP
sta IO.CLR80STORE
sta IO.SETTEXT
sta IO.CLRMIXED
jsr ROM.INIT
jsr ROM.SETVID
jsr ROM.SETKBD
jsr ROM.HOME
jmp $2000 go run interpreter
2019-10-31 06:54:28 +00:00
.9 jsr MLI no .SYSTEM found, so quit.
2023-11-04 14:42:28 +00:00
.DA #MLI.QUIT
.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
2023-11-04 14:42:28 +00:00
bit IO.RROMBNK2
jsr ROM.SETINV
2020-08-30 17:50:57 +00:00
.2 lda ILDR.MSG,x
2020-08-30 17:50:57 +00:00
pha
ora #$80
2023-11-04 14:42:28 +00:00
jsr ROM.COUT
2020-08-30 17:50:57 +00:00
inx
pla
bpl .2
2020-08-30 17:50:57 +00:00
lda #$A0
2023-11-04 14:42:28 +00:00
jsr ROM.COUT
ldy #0
.3 iny
2023-11-04 14:42:28 +00:00
lda LDR.PBuf,y
jsr ROM.COUT
cpy LDR.PBuf
bne .3
bra *
*--------------------------------------
2023-11-04 14:42:28 +00:00
ILDR.EnumInit lda /ILDR.DBuf search directory buffer
sta idxl+1
2023-11-04 14:42:28 +00:00
lda #ILDR.DBuf+4 skip Prev/next Block Ptr
sta idxl
2023-11-04 14:42:28 +00:00
lda ILDR.DBuf+35 EL
sta ILDR.EL
2023-11-04 14:42:28 +00:00
lda ILDR.DBuf+36 EPB
sta ILDR.EPB
sta ILDR.EITB
2023-11-04 14:42:28 +00:00
lda ILDR.DBuf+37 FCLO
eor #$ff
sta ILDR.nFC
2023-11-04 14:42:28 +00:00
lda ILDR.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
2023-11-04 14:42:28 +00:00
sta LDR.PBuf filename Len
tay
.5 lda (idxl),y
2023-11-04 14:42:28 +00:00
sta LDR.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
2023-11-04 14:42:28 +00:00
cmp LDR.PBuf
2022-03-13 12:52:24 +00:00
bcs .1 filename LE prefix/suffix
bit ILDR.bPFXSFX
bpl .12 go check prefix
tay
2023-11-04 14:42:28 +00:00
ldx LDR.PBuf
2023-11-04 14:42:28 +00:00
.11 lda LDR.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
2023-11-04 14:42:28 +00:00
.13 lda LDR.PBuf,y
2022-03-13 12:52:24 +00:00
eor (src),y
asl
bne .1
dey
bne .13
.15 ldy #$1D MIN_VERSION
lda (idxl),y
bpl .10 no lowercase information
2023-11-04 14:42:28 +00:00
ldx LDR.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
2023-11-04 14:42:28 +00:00
.8 lda LDR.PBuf,x
eor #$20 to lowercase
2023-11-04 14:42:28 +00:00
sta LDR.PBuf,x
.9 dex
bne .6
.10 clc
rts
*--------------------------------------
ILDR.LoadFilePBuf
2023-11-04 14:42:28 +00:00
ldy #LDR.PBuf
lda /LDR.PBuf
ILDR.LoadFile sty ILDR.OPEN+1 Filename
sta ILDR.OPEN+2
jsr MLI
2023-11-04 14:42:28 +00:00
.DA #MLI.OPEN
.DA ILDR.OPEN
bcs .9
jsr MLI
2023-11-04 14:42:28 +00:00
.DA #MLI.GETEOF
.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
2023-11-04 14:42:28 +00:00
.1
jsr MLI
.DA #MLI.READ
.DA ILDR.READ
bcs .9
jsr MLI
2023-11-04 14:42:28 +00:00
.DA #MLI.CLOSE
.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
2023-11-04 14:42:28 +00:00
.DA ILDR.IOBuf
.HS 01 REF
*--------------------------------------
ILDR.GETEOF .DA #2 PARAM CNT
.DA #01 REF
.HS 000000
*--------------------------------------
ILDR.READ .DA #4 PARAM CNT
.HS 01 REF
2023-11-04 14:42:28 +00:00
.DA $2000
.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
*--------------------------------------
2023-11-04 14:42:28 +00:00
ILDR.ATINIT .PS "ATINIT"
.DO M.PM=1
ILDR.PMPFX .PS "PM."
.FIN
ILDR.SYSTEMSFX .PS ".SYSTEM"
*--------------------------------------
.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
2023-11-04 14:42:28 +00:00
*--------------------------------------
.EP
*--------------------------------------
ILDR.LEN .EQ *-ILDR.START
*--------------------------------------
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
2023-11-04 14:42:28 +00:00
LOAD usr/src/prodos.fx/pdos8m.s
2019-10-31 06:54:28 +00:00
ASM