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

357 lines
6.1 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.

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
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 PM
jsr ILDR.EnumInit
.1 ldx #S.FI.T.BIN
ldy #ILDR.KMSFX
lda /ILDR.KMSFX
jsr ILDR.EnumNext
bcs .4
jsr ILDR.LoadFilePBuf
bcs ILDR.MLIERR
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
.FIN
*--------------------------------------
.4 jsr ILDR.EnumInit
ldx #S.FI.T.SYS
ldy #ILDR.SYSTEMSFX
lda /ILDR.SYSTEMSFX
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 suffix
*--------------------------------------
ILDR.EnumNext stx ILDR.FT
sty src
sta src+1
.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 suffix len
cmp pbuf
bcs .1 filename LE suffix
tay
ldx pbuf
.11 lda pbuf,x
eor (src),y
asl
bne .1
dex
dey
bne .11
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
*--------------------------------------
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.KMSFX .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
.ED
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.ildr
LOAD usr/src/prodos.fx/prodos.s
ASM