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

235 lines
5.0 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 gfi_list
bcc gfi_ok branch if 'atinit' file found
cmp #MLI.E.FNOTFND
beq ILDR.SYSTEM if so, continue loading interpreter
ATINIT.KO jmp badatinit
gfi_ok lda gfi_type
cmp #$E2 is 'atinit' correct file type?
bne ATINIT.KO error - wrong file type
jsr MLI open 'atinit' file
.DA #MLIOPEN
.DA atopen
bne ATINIT.KO error
lda #$9F max size = 39.75k ($2000-$BF00)
sta rdlen+1
stz rdlen
jsr MLI read 'atinit' file to 'sysentry'
.DA #MLIREAD
.DA rdparm
bne ATINIT.KO error - too big
jsr MLI close 'atinit' file
.DA #MLICLOSE
.DA clparm
bne ATINIT.KO error
lda RROMBNK2 enable ROM
jsr sysentry execute ATinit
*--------------------------------------
ILDR.SYSTEM lda /dbuf search directory buffer
sta idxl+1
lda #$04 start 1 entry past header
bne H2434 always.
H2432 lda idxl calc next entry position
H2434 clc
adc dbuf+35 inc to next entry address
sta idxl
bcs H2451 branch if page cross.
adc dbuf+35 test for end of block.
bcc H2453 branch if not page cross
lda idxl+1
lsr end of block?
bcc H2453 no.
cmp #$09 end of directory?
bne H244D no.
jmp nointrp no interpreter, go quit.
H244D lda #$04 reset index to 1st entry in next block.
sta idxl
H2451 inc idxl+1 inc to next page.
H2453 ldy #$10 check file type.
lda #$FF must be a prodos sys file
eor (idxl),y
bne H2432 if not sys.
tay see if active
lda (idxl),y
beq H2432 if deleted file.
and #$0F strip file 'kind'.
sta pbuf save length of name.
cmp #$08 must be at least 'x.system'
bcc H2432 else, ignore it.
tay compare last 7 chars for '.system'
ldx #$06
H246C lda (idxl),y
eor iterp,x
asl ignore bit 7
bne H2432 branch if something else
dey
dex
bpl H246C
ldy #$00
H247A iny
lda (idxl),y
sta pbuf,y
cpy pbuf
bne H247A
jsr MLI open interpreter file
.DA #$C8
.DA opparm
bne badlod
jsr MLI get eof (length of file)
.DA #$D1
.DA efparm
bne badlod
lda eof+2
bne toolong
lda eof+1
cmp #$9F max size = 39.75k ($2000-$BF00)
bcs toolong
sta rdlen+1
lda eof
sta rdlen (read entire file)
jsr MLI read interpreter file
.DA #$CA
.DA rdparm
beq H24C8 go close if successfully read.
cmp #$56 memory conflict?
beq toolong then too large
bne badlod else, unable to load.
H24C8 jsr MLI close interpreter file
.DA #$CC
.DA clparm
bne badlod hopefully never taken
lda RROMBNK2 enable ROM
sta CLR80DISP
sta CLR80STORE
jsr init
jsr setvid
jsr setkbd
jsr home
jmp sysentry go run interpreter
nointrp jsr MLI no interpreter found,so quit.
.DA #$65
.DA quitparm
badatinit ldy #6
.1 lda atinitname,y
sta pbuf,y
dey
bpl .1
badlod ldx #ILDR.MSG.SYSLOADERR-ILDR.MSG
.HS 2C BIT ABS
toolong ldx #ILDR.MSG.SYSTOOLARG-ILDR.MSG
jsr ILDR.PrintX
ldy #0
.1 iny
lda pbuf,y
jsr COUT
cpy pbuf
bne .1
bra *
*--------------------------------------
ILDR.PrintX bit RROMBNK2
lda INVFLG
pha
jsr SETINV
.1 lda ILDR.MSG,x
pha
ora #$80
jsr COUT
inx
pla
bpl .1
lda #$A0
jsr COUT
pla
sta INVFLG
rts
*--------------------------------------
ILDR.MSG .EQ *
ILDR.MSG.SYSLOADERR .AT "Unable to load"
ILDR.MSG.SYSTOOLARG .AT "Too Large"
*--------------------------------------
gfi_list .DA #$0A
.DA atinitname
.HS 00
gfi_type .HS 00000000
.HS 0000000000000000
.HS 0000
*--------------------------------------
atopen .HS 03
.DA atinitname
.DA iobuf i/o buffer
.HS 01 ref# hard coded since no other files
*--------------------------------------
atinitname .DA #06 length of name
.AS "ATINIT" name of appletalk config file
*--------------------------------------
opparm .HS 03
.DA pbuf
.DA iobuf
.HS 01
efparm .HS 02
.DA #01
eof .HS 000000 length of file.
rdparm .HS 04
.HS 01
.DA sysentry
rdlen .HS 0000
.HS 0000
clparm .HS 01
.HS 00
quitparm .HS 04
.HS 00
.HS 0000
.HS 00
.HS 0000
iterp .AS ".SYSTEM" interpreter suffix that is required
*--------------------------------------
ILDR.LEN .EQ *-ILDR.START
MAN
SAVE usr/src/prodos.fx/prodos.s.ildr
LOAD usr/src/prodos.fx/prodos.s
ASM