2019-10-16 06:09:13 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2020-08-28 10:47:41 +00:00
|
|
|
|
XDOS.DeallocAX stx bmcnt high address of block.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
* pha save low address.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx XDOS.VCBPtr check that bitmap block address is
|
|
|
|
|
ldy XDOS.VCBs+VCB.TBLK+1,x valid given the total # of blocks
|
2023-07-10 04:57:04 +00:00
|
|
|
|
cpy bmcnt on the volume.
|
|
|
|
|
* pla
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L3C8C branch if invalid
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax
|
|
|
|
|
and #$07 bit to be or'd in
|
|
|
|
|
tay
|
|
|
|
|
lda whichbit,y (shifting takes 7 bytes, but is slower)
|
|
|
|
|
sta nofree save bit pattern.
|
|
|
|
|
txa low block address.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.1 lsr bmcnt
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ror
|
2023-07-10 04:57:04 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-07-10 04:57:04 +00:00
|
|
|
|
* lsr bmcnt
|
|
|
|
|
* ror
|
|
|
|
|
* lsr bmcnt
|
|
|
|
|
* ror
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta bmptr save pointer.
|
|
|
|
|
lsr bmcnt transfer bit which is page of bitmap
|
|
|
|
|
rol half
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.GetBM make sure device is correct one.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3C8B error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.BM.Idx current map.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp bmcnt is in-core bitmap the correct one ?
|
|
|
|
|
beq L3C64 branch if yes.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM put current map away.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3C8B error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda bmcnt get map #
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx XDOS.VCBPtr
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.VCBs+VCB.BMAPIDX,x and make it current.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.BM.DevID
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.ReadBMDevA read it into buffer
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3C8B
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3C64 ldy bmptr index to byte
|
|
|
|
|
lsr half
|
|
|
|
|
lda nofree (get indiviual bit)
|
|
|
|
|
bcc bmbufhi branch if on page 1 of bitmap
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ora XDOS.BMBuf+$100,y
|
|
|
|
|
sta XDOS.BMBuf+$100,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3C7D always.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
bmbufhi ora XDOS.BMBuf,y this address + 2 is used as an absolute reference to XDOS.BMBuf high byte.
|
|
|
|
|
sta XDOS.BMBuf,y
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L3C7D sec mark bitmap as modified
|
|
|
|
|
ror XDOS.BM.Status
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc deblock inc count of blocks deallocated
|
|
|
|
|
bne L3C8A
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc deblock+1
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3C8A clc
|
|
|
|
|
L3C8B rts
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2020-05-25 13:58:59 +00:00
|
|
|
|
L3C8C lda #MLI.E.BADFS bitmap block # impossible.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec bitmap disk address wrong
|
|
|
|
|
rts (maybe data masquerading as indx block)
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.GetFreeBlk jsr XDOS.GetBM get address of bitmap.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3CB8 error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3C95 ldy #$00 begin search at start of bitmap block.
|
|
|
|
|
sty half which half (page) to search
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3C9A lda XDOS.BMBuf,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3CB9 free blocks indicated by 'on' bits
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
bne L3C9A check all in 1st page.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc half now search page 2.
|
|
|
|
|
inc basval base value = base address / 2048.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L3CA8 lda XDOS.BMBuf+$100,y search 2nd half for free block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3CB9
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
bne L3CA8
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc basval add 2048 offset for next page.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.NextBM get next bitmap (if exists) and
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L3C95 update vcb. branch if no error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3CB8 rts return error.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3CB9 sty bmptr save index pointer to valid bit group.
|
|
|
|
|
lda basval prep for block address calculation
|
|
|
|
|
sta scrtch+1
|
|
|
|
|
tya address of bit pattern.
|
2023-07-10 04:57:04 +00:00
|
|
|
|
|
|
|
|
|
ldx #3
|
|
|
|
|
|
|
|
|
|
.1 asl multiply this and basval by 8
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rol scrtch+1
|
2023-07-10 04:57:04 +00:00
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax low address within 7 of actual address
|
|
|
|
|
sec
|
|
|
|
|
lda half
|
|
|
|
|
beq L3CDB branch if allocating from 1st half.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.BMBuf+$100,y get pattern from 2nd page.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3CDE always.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3CDB lda XDOS.BMBuf,y get bit pattern from 1st page.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3CDE rol find left most 'on' bit
|
|
|
|
|
bcs L3CE4 if found.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx adjust low address.
|
|
|
|
|
bne L3CDE always.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3CE4 lsr restore pos'n of all but left most bit.
|
|
|
|
|
bcc L3CE4 loop until mark moves into carry.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
stx scrtch save low address.
|
|
|
|
|
ldx half which half of bitmap ?
|
|
|
|
|
bne L3CF4 if page 2.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.BMBuf,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3CF7 always.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3CF4 sta XDOS.BMBuf+$100,y update to show allocated block in use.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L3CF7 sec indicate map is modified.
|
|
|
|
|
ror XDOS.BM.Status
|
2020-05-23 18:45:32 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldx XDOS.VCBPtr subtract 1 from total free vcb blocks
|
|
|
|
|
lda XDOS.VCBs+VCB.FBLK,x to account for newly allocated block.
|
2020-05-23 18:45:32 +00:00
|
|
|
|
bne .7
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
dec XDOS.VCBs+VCB.FBLK+1,x
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.7 dec XDOS.VCBs+VCB.FBLK,x
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda scrtch return address in y,a of newly
|
|
|
|
|
ldy scrtch+1 allocated block.
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-05-23 18:45:32 +00:00
|
|
|
|
clc no errors.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.NextBM ldx XDOS.VCBPtr inc to next bitmap, but 1st make sure there is another one.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.TBLK+1,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.VCBs+VCB.BMAPIDX,x are there more maps ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3D60 if no more to look at.
|
2020-05-13 17:00:37 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
inc XDOS.VCBs+VCB.BMAPIDX,x add 1 to current map
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.GetBM ldy XDOS.VCBPtr
|
|
|
|
|
lda XDOS.VCBs+VCB.DEV,y get device #.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
cmp XDOS.BM.DevID does this map match this device ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3D4A yes.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
jsr XDOS.FlushBM otherwise, save other volume's bitmap
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3D5F
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
ldy XDOS.VCBPtr
|
|
|
|
|
lda XDOS.VCBs+VCB.DEV,y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.BM.DevID and read in fresh bitmap for this dev.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L3D4A bit XDOS.BM.Status is it already modified ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bmi L3D54 yes, return pointer
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.ReadBMDevA otherwise read in fresh bitmap.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3D5F if error.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
L3D54 ldy XDOS.VCBPtr get relative block # of bitmap.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.BMAPIDX,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
asl 2 pages per block
|
|
|
|
|
sta basval
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc no errors.
|
|
|
|
|
L3D5F rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
|
|
|
|
L3D60 lda #MLI.E.VOLFULL request can't be filled
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec error
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.FlushBM clc
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bit XDOS.BM.Status is current map modified ?
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bpl .9 no.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.WriteBM update device.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bcs .9 if error on writing.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
stz XDOS.BM.Status mark bitmap buffer as free
|
2020-05-13 17:00:37 +00:00
|
|
|
|
lda #0 MUST EXIT WITH A=0
|
2020-09-19 16:48:28 +00:00
|
|
|
|
.9 rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.ReadBMDevA sta XDOS.BM.DevID read bitmap specified by dev and vcb.
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
ldy XDOS.VCBPtr get lowest map # with free blocks in it
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.BMAPIDX,y
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.BM.Idx associate offset with bitmap ctrl block.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc add this # to the base address of
|
2023-11-12 13:20:15 +00:00
|
|
|
|
adc XDOS.VCBs+VCB.BMAP,y 1st bitmap and save in bmadadr which
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.BM.BlkNum is address of bitmap to be used.
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.VCBs+VCB.BMAP+1,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
adc #$00
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sta XDOS.BM.BlkNum+1
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$01 read device command
|
2020-05-25 13:58:59 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.WriteBM lda #$02 write command.
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.CMDNUM
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
lda GP.DEVNUM save current dev #
|
2019-10-16 06:09:13 +00:00
|
|
|
|
pha
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.BM.DevID get bitmap's dev #
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta GP.DEVNUM
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.BM.BlkNum and disk address
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.BM.BlkNum+1
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM+1
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda /XDOS.BMBuf
|
2020-05-25 13:58:59 +00:00
|
|
|
|
* lda bmbufhi+2 address of the buffer (low = 0)
|
|
|
|
|
jsr XDOS.RWBlock
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
plx keep A=error code if CS
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stx GP.DEVNUM
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
rts
|
2020-08-27 15:34:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
XDOS.WriteGBufDir
|
|
|
|
|
jsr XDOS.PackGBuf
|
|
|
|
|
bra XDOS.WriteGBuf
|
|
|
|
|
.FIN
|
2020-05-25 13:58:59 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.ReadGBufDEKeyPtr
|
|
|
|
|
lda XDOS.DE.KeyPtr read 1st block of directory into XDOS.GBuf
|
|
|
|
|
ldx XDOS.DE.KeyPtr+1
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.DO LOWERCASE=1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.ReadGBufAXDir
|
2020-08-27 15:34:55 +00:00
|
|
|
|
jsr XDOS.ReadGBufAX
|
|
|
|
|
bcc XDOS.UnpackGBuf
|
|
|
|
|
rts
|
|
|
|
|
.FIN
|
2023-11-04 14:42:28 +00:00
|
|
|
|
XDOS.ReadGBufAX sta ZP.BLKNUM
|
|
|
|
|
stx ZP.BLKNUM+1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-05-25 13:58:59 +00:00
|
|
|
|
XDOS.ReadGBuf lda #$01 read command.
|
2019-12-13 07:09:00 +00:00
|
|
|
|
.HS 2C BIT ABS
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-05-25 13:58:59 +00:00
|
|
|
|
XDOS.WriteGBuf lda #$02 write command
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
sta ZP.CMDNUM pass to device handler.
|
|
|
|
|
lda /XDOS.GBuf general buffer.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
XDOS.RWBlock sta ZP.BUFPTR+1 buffer high.
|
|
|
|
|
stz ZP.BUFPTR buffer low (always on page boundary)
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jmp XDOS.FileIO2
|
2020-08-27 15:34:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO LOWERCASE=1
|
|
|
|
|
|
2021-02-20 10:18:02 +00:00
|
|
|
|
XDOS.CheckAndUnpackGBuf
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.GBuf+35
|
|
|
|
|
sta XDOS.DH.EL
|
|
|
|
|
ldy XDOS.GBuf+36
|
|
|
|
|
sty XDOS.DH.EPB
|
2021-02-20 10:18:02 +00:00
|
|
|
|
cmp #$27
|
|
|
|
|
bne .9
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2021-02-20 10:18:02 +00:00
|
|
|
|
cpy #$0D
|
|
|
|
|
beq XDOS.UnpackGBuf
|
|
|
|
|
|
|
|
|
|
.9 lda #MLI.E.NOTPRODOS
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
XDOS.UnpackGBuf jsr XDOS.ZPT.InitGBuf
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.DH.EPB
|
2022-04-27 19:24:41 +00:00
|
|
|
|
|
2023-07-10 04:57:04 +00:00
|
|
|
|
.1 jsr XDOS.ZPT.Unpack
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-07-10 04:57:04 +00:00
|
|
|
|
dex
|
2023-06-15 06:17:56 +00:00
|
|
|
|
beq .8
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
jsr XDOS.ZPT.Next
|
|
|
|
|
bra .1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.8 clc make sure CC
|
2020-08-27 15:34:55 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-09-20 18:35:54 +00:00
|
|
|
|
*XDOS.PackGBuf.Bitmap .BS 2
|
|
|
|
|
XDOS.PackGBuf.Bitmap .EQ sos
|
|
|
|
|
*--------------------------------------
|
2023-06-15 06:17:56 +00:00
|
|
|
|
XDOS.PackGBuf jsr XDOS.ZPT.InitGBuf
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.DH.EPB
|
2020-08-28 06:23:27 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.1 lda (zpt)
|
|
|
|
|
and #$0F
|
|
|
|
|
beq .6
|
|
|
|
|
|
|
|
|
|
stz XDOS.PackGBuf.Bitmap
|
|
|
|
|
stz XDOS.PackGBuf.Bitmap+1
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
.2 lda (zpt),y
|
|
|
|
|
|
2020-08-28 06:23:27 +00:00
|
|
|
|
cmp #'a'
|
2020-08-27 15:34:55 +00:00
|
|
|
|
bcc .5
|
|
|
|
|
|
2020-08-28 06:23:27 +00:00
|
|
|
|
cmp #'z'+1
|
2020-08-27 15:34:55 +00:00
|
|
|
|
bcs .5
|
|
|
|
|
|
|
|
|
|
eor #$20 to uppercase
|
|
|
|
|
sta (zpt),y
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
cpy #8 CS if MIN_VERSION to use
|
|
|
|
|
bcs .3
|
|
|
|
|
|
|
|
|
|
lda whichbit,y
|
2020-08-28 06:23:27 +00:00
|
|
|
|
tsb XDOS.PackGBuf.Bitmap+1
|
2020-08-27 15:34:55 +00:00
|
|
|
|
bra .4
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.3 lda whichbit-8,y
|
2020-08-28 06:23:27 +00:00
|
|
|
|
tsb XDOS.PackGBuf.Bitmap
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.4 lda #$80
|
|
|
|
|
tsb XDOS.PackGBuf.Bitmap+1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.5 dey
|
|
|
|
|
bne .2
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
ldy #$1C VERSION
|
|
|
|
|
lda XDOS.PackGBuf.Bitmap
|
|
|
|
|
sta (zpt),y
|
|
|
|
|
|
|
|
|
|
iny MIN_VERSION
|
|
|
|
|
lda XDOS.PackGBuf.Bitmap+1
|
|
|
|
|
sta (zpt),y
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
.6 jsr XDOS.ZPT.Next
|
2023-11-12 13:20:15 +00:00
|
|
|
|
dex
|
2020-08-27 15:34:55 +00:00
|
|
|
|
bne .1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
rts
|
2023-06-15 06:17:56 +00:00
|
|
|
|
|
2020-08-27 15:34:55 +00:00
|
|
|
|
.FIN
|
2019-11-20 07:04:00 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.GetMark ldx XDOS.FCBPtr index to open fcb.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
ldy #$02 index to user's mark parameter.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.1 lda XDOS.FCBs+FCB.MARK,x transfer current position
|
|
|
|
|
sta (ZP.A3L),y to user's parameter list
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx
|
|
|
|
|
iny
|
|
|
|
|
cpy #$05 transfer 3 bytes
|
|
|
|
|
bne .1
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-05-25 13:58:59 +00:00
|
|
|
|
L3DFD lda #MLI.E.BEYEOF invalid position
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.SetMark ldy #$04 index to user's desired position.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
ldx XDOS.FCBPtr file's control block index.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inx inc by 2 for index to hi eof
|
|
|
|
|
inx
|
|
|
|
|
sec indicate comparisons are necessary.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
.1 lda (ZP.A3L),y move it to 'tpos'
|
|
|
|
|
sta XDOS.TmpPos-2,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc .2 branch if mark < eof
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.FCBs+FCB.EOF,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc .2 branch if mark qualifies.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3DFD branch if mark > eof (invalid position)
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
.2 dey move/compare next lower byte of mark.
|
|
|
|
|
tya test for all bytes moved/tested.
|
|
|
|
|
eor #$01 preserves carry status.
|
|
|
|
|
bne .1 branch if more.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-26 13:17:41 +00:00
|
|
|
|
rdposn ldy XDOS.FCBPtr test to see if new position is
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.MARK+1,y within the same (current) data block.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$FE
|
|
|
|
|
sta scrtch
|
2023-11-20 20:22:55 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+1 middle byte of new position
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc scrtch
|
|
|
|
|
sta scrtch
|
|
|
|
|
bcc L3E44 branch if < current position.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$02 must be within 512 bytes of beginning
|
|
|
|
|
bcs L3E44 of current position.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+2 make sure within the same 64k.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
cmp XDOS.FCBs+FCB.MARK+2,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3E44 branch if not.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jmp svmark if so, adj fcb, position ptr and return.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3E44 lda XDOS.FCBs+FCB.STYPE,y determine file type for positioning.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3E50 0 = invalid file type.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$04 tree class file?
|
|
|
|
|
bcc L3E59 yes, go position.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jmp dirmark no, test for dir type.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L3E50
|
|
|
|
|
* ldy #$A4 ??????? clear illegal filetype entry in fcb
|
|
|
|
|
* sta XDOS.FCBs,y ??????? WILL TRASH anther FCB
|
2020-07-17 15:18:31 +00:00
|
|
|
|
lda #MLI.E.BADREF and report error
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-12-13 07:09:00 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3E59 lda XDOS.FCBs+FCB.STYPE,y use storage type as # of index levels
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta levels since 1=seed, 2=sapling, 3=tree.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.F,y
|
2020-09-17 15:29:41 +00:00
|
|
|
|
and #FCB.F.DBLKMOD if previous data was modified then
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3E6B disk must be updated.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.WriteDBLK
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3ED4 if error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L3E6B ldy XDOS.FCBPtr test to see if current index block
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.MARK+2,y is usable by checking if new
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$FE position is within 128k of the
|
|
|
|
|
sta scrtch beginning of current sapling level
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+2 chunk.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
sbc scrtch
|
|
|
|
|
bcc L3E9D branch if a new index block is needed.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$02 is new position within 128k of old ?
|
|
|
|
|
bcs L3E9D branch if not.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldx levels is it a seed file ?
|
|
|
|
|
dex
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bne datlevel1 no, use current indexes.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L3E89 lda XDOS.TmpPos+1 is new position < 512 ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr
|
2023-11-26 13:17:41 +00:00
|
|
|
|
ora XDOS.TmpPos+2
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L3EEF no, mark both data and index block as
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.1stBLK,y unallocated. 1st block is only block
|
|
|
|
|
sta ZP.BLKNUM and it's data.
|
|
|
|
|
lda XDOS.FCBs+FCB.1stBLK+1,y high block address.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jmp rnewpos go read in block and set statuses.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3E9D lda XDOS.FCBs+FCB.F,y check to see if previous index block
|
2020-07-17 15:18:31 +00:00
|
|
|
|
and #FCB.F.IBLKMOD was modified.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L3EA9 read in over it if current up to date.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.WriteIBLK go update index on disk (fcb block addr)
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3ED4
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3EA9 ldx levels be sure there is a top index
|
|
|
|
|
cpx #$03 before reading it...
|
|
|
|
|
beq posindex branch if file is a tree.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+2 is new position within range of a
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr sapling file (less than 128k) ?
|
|
|
|
|
php save results
|
|
|
|
|
lda #$07 (no level is allocated for new pos'n)
|
|
|
|
|
plp restore z-flag.
|
|
|
|
|
bne L3F18 go mark all as dummy.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.ClrFCBStatus clr status bits 0,1,2 (index/data/alloc)
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex check for seed
|
|
|
|
|
beq L3E89 if seed, check for position < 512.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr rfcbfst go get only index block.
|
|
|
|
|
bcs L3ED4 if error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
jsr XDOS.UpdateFCBIBlk save newly loaded index block's address.
|
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
datlevel1 bra datlevel branch always
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3ED4 rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
posindex jsr XDOS.ClrFCBStatus clr all alloc requirements for previous
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr rfcbfst position. get highest level index block
|
|
|
|
|
bcs L3ED4
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+2 then test for a sap level index block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr
|
|
|
|
|
tay
|
|
|
|
|
lda (zpt),y
|
|
|
|
|
inc zpt+1
|
|
|
|
|
cmp (zpt),y (both high and low = 0 if no index exists)
|
|
|
|
|
bne saplevel
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax are both bytes 0 ?
|
|
|
|
|
bne saplevel
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec zpt+1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3EEF lda #$03 show neither index or data block alloc'd
|
|
|
|
|
bra L3F18
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
saplevel sta ZP.BLKNUM read in next lower index block.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y (high address)
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec zpt+1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
* jsr rfcbidx read in sapling level
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
lda #$01 prepare to read index block : read command
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.CMDNUM
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
|
|
|
|
ldx #zpt address of current index buffer.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.FileIOPtrX go read index block.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bcs L3ED4 error
|
|
|
|
|
|
2023-06-15 06:17:56 +00:00
|
|
|
|
jsr XDOS.UpdateFCBIBlk save block address of this index in fcb
|
|
|
|
|
|
|
|
|
|
datlevel jsr XDOS.Tpos2Y get block address of data block
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y data block address low
|
|
|
|
|
inc zpt+1
|
|
|
|
|
cmp (zpt),y
|
|
|
|
|
bne L3F51
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax
|
|
|
|
|
bne L3F51
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$01 show data block as never been allocated
|
|
|
|
|
dec zpt+1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
L3F18 jsr XDOS.SetFCBStatus set status to show what's missing
|
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lsr discard bit that says data block
|
|
|
|
|
lsr unallocated because carry indicates if
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.ZeroData index block is invalid and needs to be zeroed.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bcc svmark branch if it doesn't need zeroed
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.ZeroIndex zero index block in user's i/o buffer
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bra svmark
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.ZeroData lda #$00
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
inc ZP.DataPtr+1
|
|
|
|
|
|
|
|
|
|
jsr .1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
dec ZP.DataPtr+1
|
|
|
|
|
|
|
|
|
|
.1 sta (ZP.DataPtr),y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
2023-11-05 15:26:06 +00:00
|
|
|
|
bne .1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L3F51 sta ZP.BLKNUM get data block of new position
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda (zpt),y (high address)
|
|
|
|
|
dec zpt+1
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
rnewpos sta ZP.BLKNUM+1
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.ReadFCB.DBLK
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3F86 if error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.ClrFCBStatus show whole chain is allocated.
|
|
|
|
|
*--------------------------------------
|
2023-11-26 13:17:41 +00:00
|
|
|
|
svmark ldy XDOS.FCBPtr update position in fcb
|
2019-10-16 06:09:13 +00:00
|
|
|
|
iny
|
|
|
|
|
iny
|
|
|
|
|
ldx #$02
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L3F68 lda XDOS.FCBs+FCB.MARK,y save old mark in case calling routine
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta oldmark,x fails later.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.MARK,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
dex move 3 byte position marker
|
|
|
|
|
bpl L3F68
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc set up indirect address to buffer
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda ZP.DataPtr page pointed to by the current
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta sos position marker.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
lda XDOS.TmpPos+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$01
|
2023-11-05 15:26:06 +00:00
|
|
|
|
adc ZP.DataPtr+1
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sta sos+1
|
|
|
|
|
L3F86 rts carry set if error
|
2020-09-17 15:29:41 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dirmark cmp #$0D is it a directory ?
|
|
|
|
|
beq L3F9C yes...
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
|
|
|
|
lda #MLI.E.INCFF no, so compatability problem.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr GP.SYSERR should not have been opened !!!
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
|
|
|
|
L3F9C lda scrtch recover results of previous subtraction.
|
|
|
|
|
lsr use difference as counter for how many
|
|
|
|
|
sta cntent blocks must be read to get to new pos'n.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.MARK+1,y test for positive direction
|
2023-11-26 13:17:41 +00:00
|
|
|
|
cmp XDOS.TmpPos+1 indicated by carry.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.MARK+2,y
|
2023-11-26 13:17:41 +00:00
|
|
|
|
sbc XDOS.TmpPos+2
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L3FB9 if set, position forward. otherwise,
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3FAB ldy #$00 read directory file in reverse order.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
jsr XDOS.DirSeek read previous block.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3FD6 if error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc cntent count up to 128.
|
|
|
|
|
bpl L3FAB loop if more blocks to pass over.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bmi svmark always.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L3FB9 ldy #$02 position is forward from current.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
jsr XDOS.DirSeek read next directory block
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L3FD6 if error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dec cntent
|
|
|
|
|
bne L3FB9 loop if position not found in this block
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq svmark branch always.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-26 13:17:41 +00:00
|
|
|
|
XDOS.DirSeek lda (ZP.DataPtr),y get link address of previous or next
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM directory block.
|
2023-11-26 13:17:41 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZP.DataPtr),y get the rest of the link.
|
|
|
|
|
sta ZP.BLKNUM+1
|
|
|
|
|
ora ZP.BLKNUM but first be sure there is a link.
|
|
|
|
|
bne XDOS.ReadFCB.DBLK branch if certain link exists.
|
2019-12-13 07:09:00 +00:00
|
|
|
|
|
2019-11-23 15:24:55 +00:00
|
|
|
|
lda #MLI.E.EOF something is wrong with directory file!
|
2023-07-10 04:57:04 +00:00
|
|
|
|
sec error.
|
|
|
|
|
L3FD6 rts
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.ReadFCB.DBLK
|
|
|
|
|
lda #$01 read command
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.CMDNUM
|
2020-09-18 15:06:12 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
ldx #ZP.DataPtr points at address of data buffer.
|
|
|
|
|
jsr XDOS.FileIOPtrX go do file input.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
bcs .9 error.
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda ZP.BLKNUM
|
|
|
|
|
sta XDOS.FCBs+FCB.DBLK,y save block # just read in fcb.
|
|
|
|
|
lda ZP.BLKNUM+1
|
|
|
|
|
sta XDOS.FCBs+FCB.DBLK+1,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
* clc
|
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
.9 rts
|
2020-09-18 15:06:12 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
wfcbfst jsr XDOS.FlushBM update the bitmap and write file's 1st block.
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
ldx #$02 write command
|
|
|
|
|
.HS 2C BIT ABS
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
rfcbfst ldx #$01 read command.
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
lda #FCB.1stBLK
|
2023-11-26 13:17:41 +00:00
|
|
|
|
ora XDOS.FCBPtr add offset to XDOS.FCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay
|
2023-11-05 15:26:06 +00:00
|
|
|
|
txa get back command
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
ldx #zpt rd block into index portion of file buf
|
|
|
|
|
*--------------------------------------
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.FileIOPtrXCmdABlkY
|
|
|
|
|
sta ZP.CMDNUM command
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
lda XDOS.FCBs,y get disk block address from fcb.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM block 0 not legal
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bne .1
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
lda XDOS.FCBs+1,y high address of disk block
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bne .2
|
2020-05-25 13:58:59 +00:00
|
|
|
|
|
2020-09-19 16:48:28 +00:00
|
|
|
|
lda #$0C Block = $0000, allocation error.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
jsr GP.SYSDEATH doesn't return...
|
2019-10-16 06:09:13 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
.1 lda XDOS.FCBs+1,y
|
2023-11-04 14:42:28 +00:00
|
|
|
|
.2 sta ZP.BLKNUM+1
|
2020-09-19 16:48:28 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.FileIOPtrX lda $00,x get memory address of buffer from
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BUFPTR page zero pointed to by x register
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda $01,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BUFPTR+1 and pass address to device handler
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
|
|
|
|
jsr XDOS.FCBDevIDSelect
|
|
|
|
|
|
2023-11-05 15:26:06 +00:00
|
|
|
|
XDOS.FileIO2 sec also, set to indicate reg call made to
|
|
|
|
|
ror ioaccess device handler.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.DEVNUM transfer device # for dispatcher
|
|
|
|
|
sta ZP.UNITNUM to convert to unit #.
|
|
|
|
|
stz GP.ERROR clear global error code.
|
2020-09-17 15:29:41 +00:00
|
|
|
|
jmp XDOS.DevCall call the driver.
|
|
|
|
|
*--------------------------------------
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.WriteDBLK ldx #ZP.DataPtr point at memory address with x and
|
2020-09-19 16:48:28 +00:00
|
|
|
|
lda #FCB.DBLK disk address with y.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ora XDOS.FCBPtr add offset to XDOS.FCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay and put in y.
|
|
|
|
|
lda #$02 write data block.
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.FileIOPtrXCmdABlkY
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4096 if errors.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$BF mark data status as current.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
bra XDOS.ResetFCBStatus
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-12 13:20:15 +00:00
|
|
|
|
XDOS.WriteIBLK jsr XDOS.FlushBM update bitmap.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
|
|
|
|
|
ldx #zpt point to address of index buffer
|
|
|
|
|
lda #FCB.IBLK and block address of that index block.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ora XDOS.FCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay
|
|
|
|
|
lda #$02
|
2023-11-05 15:26:06 +00:00
|
|
|
|
jsr XDOS.FileIOPtrXCmdABlkY
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4096 if errors.
|
2020-07-17 15:18:31 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$7F mark index status as current.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
XDOS.ResetFCBStatus
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
and XDOS.FCBs+FCB.F,x
|
|
|
|
|
sta XDOS.FCBs+FCB.F,x
|
2020-07-17 15:18:31 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4096 rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-18 14:04:21 +00:00
|
|
|
|
XDOS.Open jsr XDOS.FindFileOrVol look up the file.
|
|
|
|
|
bcs L4096 if not, then error.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L40A0 jsr XDOS.IsOpened are any other files writing to this
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcc L40AD same file ? branch if not.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
|
|
|
|
L40A5 lda #MLI.E.OPEN file is busy, shared access not allowed.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
.HS 2C
|
2019-11-10 18:28:06 +00:00
|
|
|
|
L40A9 lda #MLI.E.UNSUPST file is wrong storage type.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
.HS 2C
|
|
|
|
|
L40AB lda #MLI.E.FCBFULL fcb full error.
|
2020-07-18 14:04:21 +00:00
|
|
|
|
sec
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L40AD lda fcbflg if this byte <> 0 then free fcb found
|
2019-11-23 15:24:55 +00:00
|
|
|
|
beq L40AB and available for use.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr get address of 1st free fcb found.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L40B9 ldy #FCB
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L40BD stz XDOS.FCBs,x but clean it first.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
inx
|
|
|
|
|
dey
|
|
|
|
|
bne L40BD
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
ldy #0
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L40CB lda XDOS.DE.DevID,y move ownership info.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.DEVID,x note: this code depends upon the defined
|
2020-09-18 15:06:12 +00:00
|
|
|
|
inx order of both the fcb and directory entry buffer.
|
|
|
|
|
iny
|
2023-11-12 13:20:15 +00:00
|
|
|
|
cpy #6
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L40CB
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Filename get storage type and
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.SetFCBSType
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tax save in x for later comparison
|
2020-09-18 15:06:12 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.Access get file's attributes and use it
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$03 as a default access request.
|
|
|
|
|
cpx #$0D if directory, don't allow write enable.
|
|
|
|
|
bne L40EB
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$01 read enabled bit
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L40EB sta XDOS.FCBs+FCB.ACCESS,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$02 check for write enabled request.
|
|
|
|
|
beq L40F7 branch for open as read-only
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda totent otherwise, be sure no one else is
|
|
|
|
|
bne L40A5 reading the same file. branch if busy.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L40F7 cpx #$04 is it a tree file type ?
|
|
|
|
|
bcc L40FF yes.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cpx #$0D is it a directory type ?
|
|
|
|
|
bne L40A9 if not, wrong storage type.
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L40FF ldx #$06 move address of 1st block of file, end
|
2019-11-10 18:28:06 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4101 sta ZP.BLKNUM+1 of file and current usage count.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.FCBPtr
|
2023-11-26 13:17:41 +00:00
|
|
|
|
ora XDOS.DE2FCB,x this is done via a translation table
|
2019-10-16 06:09:13 +00:00
|
|
|
|
tay between directory info and fcb.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
lda XDOS.DE.KeyPtr,x
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl L4101 last loop stores hi address of 1st block
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta ZP.BLKNUM and this is the low one.
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda cntent this was set up by 'tstopen'.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs,x claim fcb for this file.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr alcbuffr go allocate buffer in memory tables.
|
|
|
|
|
bcs L4147 if errors.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr
|
2020-09-18 15:06:12 +00:00
|
|
|
|
jsr XDOS.GetFCBBufX rtn addr of bufs in data & index ptrs.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda GP.FLEVEL mark level at which
|
|
|
|
|
sta XDOS.FCBs+FCB.FLEVEL,x file was opened.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.STYPE,x file must be positioned at beginning.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
cmp #$04 is it a tree file ?
|
|
|
|
|
bcs L415E no, assume a directory.
|
2020-09-18 06:03:33 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$FF fool the position routine into giving
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta XDOS.FCBs+FCB.MARK+2,x a valid position with preloaded data,
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$02 etc. set desired position to 0.
|
|
|
|
|
lda #$00
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-26 13:17:41 +00:00
|
|
|
|
L413C sta XDOS.TmpPos,y
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl L413C
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr rdposn let tree position routine do the rest.
|
|
|
|
|
bcc L4163 if successful.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4147 pha save error code.
|
2020-09-17 15:29:41 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr free buffer space.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
stz XDOS.FCBs,x necessary to release fcb also.
|
|
|
|
|
lda XDOS.FCBs+FCB.BUFID,x
|
2019-10-16 06:09:13 +00:00
|
|
|
|
beq L4156 if no bufnum, ok because never alloc'd.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
jsr relbuffr go release buffer.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L4156 pla error code.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2020-09-18 15:06:12 +00:00
|
|
|
|
L415E jsr XDOS.ReadFCB.DBLK read in 1st block of directory file.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bcs L4147 return error after freeing buffer & fcb.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4163 ldx XDOS.VCBPtr index to vcb.
|
|
|
|
|
inc XDOS.VCBs+VCB.OFCNT,x add 1 to # of files currently open
|
2023-11-12 13:20:15 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldx XDOS.FCBPtr index to fcb.
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.ID,x return ref # to user.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ldy #$05
|
2023-11-04 14:42:28 +00:00
|
|
|
|
sta (ZP.A3L),y
|
2020-07-16 06:18:17 +00:00
|
|
|
|
* clc open is successful
|
2019-10-16 06:09:13 +00:00
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-11-20 20:22:55 +00:00
|
|
|
|
XDOS.IsOpened stz cntent returns the ref # of a free fcb.
|
2020-09-19 16:48:28 +00:00
|
|
|
|
stz totent flag to indicate file already open.
|
|
|
|
|
stz fcbflg flag indicates a free fcb is available.
|
|
|
|
|
|
|
|
|
|
lda #$00
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L4188 tay index to next fcb.
|
|
|
|
|
ldx fcbflg test for free fcb found.
|
|
|
|
|
bne L4191 if already found.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc cntent
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-04 14:42:28 +00:00
|
|
|
|
L4191 lda XDOS.FCBs,y is this fcb in use ?
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L41A3 yes.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
txa if not, should we claim it ?
|
|
|
|
|
bne L41C1 branch if free fcb already found.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
sty XDOS.FCBPtr save index to new free fcb.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
lda #$FF set fcb flag to indicate
|
|
|
|
|
sta fcbflg free fcb found.
|
|
|
|
|
bne L41C1 branch always to test next fcb.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L41A3 tya add offset to index to ownership info
|
|
|
|
|
ora #$06
|
|
|
|
|
tay and put it back in y.
|
|
|
|
|
ldx #$06 index to directory entry owner info.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2023-11-20 20:22:55 +00:00
|
|
|
|
L41A9 lda XDOS.FCBs,y all bytes must match to say that it's
|
|
|
|
|
cmp XDOS.DE.DevID-1,x the same file again.
|
2019-10-16 06:09:13 +00:00
|
|
|
|
bne L41C1 if not, then next fcb.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
dey index to next lower bytes.
|
|
|
|
|
dex
|
|
|
|
|
bne L41A9 loop to check all owner info.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
inc totent file is already open, now see
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda XDOS.FCBs+FCB.ACCESS,y if it's already opened for write. and #$02 if so report file busy (with carry set).
|
2019-10-16 06:09:13 +00:00
|
|
|
|
and #$02 if so report file busy (with carry set).
|
|
|
|
|
beq L41C1 branch if this file is read access only.
|
2020-09-18 15:06:12 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
L41C1 tya calc position of next fcb.
|
|
|
|
|
and #$E0 first strip any possible index offsets.
|
|
|
|
|
clc
|
2020-07-17 06:04:08 +00:00
|
|
|
|
adc #FCB inc to next fcb.
|
|
|
|
|
bcc L4188 branch if more to compare.
|
2019-11-23 15:24:55 +00:00
|
|
|
|
|
2019-10-16 06:09:13 +00:00
|
|
|
|
clc report no conflicts.
|
|
|
|
|
rts
|
2019-11-23 15:24:55 +00:00
|
|
|
|
*--------------------------------------
|
2023-06-15 06:17:56 +00:00
|
|
|
|
XDOS.UpdateFCBIBlk
|
2023-11-20 20:22:55 +00:00
|
|
|
|
ldy XDOS.FCBPtr
|
2023-11-04 14:42:28 +00:00
|
|
|
|
lda ZP.BLKNUM
|
|
|
|
|
sta XDOS.FCBs+FCB.IBLK,y save block address of this index in fcb
|
|
|
|
|
lda ZP.BLKNUM+1
|
|
|
|
|
sta XDOS.FCBs+FCB.IBLK+1,y
|
2023-06-15 06:17:56 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
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.c
|
|
|
|
|
LOAD usr/src/prodos.fx/prodos.s
|
2019-10-16 06:09:13 +00:00
|
|
|
|
ASM
|