Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-09-18 17:06:12 +02:00
parent 960e7769ea
commit 570daa7f23
6 changed files with 188 additions and 173 deletions

View File

@ -251,9 +251,10 @@ sysdeath1 tax death error code.
adc #$06 inc to alpha a-f adc #$06 inc to alpha a-f
.3 ldy #deathmsg.LEN .3 ldy #deathmsg.LEN
ora #$80
sta $400,y sta $400,y
lda #' ' lda #" "
.4 iny .4 iny
sta $400,y sta $400,y
@ -284,7 +285,7 @@ XDOS.bfmgr lda XDOS.CmdFlags,x translate into command address.
nopath asl cmdtemp test for refnum processing nopath asl cmdtemp test for refnum processing
bcc nopreref bcc nopreref
jsr findfcb set pointers to fcb and vcb of file jsr XDOS.GetFCB set pointers to fcb and vcb of file
bcs errorsys bcs errorsys
nopreref asl cmdtemp check for necessity of time stamp nopreref asl cmdtemp check for necessity of time stamp
@ -504,11 +505,11 @@ H33B3 inx
gotprfx clc no error gotprfx clc no error
rts rts
*-------------------------------------- *--------------------------------------
findfcb ldy #$01 index to ref# XDOS.GetFCB ldy #$01 index to ref#
lda (A3L),y is it a valid file# ? lda (A3L),y is it a valid file# ?
beq badref must not be 0. beq badref must not be 0.
cmp #$09 must be 1 to 8 only. cmp #FCB.MAX+1
bcs badref bcs badref
pha pha
@ -518,35 +519,41 @@ findfcb ldy #$01 index to ref#
ror ror
ror multiply by 32. ror multiply by 32.
sta fcbptr used as an index to fcb sta fcbptr used as an index to fcb
tay tax
pla restore ref# in acc pla restore ref# in acc
cmp FCBs,y cmp FCBs+FCB.ID,x
bne errnoref bne errnoref
*--------------------------------------
XDOS.GetFCBBufX lda FCBs+FCB.BUFID,x get page address of file buffer.
tay index into global buffer table.
lda buftbl-1,y
sta bufaddrh
fndfcbuf lda FCBs+FCB.BUFID,y get page address of file buffer.
jsr getbufadr get file's address into bufaddrl,h
ldx bufaddrh (y=fcbptr preserved)
beq fcbdead fcb corrupted beq fcbdead fcb corrupted
stx datptr+1 save ptr to data area of buffer sta datptr+1 save ptr to data area of buffer
inx inc
inx index block always 2 pages after data inc index block always 2 pages after data
stx zpt+1 sta zpt+1
lda FCBs+FCB.DEVID,y also set up device # lda buftbl-2,y ???? ALWAYS 0
sta devnum
lda bufaddrl sta bufaddrl
sta datptr index and data buffers always on sta datptr index and data buffers always on
sta zpt page boundaries. sta zpt page boundaries.
lda FCBs+FCB.DEVID,x also set up device #
sta devnum
lda #VCB0 lda #VCB0
fndfvol tax search for associated vcb fndfvol tay search for associated vcb
lda VCBs+VCB.DEV,x lda VCBs+VCB.DEV,y
cmp FCBs+FCB.DEVID,y is this vcb the same device? cmp FCBs+FCB.DEVID,x is this vcb the same device?
beq tstvopen if it is, make sure volume is active. beq tstvopen if it is, make sure volume is active.
nxtfvol txa adjust index to next vcb. nxtfvol tya adjust index to next vcb.
clc clc
adc #VCB adc #VCB
bcc fndfvol loop until volume found. bcc fndfvol loop until volume found.
@ -555,16 +562,17 @@ nxtfvol txa adjust index to next vcb.
.HS 2C BIT ABS .HS 2C BIT ABS
fcbdead lda #$0B fcb error so fcbdead lda #$0B fcb error so
jsr sysdeath kill the system. jsr sysdeath kill the system.
tstvopen lda VCBs,x make sure this vcb is open. tstvopen lda VCBs,y make sure this vcb is open.
beq nxtfvol branch if it is not active. beq nxtfvol branch if it is not active.
stx vcbptr save ptr to good vcb.
clc no error
rts
errnoref lda #$00 put a zero into this fcb to sty vcbptr save ptr to good vcb.
sta FCBs,y show free fcb. clc no error
rts Y = VCBPtr, X = FCBPtr
errnoref stz FCBs,x
badref lda #MLI.E.BADREF requested refnum is badref lda #MLI.E.BADREF requested refnum is
sec illegal (out of range) sec illegal (out of range)

View File

@ -529,7 +529,7 @@ L3EA9 ldx levels be sure there is a top index
plp restore z-flag. plp restore z-flag.
bne L3F18 go mark all as dummy. bne L3F18 go mark all as dummy.
jsr clrstats clr status bits 0,1,2 (index/data/alloc) jsr XDOS.ClrFCBStatus clr status bits 0,1,2 (index/data/alloc)
dex check for seed dex check for seed
beq L3E89 if seed, check for position < 512. beq L3E89 if seed, check for position < 512.
@ -546,7 +546,7 @@ L3EA9 ldx levels be sure there is a top index
L3ED4 rts L3ED4 rts
posindex jsr clrstats clr all alloc requirements for previous posindex jsr XDOS.ClrFCBStatus clr all alloc requirements for previous
jsr rfcbfst position. get highest level index block jsr rfcbfst position. get highest level index block
bcs L3ED4 bcs L3ED4
@ -599,7 +599,7 @@ L3F18 ldy fcbptr set status to show what's missing
jsr zeroindex zero index block in user's i/o buffer jsr zeroindex zero index block in user's i/o buffer
bra svmark bra svmark
*--------------------------------------
zeroindex lda #$00 zeroindex lda #$00
tay tay
L3F30 sta (zpt),y zero out the index half of the user's L3F30 sta (zpt),y zero out the index half of the user's
@ -614,7 +614,7 @@ L3F37 sta (zpt),y
dec zpt+1 restore proper address dec zpt+1 restore proper address
rts rts
*--------------------------------------
zipdata lda #$00 zipdata lda #$00
tay tay
L3F42 sta (datptr),y zero out data area L3F42 sta (datptr),y zero out data area
@ -629,17 +629,17 @@ L3F49 sta (datptr),y
dec datptr+1 dec datptr+1
rts rts
*--------------------------------------
L3F51 sta bloknml get data block of new position L3F51 sta bloknml get data block of new position
lda (zpt),y (high address) lda (zpt),y (high address)
dec zpt+1 dec zpt+1
rnewpos sta bloknml+1 rnewpos sta bloknml+1
jsr rfcbdat jsr XDOS.ReadFCB.DBLK
bcs L3F86 if error. bcs L3F86 if error.
jsr clrstats show whole chain is allocated. jsr XDOS.ClrFCBStatus show whole chain is allocated.
*--------------------------------------
svmark ldy fcbptr update position in fcb svmark ldy fcbptr update position in fcb
iny iny
iny iny
@ -661,12 +661,6 @@ L3F68 lda FCBs+FCB.MARK,y save old mark in case calling routine
sta sos+1 sta sos+1
L3F86 rts carry set if error L3F86 rts carry set if error
*-------------------------------------- *--------------------------------------
clrstats ldy fcbptr clear allocation states for data block
lda FCBs+FCB.F,y and both levels of indexes/
and #$F8
sta FCBs+FCB.F,y indicates that either they exist now
rts or unnecessary for current position.
*--------------------------------------
dirmark cmp #$0D is it a directory ? dirmark cmp #$0D is it a directory ?
beq L3F9C yes... beq L3F9C yes...
@ -712,12 +706,13 @@ L3FD6 sec error.
rts rts
L3FD8 sta bloknml+1 L3FD8 sta bloknml+1
*--------------------------------------
* read file's data block XDOS.ReadFCB.DBLK
lda #$01 read command
rfcbdat lda #$01 read command
sta A4L sta A4L
ldx #datptr points at address of data buffer. ldx #datptr points at address of data buffer.
jsr fileio1 go do file input. jsr fileio1 go do file input.
bcs L3FF2 error. bcs L3FF2 error.
@ -726,11 +721,16 @@ rfcbdat lda #$01 read command
sta FCBs+FCB.DBLK,y save block # just read in fcb. sta FCBs+FCB.DBLK,y save block # just read in fcb.
lda bloknml+1 lda bloknml+1
sta FCBs+FCB.DBLK+1,y sta FCBs+FCB.DBLK+1,y
L3FF2 rts
* clc
L3FF2 rts
*--------------------------------------
rfcbidx lda #$01 prepare to read index block : read command rfcbidx lda #$01 prepare to read index block : read command
sta A4L sta A4L
ldx #$48 address of current index buffer.
ldx #zpt address of current index buffer.
jsr fileio1 go read index block. jsr fileio1 go read index block.
bcs L400C error bcs L400C error
@ -826,37 +826,33 @@ L40AB lda #MLI.E.FCBFULL fcb full error.
sec sec
rts rts
L40AD ldy fcbptr get address of 1st free fcb found. L40AD lda fcbflg if this byte <> 0 then free fcb found
lda fcbflg if this byte <> 0 then free fcb found
beq L40AB and available for use. beq L40AB and available for use.
L40B9 ldx #$1F assign fcb, ldx fcbptr get address of 1st free fcb found.
lda #0 L40B9 ldy #FCB
L40BD sta FCBs,y but clean it first. L40BD stz FCBs,x but clean it first.
inx
dey
bne L40BD
ldy #0
ldx fcbptr
L40CB lda d_dev,y move ownership info.
sta FCBs+FCB.DEVID,x note: this code depends upon the defined
inx order of both the fcb and directory entry buffer.
iny iny
dex cpy #6
bpl L40BD
lda #$06 start claiming it by moving in file info
tax using x as source index
ora fcbptr and y as destination (fcb).
tay
L40CB lda d_dev-1,x move ownership info.
sta FCBs,y note: this code depends upon the defined
dey order of both the fcb and directory
dex entry buffer.
bne L40CB bne L40CB
lda d_stor get storage type and lda d_stor get storage type and
lsr strip off file name length jsr XDOS.SetFCBSType
lsr by dividing by 16.
lsr
lsr
tax save in x for later comparison tax save in x for later comparison
sta FCBs+FCB.STYPE,y and in fcb for future access.
lda d_attr get file's attributes and use it lda d_attr get file's attributes and use it
and #$03 as a default access request. and #$03 as a default access request.
cpx #$0D if directory, don't allow write enable. cpx #$0D if directory, don't allow write enable.
@ -889,21 +885,23 @@ L4101 sta bloknml+1 of file and current usage count.
bpl L4101 last loop stores hi address of 1st block bpl L4101 last loop stores hi address of 1st block
sta bloknml and this is the low one. sta bloknml and this is the low one.
ldy fcbptr ldx fcbptr
lda cntent this was set up by 'tstopen'. lda cntent this was set up by 'tstopen'.
sta FCBs,y claim fcb for this file. sta FCBs,x claim fcb for this file.
jsr alcbuffr go allocate buffer in memory tables. jsr alcbuffr go allocate buffer in memory tables.
bcs L4147 if errors. bcs L4147 if errors.
jsr fndfcbuf rtn addr of bufs in data & index ptrs. ldx fcbptr
jsr XDOS.GetFCBBufX rtn addr of bufs in data & index ptrs.
lda flevel mark level at which lda flevel mark level at which
sta FCBs+FCB.FLEVEL,y file was opened. sta FCBs+FCB.FLEVEL,x file was opened.
lda FCBs+FCB.STYPE,y file must be positioned at beginning.
lda FCBs+FCB.STYPE,x file must be positioned at beginning.
cmp #$04 is it a tree file ? cmp #$04 is it a tree file ?
bcs L415E no, assume a directory. bcs L415E no, assume a directory.
lda #$FF fool the position routine into giving lda #$FF fool the position routine into giving
sta FCBs+FCB.MARK+2,y a valid position with preloaded data, sta FCBs+FCB.MARK+2,x a valid position with preloaded data,
ldy #$02 etc. set desired position to 0. ldy #$02 etc. set desired position to 0.
lda #$00 lda #$00
@ -918,28 +916,24 @@ L413C sta tposll,y
L4147 pha save error code. L4147 pha save error code.
ldx fcbptr free buffer space. ldx fcbptr free buffer space.
stz FCBs,x necessary to release fcb also.
lda FCBs+FCB.BUFID,x lda FCBs+FCB.BUFID,x
beq L4156 if no bufnum, ok because never alloc'd. beq L4156 if no bufnum, ok because never alloc'd.
jsr relbuffr go release buffer. jsr relbuffr go release buffer.
ldx fcbptr
L4156 stz FCBs,x necessary to release fcb also. L4156 pla error code.
pla error code.
sec sec
rts rts
L415E jsr rfcbdat read in 1st block of directory file. L415E jsr XDOS.ReadFCB.DBLK read in 1st block of directory file.
bcs L4147 return error after freeing buffer & fcb. bcs L4147 return error after freeing buffer & fcb.
L4163 ldx vcbptr index to vcb. L4163 ldx vcbptr index to vcb.
inc VCBs+VCB.OFCNT,x add 1 to # of files currently open inc VCBs+VCB.OFCNT,x add 1 to # of files currently open
* sec and indicate that this volume has at ldx fcbptr index to fcb.
* ror VCBs+VCB.OF,x least 1 file active. lda FCBs,x return ref # to user.
ldy fcbptr index to fcb.
lda FCBs,y return ref # to user.
ldy #$05 ldy #$05
sta (A3L),y sta (A3L),y
* clc open is successful * clc open is successful
@ -956,7 +950,7 @@ L4188 tay index to next fcb.
inc cntent inc cntent
L4191 lda FCBs,y is this fcb in use ? L4191 lda FCBs,y is this fcb in use ?
bne L41A3 yes. bne L41A3 yes.
txa if not, should we claim it ? txa if not, should we claim it ?
@ -972,7 +966,7 @@ L41A3 tya add offset to index to ownership info
tay and put it back in y. tay and put it back in y.
ldx #$06 index to directory entry owner info. ldx #$06 index to directory entry owner info.
L41A9 lda FCBs,y all bytes must match to say that it's L41A9 lda FCBs,y all bytes must match to say that it's
cmp d_dev-1,x the same file again. cmp d_dev-1,x the same file again.
bne L41C1 if not, then next fcb. bne L41C1 if not, then next fcb.
@ -984,6 +978,7 @@ L41A9 lda FCBs,y all bytes must match to say that it's
lda FCBs+FCB.ACCESS,y if it's already opened for write. and #$02 if so report file busy (with carry set). lda FCBs+FCB.ACCESS,y if it's already opened for write. and #$02 if so report file busy (with carry set).
and #$02 if so report file busy (with carry set). and #$02 if so report file busy (with carry set).
beq L41C1 branch if this file is read access only. beq L41C1 branch if this file is read access only.
sec sec
rts rts

View File

@ -41,7 +41,7 @@ L4210 jsr valdbuf validate user's data buffer range.
cmp #$04 and find out if it's a tree or other. cmp #$04 and find out if it's a tree or other.
bcc L421F branch if a tree file bcc L421F branch if a tree file
jmp dread otherwise assume it's a directory. jmp XDOS.ReadDir otherwise assume it's a directory.
L421F jsr rdposn set up data pointer. L421F jsr rdposn set up data pointer.
bcs L4202 errors. bcs L4202 errors.
@ -56,7 +56,7 @@ L421F jsr rdposn set up data pointer.
beq L421F beq L421F
sta cmdtemp save bulk block count. sta cmdtemp save bulk block count.
jsr gfcbstat make sure current data area doesn't jsr XDOS.GetFCBStatus make sure current data area doesn't
and #$40 need writing before resetting ptr to and #$40 need writing before resetting ptr to
bne L421F read into user's area. branch if data bne L421F read into user's area. branch if data
@ -251,17 +251,16 @@ fxdatptr lda datptr put current user buffer address back to normal
sta usrbuf sta usrbuf
lda datptr+1 lda datptr+1
sta usrbuf+1 bank pair byte should be moved also. sta usrbuf+1 bank pair byte should be moved also.
ldy fcbptr restore buffer address
jmp fndfcbuf
* read directory file ldx fcbptr restore buffer address
jmp XDOS.GetFCBBufX
dread jsr rdposn *--------------------------------------
XDOS.ReadDir jsr rdposn
bcs L43B8 pass back any errors. bcs L43B8 pass back any errors.
jsr preprw prepare for transfer. jsr preprw prepare for transfer.
jsr readpart move data to user's buffer. jsr readpart move data to user's buffer.
bvc dread repeat until request is satisfied. bvc XDOS.ReadDir repeat until request is satisfied.
jsr rwdone update fcb as to new position. jsr rwdone update fcb as to new position.
bcc L43B6 branch if done with no errors. bcc L43B6 branch if done with no errors.
@ -412,7 +411,7 @@ L4472 jsr mvdbufr move the user's buffer ptr to bfm zero
L4479 jsr rdposn L4479 jsr rdposn
bcs L44A2 bcs L44A2
jsr gfcbstat jsr XDOS.GetFCBStatus
and #$07 and #$07
beq L44E9 beq L44E9
@ -427,7 +426,7 @@ L4487 iny indexes and data block ?
jsr tstfrblk jsr tstfrblk
bcs L44A2 pass back any errors. bcs L44A2 pass back any errors.
jsr gfcbstat now get more specific. jsr XDOS.GetFCBStatus now get more specific.
and #$04 are we lacking a tree top ? and #$04 are we lacking a tree top ?
beq L44AC no, test for lack of sapling level index beq L44AC no, test for lack of sapling level index
@ -441,7 +440,7 @@ L44A2 pha save error.
sec sec
rts rts
L44AC jsr gfcbstat get status byte again. L44AC jsr XDOS.GetFCBStatus get status byte again.
and #$02 do we need a sapling level index block ? and #$02 do we need a sapling level index block ?
beq L44B8 no, assume it's just a data block needed beq L44B8 no, assume it's just a data block needed
@ -451,10 +450,11 @@ L44AC jsr gfcbstat get status byte again.
L44B8 jsr alcwblk go allocate for data block. L44B8 jsr alcwblk go allocate for data block.
bcs L44A2 bcs L44A2
jsr gfcbstat clear allocation required bits in status jsr XDOS.ClrFCBStatus clear allocation required bits in status
ora #$80 but first indicate index block is dirty.
and #$F8 lda #FCB.F.IBLKMOD indicate index block is dirty.
sta FCBs+FCB.F,y jsr XDOS.SetFCBStatus
lda tposhi calculate position within index block. lda tposhi calculate position within index block.
lsr lsr
lda tposlh lda tposlh
@ -467,6 +467,7 @@ L44B8 jsr alcwblk go allocate for data block.
dec zpt+1 restore pointer to lower page of index dec zpt+1 restore pointer to lower page of index
lda scrtch block. get low block address. lda scrtch block. get low block address.
sta (zpt),y store low address. sta (zpt),y store low address.
ldy fcbptr update fcb to indicate that this block ldy fcbptr update fcb to indicate that this block
sta FCBs+FCB.DBLK,y is allocated. sta FCBs+FCB.DBLK,y is allocated.
txa get high address again. txa get high address again.
@ -646,11 +647,11 @@ alcwblk jsr alc1blk
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
tstwprot jsr gfcbstat check for 'never been modified' condition tstwprot jsr XDOS.GetFCBStatus check for 'never been modified' condition
and #$F0 and #$F0
bne tstwprot.8 ordinary rts if known write ok. bne tstwprot.8 ordinary rts if known write ok.
lda FCBs+FCB.DEVID,y get file's dev #. lda FCBs+FCB.DEVID,x get file's dev #.
sta devnum get current status of block device. sta devnum get current status of block device.
twrprot1 sta unitnum make the device status call twrprot1 sta unitnum make the device status call

View File

@ -9,12 +9,12 @@ XDOS.Close ldy #$01 close all ?
* lda #$00 start at the beginning. * lda #$00 start at the beginning.
L4654 sta fcbptr save current low byte of pointer. L4654 sta fcbptr save current low byte of pointer.
tay get the level at which the file tax get the level at which the file
lda FCBs+FCB.FLEVEL,y was opened. lda FCBs+FCB.FLEVEL,x was opened.
cmp flevel if file's level is < global level cmp flevel if file's level is < global level
bcc L4675 then don't close. bcc L4675 then don't close.
lda FCBs,y is this reference file open ? lda FCBs+FCB.ID,x is this reference file open ?
beq L4675 no, try next. beq L4675 no, try next.
jsr flush2 clean it out... jsr flush2 clean it out...
@ -39,8 +39,8 @@ L4675 lda fcbptr inc pointer to next fcb
L4683 jsr flush1 flush file 1st (including updating L4683 jsr flush1 flush file 1st (including updating
bcs L46B6 bitmap). branch if errors. bcs L46B6 bitmap). branch if errors.
close2 ldy fcbptr close2 ldx fcbptr
lda FCBs+FCB.BUFID,y release file buffer lda FCBs+FCB.BUFID,x release file buffer
jsr relbuffr jsr relbuffr
bcs L46B6 bcs L46B6
@ -67,8 +67,8 @@ XDOS.Flush ldy #$01 flush all ?
* lda #$00 start at the beginning. * lda #$00 start at the beginning.
L46C3 sta fcbptr save current low byte of pointer. L46C3 sta fcbptr save current low byte of pointer.
tay index to ref #. tax index to ref #.
lda FCBs,y is this reference file open ? lda FCBs,x is this reference file open ?
beq L46D1 no, try next. beq L46D1 no, try next.
jsr flush2 clean it out... jsr flush2 clean it out...
@ -85,51 +85,53 @@ L46D9 clc
sec report error now sec report error now
L46E0 rts L46E0 rts
*--------------------------------------
flush2 jsr fndfcbuf must set up vcb & buffer locations 1st. flush2 jsr XDOS.GetFCBBufX must set up vcb & buffer locations 1st.
bcc L46F1 branch if no error. bcc L46F1 branch if no error.
L46E6 jmp glberr error so check for close or flush all. L46E6 jmp glberr error so check for close or flush all.
flush1 stz cferr for normal refnum flush, clear global error. flush1 stz cferr for normal refnum flush, clear global error.
jsr findfcb setup pointer to fcb user references. jsr XDOS.GetFCB setup pointer to fcb user references.
bcs L46E6 return any errors. bcs L46E6 return any errors.
L46F1 lda FCBs+FCB.ACCESS,y test to see if file is modified. L46F1 lda FCBs+FCB.ACCESS,x test to see if file is modified.
and #$02 is it write enabled ? and #$02 is it write enabled ?
beq L46D9 branch if 'read only' beq L46D9 branch if 'read only'
lda FCBs+FCB.DIRTY,y has eof been modified ? lda FCBs+FCB.DIRTY,x has eof been modified ?
bmi L4704 if yes. bmi L4704 if yes.
jsr gfcbstat has data been modified ? jsr XDOS.GetFCBStatus has data been modified ?
and #$70 (was written to while it's been open?) and #$70 (was written to while it's been open?)
beq L46D9 if not. beq L46D9 if not.
L4704 jsr gfcbstat L4704 jsr XDOS.GetFCBStatus
and #$40 does current data buffer need to be and #$40 does current data buffer need to be
beq L4710 written ? branch if not. beq L4710 written ? branch if not.
jsr wfcbdat if so, go write it. jsr wfcbdat if so, go write it.
bcs L46E6 if error. bcs L46E6 if error.
L4710 jsr gfcbstat check to see if the index block (tree L4710 jsr XDOS.GetFCBStatus check to see if the index block (tree
and #$80 files only) needs to be written. and #$80 files only) needs to be written.
beq L471C branch if not. beq L471C branch if not.
jsr wfcbidx jsr wfcbidx
bcs L46E6 return any errors. bcs L46E6 return any errors.
L471C lda #$06 prepare to update directory L471C ldx fcbptr
tax
ora fcbptr lda FCBs+FCB.DEVID,x
tay sta devnum A = d_dev
L4723 lda FCBs,y note: this code depends on the defined ldy #0
sta d_dev-1,x order of the file control block and the
dey temporary directory area in 'work space'
dex
bne L4723
sta devnum L4723 lda FCBs+FCB.DEVID,x note: this code depends on the defined
sta d_dev,y order of the file control block and the
inx temporary directory area in 'work space'
iny
cpy #6
bne L4723
lda d_head read the directory header for this file lda d_head read the directory header for this file
ldx d_head+1 ldx d_head+1
@ -159,26 +161,27 @@ L4755 jsr entcalc set up pointer to entry.
jsr moventry move entry to temp entry buffer in jsr moventry move entry to temp entry buffer in
ldy fcbptr 'work space'. update 'blocks used' count ldx fcbptr 'work space'. update 'blocks used' count
lda FCBs+FCB.UBLK,y lda FCBs+FCB.UBLK,x
sta d_usage sta d_usage
lda FCBs+FCB.UBLK+1,y lda FCBs+FCB.UBLK+1,x
sta d_usage+1 sta d_usage+1
ldx #$00 and move in end of file mark whether ldy #0 and move in end of file mark whether
L476C lda FCBs+FCB.EOF,y needed or not. L476C lda FCBs+FCB.EOF,x needed or not.
sta d_eof,x sta d_eof,y
inx iny
cpx #$03 move all 3 bytes cpy #$03 move all 3 bytes
beq L4780 beq L4780
lda FCBs+FCB.1stBLK,y also move in the address of the file's lda FCBs+FCB.1stBLK,x also move in the address of the file's
sta d_filid,x first block since it might have changed sta d_filid,y first block since it might have changed
iny since the file first opened. inx since the file first opened.
bne L476C branch always. bne L476C branch always.
L4780 lda FCBs+FCB.STYPE-2,y the last thing to update is storage L4780 ldx fcbptr
lda FCBs+FCB.STYPE,x the last thing to update is storage
asl type (y=fcbptr+2). shift into high asl type (y=fcbptr+2). shift into high
asl nibble. asl nibble.
asl asl
@ -219,14 +222,27 @@ glberr ldy #$01
L47C1 pla L47C1 pla
rts rts
*--------------------------------------
gfcbstat ldy fcbptr index to fcb. XDOS.SetFCBSType
lda FCBs+FCB.F,y return status byte. lsr
lsr
lsr
lsr
ldy fcbptr and save it in fcb.
sta FCBs+FCB.STYPE,y
rts
*--------------------------------------
XDOS.ClrFCBStatus
ldy fcbptr clear allocation states for data block
lda FCBs+FCB.F,y and both levels of indexes/
and #$F8
sta FCBs+FCB.F,y indicates that either they exist now
rts or unnecessary for current position.
*--------------------------------------
XDOS.GetFCBStatus
ldx fcbptr index to fcb.
lda FCBs+FCB.F,x return status byte.
rts rts
L47CA lda #MLI.E.LOCKED access error
sec
L47CD rts
*-------------------------------------- *--------------------------------------
XDOS.SetFCBStatus XDOS.SetFCBStatus
ldx fcbptr ldx fcbptr
@ -234,6 +250,10 @@ XDOS.SetFCBStatus
sta FCBs+FCB.F,x sta FCBs+FCB.F,x
rts rts
*-------------------------------------- *--------------------------------------
L47CA lda #MLI.E.LOCKED access error
sec
L47CD rts
*--------------------------------------
XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed. XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed.
cmp #$04 tree type ? cmp #$04 tree type ?
bcs L47CA if not then access error bcs L47CA if not then access error
@ -386,13 +406,9 @@ L48C2 lda firstbl,x
bne L48C2 without disturbing carry. bne L48C2 without disturbing carry.
lda stortyp get possibly modified storage type lda stortyp get possibly modified storage type
lsr jsr XDOS.SetFCBSType
lsr
lsr jsr XDOS.ClrFCBStatus make it look as though position has
lsr
ldy fcbptr and save it in fcb.
sta FCBs+FCB.STYPE,y
jsr clrstats make it look as though position has
jsr dvcbrev nothing allocated, update total blocks jsr dvcbrev nothing allocated, update total blocks
ldy fcbptr in fcb and correct position. ldy fcbptr in fcb and correct position.
iny iny

View File

@ -493,17 +493,13 @@ L4DFE dex set proper bits to 1
L4E1E lda #MLI.E.BADBUF buffer is in use or not legal L4E1E lda #MLI.E.BADBUF buffer is in use or not legal
sec sec
rts rts
*--------------------------------------
getbufadr tax index into global buffer table. relbuffr tax index into global buffer table.
lda buftbl-2,x lda buftbl-2,x
sta bufaddrl sta bufaddrl
lda buftbl-1,x lda buftbl-1,x
sta bufaddrh sta bufaddrh
rts beq relbuffr.8 branch if unallocated buffer space.
relbuffr jsr getbufadr preserve buffer address in 'bufaddr'
tay returns high buffer address in acc.
beq L4E54 branch if unallocated buffer space.
stz buftbl-1,x take address out of buffer list. stz buftbl-1,x take address out of buffer list.
stz buftbl-2,x (x was set up by getbufadr) stz buftbl-2,x (x was set up by getbufadr)
@ -514,15 +510,15 @@ freebuf ldx bufaddrh get hi buffer address
inx inx
inx inx
L4E43 dex drop to next lower page. .1 dex drop to next lower page.
jsr cmembit get bit and position to memtable of jsr cmembit get bit and position to memtable of
eor #$FF this page. invert mask. eor #$FF this page. invert mask.
and MEMTABL,y mark address as free space. and MEMTABL,y mark address as free space.
sta MEMTABL,y sta MEMTABL,y
cpx bufaddrh all pages freed ? cpx bufaddrh all pages freed ?
bne L4E43 no. bne .1 no.
L4E54 clc no error. relbuffr.8 clc no error.
rts rts
*-------------------------------------- *--------------------------------------
* calculate memory allocation bit position. * calculate memory allocation bit position.
@ -605,7 +601,7 @@ L4EB8 lda (usrbuf),y move all 4 pages of the buffer to
inc usrbuf+1 inc usrbuf+1
dex dex
bpl L4EB8 bpl L4EB8
cmembit.CLCRTS XDOS.SetBuf.CLCRTS
clc no errors clc no errors
L4EC7 rts L4EC7 rts
*-------------------------------------- *--------------------------------------
@ -617,9 +613,9 @@ XDOS.IsValidChar
XDOS.IsValidFirstChar XDOS.IsValidFirstChar
.DO ENHFILENAME=1 .DO ENHFILENAME=1
cmp #'.' cmp #'.'
beq cmembit.CLCRTS beq XDOS.SetBuf.CLCRTS
cmp #'_' cmp #'_'
beq cmembit.CLCRTS beq XDOS.SetBuf.CLCRTS
.FIN .FIN
cmp #'A' cmp #'A'
bcc XDOS.IsValidFirstChar.SEC bcc XDOS.IsValidFirstChar.SEC
@ -817,7 +813,7 @@ whichbit .HS 8040201008040201
ofcbtbl .HS 0C0D1819151617 ofcbtbl .HS 0C0D1819151617
inftabl .HS 1E101F2080939421 inftabl .HS 1E101F2080939421
.HS 22232418191A1B .HS 22232418191A1B
deathmsg .AS "SYS ERR-$0" deathmsg .AS -"SYS ERR-$0"
deathmsg.LEN .EQ *-deathmsg deathmsg.LEN .EQ *-deathmsg
*-------------------------------------- *--------------------------------------
XDOS.DATA .DUMMY XDOS.DATA .DUMMY

View File

@ -132,14 +132,13 @@ pathbuf .EQ $D700
XDOS.ClockDrv .EQ $D742 XDOS.ClockDrv .EQ $D742
prefixbuf .EQ $D742+125 prefixbuf .EQ $D742+125
*-------------------------------------- *--------------------------------------
FCB.MAX .EQ 8
FCBs .EQ $D800 FCBs .EQ $D800
FCB.ID .EQ 0 FCB.ID .EQ 0
FCB.DEVID .EQ 1 FCB.DEVID .EQ 1 d_dev -> d_dev+5
FCB.DIRHBLK .EQ 2 2 bytes
FCB.DIREBLK .EQ 4 2 bytes
FCB.DIRENUM .EQ 6
FCB.STYPE .EQ 7 FCB.STYPE .EQ 7
FCB.F .EQ 8 FCB.F .EQ 8
FCB.F.STMOD .EQ %00001000 FCB.F.STMOD .EQ %00001000