2019-10-16 06:09:13 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
entcalc jsr XDOS.ZPT.InitGBuf
|
|
|
|
|
|
|
|
|
|
ldx d_entnum on the entry #.
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.1 dex addr = XDOS.GBuf + ((d_entnum-1) * h_entln)
|
|
|
|
|
beq crerr3 branch with carry clear = no errors.
|
|
|
|
|
|
|
|
|
|
jsr XDOS.ZPT.Next
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
crerr3 rts carry set if error.
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
drevise lda GP.DATE
|
|
|
|
|
beq drevise1 if no clock, then don't mod date/time.
|
|
|
|
|
|
|
|
|
|
ldx #$03
|
|
|
|
|
|
|
|
|
|
modtime lda GP.DATE,x move last modification date/time
|
|
|
|
|
sta d_moddt,x to entry being updated.
|
|
|
|
|
dex
|
|
|
|
|
bpl modtime
|
|
|
|
|
|
|
|
|
|
drevise1 lda bkbitflg (bit 5 = backup needed)
|
|
|
|
|
tsb d_attr mark entry as backupable
|
|
|
|
|
|
|
|
|
|
lda d_dev get device # of directory
|
|
|
|
|
sta GP.DEVNUM to be revised
|
|
|
|
|
|
|
|
|
|
lda d_entblk and address of directory block.
|
|
|
|
|
ldx d_entblk+1
|
|
|
|
|
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.ReadGBufAX read block into general purpose buffer
|
|
|
|
|
.FIN
|
|
|
|
|
bcs crerr3
|
|
|
|
|
|
|
|
|
|
jsr entcalc fix up ptr to entry location within XDOS.GBuf.
|
|
|
|
|
|
|
|
|
|
ldy h_entln now move 'd.' info to directory.
|
|
|
|
|
dey
|
|
|
|
|
|
|
|
|
|
.1 lda d_stor,y
|
|
|
|
|
sta (zpt),y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
lda d_head is the entry block same as
|
|
|
|
|
cmp ZP.BLKNUM the entry's header block?
|
|
|
|
|
bne H36E0 if no, go save entry block
|
|
|
|
|
|
|
|
|
|
lda d_head+1 then maybe, so test high addresses.
|
|
|
|
|
cmp ZP.BLKNUM+1
|
|
|
|
|
beq uphead branch if they are the same block.
|
|
|
|
|
|
|
|
|
|
H36E0 .DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.WriteGBufDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.WriteGBuf go write updated directory block.
|
|
|
|
|
.FIN
|
|
|
|
|
bcs crerr3
|
|
|
|
|
|
|
|
|
|
lda d_head get address of header block and
|
|
|
|
|
ldx d_head+1
|
|
|
|
|
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.ReadGBufAX go read in header block to modify.
|
|
|
|
|
.FIN
|
|
|
|
|
bcs crerr3
|
|
|
|
|
|
|
|
|
|
uphead ldy #$01 update current # of files in this dir.
|
|
|
|
|
|
|
|
|
|
H36F2 lda h_fcnt,y
|
|
|
|
|
sta XDOS.GBuf+37,y (current entry count)
|
|
|
|
|
dey
|
|
|
|
|
bpl H36F2
|
|
|
|
|
|
|
|
|
|
lda h_attr also update header's attributes.
|
|
|
|
|
sta XDOS.GBuf+34
|
|
|
|
|
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.WriteGBufDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.WriteGBuf go write updated header
|
|
|
|
|
.FIN
|
|
|
|
|
bcs H375A
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ripple lda XDOS.GBuf+4 test for 'root' directory because
|
|
|
|
|
and #$F0 if it is, then directory revision
|
|
|
|
|
eor #$F0 is complete (leaves carry clear).
|
|
|
|
|
beq H3770 branch if done.
|
|
|
|
|
|
|
|
|
|
lda XDOS.GBuf+41 get entry #
|
|
|
|
|
sta d_entnum
|
|
|
|
|
lda XDOS.GBuf+42 and the length of entries in that dir
|
|
|
|
|
sta h_entln
|
|
|
|
|
|
|
|
|
|
lda XDOS.GBuf+39 get addr of parent entry's dir block
|
|
|
|
|
ldx XDOS.GBuf+40
|
|
|
|
|
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAX no need to pak/unpak....will disturb zpt
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.ReadGBufAX read it
|
|
|
|
|
.FIN
|
|
|
|
|
bcs H375A
|
|
|
|
|
|
|
|
|
|
jsr entcalc get indirect ptr to parent entry in XDOS.GBuf
|
|
|
|
|
|
|
|
|
|
lda GP.DATE don't touch mod
|
|
|
|
|
beq H373B if no clock...
|
|
|
|
|
|
|
|
|
|
ldx #$03 update the modification date & time
|
|
|
|
|
ldy #$24 for this entry too
|
|
|
|
|
|
|
|
|
|
H3732 lda GP.DATE,x
|
|
|
|
|
sta (zpt),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl H3732
|
|
|
|
|
|
|
|
|
|
H373B .DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.WriteGBuf
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.WriteGBuf write updated entry back to disk.
|
|
|
|
|
.FIN
|
|
|
|
|
bcs H375A if error.
|
|
|
|
|
|
|
|
|
|
ldy #$26 compare current block # to this
|
|
|
|
|
lda (zpt),y entry's header block.
|
|
|
|
|
tax
|
|
|
|
|
dey
|
|
|
|
|
lda (zpt),y block as header.
|
|
|
|
|
cmp ZP.BLKNUM are low addresses the same?
|
|
|
|
|
bne H3751 branch if entry doesn't reside in same
|
|
|
|
|
|
|
|
|
|
cpx ZP.BLKNUM+1 are high address the same?
|
|
|
|
|
beq ripple they are the same, continue to root dir.
|
|
|
|
|
|
|
|
|
|
H3751 .DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAX
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.ReadGBufAX
|
|
|
|
|
.FIN
|
|
|
|
|
bcc ripple continue if read was good
|
|
|
|
|
|
|
|
|
|
H375A rts
|
|
|
|
|
|
|
|
|
|
H3770 clc no error
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-07-18 14:04:21 +00:00
|
|
|
|
XDOS.FindDirOrVol
|
|
|
|
|
jsr XDOS.FindFileOrVol
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda d_stor
|
|
|
|
|
|
|
|
|
|
and #$F0
|
|
|
|
|
cmp #$D0
|
|
|
|
|
beq moventry.CLCRTS
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
.9 lda #MLI.E.UNSUPST
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.FindFileOrVol
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr XDOS.CheckPath
|
2020-07-18 14:04:21 +00:00
|
|
|
|
bcc moventry
|
|
|
|
|
|
|
|
|
|
cmp #MLI.E.INVPATH
|
|
|
|
|
bne fnderr
|
2020-07-22 15:51:03 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-07-18 14:04:21 +00:00
|
|
|
|
|
2019-11-10 18:28:06 +00:00
|
|
|
|
moventry ldy h_entln Get FileInfo From Directory Block Buffer
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2019-11-10 18:28:06 +00:00
|
|
|
|
.1 dey
|
|
|
|
|
lda (zpt),y move entry into storage
|
|
|
|
|
sta d_stor,y
|
|
|
|
|
tya
|
|
|
|
|
bne .1
|
2020-07-18 14:04:21 +00:00
|
|
|
|
moventry.CLCRTS
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.FindFile jsr XDOS.CheckPath see if file exists
|
2020-07-18 14:04:21 +00:00
|
|
|
|
bcc moventry
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.CheckPath jsr XDOS.FindVol
|
2020-09-20 18:35:54 +00:00
|
|
|
|
bcs fnderr.RTS
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
bne lookfil0 branch if more than root
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
jsr XDOS.ZPT.InitGBuf
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
ldy #$1F move in id and date info
|
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.1 lda (zpt),y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_stor,y
|
|
|
|
|
dey
|
|
|
|
|
cpy #$17
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.2 lda rootstuf-$10,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_stor,y
|
|
|
|
|
dey
|
|
|
|
|
cpy #$0F
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .2
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$D0 fake directory file
|
|
|
|
|
sta d_stor
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+2 check forward link.
|
|
|
|
|
ora XDOS.GBuf+3 if non-zero, assume full sized directory
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .3 else assume it's the slot 3 /RAM volume
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$02 so reset eof and blocks_used fields
|
|
|
|
|
sta d_eof+1
|
|
|
|
|
lda #$01
|
|
|
|
|
sta d_usage
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.3 lda #MLI.E.INVPATH bad path (carry set)
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-11 14:21:06 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-20 18:35:54 +00:00
|
|
|
|
errdir lda #MLI.E.BADDIR directory error
|
|
|
|
|
fnderr sec
|
|
|
|
|
fnderr.RTS rts
|
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lookfil0 stz nofree reset free entry indicator.
|
2020-09-20 18:35:54 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec dir to be searched has header in this block.
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L37C9 stz totent reset entry counter.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
jsr XDOS.LookupNameInDirBlk look for name pointed to by pnptr.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc namfound if name was found.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda entcntl have we looked at all of the
|
|
|
|
|
sbc totent entries in this directory?
|
|
|
|
|
bcc L37E2 maybe, check hi count.
|
|
|
|
|
bne L37EB no, read next directory block.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-09-20 18:35:54 +00:00
|
|
|
|
lda entcnth has the last entry been looked at?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq errfnf yes, give 'file not found' error
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L37E2 dec entcnth should be at least one
|
|
|
|
|
L37EB sta entcntl keep a running count.
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda /XDOS.GBuf reset indirect pointer
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta zpt+1
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+2 get link to next dir block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L37FC (if there is one).
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
cmp XDOS.GBuf+3 are both zero, i.e. no link? if so,
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq errdir then not all entries were acct'd for.
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L37FC ldx XDOS.GBuf+3 acc has value for block# (low).
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.ReadGBufAX go read the next linked directory.
|
|
|
|
|
.FIN
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L37C9 if no error.
|
|
|
|
|
rts return error in acc.
|
2020-09-20 18:35:54 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
errfnf lda nofree was any free entry found?
|
2023-11-12 13:20:15 +00:00
|
|
|
|
bne .2
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+2 test link
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
cmp XDOS.GBuf+3 if both are 0 then give up.
|
|
|
|
|
beq .2 report 'not found'.
|
|
|
|
|
|
|
|
|
|
.1 sta d_entblk
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+3
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_entblk+1 assume 1st entry of next block
|
|
|
|
|
lda #$01 is free for use.
|
|
|
|
|
sta d_entnum mark as valid (for create)
|
|
|
|
|
sta nofree
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.2 jsr nxtpnam1 'file not found' or 'path not found'?
|
|
|
|
|
|
2019-11-26 16:35:49 +00:00
|
|
|
|
errpath1 beq .1 if non-zero then 'path not found'
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.PNOTFND path not found
|
2019-11-26 16:35:49 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2019-11-26 16:35:49 +00:00
|
|
|
|
.1 lda #MLI.E.FNOTFND file not found
|
|
|
|
|
sec
|
2019-12-06 07:15:51 +00:00
|
|
|
|
lookfil0.RTS rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
namfound jsr nxtpname adj index to next name in path.
|
|
|
|
|
beq filfound branch if that was the last name.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$00 be sure this is a directory entry.
|
|
|
|
|
lda (zpt),y high nibble will tell.
|
|
|
|
|
and #$F0
|
|
|
|
|
cmp #$D0 is it a subdirectory?
|
|
|
|
|
bne errpath1 error if not.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
ldy #$12 get address of 1st subdirectory block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y
|
2020-08-27 15:34:55 +00:00
|
|
|
|
sta d_head+1 save as file's header block too
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
dey
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y
|
2020-08-27 15:34:55 +00:00
|
|
|
|
sta d_head
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX read subdirectory into XDOS.GBuf.
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
2019-12-06 07:15:51 +00:00
|
|
|
|
bcs lookfil0.RTS if error.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+37 get the # of files contained in this
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta entcntl directory.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+38
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta entcnth
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Check if $75 at VOL/DIR entry + $14
|
|
|
|
|
* (8 bytes reserved)
|
|
|
|
|
*--------------------------------------
|
2019-11-26 16:35:49 +00:00
|
|
|
|
.DO LOWERCASE=0
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+20 make sure password is disabled
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx #$00
|
|
|
|
|
sec
|
|
|
|
|
rol
|
|
|
|
|
L3869 bcc L386C
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
L386C asl
|
|
|
|
|
bne L3869
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cpx #$05 is password disabled?
|
|
|
|
|
beq movhead
|
|
|
|
|
|
|
|
|
|
lda #MLI.E.INCFF directory is not compatible
|
2019-11-23 15:24:55 +00:00
|
|
|
|
sec
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-26 16:35:49 +00:00
|
|
|
|
.FIN
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
movhead jsr movhed0 move directory info.
|
|
|
|
|
jmp lookfil0 do next local pathname.
|
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
movhed0 ldx #9 move this directory info
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda XDOS.GBuf+$1C,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta h_credt,x
|
|
|
|
|
dex
|
2019-12-06 07:15:51 +00:00
|
|
|
|
bpl .1
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.DO ACL=1
|
2022-10-20 15:43:19 +00:00
|
|
|
|
ldx #7
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+$14
|
2020-07-13 19:29:31 +00:00
|
|
|
|
cmp #$57
|
|
|
|
|
bne .20
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+$15
|
2022-10-20 15:43:19 +00:00
|
|
|
|
bne .20
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 lda XDOS.GBuf+$14,x
|
2020-07-13 19:29:31 +00:00
|
|
|
|
sta h_acl,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2022-10-20 15:43:19 +00:00
|
|
|
|
|
|
|
|
|
bra .21
|
|
|
|
|
|
|
|
|
|
.20 stz h_acl,x
|
|
|
|
|
dex
|
|
|
|
|
bpl .20
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2022-10-20 15:43:19 +00:00
|
|
|
|
.21 .FIN
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda XDOS.GBuf+4 if this is root, then nothing to do
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$F0
|
|
|
|
|
eor #$F0 test header type.
|
2019-12-06 07:15:51 +00:00
|
|
|
|
beq .8 branch if root
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx #$03 otherwise, save owner info about
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.3 lda XDOS.GBuf+$27,x this header.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta own_blk,x
|
|
|
|
|
dex
|
2020-07-13 19:29:31 +00:00
|
|
|
|
bpl .3
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-12-06 07:15:51 +00:00
|
|
|
|
.8 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
filfound lda h_maxent figure out which entry # this is
|
|
|
|
|
sec
|
|
|
|
|
sbc cntent max entries - count entries + 1
|
|
|
|
|
adc #$00 = entry # (carry was set)
|
|
|
|
|
sta d_entnum
|
2023-06-15 06:17:56 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda ZP.BLKNUM and indicate block # of this directory
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_entblk
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda ZP.BLKNUM+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_entblk+1
|
2023-06-15 06:17:56 +00:00
|
|
|
|
|
|
|
|
|
* clc done by ADC #$00
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-11 14:21:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.LookupNameInDirBlk
|
|
|
|
|
lda h_maxent reset count of files per block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta cntent
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr XDOS.ZPT.InitGBuf reset indirect pointer to XDOS.GBuf
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bcs .4 branch if this block contains a header
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.1 ldy #$00
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y get length of name in directory.
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bne .2 branch if there is a name.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda nofree test if a free entry has been declared.
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bne .4 yes, inc to next entry.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr filfound set address for current entry.
|
|
|
|
|
|
|
|
|
|
inc nofree indicate a free spot has been found.
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bra .4
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.2 and #$0F strip byte (is checked by 'filfound')
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc totent inc count of valid files found.
|
|
|
|
|
sta namcnt save name length as counter.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx namptr get index to current path.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.PathBuf,x are both names the same length?
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bne .4 no, inc to next entry.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.3 inx (first) next letter index
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
lda (zpt),y compare names letter by letter
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.PathBuf,x
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bne .4
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec namcnt all letters compared?
|
2023-06-15 06:17:56 +00:00
|
|
|
|
bne .3 no, continue.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc a match is found.
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.9 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.4 dec cntent checked all entries in this block?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
2023-06-15 06:17:56 +00:00
|
|
|
|
beq .9 yes, no name match.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
jsr XDOS.ZPT.Next
|
|
|
|
|
bra .1
|
2019-11-11 14:21:06 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.FindVol jsr XDOS.FindVolInVCBOrDev
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs novolume
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-12-06 07:15:51 +00:00
|
|
|
|
.DO ACL=1
|
|
|
|
|
ldx #$4A
|
|
|
|
|
.ELSE
|
2019-11-11 21:56:58 +00:00
|
|
|
|
ldx #$42 zero out directory temps
|
2019-12-06 07:15:51 +00:00
|
|
|
|
.FIN
|
|
|
|
|
|
|
|
|
|
.1 stz own_blk,x and owner info
|
2019-11-11 21:56:58 +00:00
|
|
|
|
dex
|
2019-12-06 07:15:51 +00:00
|
|
|
|
bpl .1
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.DEVNUM setup device # for this directory
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_dev
|
|
|
|
|
jsr movhed0 setup other header info from directory
|
2019-11-11 21:56:58 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldy #$01 in XDOS.GBuf and clean up misc info.
|
|
|
|
|
ldx XDOS.VCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 lda XDOS.VCBs+VCB.TBLK,x misc info includes
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta h_tblk,y total # of blocks,
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.BMAP,x the address of the 1st bitmap,
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta h_bmap,y
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda ZP.BLKNUM,y directory's disk address,
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta d_head,y
|
|
|
|
|
lda h_fcnt,y and setting up a counter for the # of
|
|
|
|
|
sta entcntl,y files in this directory.
|
|
|
|
|
dex
|
|
|
|
|
dey
|
2019-12-06 07:15:51 +00:00
|
|
|
|
bpl .2
|
2023-11-04 14:42:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
nxtpname jsr nxtpnam1 get new namptr in y and namlen in acc.
|
|
|
|
|
sty namptr save new pathname pointer.
|
|
|
|
|
rts (status reg according to accumulator)
|
2023-11-04 14:42:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
nxtpnam1 ldy namptr inc pathname pointer to next name
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.PathBuf,y in the path.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
adc namptr if this addition results in zero,
|
|
|
|
|
tay then prefixed directory has been moved
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bne .1 to another device. branch if not.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.DEVNUM revise GP.DEVNUM for prefixed directory
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta p_dev
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda XDOS.PathBuf,y test for end of name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc no errors
|
|
|
|
|
novolume rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.FindVolInVCBOrDev
|
|
|
|
|
lda #$00
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldy GP.PFXPTR use prefix volume name to look up vcb.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bit prfxflg is this a prefixed path?
|
|
|
|
|
bpl L396F branch if it is
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay set ptr to volume name
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L396F sty L39D4+1 and save.
|
|
|
|
|
sta GP.DEVNUM zero out dev# until vcb located.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda #XDOS.VCB0
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3975 pha acc now used as vcb lookup index.
|
|
|
|
|
tax index pointer to x.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs,x get vcb volume name length.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3987 branch if claimed vcb to be tested.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L397C ldy L39D4+1 restore pointer to requested vol name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
pla now adj vcb index to next vcb entry.
|
|
|
|
|
clc
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #VCB
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L3975 branch if more vcb's to check
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L39D4 otherwise go look for unlogged volumes.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3987 sta namcnt save length of vol name to be compared.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L398A cmp XDOS.PathBuf,y is it the same as requested vol name?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L397C branch if not
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
iny next character
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec namcnt last character?
|
|
|
|
|
bpl L398A if not.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
plx restore pointer to matching vcb.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stx XDOS.VCBPtr save it for future reference.
|
|
|
|
|
lda XDOS.VCBs+VCB.DEV,x get it's device #
|
|
|
|
|
sta GP.DEVNUM and save it.
|
2020-08-27 15:34:55 +00:00
|
|
|
|
|
|
|
|
|
lda #$02 assume prefix is not used and
|
|
|
|
|
ldx #$00 that root directory is to be used.
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda L39D4+1 = 0 if no prefix.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L39AC tay if prefix then find ptr to prefixed
|
|
|
|
|
sta namptr dir name. save path ptr.
|
|
|
|
|
beq L39C2 branch if no prefix.
|
2020-08-27 15:34:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
2023-11-04 14:42:28 +00:00
|
|
|
|
adc XDOS.PathBuf,y inc to next dir in prefix path.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L39AC branch if another dir in prefix.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
pla
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda p_blok volume verification will occur at
|
2020-08-27 15:34:55 +00:00
|
|
|
|
pha
|
|
|
|
|
ldx p_blok+1 subdirectory level.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
* verify volume name
|
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
L39C2 pla
|
|
|
|
|
|
|
|
|
|
jsr XDOS.ReadGBufAX read in directory (or prefix dir)
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L39CC if error then look on other devices.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
2021-02-20 10:18:02 +00:00
|
|
|
|
jsr XDOS.CheckAndUnpackGBuf
|
|
|
|
|
bcs L39CC
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
|
|
|
|
|
2019-11-20 07:04:00 +00:00
|
|
|
|
jsr XDOS.CheckVolName compare dir name with path name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L39F0 if they match, stop looking.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L39CC ldx XDOS.VCBPtr check if current (matched) vcb is active
|
|
|
|
|
lda XDOS.VCBs+VCB.OFCNT,x i.e. does it have open files?
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bne L39ED report not found if active.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L39D4 lda #$FF SELF MODIFIED vnptr : make path ptr same as volume ptr
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta namptr
|
|
|
|
|
jsr mvdevnums copy all device #'s to be examined.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.DEVNUM log current device 1st before searching
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L39F1 others.
|
2019-11-11 21:56:58 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L39E2 ldx GP.DEVCNT scan look list for devices we need
|
2019-11-11 21:56:58 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L39E5 lda loklst,x to search for the requested volume.
|
|
|
|
|
bne L39F4 branch if we've a device to look at.
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl L39E5 look at next one.
|
2019-11-11 21:56:58 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L39ED lda #MLI.E.VNOTFND no mounted volume
|
|
|
|
|
sec error
|
|
|
|
|
L39F0 rts
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L39F1 ldx GP.DEVCNT now remove the device from the list
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L39F4 cmp loklst,x of prospective devices.
|
|
|
|
|
beq L39FE branch if match.
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex look until found.
|
|
|
|
|
bpl L39F4 always taken (usually) unless
|
2020-09-17 15:29:41 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bmi L39ED if dev was removed from GP.DEVLST (/RAM).
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L39FE sta GP.DEVNUM preserve device to be checked next.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
stz loklst,x mark this one as tested.
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
|
|
|
|
jsr XDOS.FindVCBForDevNum find vcb that claims this dev (if any).
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3A29 branch if vcb full.
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs,x did we find it or return free vcb?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3A16 if free vcb.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.OFCNT,x is this volume active?
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bne L39E2 if so, no need to re-log.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3A16 lda #$02 go read root dir into XDOS.GBuf
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx #$00
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
2020-05-25 13:58:59 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L39E2 ignore if unable to read.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-09-17 05:43:06 +00:00
|
|
|
|
jsr XDOS.VCBMount
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L39E2 look at next if non-xdos disk mounted.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
|
|
|
|
jsr XDOS.CheckVolName is this the volume ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L39E2 if not
|
|
|
|
|
L3A29 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
mvdevnums ldx GP.DEVCNT copy all dev #'s to be checked.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda GP.DEVLST,x active device list.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$F0 strip device type info.
|
|
|
|
|
sta loklst,x copy them to a temp workspace
|
|
|
|
|
dex
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bpl .1
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx GP.DEVCNT
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-20 07:04:00 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-28 15:11:27 +00:00
|
|
|
|
XDOS.FindVCBForDevNum
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda #XDOS.VCB0 look for vcb for GP.DEVNUM
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$FF
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-08-28 15:11:27 +00:00
|
|
|
|
.1 tax new index to next vcb
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.DEV,x check all devnums
|
|
|
|
|
cmp GP.DEVNUM is this the vcb?
|
2020-08-28 15:11:27 +00:00
|
|
|
|
beq .7
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs,x is this a free vcb?
|
2020-08-28 15:11:27 +00:00
|
|
|
|
bne .3 if not
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
2020-08-28 15:11:27 +00:00
|
|
|
|
bne .3 already found a free one
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stx XDOS.VCBPtr save first free VCB
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-08-28 15:11:27 +00:00
|
|
|
|
.3 txa
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc inc index to next vcb
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #VCB
|
2020-08-28 15:11:27 +00:00
|
|
|
|
bcc .1
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx XDOS.VCBPtr get found free if any
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tya any free vcb's available?
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bpl .8 yes, exit with X = XDOS.VCBPtr
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda #XDOS.VCB0 look for an entry to kick out
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-08-28 15:11:27 +00:00
|
|
|
|
.4 tax
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.OFCNT,x any open files?
|
2020-08-28 15:11:27 +00:00
|
|
|
|
beq .5 no, kick this one out.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
txa next vcb
|
|
|
|
|
clc
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #VCB
|
2020-08-28 15:11:27 +00:00
|
|
|
|
bcc .4
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-05-23 18:45:32 +00:00
|
|
|
|
lda #MLI.E.VCBFULL all vcb entries have open files
|
2020-05-13 17:00:37 +00:00
|
|
|
|
* sec
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.5 stz XDOS.VCBs,x free this entry
|
|
|
|
|
stz XDOS.VCBs+VCB.DEV,x
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.7 stx XDOS.VCBPtr save entry index.
|
2020-08-28 15:11:27 +00:00
|
|
|
|
|
|
|
|
|
.8 clc no error.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
rts
|
2019-11-20 07:04:00 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.CheckVolName
|
|
|
|
|
ldx #$00 index to directory name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy namptr index to pathname.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+4 get dir name length and type.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$E0 is it a directory?
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bcc .1 if not.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$0F isolate name length and
|
|
|
|
|
sta namcnt save as a counter.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bne .3 branch if valid length.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 sec indicate not found
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 lda XDOS.GBuf+4,x next char
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.3 cmp XDOS.PathBuf,y
|
|
|
|
|
bne .1 if not the same.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx check next char
|
|
|
|
|
iny
|
|
|
|
|
dec namcnt
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bpl .2 if more to compare.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
clc match found
|
2019-11-26 16:35:49 +00:00
|
|
|
|
XDOS.CheckVolName.RTS
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-20 07:04:00 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
XDOS.VCBMount ldx XDOS.VCBPtr previously logged in volume?
|
|
|
|
|
lda XDOS.VCBs,x (acc = 0?)
|
2020-09-17 05:43:06 +00:00
|
|
|
|
beq XDOS.VCBMountAtX no, go prepare vcb.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-09-17 05:43:06 +00:00
|
|
|
|
jsr XDOS.VCBCmpGBUF does vcb match vol read?
|
2019-11-26 16:35:49 +00:00
|
|
|
|
bcc XDOS.CheckVolName.RTS yes, do not disturb.
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2020-09-17 05:43:06 +00:00
|
|
|
|
XDOS.VCBMountAtX
|
|
|
|
|
ldy #VCB zero out vcb entry
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3AB2 stz XDOS.VCBs,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
dey
|
2020-08-28 15:11:27 +00:00
|
|
|
|
bne L3AB2
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf pointer to previous dir block
|
|
|
|
|
ora XDOS.GBuf+1 must be null
|
2020-05-13 17:00:37 +00:00
|
|
|
|
bne tsterr
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+4 test for header
|
2020-05-13 17:00:37 +00:00
|
|
|
|
and #$E0
|
|
|
|
|
cmp #$E0
|
|
|
|
|
bne tsterr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
jsr tstdupvol does a duplicate with open files
|
|
|
|
|
bcs L3B04 already exist? branch if yes.
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+4 move volume name to vcb.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$0F strip root marker
|
|
|
|
|
tay
|
|
|
|
|
pha
|
2020-08-28 15:11:27 +00:00
|
|
|
|
* clc
|
2023-11-04 14:42:28 +00:00
|
|
|
|
adc XDOS.VCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3ACE lda XDOS.GBuf+4,y
|
|
|
|
|
sta XDOS.VCBs,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
dey
|
|
|
|
|
bne L3ACE
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
pla get length again
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.VCBs,x and save.
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.DEVNUM last device used.
|
|
|
|
|
sta XDOS.VCBs+VCB.DEV,x save device # and
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda XDOS.GBuf+39,y
|
|
|
|
|
sta XDOS.VCBs+VCB.BMAP,x copy BMAP+TBLK
|
2020-07-16 14:53:35 +00:00
|
|
|
|
iny
|
|
|
|
|
inx
|
|
|
|
|
cpy #4
|
|
|
|
|
bne .1
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3B04 clc indicate logged if possible
|
2019-11-26 16:35:49 +00:00
|
|
|
|
rts
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
|
|
|
|
tsterr lda #MLI.E.NOTPRODOS not tree or dir, unrecognized type
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-11-20 07:04:00 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
XDOS.VCBCmpGBUF lda XDOS.GBuf+4 with name in directory.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$0F
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.VCBs,x are they the same length?
|
|
|
|
|
stx .1+1 xvcbptr : see rev note #23
|
2020-09-16 12:00:54 +00:00
|
|
|
|
bne .9 if not the same.
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay
|
2020-08-28 15:11:27 +00:00
|
|
|
|
clc
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 adc #$FF xvcbptr : SELF MODIFIED
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 lda XDOS.GBuf+4,y
|
|
|
|
|
cmp XDOS.VCBs,x
|
2020-09-16 12:00:54 +00:00
|
|
|
|
bne .9 if not the same.
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
dey
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bne .2
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc indicate match.
|
2020-09-16 12:00:54 +00:00
|
|
|
|
.HS B0 BCS
|
|
|
|
|
.9 sec
|
2019-11-26 16:35:49 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx .1+1 xvcbptr : offset to start of vcb (rev note #23)
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-26 16:35:49 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
tstdupvol lda #XDOS.VCB0 check for other logged in volumes with the same name.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3B2C tax
|
2020-09-17 05:43:06 +00:00
|
|
|
|
jsr XDOS.VCBCmpGBUF
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3B41 if no match.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.OFCNT,x test for any open files.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bne L3B4B cannot look at this volume.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stz XDOS.VCBs,x take duplicate offline if no open files
|
|
|
|
|
stz XDOS.VCBs+VCB.DEV,x
|
2020-05-13 17:00:37 +00:00
|
|
|
|
* clc ok to log in new volume.
|
|
|
|
|
rts
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3B41 txa index to next vcb
|
2020-05-13 17:00:37 +00:00
|
|
|
|
* sec
|
2020-07-17 15:18:31 +00:00
|
|
|
|
adc #VCB-1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L3B2C branch if more to check
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-09-16 12:00:54 +00:00
|
|
|
|
clc
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-20 07:04:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3B4B sta XDOS.VCBDupFlag duplicate has been found.
|
|
|
|
|
stx XDOS.VCBDupEnt save pointer to conflicting vcb.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec error.
|
|
|
|
|
rts
|
2019-11-26 16:35:49 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
tstfrblk ldx XDOS.VCBPtr test if enough free blocks available for request.
|
|
|
|
|
lda XDOS.VCBs+VCB.FBLK+1,x check if proper count for this volume.
|
|
|
|
|
ora XDOS.VCBs+VCB.FBLK,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3BAD branch if count is non-zero.
|
|
|
|
|
|
|
|
|
|
tkfrecnt jsr cntbms get # of bitmaps
|
|
|
|
|
sta bmcnt and save.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
stz scrtch start count at 0
|
|
|
|
|
stz scrtch+1
|
|
|
|
|
lda #$FF mark 'first free' temp as unknown
|
|
|
|
|
sta nofree
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM update volume bitmap.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3BC1 if error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
ldx XDOS.VCBPtr get address of 1st bitmap
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.BMAP,x
|
|
|
|
|
sta ZP.BLKNUM
|
|
|
|
|
lda XDOS.VCBs+VCB.BMAP+1,x
|
|
|
|
|
sta ZP.BLKNUM+1
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
L3B81 jsr XDOS.ReadGBuf use general buffer for temp space to
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3BC1 count free blocks (bits).
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr count
|
|
|
|
|
dec bmcnt was that the last bitmap?
|
|
|
|
|
bmi L3B96 if so, go change fcb so not done again.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
inc ZP.BLKNUM
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3B81
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
inc ZP.BLKNUM+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bra L3B81
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L3B96 ldx XDOS.VCBPtr mark which block had 1st free space
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda nofree
|
|
|
|
|
bmi L3BBE if no free space was found.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
sta XDOS.VCBs+VCB.BMAPIDX,x update the free count.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2019-10-19 18:35:30 +00:00
|
|
|
|
lda scrtch+1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
sta XDOS.VCBs+VCB.FBLK+1,x update volume control byte.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda scrtch
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.VCBs+VCB.FBLK,x
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L3BAD lda XDOS.VCBs+VCB.FBLK,x compare total available free blocks
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec on this volume.
|
|
|
|
|
sbc reql
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.FBLK+1,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sbc reqh
|
|
|
|
|
bcc L3BBE
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
L3BBE lda #MLI.E.VOLFULL
|
|
|
|
|
sec
|
|
|
|
|
L3BC1 rts
|
2023-11-04 14:42:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
count ldy #$00
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3BC4 lda XDOS.GBuf,y bit pattern.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3BCC don't count
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr cntfree
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3BCC lda XDOS.GBuf+$100,y do both pages with same loop
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3BD4
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr cntfree
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3BD4 iny
|
|
|
|
|
bne L3BC4 loop until all 512 bytes counted.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bit nofree has 1st block w/free space been found?
|
|
|
|
|
bpl L3BEE if yes.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda scrtch test to see if any blocks were counted
|
|
|
|
|
ora scrtch+1
|
|
|
|
|
beq L3BEE branch if none counted.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr cntbms get total # of maps.
|
|
|
|
|
sec subtract countdown from total bitmaps
|
|
|
|
|
sbc bmcnt
|
|
|
|
|
sta nofree
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3BEE rts
|
2023-11-04 14:42:28 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cntfree asl count the # of bits in this byte
|
|
|
|
|
bcc L3BFA
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc scrtch
|
|
|
|
|
bne L3BFA
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc scrtch+1
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3BFA ora #$00
|
|
|
|
|
bne cntfree loop until all bits counted
|
|
|
|
|
rts
|
2023-11-04 14:42:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
cntbms ldx XDOS.VCBPtr
|
|
|
|
|
ldy XDOS.VCBs+VCB.TBLK+1,x return the # of bitmaps
|
|
|
|
|
lda XDOS.VCBs+VCB.TBLK,x possible with the total count
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3C0B found in the vcb.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey adj for bitmap block boundary
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3C0B tya
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr divide by 16. the result is
|
|
|
|
|
lsr the # of bitmaps.
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
MAN
|
2020-05-23 18:45:32 +00:00
|
|
|
|
SAVE usr/src/prodos.fx/prodos.s.xdos.b
|
|
|
|
|
LOAD usr/src/prodos.fx/prodos.s
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ASM
|