Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-07-17 17:18:31 +02:00
parent 238dacc597
commit 88a56a14a3
11 changed files with 158 additions and 141 deletions

Binary file not shown.

Binary file not shown.

View File

@ -514,7 +514,7 @@ findfcb ldy #$01 index to ref#
cmp FCBs,y cmp FCBs,y
bne errnoref bne errnoref
fndfcbuf lda FCBs+11,y get page address of file buffer. fndfcbuf lda FCBs+FCB.BUFID,y get page address of file buffer.
jsr getbufadr get file's address into bufaddrl,h jsr getbufadr get file's address into bufaddrl,h
ldx bufaddrh (y=fcbptr preserved) ldx bufaddrh (y=fcbptr preserved)
beq fcbdead fcb corrupted beq fcbdead fcb corrupted
@ -523,7 +523,7 @@ fndfcbuf lda FCBs+11,y get page address of file buffer.
inx inx
inx index block always 2 pages after data inx index block always 2 pages after data
stx zpt+1 stx zpt+1
lda FCBs+1,y also set up device # lda FCBs+FCB.DEVID,y also set up device #
sta devnum sta devnum
lda bufaddrl lda bufaddrl
sta datptr index and data buffers always on sta datptr index and data buffers always on
@ -531,7 +531,7 @@ fndfcbuf lda FCBs+11,y get page address of file buffer.
fndfvol tax search for associated vcb fndfvol tax search for associated vcb
lda VCBs+VCB.DEV,x lda VCBs+VCB.DEV,x
cmp FCBs+1,y is this vcb the same device? cmp FCBs+FCB.DEVID,y 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 txa adjust index to next vcb.

View File

@ -577,7 +577,7 @@ logvcb ldx vcbptr previously logged in volume?
jsr cmpvcb does vcb match vol read? jsr cmpvcb does vcb match vol read?
bcc XDOS.CheckVolName.RTS yes, do not disturb. bcc XDOS.CheckVolName.RTS yes, do not disturb.
logvcb1 ldy #$1F zero out vcb entry logvcb1 ldy #VCB-1 zero out vcb entry
L3AB2 stz VCBs,x L3AB2 stz VCBs,x
inx inx
@ -695,10 +695,8 @@ L3B2C tax
rts rts
L3B41 txa index to next vcb L3B41 txa index to next vcb
and #$E0 strip odd stuff.
* sec * sec
adc #$1F inc to next entry. adc #VCB-1
bcc L3B2C branch if more to check bcc L3B2C branch if more to check
L3B49 clc L3B49 clc

View File

@ -280,7 +280,7 @@ XDOS.GetMark ldx fcbptr index to open fcb.
ldy #$02 index to user's mark parmeter. ldy #$02 index to user's mark parmeter.
.1 lda FCBs+18,x transfer current position .1 lda FCBs+FCB.MARK,x transfer current position
sta (A3L),y to user's parameter list sta (A3L),y to user's parameter list
inx inx
iny iny
@ -304,7 +304,7 @@ XDOS.SetMark ldy #$04 index to user's desired position.
sta tposll-2,y sta tposll-2,y
bcc .2 branch if mark < eof bcc .2 branch if mark < eof
cmp FCBs+21,x cmp FCBs+FCB.EOF,x
bcc .2 branch if mark qualifies. bcc .2 branch if mark qualifies.
bne L3DFD branch if mark > eof (invalid position) bne L3DFD branch if mark > eof (invalid position)
@ -317,7 +317,7 @@ XDOS.SetMark ldy #$04 index to user's desired position.
bne .1 branch if more. bne .1 branch if more.
rdposn ldy fcbptr test to see if new position is rdposn ldy fcbptr test to see if new position is
lda FCBs+19,y within the same (current) data block. lda FCBs+FCB.MARK+1,y within the same (current) data block.
and #$FE and #$FE
sta scrtch sta scrtch
lda tposlh middle byte of new position lda tposlh middle byte of new position
@ -330,12 +330,12 @@ rdposn ldy fcbptr test to see if new position is
bcs L3E44 of current position. bcs L3E44 of current position.
lda tposhi make sure within the same 64k. lda tposhi make sure within the same 64k.
cmp FCBs+20,y cmp FCBs+FCB.MARK+2,y
bne L3E44 branch if not. bne L3E44 branch if not.
jmp svmark if so, adj fcb, position ptr and return. jmp svmark if so, adj fcb, position ptr and return.
L3E44 lda FCBs+7,y determine file type for positioning. L3E44 lda FCBs+FCB.STYPE,y determine file type for positioning.
beq L3E50 0 = invalid file type. beq L3E50 0 = invalid file type.
cmp #$04 tree class file? cmp #$04 tree class file?
@ -345,13 +345,13 @@ L3E44 lda FCBs+7,y determine file type for positioning.
L3E50 ldy #$A4 clear illegal filetype entry in fcb L3E50 ldy #$A4 clear illegal filetype entry in fcb
sta FCBs,y sta FCBs,y
lda #$43 and report error lda #MLI.E.BADREF and report error
sec sec
rts rts
L3E59 lda FCBs+7,y use storage type as # of index levels L3E59 lda FCBs+FCB.STYPE,y use storage type as # of index levels
sta levels since 1=seed, 2=sapling, 3=tree. sta levels since 1=seed, 2=sapling, 3=tree.
lda FCBs+8,y lda FCBs+FCB.F,y
and #$40 if previous data was modified then and #$40 if previous data was modified then
beq L3E6B disk must be updated. beq L3E6B disk must be updated.
@ -360,7 +360,7 @@ L3E59 lda FCBs+7,y use storage type as # of index levels
bcs L3ED4 if error. bcs L3ED4 if error.
L3E6B ldy fcbptr test to see if current index block L3E6B ldy fcbptr test to see if current index block
lda FCBs+20,y is usable by checking if new lda FCBs+FCB.MARK+2,y is usable by checking if new
and #$FE position is within 128k of the and #$FE position is within 128k of the
sta scrtch beginning of current sapling level sta scrtch beginning of current sapling level
lda tposhi chunk. lda tposhi chunk.
@ -380,13 +380,13 @@ L3E89 lda tposlh is new position < 512 ?
ora tposhi ora tposhi
bne L3EEF no, mark both data and index block as bne L3EEF no, mark both data and index block as
lda FCBs+12,y unallocated. 1st block is only block lda FCBs+FCB.1stBLK,y unallocated. 1st block is only block
sta bloknml and it's data. sta bloknml and it's data.
lda FCBs+13,y high block address. lda FCBs+FCB.1stBLK+1,y high block address.
jmp rnewpos go read in block and set statuses. jmp rnewpos go read in block and set statuses.
L3E9D lda FCBs+8,y check to see if previous index block L3E9D lda FCBs+FCB.F,y check to see if previous index block
and #$80 was modified. and #FCB.F.IBLKMOD was modified.
beq L3EA9 read in over it if current up to date. beq L3EA9 read in over it if current up to date.
jsr wfcbidx go update index on disk (fcb block addr) jsr wfcbidx go update index on disk (fcb block addr)
@ -413,9 +413,9 @@ L3EA9 ldx levels be sure there is a top index
ldy fcbptr save newly loaded index block's address. ldy fcbptr save newly loaded index block's address.
lda bloknml lda bloknml
sta FCBs+14,y sta FCBs+FCB.IBLK,y
lda bloknml+1 lda bloknml+1
sta FCBs+15,y sta FCBs+FCB.IBLK+1,y
bcc datlevel branch always bcc datlevel branch always
L3ED4 rts L3ED4 rts
@ -464,8 +464,8 @@ datlevel lda tposhi get block address of data block
dec zpt+1 dec zpt+1
L3F18 ldy fcbptr set status to show what's missing L3F18 ldy fcbptr set status to show what's missing
ora FCBs+8,y ora FCBs+FCB.F,y
sta FCBs+8,y sta FCBs+FCB.F,y
lsr discard bit that says data block lsr discard bit that says data block
lsr unallocated because carry indicates if lsr unallocated because carry indicates if
jsr zipdata index block is invalid and needs to be jsr zipdata index block is invalid and needs to be
@ -518,10 +518,10 @@ svmark ldy fcbptr update position in fcb
iny iny
iny iny
ldx #$02 ldx #$02
L3F68 lda FCBs+18,y save old mark in case calling routine L3F68 lda FCBs+FCB.MARK,y save old mark in case calling routine
sta oldmark,x fails later. sta oldmark,x fails later.
lda tposll,x lda tposll,x
sta FCBs+18,y sta FCBs+FCB.MARK,y
dey dey
dex move 3 byte position marker dex move 3 byte position marker
bpl L3F68 bpl L3F68
@ -536,9 +536,9 @@ L3F68 lda FCBs+18,y save old mark in case calling routine
L3F86 rts carry set if error L3F86 rts carry set if error
clrstats ldy fcbptr clear allocation states for data block clrstats ldy fcbptr clear allocation states for data block
lda FCBs+8,y and both levels of indexes/ lda FCBs+FCB.F,y and both levels of indexes/
and #$F8 and #$F8
sta FCBs+8,y indicates that either they exist now sta FCBs+FCB.F,y indicates that either they exist now
rts or unnecessary for current position. rts or unnecessary for current position.
dirmark cmp #$0D is it a directory ? dirmark cmp #$0D is it a directory ?
@ -550,7 +550,7 @@ dirmark cmp #$0D is it a directory ?
L3F9C lda scrtch recover results of previous subtraction. L3F9C lda scrtch recover results of previous subtraction.
lsr use difference as counter for how many lsr use difference as counter for how many
sta cntent blocks must be read to get to new pos'n. sta cntent blocks must be read to get to new pos'n.
lda FCBs+19,y test for positive direction lda FCBs+FCB.MARK+1,y test for positive direction
cmp tposlh indicated by carry. cmp tposlh indicated by carry.
bcc L3FB9 if set, position forward. otherwise, bcc L3FB9 if set, position forward. otherwise,
@ -597,9 +597,9 @@ rfcbdat lda #$01 read command
ldy fcbptr ldy fcbptr
lda bloknml lda bloknml
sta FCBs+16,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+17,y sta FCBs+FCB.DBLK+1,y
L3FF2 rts L3FF2 rts
rfcbidx lda #$01 prepare to read index block : read command rfcbidx lda #$01 prepare to read index block : read command
@ -610,10 +610,12 @@ rfcbidx lda #$01 prepare to read index block : read command
ldy fcbptr ldy fcbptr
lda bloknml lda bloknml
sta FCBs+14,y save block address of this index in fcb sta FCBs+FCB.IBLK,y save block address of this index in fcb
lda bloknml+1 lda bloknml+1
sta FCBs+15,y sta FCBs+FCB.IBLK+1,y
clc
* clc
L400C rts L400C rts
wfcbfst jsr upbmap update the bitmap and write file's 1st block. wfcbfst jsr upbmap update the bitmap and write file's 1st block.
@ -633,7 +635,7 @@ rfcbfst lda #$01 read command.
dofileio sta A4L command dofileio sta A4L command
lda FCBs,y get disk block address from fcb. lda FCBs,y get disk block address from fcb.
sta bloknml block 0 not legal sta bloknml block 0 not legal
cmp FCBs+1,y cmp FCBs+FCB.DEVID,y
bne L4031 bne L4031
cmp #$00 are both bytes 0 ? cmp #$00 are both bytes 0 ?
bne L4031 no, continue request bne L4031 no, continue request
@ -641,17 +643,18 @@ dofileio sta A4L command
lda #$0C otherwise, allocation error. lda #$0C otherwise, allocation error.
jsr sysdeath doesn't return... jsr sysdeath doesn't return...
L4031 lda FCBs+1,y high address of disk block L4031 lda FCBs+FCB.DEVID,y high address of disk block
sta bloknml+1 sta bloknml+1
fileio1 php no interrupts fileio1 php no interrupts
sei sei
lda $00,x get memory address of buffer from lda $00,x get memory address of buffer from
sta buf page zero pointed to by x register sta buf page zero pointed to by x register
lda $01,x lda $01,x
sta buf+1 and pass address to device handler sta buf+1 and pass address to device handler
ldy fcbptr ldy fcbptr
lda FCBs+1,y lda FCBs+FCB.DEVID,y
sta devnum along with device #. sta devnum along with device #.
lda #$FF also, set to indicate reg call made to lda #$FF also, set to indicate reg call made to
sta ioaccess device handler. sta ioaccess device handler.
@ -687,10 +690,12 @@ wfcbidx jsr upbmap update bitmap.
lda #$02 lda #$02
jsr dofileio go write out index block. jsr dofileio go write out index block.
bcs L4096 if errors. bcs L4096 if errors.
lda #$7F mark index status as current. lda #$7F mark index status as current.
L408D ldy fcbptr change status byte to reflect L408D ldy fcbptr change status byte to reflect
and FCBs+8,y successful disk file update. and FCBs+FCB.F,y successful disk file update.
sta FCBs+8,y (carry is unaffected) sta FCBs+FCB.F,y (carry is unaffected)
L4096 rts L4096 rts
*-------------------------------------- *--------------------------------------
XDOS.Open jsr findfile look up the file. XDOS.Open jsr findfile look up the file.
@ -740,7 +745,7 @@ L40CB lda d_dev-1,x move ownership info.
lsr lsr
lsr lsr
tax save in x for later comparison tax save in x for later comparison
sta FCBs+7,y and in fcb for future access. 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.
@ -748,7 +753,7 @@ L40CB lda d_dev-1,x move ownership info.
and #$01 read enabled bit and #$01 read enabled bit
L40EB sta FCBs+9,y L40EB sta FCBs+FCB.ACCESS,y
and #$02 check for write enabled request. and #$02 check for write enabled request.
beq L40F7 branch for open as read-only beq L40F7 branch for open as read-only
@ -781,12 +786,12 @@ L4101 sta bloknml+1 of file and current usage count.
jsr fndfcbuf rtn addr of bufs in data & index ptrs. jsr fndfcbuf rtn addr of bufs in data & index ptrs.
lda flevel mark level at which lda flevel mark level at which
sta FCBs+27,y file was opened. sta FCBs+FCB.FLEVEL,y file was opened.
lda FCBs+7,y file must be positioned at beginning. lda FCBs+FCB.STYPE,y 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+20,y a valid position with preloaded data, sta FCBs+FCB.MARK+2,y 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
@ -800,7 +805,7 @@ L413C sta tposll,y
L4147 pha save error code. L4147 pha save error code.
ldy fcbptr free buffer space. ldy fcbptr free buffer space.
lda FCBs+11,y lda FCBs+FCB.BUFID,y
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.
@ -864,7 +869,7 @@ L41A9 lda FCBs,y all bytes must match to say that it's
bne L41A9 loop to check all owner info. bne L41A9 loop to check all owner info.
inc totent file is already open, now see inc totent file is already open, now see
lda FCBs+9,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

View File

@ -12,11 +12,11 @@ XDOS.Read jsr mvdbufr xfer buffer address and request count
bcc L4205 branch if result mark < eof. adjust bcc L4205 branch if result mark < eof. adjust
ldy fcbptr request to read until just before eof. ldy fcbptr request to read until just before eof.
lda FCBs+21,y result = (eof-1) - position lda FCBs+FCB.EOF,y result = (eof-1) - position
sbc tposll sbc tposll
sta cbytes sta cbytes
sta rwreql sta rwreql
lda FCBs+22,y lda FCBs+FCB.EOF+1,y
sbc tposlh sbc tposlh
sta cbytes+1 sta cbytes+1
sta rwreqh sta rwreqh
@ -158,12 +158,13 @@ preprw ldy fcbptr adj pointer to user's buffer to make
sta usrbuf sta usrbuf
bcs L42E9 if no adjustment to hi address needed bcs L42E9 if no adjustment to hi address needed
dec usrbuf+1 dec usrbuf+1
L42E9 lda FCBs+31,y test for new line enabled.
L42E9 lda FCBs+FCB.NLMASK,y test for new line enabled.
clc clc
beq L42F9 if new line not enabled. beq L42F9 if new line not enabled.
sec carry indicates new line enabled sec carry indicates new line enabled
sta nlmask sta nlmask
lda FCBs+10,y move newline character to more lda FCBs+FCB.NLBYTE,y move newline character to more
sta nlchar accesible spot. sta nlchar accesible spot.
L42F9 ldy tposll index to 1st data. L42F9 ldy tposll index to 1st data.
lda datptr reset low order of position pointer to lda datptr reset low order of position pointer to
@ -279,10 +280,10 @@ dread jsr rdposn
ldy #$00 provide dummy back pointer for future ldy #$00 provide dummy back pointer for future
ldx fcbptr re-position. x = hi byte of last block ldx fcbptr re-position. x = hi byte of last block
L43A6 lda FCBs+16,x L43A6 lda FCBs+FCB.DBLK,x
sta (datptr),y sta (datptr),y
stz FCBs+16,x mark current block as impossible stz FCBs+FCB.DBLK,x mark current block as impossible
inx inx
iny inc indexes to do both hi and low bytes iny inc indexes to do both hi and low bytes
cpy #$02 cpy #$02
@ -302,7 +303,7 @@ mvcbytes ldy #$04 move request count to a more accessable location
sta cbytes+1 sta cbytes+1
sta rwreqh sta rwreqh
ldy fcbptr return y = val(fcbptr), ldy fcbptr return y = val(fcbptr),
lda FCBs+9,y a = attributes lda FCBs+FCB.ACCESS,y a = attributes
clc and carry clear... clc and carry clear...
rts rts
@ -314,7 +315,7 @@ mvdbufr ldy #$02 move the pointer to user's buffer
sta usrbuf+1 sta usrbuf+1
gfcbstyp ldy fcbptr return storage type gfcbstyp ldy fcbptr return storage type
lda FCBs+7,y lda FCBs+FCB.STYPE,y
rts rts
* this subroutine adds the requested byte count to mark and returns sum * this subroutine adds the requested byte count to mark and returns sum
@ -327,7 +328,7 @@ gfcbstyp ldy fcbptr return storage type
calcmrk ldx #$00 calcmrk ldx #$00
ldy fcbptr ldy fcbptr
clc clc
L43EE lda FCBs+18,y L43EE lda FCBs+FCB.MARK,y
sta tposll,x sta tposll,x
sta oldmark,x sta oldmark,x
adc cbytes,x adc cbytes,x
@ -341,7 +342,7 @@ L43EE lda FCBs+18,y
bne L43EE always. bne L43EE always.
eoftest lda scrtch,x new mark in scrtch. eoftest lda scrtch,x new mark in scrtch.
cmp FCBs+21,y is new position > eof ? cmp FCBs+FCB.EOF,y is new position > eof ?
bcc L4414 no, proceed. bcc L4414 no, proceed.
bne L4414 yes, adjust 'cbytes' request bne L4414 yes, adjust 'cbytes' request
@ -354,9 +355,9 @@ L4414 rts
werreof jsr plus2fcb reset eof to pre-error position. werreof jsr plus2fcb reset eof to pre-error position.
L4418 lda oldeof,x place oldeof back into fcb L4418 lda oldeof,x place oldeof back into fcb
sta FCBs+21,y sta FCBs+FCB.EOF,y
lda oldmark,x also reset mark to last best lda oldmark,x also reset mark to last best
sta FCBs+18,y write position sta FCBs+FCB.MARK,y write position
sta scrtch,x and copy mark to scrtch for test of sta scrtch,x and copy mark to scrtch for test of
dey eof less than mark. dey eof less than mark.
dex dex
@ -369,12 +370,12 @@ L4418 lda oldeof,x place oldeof back into fcb
wadjeof jsr plus2fcb get y=fcbptr+2, x=2, a=y. wadjeof jsr plus2fcb get y=fcbptr+2, x=2, a=y.
L4434 lda FCBs+21,y copy eof to old eof L4434 lda FCBs+FCB.EOF,y copy eof to old eof
sta oldeof,x sta oldeof,x
bcc L4442 and if carry set... bcc L4442 and if carry set...
lda scrtch,x then copy scrtch to fcb's eof. lda scrtch,x then copy scrtch to fcb's eof.
sta FCBs+21,y sta FCBs+FCB.EOF,y
L4442 dey L4442 dey
dex copy all 3 bytes dex copy all 3 bytes
@ -457,7 +458,7 @@ L44B8 jsr alcwblk go allocate for data block.
jsr gfcbstat clear allocation required bits in status jsr gfcbstat clear allocation required bits in status
ora #$80 but first indicate index block is dirty. ora #$80 but first indicate index block is dirty.
and #$F8 and #$F8
sta FCBs+8,y sta FCBs+FCB.F,y
lda tposhi calculate position within index block. lda tposhi calculate position within index block.
lsr lsr
lda tposlh lda tposlh
@ -471,9 +472,9 @@ L44B8 jsr alcwblk go allocate for data block.
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+16,y is allocated. sta FCBs+FCB.DBLK,y is allocated.
txa get high address again. txa get high address again.
sta FCBs+17,y sta FCBs+FCB.DBLK+1,y
L44E9 jsr preprw L44E9 jsr preprw
jsr wrtpart jsr wrtpart
@ -541,7 +542,7 @@ L4549 sty tposll save low position
php save statuses php save statuses
jsr gfcbstat jsr gfcbstat
ora #$50 ora #$50
sta FCBs+8,y sta FCBs+FCB.F,y
clc adjust user's low buffer address clc adjust user's low buffer address
lda tposll lda tposll
adc usrbuf adc usrbuf
@ -583,9 +584,9 @@ L457A jsr alcwblk get another block address for the sap
sta (zpt),y save hi address sta (zpt),y save hi address
dec zpt+1 dec zpt+1
ldy fcbptr make newly allocated block the current ldy fcbptr make newly allocated block the current
sta FCBs+15,y index block. sta FCBs+FCB.IBLK+1,y index block.
txa txa
sta FCBs+14,y sta FCBs+FCB.IBLK,y
jsr wfcbfst save new top of tree jsr wfcbfst save new top of tree
bcs L45B1 bcs L45B1
@ -604,18 +605,18 @@ swapdown jsr alcwblk make current seed into a sapling, allocate a block befo
bcs L45F6 return errors. bcs L45F6 return errors.
ldy fcbptr get previous first block ldy fcbptr get previous first block
lda FCBs+12,y address into index block. lda FCBs+FCB.1stBLK,y address into index block.
pha save temporarily while swapping in new pha save temporarily while swapping in new
lda scrtch top index. get new block address (low) lda scrtch top index. get new block address (low)
tax tax
sta FCBs+12,y sta FCBs+FCB.1stBLK,y
lda FCBs+13,y lda FCBs+FCB.1stBLK+1,y
pha pha
lda scrtch+1 and high address too lda scrtch+1 and high address too
sta FCBs+13,y sta FCBs+FCB.1stBLK+1,y
sta FCBs+15,y make new top also the current index in sta FCBs+FCB.IBLK+1,y make new top also the current index in
txa memory. get low address again. txa memory. get low address again.
sta FCBs+14,y sta FCBs+FCB.IBLK,y
inc zpt+1 make previous the 1st entry in sub index inc zpt+1 make previous the 1st entry in sub index
pla pla
sta (zpt) sta (zpt)
@ -626,11 +627,12 @@ swapdown jsr alcwblk make current seed into a sapling, allocate a block befo
bcs L45F6 if error. bcs L45F6 if error.
jsr gfcbstyp now adjust storage type by adding 1 jsr gfcbstyp now adjust storage type by adding 1
adc #$01 (seed becomes sapling becomes tree) * adc #$01 (seed becomes sapling becomes tree)
sta FCBs+7,y inc
lda FCBs+8,y mark storage type modified sta FCBs+FCB.STYPE,y
ora #$08 lda FCBs+FCB.F,y mark storage type modified
sta FCBs+8,y ora #FCB.F.STMOD
sta FCBs+FCB.F,y
clc no error clc no error
L45F6 rts L45F6 rts
@ -640,15 +642,17 @@ alcwblk jsr alc1blk
jsr gfcbstat mark usage as modified jsr gfcbstat mark usage as modified
ora #$10 ora #FCB.F.UMOD
sta FCBs+8,y sta FCBs+FCB.F,y
lda FCBs+24,y inc current usage count by 1
clc lda FCBs+FCB.UBLK,y inc current usage count by 1
adc #$01 inc
sta FCBs+24,y sta FCBs+FCB.UBLK,y
lda FCBs+25,y bne L4615
adc #$00
sta FCBs+25,y lda FCBs+FCB.UBLK+1,y
inc
sta FCBs+FCB.UBLK+1,y
L4615 clc no error L4615 clc no error
L4616 rts L4616 rts
@ -657,7 +661,7 @@ tstwprot jsr gfcbstat check for 'never been modified' condition
and #$F0 and #$F0
bne L4615 ordinary rts if known write ok. bne L4615 ordinary rts if known write ok.
lda FCBs+1,y get file's dev #. lda FCBs+FCB.DEVID,y 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

@ -10,7 +10,7 @@ XDOS.Close ldy #$01 close all ?
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 tay get the level at which the file
lda FCBs+27,y was opened. lda FCBs+FCB.FLEVEL,y 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.
@ -40,14 +40,14 @@ L4683 jsr flush1 flush file 1st (including updating
bcs L46B6 bitmap). branch if errors. bcs L46B6 bitmap). branch if errors.
close2 ldy fcbptr close2 ldy fcbptr
lda FCBs+11,y release file buffer lda FCBs+FCB.BUFID,y release file buffer
jsr relbuffr jsr relbuffr
bcs L46B6 bcs L46B6
lda #$00 lda #$00
ldy fcbptr ldy fcbptr
sta FCBs,y free fcb too sta FCBs,y free fcb too
lda FCBs+1,y lda FCBs+FCB.DEVID,y
sta devnum go look for associated vcb sta devnum go look for associated vcb
jsr fnddvcb jsr fnddvcb
@ -98,11 +98,11 @@ flush1 stz cferr for normal refnum flush, clear global error.
jsr findfcb setup pointer to fcb user references. jsr findfcb setup pointer to fcb user references.
bcs L46E6 return any errors. bcs L46E6 return any errors.
L46F1 lda FCBs+9,y test to see if file is modified. L46F1 lda FCBs+FCB.ACCESS,y 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+28,y has eof been modified ? lda FCBs+FCB.DIRTY,y has eof been modified ?
bmi L4704 if yes. bmi L4704 if yes.
jsr gfcbstat has data been modified ? jsr gfcbstat has data been modified ?
@ -156,13 +156,14 @@ L4755 jsr entcalc buffer. 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 ldy fcbptr 'work space'. update 'blocks used' count
lda FCBs+24,y lda FCBs+FCB.UBLK,y
sta d_usage sta d_usage
lda FCBs+25,y lda FCBs+FCB.UBLK+1,y
sta d_usage+1 sta d_usage+1
ldx #$00 and move in end of file mark whether ldx #$00 and move in end of file mark whether
L476C lda FCBs+21,y needed or not. L476C lda FCBs+FCB.EOF,y needed or not.
sta d_eof,x sta d_eof,x
inx inx
cpx #$03 move all 3 bytes cpx #$03 move all 3 bytes
@ -173,7 +174,7 @@ L476C lda FCBs+21,y needed or not.
iny since the file first opened. iny since the file first opened.
bne L476C branch always. bne L476C branch always.
L4780 lda FCBs+5,y the last thing to update is storage L4780 lda FCBs+FCB.STYPE-2,y 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
@ -187,9 +188,9 @@ L4780 lda FCBs+5,y the last thing to update is storage
bcs glberr error. bcs glberr error.
ldy fcbptr mark ldy fcbptr mark
lda FCBs+28,y fcb/directory lda FCBs+FCB.DIRTY,y fcb/directory
and #$7F as and #$7F as
sta FCBs+28,y undirty. sta FCBs+FCB.DIRTY,y undirty.
lda d_dev see if bitmap should be written. lda d_dev see if bitmap should be written.
cmp bmadev is it in same as current file ? cmp bmadev is it in same as current file ?
bne L47B2 yes, put it on the disk if necessary. bne L47B2 yes, put it on the disk if necessary.
@ -217,7 +218,7 @@ L47C1 pla
rts rts
gfcbstat ldy fcbptr index to fcb. gfcbstat ldy fcbptr index to fcb.
lda FCBs+8,y return status byte. lda FCBs+FCB.F,y return status byte.
rts rts
L47CA lda #MLI.E.LOCKED access error L47CA lda #MLI.E.LOCKED access error
@ -233,7 +234,7 @@ XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed.
asl asl
asl asl
sta stortyp may be used later. sta stortyp may be used later.
lda FCBs+9,y lda FCBs+FCB.ACCESS,y
and #$02 is write enabled to set new eof ? and #$02 is write enabled to set new eof ?
beq L47CA no, access error. beq L47CA no, access error.
@ -245,7 +246,7 @@ XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed.
iny upon contraction. iny upon contraction.
ldx #$02 all 3 bytes of the eof ldx #$02 all 3 bytes of the eof
L47EF lda FCBs+21,y L47EF lda FCBs+FCB.EOF,y
sta oldeof,x sta oldeof,x
dey dey
dex dex
@ -276,7 +277,7 @@ eofset ldy #$04
inx inx
L481C lda (A3L),y L481C lda (A3L),y
sta FCBs+21,x sta FCBs+FCB.EOF,x
dex dex
dey dey
cpy #$02 all 3 bytes moved ? cpy #$02 all 3 bytes moved ?
@ -298,7 +299,7 @@ purge jsr flush1 make sure file is current
iny iny
ldx #$02 ldx #$02
L4840 lda FCBs+18,y L4840 lda FCBs+FCB.MARK,y
cmp tposll,x compare until not equal or carry clear. cmp tposll,x compare until not equal or carry clear.
bcc L485F branch if eof > mark. bcc L485F branch if eof > mark.
@ -312,7 +313,7 @@ L484E ldy fcbptr
ldx #$00 ldx #$00
L4853 lda tposll,x fake position, correct position will L4853 lda tposll,x fake position, correct position will
sta FCBs+18,y be made below... sta FCBs+FCB.MARK,y be made below...
iny iny
inx inx
cpx #$03 move all 3 bytes cpx #$03 move all 3 bytes
@ -349,9 +350,9 @@ L485F jsr tkfrecnt force free block count before releasing
L489F sta dseed+1 L489F sta dseed+1
L48A2 ldy fcbptr also must pass file's 1st block address. L48A2 ldy fcbptr also must pass file's 1st block address.
lda FCBs+12,y lda FCBs+FCB.1stBLK,y
sta firstbl sta firstbl
lda FCBs+13,y lda FCBs+FCB.1stBLK+1,y
sta firstbh sta firstbh
stz deblock lastly, initialize # of blocks to stz deblock lastly, initialize # of blocks to
stz deblock+1 be free'd. stz deblock+1 be free'd.
@ -363,10 +364,10 @@ L48A2 ldy fcbptr also must pass file's 1st block address.
ldx #$00 ldx #$00
L48C2 lda firstbl,x L48C2 lda firstbl,x
sta FCBs+12,y move in possible new first file block sta FCBs+FCB.1stBLK,y move in possible new first file block
lda FCBs+24,y address. adjust usage count also lda FCBs+FCB.UBLK,y address. adjust usage count also
sbc deblock,x sbc deblock,x
sta FCBs+24,y sta FCBs+FCB.UBLK,y
iny iny
inx inx
txa txa
@ -379,18 +380,19 @@ L48C2 lda firstbl,x
lsr lsr
lsr lsr
ldy fcbptr and save it in fcb. ldy fcbptr and save it in fcb.
sta FCBs+7,y sta FCBs+FCB.STYPE,y
jsr clrstats make it look as though position has 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
iny iny
ldx #$02 ldx #$02
L48F2 lda FCBs+18,y tell 'rdposn' to go to correct L48F2 lda FCBs+FCB.MARK,y tell 'rdposn' to go to correct
sta tposll,x sta tposll,x
eor #$80 position from incorrect place. eor #$80 position from incorrect place.
sta FCBs+18,y sta FCBs+FCB.MARK,y
dey dey
dex dex
bpl L48F2 bpl L48F2
@ -428,7 +430,7 @@ XDOS.GetEOF ldx fcbptr index to end of file mark
ldy #$02 and index to user's call parameters ldy #$02 and index to user's call parameters
L4924 lda FCBs+21,x L4924 lda FCBs+FCB.EOF,x
sta (A3L),y sta (A3L),y
inx inx
iny iny
@ -442,11 +444,11 @@ XDOS.NewLine ldy #$02 adjust newline status for open file.
lda (A3L),y on or off ? lda (A3L),y on or off ?
ldx fcbptr it will be 0 if off. ldx fcbptr it will be 0 if off.
sta FCBs+31,x set new line mask sta FCBs+FCB.NLMASK,x set new line mask
iny iny
lda (A3L),y and move in 'new-line' byte lda (A3L),y and move in 'new-line' byte
sta FCBs+10,x sta FCBs+FCB.NLBYTE,x
clc no error possible clc no error possible
rts rts
@ -537,10 +539,9 @@ L49CF rts
L49D0 ldy #$0B L49D0 ldy #$0B
lda (A3L),y was clock null input ? lda (A3L),y was clock null input ?
beq L49D9 if yes. bne XDOS.SetFileInfoEx.8
jmp drevise1 end by updating directory. jmp drevise update with clock also...
L49D9 jmp drevise update with clock also...
*-------------------------------------- *--------------------------------------
XDOS.SetFileInfoEx XDOS.SetFileInfoEx
jsr findfile jsr findfile
@ -554,7 +555,7 @@ XDOS.SetFileInfoEx
dey dey
dex dex
bpl .2 bpl .2
XDOS.SetFileInfoEx.8
jmp drevise1 jmp drevise1
*-------------------------------------- *--------------------------------------
XDOS.GetFileInfoEx XDOS.GetFileInfoEx

View File

@ -142,9 +142,9 @@ fcbused pha mark fcb as dirty so the directory will be flushed on 'flush
tya save regs. tya save regs.
pha pha
ldy fcbptr ldy fcbptr
lda FCBs+28,y fetch current fcb dirty byte. lda FCBs+FCB.DIRTY,y fetch current fcb dirty byte.
ora #$80 mark fcb as dirty. ora #$80 mark fcb as dirty.
sta FCBs+28,y save it back sta FCBs+FCB.DIRTY,y save it back
pla and restore regs. pla and restore regs.
tay tay
pla pla
@ -477,7 +477,7 @@ L4DFE dex set proper bits to 1
ldy fcbptr calculate buffer number ldy fcbptr calculate buffer number
lda FCBs,y lda FCBs,y
asl buffer number = (entnum) * 2. asl buffer number = (entnum) * 2.
sta FCBs+11,y save it in fcb. sta FCBs+FCB.BUFID,y save it in fcb.
tax use entnum * 2 as index to global tax use entnum * 2 as index to global
lda datptr+1 buffer addr tables. get addr already lda datptr+1 buffer addr tables. get addr already
sta buftbl-1,x validated as good. store hi addr sta buftbl-1,x validated as good. store hi addr

View File

@ -763,6 +763,8 @@ XRW.Seek ldx XRW.UnitIndex
nop nop
nop nop
lda IO.D2.Ph0On,y lda IO.D2.Ph0On,y
nop
nop
jsr XRW.WaitSeekTime jsr XRW.WaitSeekTime

View File

@ -139,16 +139,24 @@ prefixbuf .EQ $D742+125
FCBs .EQ $D800 FCBs .EQ $D800
FCB.ID .EQ 0 FCB.ID .EQ 0
FCB.DEVID .EQ 1 FCB.DEVID .EQ 1
FCB.MARK .EQ 2
FCB.STYPE .EQ 7 FCB.STYPE .EQ 7
FCB.F .EQ 8 FCB.F .EQ 8
FCB.F.STMOD .EQ 8 FCB.F.STMOD .EQ %00001000
FCB.F.UMOD .EQ %00010000
FCB.F.IBLKMOD .EQ %10000000
FCB.ACCESS .EQ 9
FCB.NLBYTE .EQ 10 FCB.NLBYTE .EQ 10
FCB.BUFID .EQ 11 FCB.BUFID .EQ 11
FCB.IBLK .EQ 14 FCB.1stBLK .EQ 12 2 bytes
FCB.IBLK .EQ 14 2 bytes
FCB.DBLK .EQ 16 2 bytes
FCB.MARK .EQ 18 3 bytes
FCB.EOF .EQ 21 3 bytes FCB.EOF .EQ 21 3 bytes
FCB.UBLK .EQ 24 2 bytes
FCB.FLEVEL .EQ 27 FCB.FLEVEL .EQ 27
FCB.DIRTY .EQ 28
FCB.NLMASK .EQ 31 FCB.NLMASK .EQ 31
* *
FCB .EQ 32 FCB .EQ 32
@ -159,7 +167,6 @@ VCB.OFCNT .EQ 17
VCB.BMAP .EQ 18 VCB.BMAP .EQ 18
VCB.TBLK .EQ 20 VCB.TBLK .EQ 20
VCB.FBLK .EQ 22 VCB.FBLK .EQ 22
*VCB.ROOT .EQ 24
VCB.BMAPIDX .EQ 24 VCB.BMAPIDX .EQ 24
* *
VCB .EQ 32 VCB .EQ 32

View File

@ -33,6 +33,7 @@ RW.Init >LDYAI RW.MSG
rts rts
.10 jsr RW.Detect2 .10 jsr RW.Detect2
bcc .1 bcc .1
>LDYAI RW.MSG.KO1 >LDYAI RW.MSG.KO1
jsr PrintFYA jsr PrintFYA
@ -94,7 +95,6 @@ RW.Detect2 php
bpl .1 bpl .1
lda #0 lda #0
.2 sta RWBankSelect .2 sta RWBankSelect
*-------------------------------------- *--------------------------------------
* Added after David Finnigan from macgui.com testing sessions * Added after David Finnigan from macgui.com testing sessions
* *
@ -120,7 +120,6 @@ RW.Detect2 php
* *
* to address possibly a timing issue with Accelerators * to address possibly a timing issue with Accelerators
*-------------------------------------- *--------------------------------------
cmp 0 cmp 0
bne .4 bne .4
eor #$FF eor #$FF
@ -145,9 +144,11 @@ RW.Detect2 php
sta CLRALTZP sta CLRALTZP
plp plp
lda RW.PGCNT lda RW.PGCNT
beq .9 bmi .9
clc clc
rts rts
.9 sec .9 sec
rts rts
*-------------------------------------- *--------------------------------------
@ -357,8 +358,7 @@ DRV.COMMAND .EQ $42
DRV.BUFF .EQ $44 DRV.BUFF .EQ $44
DRV.BLKNUM .EQ $46 DRV.BLKNUM .EQ $46
*-------------------------------------- *--------------------------------------
RWDRV.B.START RWDRV.B.START .PH $FF00
.PH $FF00
RWDRV.START cld ProDOS will check that byte!!! RWDRV.START cld ProDOS will check that byte!!!
ldy DRV.COMMAND 0 = Status ? ldy DRV.COMMAND 0 = Status ?
beq RMDRV.CMDSTATUS beq RMDRV.CMDSTATUS