2019-10-16 06:09:13 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.Close ldy #$01 close all ?
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2020-09-28 17:28:41 +00:00
|
|
|
|
bne XDOS.CloseOne no, just one of them.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta cferr clear global close error.
|
2020-07-18 14:04:21 +00:00
|
|
|
|
* lda #$00 start at the beginning.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.1 sta XDOS.FCBPtr save current low byte of pointer.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
tax get the level at which the file
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.FLEVEL,x was opened.
|
|
|
|
|
cmp GP.FLEVEL if file's level is < global level
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bcc .2 then don't close.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.ID,x is this reference file open ?
|
|
|
|
|
beq .2 no, try next.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr flush2 clean it out...
|
|
|
|
|
bcs L46B6 return flush errors.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr close2 update fcb & vcb
|
2020-09-28 17:28:41 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$01
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2023-11-05 15:26:06 +00:00
|
|
|
|
beq .2 no error if close all.
|
2020-09-28 17:28:41 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L46B6 close error.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.2 lda XDOS.FCBPtr inc pointer to next fcb
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #FCB
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bcc .1 branch if within same page.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda cferr on final close report logged errors.
|
|
|
|
|
beq L46B4 branch if errors.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts (carry already set).
|
2020-09-28 17:28:41 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.CloseOne jsr XDOS.FlushOne flush file 1st (including updating bitmap)
|
2020-09-28 17:28:41 +00:00
|
|
|
|
* bcs L46B6 branch if errors.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-28 17:28:41 +00:00
|
|
|
|
bcc close2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-09-28 17:28:41 +00:00
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
jsr close2
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
rts
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
close2 ldx XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.BUFID,x release file buffer
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr relbuffr
|
|
|
|
|
bcs L46B6
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
jsr XDOS.FCBDevIDSelect
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
stz XDOS.FCBs,x free fcb too
|
2020-09-17 15:29:41 +00:00
|
|
|
|
|
2020-08-28 15:11:27 +00:00
|
|
|
|
jsr XDOS.FindVCBForDevNum get vcb pointer.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
dec XDOS.VCBs+VCB.OFCNT,x indicate one less file open.
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
L46B4 clc
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L46B6 bcs L46E6 don't report close all error now.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.Flush ldy #$01 flush all ?
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bne XDOS.FlushOne no, just one of them.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta cferr clear global flush error.
|
2020-07-18 14:04:21 +00:00
|
|
|
|
* lda #$00 start at the beginning.
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L46C3 sta XDOS.FCBPtr save current low byte of pointer.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
tax index to ref #.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.FCBs,x is this reference file open ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L46D1 no, try next.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr flush2 clean it out...
|
|
|
|
|
bcs L46E6 return anty errors.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L46D1 lda XDOS.FCBPtr inc pointer to next fcb.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #FCB
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L46C3 branch if within same page
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L46D9 clc
|
|
|
|
|
lda cferr on last flush,
|
|
|
|
|
beq L46E0 branch if no logged errors.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec report error now
|
|
|
|
|
L46E0 rts
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
flush2 jsr XDOS.GetFCBBufX must set up vcb & buffer locations 1st.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L46F1 branch if no error.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L46E6 jmp glberr error so check for close or flush all.
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.FlushOne stz cferr for normal refnum flush, clear global error.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.GetFCB setup pointer to fcb user references.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L46E6 return any errors.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L46F1 lda XDOS.FCBs+FCB.ACCESS,x test to see if file is modified.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$02 is it write enabled ?
|
|
|
|
|
beq L46D9 branch if 'read only'
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.DIRTY,x has eof been modified ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bmi L4704 if yes.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
jsr XDOS.GetFCBStatus has data been modified ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$70 (was written to while it's been open?)
|
|
|
|
|
beq L46D9 if not.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L4704 jsr XDOS.GetFCBStatus
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$40 does current data buffer need to be
|
|
|
|
|
beq L4710 written ? branch if not.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.WriteDBLK if so, go write it.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L46E6 if error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
L4710 jsr XDOS.GetFCBStatus check to see if the index block (tree
|
2023-11-20 20:22:55 +00:00
|
|
|
|
* and #$80 files only) needs to be written.
|
|
|
|
|
* beq L471C branch if not.
|
|
|
|
|
|
|
|
|
|
bpl L471C
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.WriteIBLK
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L46E6 return any errors.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
L471C ldy #0
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.FCBDevIDSelect X = XDOS.FCBPtr
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4723 lda XDOS.FCBs+FCB.DEVID,x note: this code depends on the defined
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.DevID,y order of the file control block and the
|
2020-09-18 15:06:12 +00:00
|
|
|
|
inx temporary directory area in 'work space'
|
|
|
|
|
iny
|
|
|
|
|
cpy #6
|
|
|
|
|
bne L4723
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.DirHBlk read the directory header for this file
|
|
|
|
|
ldx XDOS.DE.DirHBlk+1
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
2020-08-28 06:23:27 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX read DIR into the general purpose buffer.
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L46E6 if error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.GetDH move header info.
|
|
|
|
|
lda XDOS.DE.DirEBlk get address of directory block that
|
|
|
|
|
ldx XDOS.DE.DirEBlk+1 contains the file entry.
|
|
|
|
|
cmp XDOS.DE.DirHBlk test to see if it's the same block the
|
2020-05-25 13:58:59 +00:00
|
|
|
|
bne .1 header is in. branch if not.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
cpx XDOS.DE.DirHBlk+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L4755 branch if header block = entry block
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-08-28 06:23:27 +00:00
|
|
|
|
.1 .DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.ReadGBufAXDir
|
|
|
|
|
.ELSE
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX read DIR block with file entry in general buffer.
|
2020-08-28 06:23:27 +00:00
|
|
|
|
.FIN
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4755 jsr XDOS.ZPT.SetEIB set up pointer to entry.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.ZPT.GetDE move entry to temp entry buffer in
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr 'work space'. update 'blocks used' count
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.UBLK,x
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.BlkUsed
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.UBLK+1,x
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.BlkUsed+1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
ldy #0 and move in end of file mark whether
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L476C lda XDOS.FCBs+FCB.EOF,x needed or not.
|
|
|
|
|
sta XDOS.DE.EOF,y
|
2020-09-18 15:06:12 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #$03 move all 3 bytes
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L4780
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.1stBLK,x also move in the address of the file's
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Type,y first block since it might have changed
|
2020-09-18 15:06:12 +00:00
|
|
|
|
inx since the file first opened.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L476C branch always.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4780 ldx XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.STYPE,x the last thing to update is storage
|
2023-11-20 20:22:55 +00:00
|
|
|
|
asl type (y=XDOS.FCBPtr+2). shift into high
|
2019-10-16 06:09:13 +00:00
|
|
|
|
asl nibble.
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta scrtch
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Filename get old type byte (might be the same).
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$0F strip off old type,
|
|
|
|
|
ora scrtch add in the new type
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Filename and put it away.
|
|
|
|
|
jsr XDOS.DE.Update go update directory.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs glberr error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr mark
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stz XDOS.FCBs+FCB.DIRTY,x fcb/directory as undirty.
|
2020-09-17 15:29:41 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.DevID see if bitmap should be written.
|
|
|
|
|
cmp XDOS.BM.DevID is it in same as current file ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L47B2 yes, put it on the disk if necessary.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM go put it away.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs glberr flush error
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L47B2 clc
|
|
|
|
|
rts
|
2020-09-28 17:28:41 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
* report error only if not a close all or flush all
|
2020-09-28 17:28:41 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
glberr ldy #$01
|
|
|
|
|
pha
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L47C1 not an 'all' so report now
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc
|
|
|
|
|
pla
|
|
|
|
|
sta cferr save for later
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L47C1 pla
|
|
|
|
|
rts
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-19 16:48:28 +00:00
|
|
|
|
XDOS.FCBDevIDSelect
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.DEVID,x
|
|
|
|
|
sta GP.DEVNUM
|
2020-09-19 16:48:28 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-09-18 15:06:12 +00:00
|
|
|
|
XDOS.SetFCBSType
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr and save it in fcb.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.STYPE,y
|
2020-09-18 15:06:12 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.ClrFCBStatus
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr clear allocation states for data block
|
|
|
|
|
lda XDOS.FCBs+FCB.F,y and both levels of indexes/
|
2020-09-18 15:06:12 +00:00
|
|
|
|
and #$F8
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.F,y indicates that either they exist now
|
2020-09-18 15:06:12 +00:00
|
|
|
|
rts or unnecessary for current position.
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.GetFCBStatus
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr index to fcb.
|
|
|
|
|
lda XDOS.FCBs+FCB.F,x return status byte.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2020-09-17 15:29:41 +00:00
|
|
|
|
XDOS.SetFCBStatus
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ora XDOS.FCBs+FCB.F,x
|
|
|
|
|
sta XDOS.FCBs+FCB.F,x
|
2020-09-17 15:29:41 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L47CA lda #MLI.E.LOCKED access error
|
|
|
|
|
sec
|
|
|
|
|
L47CD rts
|
|
|
|
|
*--------------------------------------
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.SetEOF jsr XDOS.GetFCB.ST can only move end of tree, sapling or seed.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$04 tree type ?
|
|
|
|
|
bcs L47CA if not then access error
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
sta stortyp may be used later.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.ACCESS,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$02 is write enabled to set new eof ?
|
|
|
|
|
beq L47CA no, access error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.TestWP hardware write protected ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L47CA yes, access error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr save old eof so it can be seen
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny whether blocks need to be released
|
|
|
|
|
iny upon contraction.
|
|
|
|
|
ldx #$02 all 3 bytes of the eof
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L47EF lda XDOS.FCBs+FCB.EOF,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta oldeof,x
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl L47EF
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$04
|
|
|
|
|
ldx #$02
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L47FD lda (ZP.A3L),y position mark to new eof
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.TmpPos,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl L47FD
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx #$02 point to 3rd byte.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4808 lda oldeof,x see if eof moved backwards so blocks
|
2023-11-26 13:17:41 +00:00
|
|
|
|
cmp XDOS.TmpPos,x can be released.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc eofset (branch if not)
|
|
|
|
|
bne purge branch if blocks to be released
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl L4808 all 3 bytes
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
eofset ldy #$04
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr place new end of file into fcb
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
inx
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L481C lda (ZP.A3L),y
|
|
|
|
|
sta XDOS.FCBs+FCB.EOF,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
dey
|
|
|
|
|
cpy #$02 all 3 bytes moved ?
|
|
|
|
|
bcs L481C no.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jmp XDOS.SetFCB.DIRTY mark fcb as dirty.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
purge jsr XDOS.FlushOne make sure file is current
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L47CD
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx ZP.DataPtr+1 pointer to index block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
inx
|
|
|
|
|
stx zpt+1 (zero page conflict with dir buf ptr)
|
2023-11-05 15:26:06 +00:00
|
|
|
|
ldx ZP.DataPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
stx zpt
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr check if eof < mark
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
ldx #$02
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4840 lda XDOS.FCBs+FCB.MARK,y
|
2023-11-26 13:17:41 +00:00
|
|
|
|
cmp XDOS.TmpPos,x compare until not equal or carry clear.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L485F branch if eof > mark.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L484E branch if eof < mark.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl L4840 compare all 3 bytes
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L484E ldy XDOS.FCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx #$00
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L4853 lda XDOS.TmpPos,x fake position, correct position will
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.MARK,y be made below...
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
inx
|
|
|
|
|
cpx #$03 move all 3 bytes
|
|
|
|
|
bne L4853
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L485F jsr XDOS.GetFreeCntVCBX force free block count before releasing
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos blocks. prepare for purge of excess...
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta dseed all blocks and bytes beyond new eof
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+1 must be zero'd
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta dsap
|
|
|
|
|
and #$01
|
|
|
|
|
sta dseed+1
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+2
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr
|
|
|
|
|
sta dtree
|
|
|
|
|
ror dsap pass position in terms of block & bytes.
|
|
|
|
|
lda dseed now adjust for boundaries of $200
|
|
|
|
|
ora dseed+1
|
|
|
|
|
bne L48A2 branch if no adjustment necessary.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-07-16 06:18:17 +00:00
|
|
|
|
lda dsap get correct block positions for sap
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec and tree levels.
|
|
|
|
|
sbc #$01
|
|
|
|
|
sta dsap deallocate for last (phantom) block
|
2020-07-18 14:04:21 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$02 and don't modify last data block.
|
|
|
|
|
bcs L489F branch if tree level unaffected.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec dtree
|
|
|
|
|
bpl L489F branch if new eof not zero
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$00
|
|
|
|
|
sta dtree otherwise, make a null seed out of it.
|
|
|
|
|
sta dsap
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L489F sta dseed+1
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L48A2 ldy XDOS.FCBPtr also must pass file's 1st block address.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.1stBLK,y
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.1stBLK
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.1stBLK+1,y
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.1stBLK+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
stz deblock lastly, initialize # of blocks to
|
|
|
|
|
stz deblock+1 be free'd.
|
|
|
|
|
jsr detree deallocate blocks from tree.
|
|
|
|
|
php save any error status until fcb
|
|
|
|
|
pha is cleaned up.
|
2020-09-17 15:29:41 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr
|
2023-11-05 15:26:06 +00:00
|
|
|
|
ldx #$ff
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
L48C2 inx
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.1stBLK,x
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.1stBLK,y move in possible new first file block
|
|
|
|
|
lda XDOS.FCBs+FCB.UBLK,y address. adjust usage count also
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sbc deblock,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.UBLK,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
txa
|
2023-11-05 15:26:06 +00:00
|
|
|
|
beq L48C2 without disturbing carry.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda stortyp get possibly modified storage type
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.SetFCBSType
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.ClrFCBStatus make it look as though position has
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.SetVCB.FBLK nothing allocated, update total blocks
|
|
|
|
|
ldy XDOS.FCBPtr in fcb and correct position.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
iny
|
2020-07-17 15:18:31 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
ldx #2
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L48F2 lda XDOS.FCBs+FCB.MARK,y tell 'rdposn' to go to correct
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.TmpPos,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
eor #$80 position from incorrect place.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.MARK,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl L48F2
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr rdposn go to correct position.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L490D if no error.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
|
|
|
|
|
plx discard latest error code to stack
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
plp
|
|
|
|
|
sec
|
|
|
|
|
php
|
2023-11-05 15:26:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
pha save new error.
|
|
|
|
|
|
|
|
|
|
* mark file as in need of a flush and update fcb with new end of file,
|
|
|
|
|
* then flush it.
|
|
|
|
|
|
|
|
|
|
L490D jsr eofset go mark and update
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.FlushOne then go do the flush.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L491C branch if no error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
plx clean previous error off stack
|
|
|
|
|
plx and previous P
|
|
|
|
|
rts
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L491C pla report any errors that may have
|
|
|
|
|
plp appeared.
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.GetEOF ldx XDOS.FCBPtr index to end of file mark
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
ldy #$02 and index to user's call parameters
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4924 lda XDOS.FCBs+FCB.EOF,x
|
|
|
|
|
sta (ZP.A3L),y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
iny
|
|
|
|
|
cpy #$05
|
|
|
|
|
bne L4924 loop until all 3 bytes moved
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc no errors
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.NewLine ldy #$02 adjust newline status for open file.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda (ZP.A3L),y on or off ?
|
|
|
|
|
ldx XDOS.FCBPtr it will be 0 if off.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.NLMASK,x set new line mask
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda (ZP.A3L),y and move in 'new-line' byte
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.NLBYTE,x
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc no error possible
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.GetFileInfo
|
2020-07-18 14:04:21 +00:00
|
|
|
|
jsr XDOS.FindFile look for file.
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bcc .1 no error.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr XDOS.GetFileInfoVol
|
|
|
|
|
bcs .9
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.1 lda XDOS.DE.Filename transfer bytes from internal order to
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lsr call spec via XDOS.DE2FINFO translation
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr table but first change storage type to
|
|
|
|
|
lsr external (low nibble) format.
|
|
|
|
|
lsr
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Filename
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$11 index to last of user's spec table.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
.2 lda XDOS.DE2FINFO-3,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$7F strip bit used by setinfo
|
|
|
|
|
tax
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Filename,x move directory info to call spec. table
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta (ZP.A3L),y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
cpy #$03
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bcs .2 if all info bytes moved, retn carry clr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
* clc
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-17 06:04:08 +00:00
|
|
|
|
XDOS.SetFileInfo
|
2020-07-18 14:04:21 +00:00
|
|
|
|
jsr XDOS.FindFile get the file to work on.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bcs .3 if error.
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.BUBIT see if backup bit can be cleared
|
2020-07-17 06:04:08 +00:00
|
|
|
|
eor #$20
|
2023-11-20 20:22:55 +00:00
|
|
|
|
and XDOS.DE.Access
|
2020-07-17 06:04:08 +00:00
|
|
|
|
and #$20
|
|
|
|
|
sta bkbitflg or preserve current...
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-07-17 06:04:08 +00:00
|
|
|
|
ldy #$0D init pointer to user supplied list.
|
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
.1 ldx XDOS.DE2FINFO-3,y get index to corresponding 'd.' table.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bmi .2 branch if parameter can't be set.
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Filename,x
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
.2 dey has user's request been satisfied ?
|
2020-07-17 06:04:08 +00:00
|
|
|
|
cpy #$03
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bcs .1 no, move next byte.
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
|
|
|
|
and #$18 make sure no illegal access bits were
|
2023-11-05 15:26:06 +00:00
|
|
|
|
beq .4 set !! branch if legal access.
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.LOCKED otherwise, access error.
|
|
|
|
|
sec
|
2023-11-05 15:26:06 +00:00
|
|
|
|
.3 rts
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
.4 ldy #$0B
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda (ZP.A3L),y was clock null input ?
|
2020-07-17 15:18:31 +00:00
|
|
|
|
bne XDOS.SetFileInfoEx.8
|
2020-07-17 06:04:08 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jmp XDOS.DE.Update update with clock also...
|
2020-07-17 06:04:08 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-23 15:24:55 +00:00
|
|
|
|
XDOS.SetFileInfoEx
|
2020-07-18 14:04:21 +00:00
|
|
|
|
jsr XDOS.FindFile
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bcs XDOS.GetFileInfoEx.RTS
|
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
ldx #S.FIEX.BLKPTR+2-1
|
|
|
|
|
ldy #S.FIEX.BLKPTR+2-1+3
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 lda (ZP.A3L),y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Filename,x
|
2020-05-28 21:13:52 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.SetFileInfoEx.8
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jmp XDOS.DE.UpdateNoMTime
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-17 06:04:08 +00:00
|
|
|
|
XDOS.GetFileInfoEx
|
2021-04-08 20:30:18 +00:00
|
|
|
|
jsr XDOS.FindFile
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
jsr XDOS.GetFileInfoVol
|
2020-07-18 14:04:21 +00:00
|
|
|
|
bcs .9
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
.1 ldx #S.FIEX.BLKPTR+2-1
|
2020-07-17 06:04:08 +00:00
|
|
|
|
ldy #S.FIEX.BLKPTR+2-1+3
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.2 lda XDOS.DE.Filename,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta (ZP.A3L),y
|
2020-07-17 06:04:08 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-07-17 06:04:08 +00:00
|
|
|
|
ldx #7
|
|
|
|
|
ldy #S.FIEX.ACL+7+3
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.DO ACL=1
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.3 lda XDOS.DH.ACL,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta (ZP.A3L),y
|
2020-07-17 06:04:08 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.ELSE
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
.3 sta (ZP.A3L),y
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
.FIN
|
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
* clc
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.9
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.GetFileInfoEx.RTS
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.GetFileInfoVol
|
|
|
|
|
cmp #MLI.E.INVPATH was it a root directory file ?
|
|
|
|
|
sec (in case of no match)
|
|
|
|
|
bne .9 if not, then error.
|
|
|
|
|
|
|
|
|
|
lda #$F0
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.Filename for get info, report proper storage type
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
stz reql force a count of free blocks.
|
|
|
|
|
stz reqh
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx XDOS.VCBPtr
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.GetFreeCntVCBX get a fresh count of free blocks on
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.VCBPtr this volume.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.FBLK+1,x return total blocks and total in use.
|
2021-04-08 20:30:18 +00:00
|
|
|
|
sta reqh 1st transfer 'free' blocks to zpage
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.FBLK,x for later subtraction to determine
|
2021-04-08 20:30:18 +00:00
|
|
|
|
sta reql the 'used' count.
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.TBLK+1,x transfer to 'd.' table as aux id
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.AuxType+1 (total block count is considered aux id
|
2021-04-08 20:30:18 +00:00
|
|
|
|
pha for the volume)
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.TBLK,x
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.AuxType
|
2021-04-08 20:30:18 +00:00
|
|
|
|
sec subtract and report the number of
|
|
|
|
|
sbc reql blocks 'in use'
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.BlkUsed
|
2021-04-08 20:30:18 +00:00
|
|
|
|
pla
|
|
|
|
|
sbc reqh
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.DE.BlkUsed+1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
|
2020-07-17 06:04:08 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2020-07-18 14:04:21 +00:00
|
|
|
|
XDOS.ACL jsr XDOS.FindDirOrVol
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.ReadGBufDEKeyPtr
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
ldx #7
|
2020-07-18 14:04:21 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.FIEX.ACL+3
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda (ZP.A3L),y
|
2020-07-18 14:04:21 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
ldy #S.FIEX.ACL+7+3
|
2020-07-18 14:04:21 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda (ZP.A3L),y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.GBuf+20,x
|
2020-05-28 21:13:52 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
2020-07-18 14:04:21 +00:00
|
|
|
|
bpl .1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jmp XDOS.WriteGBufDir
|
|
|
|
|
.ELSE
|
2020-07-16 14:53:35 +00:00
|
|
|
|
jmp XDOS.WriteGBuf
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
2020-07-18 14:04:21 +00:00
|
|
|
|
|
|
|
|
|
.2 ldy #S.FIEX.ACL+7+3
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.3 lda XDOS.GBuf+20,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta (ZP.A3L),y
|
2020-07-18 14:04:21 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
* clc
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.9 rts
|
2020-07-10 13:59:56 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
XDOS.Rename jsr XDOS.CheckPath look for source (original) file.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
bcc XDOS.RenameFileDir if found.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$40 trying to rename a volume ?
|
|
|
|
|
bne L49FD no, return error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
XDOS.RenameVol jsr XDOS.GetRenPath syntax new name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L49FD rename error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.PathBuf find out if only rootname for new name
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y must be $FF if volume name only.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L4A72 if not single name
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.VCBPtr check for open files before changing.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.OFCNT,x
|
2020-05-23 18:45:32 +00:00
|
|
|
|
beq L49FF if volume not busy.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
lda #MLI.E.OPEN file busy error.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L49FD sec
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-05-23 18:45:32 +00:00
|
|
|
|
L49FF ldy #0 get newname's length
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.PathBuf,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ora #$F0 (root file storage type)
|
2019-12-13 07:09:00 +00:00
|
|
|
|
jsr XDOS.UpdateHdr update root directory.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bcs .9 rename error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$00
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.VCBPtr update vcb also.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.3 lda XDOS.PathBuf,y move new name to vcb.
|
2020-05-25 13:58:59 +00:00
|
|
|
|
beq .8
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.VCBs,x
|
2020-05-25 13:58:59 +00:00
|
|
|
|
iny next character
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bra .3
|
2020-05-25 13:58:59 +00:00
|
|
|
|
.8
|
2020-05-23 18:45:32 +00:00
|
|
|
|
* clc no errors
|
|
|
|
|
.9 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-11-11 14:21:06 +00:00
|
|
|
|
XDOS.RenameFileDir
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.GetNamPtr set y = 1st char of path, x = 0.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4A21 lda XDOS.PathBuf,y move original name to XDOS.GBuf
|
|
|
|
|
sta XDOS.GBuf,x for later comparison to new name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bmi L4A2D if last character has been moved
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny otherwise, get the next one.
|
|
|
|
|
inx
|
2019-11-11 14:21:06 +00:00
|
|
|
|
bra L4A21
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
L4A2D jsr XDOS.GetRenPath get new name syntaxed.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74 rename error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.GetNamPtr set y = path, x = 0.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y now compare new name with old name
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4A38 cmp XDOS.GBuf,x to make sure they are in the same dir.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
php save result of comparison.
|
|
|
|
|
and #$F0 was last char really a count ?
|
|
|
|
|
bne L4A46 if not.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sty rnptr save pointer to next name, it might
|
|
|
|
|
stx namptr be the last.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4A46 plp result of last comparison ?
|
|
|
|
|
bne L4A52 branch if different character or count.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx bump pointers.
|
|
|
|
|
iny
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y was it the last character ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L4A38 if not.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc no operation, names were the same.
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4A52 ldy rnptr index to last name in the chain.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y get last name length.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
adc rnptr
|
|
|
|
|
tay
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y this byte should be $00 !
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L4A72 if not, bad path error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx namptr index to last of original name
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
adc namptr
|
|
|
|
|
tax
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.GBuf,x this byte should also be $00.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L4A76 if so, continue processing.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
|
|
|
|
L4A72 lda #MLI.E.INVPATH bad pathname error.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L4A7F lda #MLI.E.DUPFILE
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4A74 sec
|
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
L4A76 jsr XDOS.CheckPath test for duplicate file name.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bcc L4A7F duplicate name error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
cmp #MLI.E.FNOTFND was it a valid file not found ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L4A74 no, rename error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
jsr XDOS.GetPath syntax pathname of file to be changed.
|
2020-07-18 14:04:21 +00:00
|
|
|
|
jsr XDOS.FindFile get all the info on this file.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74 rename error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.IsOpened is file in use ?
|
2019-11-10 18:28:06 +00:00
|
|
|
|
lda #MLI.E.OPEN anticipate file busy error.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74 error if in use.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Access test bit which allows rename.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$40
|
|
|
|
|
bne L4A9D branch if ok to rename
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.LOCKED otherwise, illegal access.
|
2019-11-11 14:21:06 +00:00
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
L4A98 lda #MLI.E.INCFF
|
2023-11-05 15:26:06 +00:00
|
|
|
|
sec
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4A9D lda XDOS.DE.Filename find out which storage type.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$F0 strip off name length.
|
|
|
|
|
cmp #$D0 is it a directory ?
|
|
|
|
|
beq L4AAE then ok.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$40 is it a seed, sapling or tree ?
|
2019-11-11 14:21:06 +00:00
|
|
|
|
bcs L4A98 file incompatible error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-11-11 14:21:06 +00:00
|
|
|
|
L4AAE jsr XDOS.GetRenPath since both names go into the directory,
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74 syntax the new name to get the local
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy rnptr name address. y = index to local name
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.PathBuf,y length. adj y to last char of new name.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tya
|
2023-11-04 14:42:28 +00:00
|
|
|
|
adc XDOS.PathBuf,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4ABE lda XDOS.PathBuf,y move local name to dir entry workspace.
|
|
|
|
|
sta XDOS.DE.Filename,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne L4ABE
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Filename preserve file storage type.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$F0 strip off old name length.
|
|
|
|
|
tax
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ora XDOS.PathBuf,y add in new name's length.
|
|
|
|
|
sta XDOS.DE.Filename
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cpx #$D0 that file must be changed also.
|
|
|
|
|
bne L4AF0 branch if not directory type.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.ReadGBufDEKeyPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74 errors.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy rnptr change the header's name to match the
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.PathBuf,y owner's new name. get local name length.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ora #$E0 assume it's a header.
|
2019-12-13 07:09:00 +00:00
|
|
|
|
jsr XDOS.UpdateHdr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4A74
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4AF0 jmp XDOS.DE.UpdateNoMTime end by updating all path directories.
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.GetNamPtr ldy #$00 return pointer to 1st name of path.
|
|
|
|
|
bit prfxflg is this a prefixed name ?
|
|
|
|
|
bmi .1 branch if not.
|
|
|
|
|
|
|
|
|
|
ldy GP.NEWPFXPTR
|
|
|
|
|
|
|
|
|
|
.1 ldx #$00
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.UpdateHdr ldx #$00
|
|
|
|
|
|
|
|
|
|
.1 sta XDOS.GBuf+4,x
|
|
|
|
|
inx
|
|
|
|
|
iny
|
|
|
|
|
lda XDOS.PathBuf,y
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jmp XDOS.WriteGBufDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jmp XDOS.WriteGBuf write changed header block.
|
|
|
|
|
.FIN
|
2019-11-11 14:21:06 +00:00
|
|
|
|
*--------------------------------------
|
2023-07-10 04:57:04 +00:00
|
|
|
|
XDOS.Destroy jsr XDOS.FindFile look for file to be destroyed.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bcs L4B67 if error.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.IsOpened is it open ?
|
2023-07-10 04:57:04 +00:00
|
|
|
|
lda totent
|
|
|
|
|
bne L4B64 error if open.
|
|
|
|
|
|
|
|
|
|
stz reql force proper free count in volume.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
stz reqh (no disk access occurs if already proper)
|
|
|
|
|
jsr XDOS.CheckFree
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bcc L4B39 no errors.
|
|
|
|
|
|
|
|
|
|
cmp #MLI.E.VOLFULL was error a full disk ?
|
|
|
|
|
bne L4B66 no, report error.
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4B39 lda XDOS.DE.Access make sure ok to destroy file.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
* and #$80
|
|
|
|
|
* bne L4B45
|
|
|
|
|
bmi L4B45
|
|
|
|
|
|
|
|
|
|
lda #MLI.E.LOCKED access error
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr GP.SYSERR
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
L4B45 lda GP.DEVNUM last device used.
|
|
|
|
|
jsr XDOS.TestWPA test for write protected hardware
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bcs L4B67 before going thru deallocation.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.KeyPtr 'detree' needs first block address
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.1stBLK
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.KeyPtr+1
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sta XDOS.1stBLK+1
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Filename find out which storage type.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
and #$F0 strip off name length.
|
|
|
|
|
cmp #$40 is it a seed, sapling or tree ?
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bcc XDOS.DestroyFile branch if it is.
|
|
|
|
|
bra XDOS.DestroyDir otherwise, test for directory destroy.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
L4B64 lda #MLI.E.OPEN file busy error.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
|
2023-07-10 04:57:04 +00:00
|
|
|
|
L4B66 sec can't be destroyed
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4B67 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.DestroyFile
|
|
|
|
|
sta stortyp destroy a tree file. save storage type.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
ldx #$05
|
|
|
|
|
|
|
|
|
|
* lda #$00 set 'detree' input variables, must be
|
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
.1 stz stortyp,x in order: deblock, dtree, dsap, dseed.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
dex
|
2023-11-26 13:17:41 +00:00
|
|
|
|
bne .1 loop until all zero'd.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
lda #$02 this avoids an extra file i/o and pre-
|
|
|
|
|
sta dseed+1 vents destruction of any deleted data.
|
|
|
|
|
inc delflag don't allow detree to zero index blocks.
|
|
|
|
|
jsr detree make trees and saplings into seeds.
|
|
|
|
|
dec delflag reset flag.
|
|
|
|
|
bcs L4B93 (de-evolution)
|
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L4B85 lda XDOS.1stBLK now deallocate seed.
|
|
|
|
|
ldx XDOS.1stBLK+1
|
2023-07-10 04:57:04 +00:00
|
|
|
|
jsr XDOS.DeallocAX
|
|
|
|
|
bcs L4B93
|
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
L4B93 pha save possible error code.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
stz XDOS.DE.Filename update directory to free entry space.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.DH.DecFileCnt mark header with one less file.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.SetVCB.FBLK go update block count in vcb (ignore
|
|
|
|
|
jsr XDOS.DE.Update error, if any) and update dir last.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
tax save possible new error code,
|
|
|
|
|
pla restore possible old error code.
|
|
|
|
|
bcc L4BAF branch if last call succeeded.
|
|
|
|
|
txa last call failed, use it's error code.
|
|
|
|
|
|
|
|
|
|
L4BAF cmp #$01 adjust carry accordingly
|
|
|
|
|
rts
|
2023-11-20 20:22:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-07-10 04:57:04 +00:00
|
|
|
|
L4BCD bcc L4B85 branch widened (always taken)
|
2023-11-26 13:17:41 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.DestroyDir cmp #$D0 is this a directory file ?
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bne L4C1B no, file incompatible.
|
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.GetBM make sure a buffer available for bitmap
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bcs L4C1A if error.
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
jsr XDOS.ReadGBufDEKeyPtr read 1st block of directory into XDOS.GBuf
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bcs L4C1A
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.GBuf+37 do any files exist in this directory ?
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ora XDOS.GBuf+38
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bne L4C1Abis if so, access error.
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4BF6 sta XDOS.GBuf+4 make it an invalid subdirectory
|
2023-07-10 04:57:04 +00:00
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
jsr XDOS.WriteGBufDir
|
|
|
|
|
.ELSE
|
|
|
|
|
jsr XDOS.WriteGBuf
|
|
|
|
|
.FIN
|
|
|
|
|
bcs L4C1A
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L4BFE lda XDOS.GBuf+2 get forward link.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
cmp #$01 test for null block into carry.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.GBuf+3 get the rest of the block address.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
bne L4C0A branch if not null.
|
|
|
|
|
bcc L4BCD was the low part null as well ?
|
|
|
|
|
|
|
|
|
|
L4C0A jsr XDOS.DeallocAX free this block.
|
|
|
|
|
bcs L4C1A
|
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.GBuf+2
|
|
|
|
|
ldx XDOS.GBuf+3
|
2023-07-10 04:57:04 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX read next DIR block (no need to unpack)
|
|
|
|
|
bcc L4BFE loop until all freed
|
|
|
|
|
|
|
|
|
|
L4C1A rts
|
|
|
|
|
|
|
|
|
|
L4C1Abis lda #MLI.E.LOCKED access error.
|
|
|
|
|
.HS 2C BIT ABS
|
|
|
|
|
L4C1B lda #MLI.E.INCFF file incompatible
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr GP.SYSERR
|
2023-11-20 20:22:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.SetFCB.DIRTY
|
|
|
|
|
pha mark fcb as dirty so the directory will be flushed on 'flush'.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
phy save regs.
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
lda #$80 mark fcb as dirty.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.DIRTY,y save it back
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
ply and restore regs.
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.SetVCB.FBLK
|
|
|
|
|
ldx XDOS.VCBPtr update block free count in vcb. point to vcb of correct device.
|
|
|
|
|
lda deblock get # of blocks recently freed.
|
|
|
|
|
adc XDOS.VCBs+VCB.FBLK,x
|
|
|
|
|
sta XDOS.VCBs+VCB.FBLK,x update current free block count.
|
|
|
|
|
lda deblock+1
|
|
|
|
|
adc XDOS.VCBs+VCB.FBLK+1,x
|
|
|
|
|
sta XDOS.VCBs+VCB.FBLK+1,x
|
2019-11-11 14:21:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
stz XDOS.VCBs+VCB.BMAPIDX,x force re-scan from 1st bitmap
|
2023-11-04 14:42:28 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
* lda #0 ?????
|
2023-11-04 14:42:28 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-11 14:21: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.e
|
|
|
|
|
LOAD usr/src/prodos.fx/prodos.s
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ASM
|