ProDOS.FX 8M : Bug fixes for QUIT code

This commit is contained in:
burniouf 2023-11-05 16:26:06 +01:00
parent e65065228c
commit 0728260b06
9 changed files with 256 additions and 225 deletions

Binary file not shown.

Binary file not shown.

View File

@ -118,9 +118,9 @@ S.FIEX.ACL.MOD .EQ 46
*
S.FIEX .EQ 48
*--------------------------------------
TBX.MemReset .EQ 0
TBX.EnumBlk .EQ 2
TBX.EnumNext .EQ 4
TBX.EnumBlk .EQ 0
TBX.EnumNext .EQ 1
TBX.MemReset .EQ 2
*--------------------------------------
MLI .EQ $BF00
GP.DISPATCH .EQ $BF03

View File

@ -36,9 +36,16 @@ GP.START1 jmp GP.MLIENTRY MLI Entry point
*--------------------------------------
php GP.MLIENTRY
sei
jmp GP.MLICONT
bra GP.MLICONT
*--------------------------------------
GP.TOOLBOX bit IO.RRAMWRAMBNK1
.DO AUXLC=1
sta IO.SETALTZP
.FIN
jmp XDOS.TBX
*--------------------------------------
.LIST ON
@ -75,7 +82,18 @@ GP.IRQVs .HS 0000 int #1
.HS 0000 int #3
.HS 0000 int #4
*--------------------------------------
.BS 8
.DO AUXLC=1
GP.TBXEXIT sta IO.CLRALTZP
sta IO.RROMBNK2
rts
.FIN
.LIST ON
GP.FREE2 .EQ $BF90-*
.LIST OFF
.BS GP.FREE2
*--------------------------------------
.HS 0000 GP.DATE
.HS 0000 GP.TIME
@ -162,13 +180,16 @@ GP.MLIEXIT.PCL ldx #$FF SELF MODIFIED
GP.MLIEXIT.X ldx #$FF SELF MODIFIED
GP.MLIEXIT.Y ldy #$FF SELF MODIFIED
bra GP.MLIEXITX2
GP.SELJMP sta IO.CLRALTZP
jmp $1000
.FIN
*--------------------------------------
.LIST ON
GP.FREE2 .EQ $BFEB-*
GP.FREE3 .EQ $BFEB-*
.LIST OFF
.BS GP.FREE2
.BS GP.FREE3
*--------------------------------------
GP.IRQV bit IO.RRAMWRAMBNK1 ***NEW ROM ONLY IRQ $fffe > $Cxxx space***
bit IO.RRAMWRAMBNK1 Entry used when rom/mainLC/auxLC
@ -190,5 +211,5 @@ GP.LEN .EQ *-GP.START
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.gp
LOAD usr/src/prodos.fx/pdos8m.s
LOAD usr/src/prodos.fx/prodos.s
ASM

View File

@ -51,7 +51,7 @@ XDOS.VCB0 .EQ XDOS.VCBs+6 range $D906-$DA00
* ZERO Page
*--------------------------------------
zpt .EQ $48 highly used zero page index pointer
datptr .EQ $4A ptr to data area of buffer.
ZP.DataPtr .EQ $4A ptr to data area of buffer.
sos .EQ $4C sos buffer pointer.
usrbuf .EQ $4E data ptr in user buffer.
*--------------------------------------
@ -646,7 +646,7 @@ XDOS.GetFCBBufX lda XDOS.FCBs+FCB.BUFID,x get page address of file buffer.
beq fcbdead fcb corrupted
sta datptr+1 save ptr to data area of buffer
sta ZP.DataPtr+1 save ptr to data area of buffer
inc
inc index block always 2 pages after data
sta zpt+1
@ -654,7 +654,7 @@ XDOS.GetFCBBufX lda XDOS.FCBs+FCB.BUFID,x get page address of file buffer.
lda GB.BUFTABL-2,y ???? ALWAYS 0
sta bufaddrl
sta datptr index and data buffers always on
sta ZP.DataPtr index and data buffers always on
sta zpt page boundaries.
jsr XDOS.FCBDevIDSelect
@ -832,8 +832,8 @@ tstfnf cmp #MLI.E.FNOTFND 'file not found' is ok
cmp #$0D
bne ctyperr report type error if not directory.
tstdspc lda GP.DEVNUM make sure destination device
jsr twrprot1 is not write protected.
tstdspc lda GP.DEVNUM make sure destination device
jsr XDOS.TestWPA is not write protected.
bcs H351D
lda nofree is there space in directory to

View File

@ -46,7 +46,7 @@ XDOS.DeallocAX stx bmcnt high address of block.
sta XDOS.VCBs+VCB.BMAPIDX,x and make it current.
lda bmadev
jsr gtbmap read it into buffer
jsr XDOS.ReadBMDevA read it into buffer
bcs L3C8B
L3C64 ldy bmptr index to byte
@ -98,7 +98,7 @@ L3CA8 lda XDOS.BMBuf+$100,y search 2nd half for free block
bne L3CA8
inc basval add 2048 offset for next page.
jsr nxtbmap get next bitmap (if exists) and
jsr XDOS.NextBM get next bitmap (if exists) and
bcc L3C95 update vcb. branch if no error.
L3CB8 rts return error.
@ -156,7 +156,7 @@ L3CF7 lda #$80 indicate map is modified.
clc no errors.
rts
*--------------------------------------
nxtbmap ldx XDOS.VCBPtr inc to next bitmap, but 1st make sure there is another one.
XDOS.NextBM ldx XDOS.VCBPtr inc to next bitmap, but 1st make sure there is another one.
lda XDOS.VCBs+VCB.TBLK+1,x
lsr
lsr
@ -183,7 +183,7 @@ fndbmap ldy XDOS.VCBPtr
L3D4A ldy bmastat is it already modified ?
bmi L3D54 yes, return pointer
jsr gtbmap otherwise read in fresh bitmap.
jsr XDOS.ReadBMDevA otherwise read in fresh bitmap.
bcs L3D5F if error.
L3D54 ldy XDOS.VCBPtr get relative block # of bitmap.
@ -202,14 +202,14 @@ upbmap clc
lda bmastat is current map modified ?
bpl .9 no.
jsr wrtbmap update device.
jsr XDOS.WriteBM update device.
bcs .9 if error on writing.
stz bmastat mark bitmap buffer as free
lda #0 MUST EXIT WITH A=0
.9 rts
*--------------------------------------
gtbmap sta bmadev read bitmap specified by dev and vcb.
XDOS.ReadBMDevA sta bmadev read bitmap specified by dev and vcb.
ldy XDOS.VCBPtr get lowest map # with free blocks in it
lda XDOS.VCBs+VCB.BMAPIDX,y
@ -224,7 +224,7 @@ gtbmap sta bmadev read bitmap specified by dev and vcb.
lda #$01 read device command
.HS 2C BIT ABS
wrtbmap lda #$02 write command.
XDOS.WriteBM lda #$02 write command.
sta ZP.CMDNUM
@ -244,7 +244,7 @@ wrtbmap lda #$02 write command.
plx keep A=error code if CS
stx GP.DEVNUM
L3DB6 rts
rts
*--------------------------------------
.DO LOWERCASE=1
XDOS.WriteGBufDir
@ -275,14 +275,7 @@ XDOS.WriteGBuf lda #$02 write command
XDOS.RWBlock sta ZP.BUFPTR+1 buffer high.
stz ZP.BUFPTR buffer low (always on page boundary)
stz GP.ERROR clear global error code.
lda #$FF indicates reg call made to dev handler
sta ioaccess
lda GP.DEVNUM transfer dev # for dispatcher to
sta ZP.UNITNUM convert to unit #.
jmp XDOS.DevCall call the driver.
jmp XDOS.FileIO2
*--------------------------------------
.DO LOWERCASE=1
@ -454,7 +447,7 @@ L3E59 lda XDOS.FCBs+FCB.STYPE,y use storage type as # of index levels
and #FCB.F.DBLKMOD if previous data was modified then
beq L3E6B disk must be updated.
jsr wfcbdat
jsr XDOS.WriteDBLK
bcs L3ED4 if error.
@ -488,7 +481,7 @@ L3E9D lda XDOS.FCBs+FCB.F,y check to see if previous index block
and #FCB.F.IBLKMOD was modified.
beq L3EA9 read in over it if current up to date.
jsr wfcbidx go update index on disk (fcb block addr)
jsr XDOS.WriteIBLK go update index on disk (fcb block addr)
bcs L3ED4
L3EA9 ldx levels be sure there is a top index
@ -547,8 +540,7 @@ saplevel sta ZP.BLKNUM read in next lower index block.
sta ZP.CMDNUM
ldx #zpt address of current index buffer.
jsr fileio1 go read index block.
jsr XDOS.FileIOPtrX go read index block.
bcs L3ED4 error
jsr XDOS.UpdateFCBIBlk save block address of this index in fcb
@ -570,25 +562,25 @@ L3F18 jsr XDOS.SetFCBStatus set status to show what's missing
lsr discard bit that says data block
lsr unallocated because carry indicates if
jsr zipdata index block is invalid and needs to be zeroed.
jsr XDOS.ZeroData index block is invalid and needs to be zeroed.
bcc svmark branch if it doesn't need zeroed
jsr zeroindex zero index block in user's i/o buffer
jsr XDOS.ZeroIndex zero index block in user's i/o buffer
bra svmark
*--------------------------------------
zipdata lda #$00
XDOS.ZeroData lda #$00
tay
L3F42 sta (datptr),y zero out data area
inc ZP.DataPtr+1
jsr .1
dec ZP.DataPtr+1
.1 sta (ZP.DataPtr),y
iny
bne L3F42
bne .1
inc datptr+1
L3F49 sta (datptr),y
iny
bne L3F49
dec datptr+1
rts
*--------------------------------------
L3F51 sta ZP.BLKNUM get data block of new position
@ -615,11 +607,11 @@ L3F68 lda XDOS.FCBs+FCB.MARK,y save old mark in case calling routine
bpl L3F68
clc set up indirect address to buffer
lda datptr page pointed to by the current
lda ZP.DataPtr page pointed to by the current
sta sos position marker.
lda tposlh
and #$01
adc datptr+1
adc ZP.DataPtr+1
sta sos+1
L3F86 rts carry set if error
*--------------------------------------
@ -659,11 +651,11 @@ L3FB9 ldy #$02 position is forward from current.
beq svmark branch always.
*--------------------------------------
dirpos1 lda (datptr),y get link address of previous or next
dirpos1 lda (ZP.DataPtr),y get link address of previous or next
sta ZP.BLKNUM directory block.
cmp #$01 test for null byte into carry
iny but first be sure there is a link.
lda (datptr),y get the rest of the link.
lda (ZP.DataPtr),y get the rest of the link.
bne L3FD8 branch if certain link exists.
bcs L3FD8 was the low part null as well ?
@ -680,9 +672,8 @@ XDOS.ReadFCB.DBLK
lda #$01 read command
sta ZP.CMDNUM
ldx #datptr points at address of data buffer.
jsr fileio1 go do file input.
ldx #ZP.DataPtr points at address of data buffer.
jsr XDOS.FileIOPtrX go do file input.
bcs L3FF2 error.
ldy fcbptr
@ -699,8 +690,7 @@ L3FF2 rts
* sta ZP.CMDNUM
* ldx #zpt address of current index buffer.
* jsr fileio1 go read index block.
* XDOS.FileIOPtrX go read index block.
* bcs L400C error
* ldy fcbptr
@ -715,26 +705,26 @@ L3FF2 rts
*--------------------------------------
wfcbfst jsr upbmap update the bitmap and write file's 1st block.
lda #$02 write command
.HS 2C skip next instruction
ldx #$02 write command
.HS 2C BIT ABS
rfcbfst lda #$01 read command.
rfcbfst ldx #$01 read command.
pha save the command
lda #FCB.1stBLK
ora fcbptr add offset to fcbptr
tay
pla
txa get back command
ldx #zpt rd block into index portion of file buf
*--------------------------------------
dofileio sta ZP.CMDNUM command
XDOS.FileIOPtrXCmdABlkY
sta ZP.CMDNUM command
lda XDOS.FCBs,y get disk block address from fcb.
lda XDOS.FCBs,y get disk block address from fcb.
sta ZP.BLKNUM block 0 not legal
bne .1
lda XDOS.FCBs+1,y high address of disk block
lda XDOS.FCBs+1,y high address of disk block
bne .2
lda #$0C Block = $0000, allocation error.
@ -743,39 +733,41 @@ dofileio sta ZP.CMDNUM command
.1 lda XDOS.FCBs+1,y
.2 sta ZP.BLKNUM+1
*--------------------------------------
fileio1 lda $00,x get memory address of buffer from
XDOS.FileIOPtrX lda $00,x get memory address of buffer from
sta ZP.BUFPTR page zero pointed to by x register
lda $01,x
sta ZP.BUFPTR+1 and pass address to device handler
jsr XDOS.FCBDevIDSelect
lda #$FF also, set to indicate reg call made to
sta ioaccess device handler.
XDOS.FileIO2 sec also, set to indicate reg call made to
ror ioaccess device handler.
lda GP.DEVNUM transfer device # for dispatcher
sta ZP.UNITNUM to convert to unit #.
stz GP.ERROR clear global error code.
jmp XDOS.DevCall call the driver.
*--------------------------------------
wfcbdat ldx #datptr point at memory address with x and
*--------------------------------------
XDOS.WriteDBLK ldx #ZP.DataPtr point at memory address with x and
lda #FCB.DBLK disk address with y.
ora fcbptr add offset to fcbptr
tay and put in y.
lda #$02 write data block.
jsr dofileio
jsr XDOS.FileIOPtrXCmdABlkY
bcs L4096 if errors.
lda #$BF mark data status as current.
bra XDOS.ResetFCBStatus
wfcbidx jsr upbmap update bitmap.
XDOS.WriteIBLK jsr upbmap update bitmap.
ldx #zpt point to address of index buffer
lda #FCB.IBLK and block address of that index block.
ora fcbptr
tay
lda #$02
jsr dofileio go write out index block.
jsr XDOS.FileIOPtrXCmdABlkY
bcs L4096 if errors.
lda #$7F mark index status as current.

View File

@ -37,7 +37,7 @@ L420D jmp rwdone do nothing.
L4210 jsr valdbuf validate user's data buffer range.
bcs L4202 branch if memory conflict.
jsr gfcbstyp get storage type
jsr XDOS.GetFCB.ST get storage type
cmp #$04 and find out if it's a tree or other.
bcc L421F branch if a tree file
@ -62,15 +62,15 @@ L421F jsr rdposn set up data pointer.
sta ioaccess needs to be written to force 1st call
lda usrbuf thru all dev handler checking. make
sta datptr the data buffer the user's space.
sta ZP.DataPtr the data buffer the user's space.
lda usrbuf+1
sta datptr+1
sta ZP.DataPtr+1
L4249 jsr rdposn get next block directly into user space.
bcs L42B7 if error.
L424E inc datptr+1 incll ptrs by one block (512 bytes)
inc datptr+1
L424E inc ZP.DataPtr+1 incll ptrs by one block (512 bytes)
inc ZP.DataPtr+1
dec rwreqh
dec rwreqh
inc tposlh
@ -116,7 +116,7 @@ L429C dec zpt+1
lda ioaccess has 1st call gone to device yet ?
beq L4249 no, go thru normal route
lda datptr+1 reset hi buffer address for dev handler
lda ZP.DataPtr+1 reset hi buffer address for dev handler
sta ZP.BUFPTR+1
jsr XDOS.DevCall
bcc L424E no errors, branch always.
@ -147,21 +147,21 @@ preprw ldy fcbptr adj pointer to user's buffer to make
lda usrbuf
sbc tposll
sta usrbuf
bcs L42E9 if no adjustment to hi address needed
bcs .1 if no adjustment to hi address needed
dec usrbuf+1
L42E9 lda XDOS.FCBs+FCB.NLMASK,y test for new line enabled.
.1 lda XDOS.FCBs+FCB.NLMASK,y test for new line enabled.
clc
beq L42F9 if new line not enabled.
beq .2 if new line not enabled.
sec carry indicates new line enabled
sta nlmask
lda XDOS.FCBs+FCB.NLBYTE,y move newline character to more
sta nlchar accesible spot.
L42F9 ldy tposll index to 1st data.
lda datptr reset low order of position pointer to
.2 ldy tposll index to 1st data.
lda ZP.DataPtr reset low order of position pointer to
sta sos beginning of page.
ldx rwreql get low order count of requested bytes.
rts return statuses.
@ -195,7 +195,7 @@ L4319 dex dec # of bytes left to move.
inc tposhi
L4329 inc sos+1 and sos buffer high address.
eor datptr+1 (carry is undisturbed)
eor ZP.DataPtr+1 (carry is undisturbed)
beq L4310 branch if more to read in buffer.
clv indicate not finished.
@ -208,7 +208,7 @@ L4332 lda rwreqh
bne L4340 no, adjust high byte of request.
lda sos+1 maybe, check for end of block buffer.
eor datptr+1 (don't disturb carry).
eor ZP.DataPtr+1 (don't disturb carry).
bne L4343 if hi count can be dealt with next time
L4340 dec rwreqh
@ -252,9 +252,9 @@ L4374 plp restore return statuses.
setvflg rts this byte ($60) is used to set v flag.
*--------------------------------------
fxdatptr lda datptr put current user buffer address back to normal
fxdatptr lda ZP.DataPtr put current user buffer address back to normal
sta usrbuf
lda datptr+1
lda ZP.DataPtr+1
sta usrbuf+1 bank pair byte should be moved also.
ldx fcbptr restore buffer address
@ -275,13 +275,13 @@ XDOS.ReadDir jsr rdposn
bne L43B7 branch if not eof error.
jsr svmark
jsr zipdata clear out data block.
jsr XDOS.ZeroData clear out data block.
ldy #$00 provide dummy back pointer for future
ldx fcbptr re-position. x = hi byte of last block
L43A6 lda XDOS.FCBs+FCB.DBLK,x
sta (datptr),y
sta (ZP.DataPtr),y
stz XDOS.FCBs+FCB.DBLK,x mark current block as impossible
inx
iny inc indexes to do both hi and low bytes
@ -313,7 +313,7 @@ mvdbufr ldy #$02 move the pointer to user's buffer
lda (ZP.A3L),y
sta usrbuf+1
gfcbstyp ldy fcbptr return storage type
XDOS.GetFCB.ST ldy fcbptr return storage type
lda XDOS.FCBs+FCB.STYPE,y
rts
*--------------------------------------
@ -399,7 +399,7 @@ XDOS.Write jsr mvcbytes first determine if requested write is legal.
L445E lda #MLI.E.LOCKED illegal access error.
bne L44A2
L4462 jsr tstwprot otherwise, make sure device is not
L4462 jsr XDOS.TestWP otherwise, make sure device is not
bcs L44A2 write protected. if so, branch to abort.
lda cbytes
@ -506,7 +506,7 @@ L4507 iny page crossed ?
bne L44A2
L451C inc sos+1 adjust sos buffer high address
eor datptr+1 (carry is undisturbed)
eor ZP.DataPtr+1 (carry is undisturbed)
beq L44FF branch if more to write to buffer.
clv indicates not finished.
@ -519,7 +519,7 @@ L4525 lda rwreqh
bne L4533 if not.
lda sos+1 this is necessary for proper
eor datptr+1 adjustment of request count
eor ZP.DataPtr+1 adjustment of request count
bne L4536
L4533 dec rwreqh
@ -559,7 +559,7 @@ L4564 jsr fcbused set directory flush bit.
topdown jsr swapdown make current 1st block an entry in new
bcs L45B1 top. branch if errors.
jsr gfcbstyp get storage type
jsr XDOS.GetFCB.ST get storage type
* has storage type been changed to 'tree' ? if not, assume it was originally
* a seed and both levels need to be built. otherwise, only an index needs
@ -591,22 +591,21 @@ L457A jsr alcwblk get another block address for the sap
jsr wfcbfst save new top of tree
bcs L45B1
*--------------------------------------
zeroindex lda #$00
XDOS.ZeroIndex lda #$00
tay
.1 sta (zpt),y zero out the index half of the user's
iny i/o buffer
bne .1
inc zpt+1
jsr .1
.2 sta (zpt),y
dec zpt+1
.1 sta (zpt),y
iny
bne .2
bne .1
dec zpt+1 restore proper address
rts
*--------------------------------------
sapdown jsr gfcbstyp find out if dealing with a tree.
sapdown jsr XDOS.GetFCB.ST find out if dealing with a tree.
cmp #$01 if seed then adj to file type is needed.
beq swapdown branch if seed
@ -661,14 +660,14 @@ alcwblk jsr alc1blk
.9 rts
*--------------------------------------
tstwprot jsr XDOS.GetFCBStatus check for 'never been modified' condition
XDOS.TestWP jsr XDOS.GetFCBStatus check for 'never been modified' condition
and #$F0
clc
bne tstwprot.RTS ordinary rts if known write ok.
bne XDOS.Tpos2Y.RTS ordinary rts if known write ok.
jsr XDOS.FCBDevIDSelect
twrprot1 sta ZP.UNITNUM make the device status call
XDOS.TestWPA sta ZP.UNITNUM make the device status call
lda ZP.BLKNUM+1
pha
@ -683,19 +682,14 @@ twrprot1 sta ZP.UNITNUM make the device status call
lda #$00 otherwise, assume no errors.
.1 plx
stx ZP.BLKNUM restore the block #
plx
stx ZP.BLKNUM+1
tstwprot.RTS rts
.1 jmp XDOS.PopBlkNumRTS restore the block #
*--------------------------------------
XDOS.Tpos2Y lda tposhi get index to next block address
lsr
lda tposlh
ror
tay index to address = int(pos/512)
rts
XDOS.Tpos2Y.RTS rts
*--------------------------------------
MAN
SAVE usr/src/prodos.fx/prodos.s.xdos.d

View File

@ -8,14 +8,14 @@ XDOS.Close ldy #$01 close all ?
sta cferr clear global close error.
* lda #$00 start at the beginning.
L4654 sta fcbptr save current low byte of pointer.
.1 sta fcbptr save current low byte of pointer.
tax get the level at which the file
lda XDOS.FCBs+FCB.FLEVEL,x was opened.
cmp GP.FLEVEL if file's level is < global level
bcc L4675 then don't close.
bcc .2 then don't close.
lda XDOS.FCBs+FCB.ID,x is this reference file open ?
beq L4675 no, try next.
lda XDOS.FCBs+FCB.ID,x is this reference file open ?
beq .2 no, try next.
jsr flush2 clean it out...
bcs L46B6 return flush errors.
@ -24,14 +24,14 @@ L4654 sta fcbptr save current low byte of pointer.
ldy #$01
lda (ZP.A3L),y
beq L4675 no error if close all.
beq .2 no error if close all.
bcs L46B6 close error.
L4675 lda fcbptr inc pointer to next fcb
.2 lda fcbptr inc pointer to next fcb
clc
adc #FCB
bcc L4654 branch if within same page.
bcc .1 branch if within same page.
lda cferr on final close report logged errors.
beq L46B4 branch if errors.
@ -119,14 +119,14 @@ L4704 jsr XDOS.GetFCBStatus
and #$40 does current data buffer need to be
beq L4710 written ? branch if not.
jsr wfcbdat if so, go write it.
jsr XDOS.WriteDBLK if so, go write it.
bcs L46E6 if error.
L4710 jsr XDOS.GetFCBStatus check to see if the index block (tree
and #$80 files only) needs to be written.
beq L471C branch if not.
jsr wfcbidx
jsr XDOS.WriteIBLK
bcs L46E6 return any errors.
L471C ldy #0
@ -267,7 +267,7 @@ 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 XDOS.GetFCB.ST can only move end of tree, sapling or seed.
cmp #$04 tree type ?
bcs L47CA if not then access error
@ -280,7 +280,7 @@ XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed.
and #$02 is write enabled to set new eof ?
beq L47CA no, access error.
jsr tstwprot hardware write protected ?
jsr XDOS.TestWP hardware write protected ?
bcs L47CA yes, access error.
ldy fcbptr save old eof so it can be seen
@ -330,11 +330,11 @@ L481C lda (ZP.A3L),y
purge jsr flush1 make sure file is current
bcs L47CD
ldx datptr+1 pointer to index block
ldx ZP.DataPtr+1 pointer to index block
inx
inx
stx zpt+1 (zero page conflict with dir buf ptr)
ldx datptr
ldx ZP.DataPtr
stx zpt
ldy fcbptr check if eof < mark
iny
@ -405,18 +405,17 @@ L48A2 ldy fcbptr also must pass file's 1st block address.
sec
ldy fcbptr
ldx #$00
ldx #$ff
L48C2 lda firstbl,x
sta XDOS.FCBs+FCB.1stBLK,y move in possible new first file block
L48C2 inx
lda firstbl,x
sta XDOS.FCBs+FCB.1stBLK,y move in possible new first file block
lda XDOS.FCBs+FCB.UBLK,y address. adjust usage count also
sbc deblock,x
sta XDOS.FCBs+FCB.UBLK,y
iny
inx
txa
and #$01 test for both bytes adjusted
bne L48C2 without disturbing carry.
beq L48C2 without disturbing carry.
lda stortyp get possibly modified storage type
jsr XDOS.SetFCBSType
@ -427,8 +426,8 @@ L48C2 lda firstbl,x
iny
iny
ldx #$02
ldx #2
L48F2 lda XDOS.FCBs+FCB.MARK,y tell 'rdposn' to go to correct
sta tposll,x
eor #$80 position from incorrect place.
@ -440,12 +439,13 @@ L48F2 lda XDOS.FCBs+FCB.MARK,y tell 'rdposn' to go to correct
jsr rdposn go to correct position.
bcc L490D if no error.
tax otherwise, report latest error.
pla
plx discard latest error code to stack
plp
txa restore latest error code to stack
sec
php
pha save new error.
* mark file as in need of a flush and update fcb with new end of file,
@ -455,13 +455,10 @@ L490D jsr eofset go mark and update
jsr flush1 then go do the flush.
bcc L491C branch if no error.
tax save latest error.
pla clean previous error off stack
plp
txa and restore latest error to stack.
sec show error condition.
php restore error status to stack
pha and the error code.
plx clean previous error off stack
plx and previous P
rts
L491C pla report any errors that may have
plp appeared.
rts
@ -524,7 +521,7 @@ XDOS.GetFileInfo
*--------------------------------------
XDOS.SetFileInfo
jsr XDOS.FindFile get the file to work on.
bcs L49CF if error.
bcs .3 if error.
lda GP.BUBIT see if backup bit can be cleared
eor #$20
@ -534,24 +531,24 @@ XDOS.SetFileInfo
ldy #$0D init pointer to user supplied list.
L49B9 ldx inftabl-3,y get index to corresponding 'd.' table.
bmi L49C3 branch if parameter can't be set.
.1 ldx inftabl-3,y get index to corresponding 'd.' table.
bmi .2 branch if parameter can't be set.
lda (ZP.A3L),y
sta d_stor,x
L49C3 dey has user's request been satisfied ?
.2 dey has user's request been satisfied ?
cpy #$03
bcs L49B9 no, move next byte.
bcs .1 no, move next byte.
and #$18 make sure no illegal access bits were
beq L49D0 set !! branch if legal access.
beq .4 set !! branch if legal access.
lda #MLI.E.LOCKED otherwise, access error.
sec
L49CF rts
.3 rts
L49D0 ldy #$0B
.4 ldy #$0B
lda (ZP.A3L),y was clock null input ?
bne XDOS.SetFileInfoEx.8
@ -706,13 +703,13 @@ L49FF ldy #0 get newname's length
ldy #$00
ldx XDOS.VCBPtr update vcb also.
.1 lda XDOS.PathBuf,y move new name to vcb.
.3 lda XDOS.PathBuf,y move new name to vcb.
beq .8
sta XDOS.VCBs,x
iny next character
inx
bra .1
bra .3
.8
* clc no errors
.9 rts
@ -771,17 +768,15 @@ L4A52 ldy rnptr index to last name in the chain.
beq L4A76 if so, continue processing.
L4A72 lda #MLI.E.INVPATH bad pathname error.
.HS 2C BIT ABS
L4A7F lda #MLI.E.DUPFILE
L4A74 sec
rts
L4A76 jsr XDOS.CheckPath test for duplicate file name.
bcs L4A7F branch if file not found, which is ok !!
bcc L4A7F duplicate name error.
lda #MLI.E.DUPFILE duplicate name error.
sec
rts
L4A7F cmp #MLI.E.FNOTFND was it a valid file not found ?
cmp #MLI.E.FNOTFND was it a valid file not found ?
bne L4A74 no, rename error.
jsr XDOS.GetPath syntax pathname of file to be changed.
@ -799,7 +794,7 @@ L4A7F cmp #MLI.E.FNOTFND was it a valid file not found ?
lda #MLI.E.LOCKED otherwise, illegal access.
.HS 2C BIT ABS
L4A98 lda #MLI.E.INCFF
L4A9B sec
sec
rts
L4A9D lda d_stor find out which storage type.
@ -867,8 +862,8 @@ L4B39 lda d_attr make sure ok to destroy file.
lda #MLI.E.LOCKED access error
jsr GP.SYSERR
L4B45 lda GP.DEVNUM last device used.
jsr twrprot1 test for write protected hardware
L4B45 lda GP.DEVNUM last device used.
jsr XDOS.TestWPA test for write protected hardware
bcs L4B66 before going thru deallocation.
lda d_frst 'detree' needs first block address
@ -928,7 +923,7 @@ L4BA1 dec h_fcnt mark header with one less file.
L4BAF cmp #$01 adjust carry accordingly
rts
dvcbrev ldx XDOS.VCBPtr update block free count in vcb. point to vcb of correct device.
dvcbrev ldx XDOS.VCBPtr update block free count in vcb. point to vcb of correct device.
lda deblock get # of blocks recently freed.
adc XDOS.VCBs+VCB.FBLK,x
sta XDOS.VCBs+VCB.FBLK,x update current free block count.

View File

@ -100,7 +100,7 @@ L4C99 stx dtmpx save index to dealc buf.
jsr XDOS.ReadGBuf read sapling level into XDOS.GBuf.
bcs L4CC2 return errors.
jsr dealblk go free all data indexes in this block
jsr XDOS.DeallocBlk0 go free all data indexes in this block
bcs L4CC2
jsr XDOS.WriteGBuf write the flipped index block
@ -116,7 +116,7 @@ L4CC2 rts sapling block numbers.
L4CC3 ldy dtree deallocate all sapling blocks greater
iny than specified block.
jsr dalblk1 (master index in XDOS.GBuf)
jsr XDOS.DeallocBlkY (master index in XDOS.GBuf)
bcs L4CC2 if errors.
jsr XDOS.WriteGBuf write updated master index back to disk.
@ -147,7 +147,7 @@ L4CF5 ldy dsap pointer to last of desirable indexes.
iny inc to 1st undesirable.
beq L4D05 branch if all are desirable.
jsr dalblk1 deallocate all indexes above specified.
jsr XDOS.DeallocBlkY deallocate all indexes above specified.
bcs L4CC2
jsr XDOS.WriteGBuf write out the index block
@ -222,63 +222,65 @@ shrink ldx firstbh first deallocate top index block
sta ZP.BLKNUM+1
bcs L4D1E report errors.
lda XDOS.GBuf get # of new 1st block from old index.
lda XDOS.GBuf get # of new 1st block from old index.
sta firstbl
lda XDOS.GBuf+$100
sta firstbh
ldy #$00
jsr swapme flip that one entry in old top index.
jsr XDOS.SwapGBUFY flip that one entry in old top index.
sec now change file type,
lda stortyp from tree to sapling,
sbc #$10 or from sapling to seed.
sta stortyp
jmp XDOS.WriteGBuf write the (deallocated) old top index.
dealblk ldy #$00 start at beginning.
dalblk1 lda ZP.BLKNUM save disk address of XDOS.GBuf's data.
*--------------------------------------
XDOS.DeallocBlk0
ldy #$00 start at beginning.
XDOS.DeallocBlkY
lda ZP.BLKNUM save disk address of XDOS.GBuf's data.
pha
lda ZP.BLKNUM+1
pha
L4D96 sty saptr save current index.
lda XDOS.GBuf,y get low address of block to deallocate.
.1 sty saptr save current index.
lda XDOS.GBuf,y get low address of block to deallocate.
cmp #$01 test for null block into carry.
ldx XDOS.GBuf+$100,y get remainder of block address.
bne L4DA5 branch if not null.
ldx XDOS.GBuf+$100,y get remainder of block address.
bne .2 branch if not null.
bcc L4DB0 was the low part null too ?
bcc .3 was the low part null too ?
L4DA5 jsr XDOS.DeallocAX free it up on volume bitmap.
bcs L4DB4 return any error.
.2 jsr XDOS.DeallocAX free it up on volume bitmap.
bcs XDOS.PopBlkNumRTS return any error.
ldy saptr get index to sapling level index block.
jsr swapme
jsr XDOS.SwapGBUFY
L4DB0 iny next block address.
bne L4D96 if more to deallocate or test.
.3 iny next block address.
bne .1 if more to deallocate or test.
clc no error.
L4DB4 tax save error code, if any.
pla restore blocknm (16 bit)
sta ZP.BLKNUM+1
pla
sta ZP.BLKNUM
txa restore return code
*--------------------------------------
XDOS.PopBlkNumRTS
plx restore blocknm (16 bit)
stx ZP.BLKNUM+1 keeping A and C if error
plx
stx ZP.BLKNUM
rts
swapme lda delflag swapping or zeroing ?
bne L4DC5 skip if swapping.
*--------------------------------------
XDOS.SwapGBUFY lda delflag swapping or zeroing ?
bne .1 skip if swapping.
tax make x = 0.
beq L4DCB zero the index (always taken).
beq .2 zero the index (always taken).
L4DC5 ldx XDOS.GBuf+$100,y index high
lda XDOS.GBuf,y index low
L4DCB sta XDOS.GBuf+$100,y save index high
.1 ldx XDOS.GBuf+$100,y index high
lda XDOS.GBuf,y index low
.2 sta XDOS.GBuf+$100,y save index high
txa
sta XDOS.GBuf,y save index low
sta XDOS.GBuf,y save index low
rts done.
*--------------------------------------
* MEMMGR memory manager
@ -295,10 +297,10 @@ alcbufr1 lda (ZP.A3L),y this buffer must be on a page boundary.
cmp #$BC nor greater than $BB00
bcs L4E1E since it would wipe out globals...
sta datptr+1
sta ZP.DataPtr+1
dey
lda (ZP.A3L),y low address should be zero !
sta datptr
sta ZP.DataPtr
bne L4E1E error if not page boundary.
inx add 4 pages for 1k buffer.
@ -311,7 +313,7 @@ L4DED dex test for conflicts.
and GP.MEMTABL,y
bne L4E1E report memory conflict, if any.
cpx datptr+1 test all 4 pages.
cpx ZP.DataPtr+1 test all 4 pages.
bne L4DED
inx add 4 pages again for allocation.
@ -321,7 +323,7 @@ L4DED dex test for conflicts.
L4DFE dex set proper bits to 1
jsr XDOS.MemTablEOR
cpx datptr+1 set all 4 pages
cpx ZP.DataPtr+1 set all 4 pages
bne L4DFE
ldy fcbptr calculate buffer number
@ -329,7 +331,7 @@ L4DFE dex set proper bits to 1
asl buffer number = (entnum) * 2.
sta XDOS.FCBs+FCB.BUFID,y save it in fcb.
tax use entnum * 2 as index to global
lda datptr+1 buffer addr tables. get addr already
lda ZP.DataPtr+1 buffer addr tables. get addr already
sta GB.BUFTABL-1,x validated as good. store hi addr
clc (entnums start at 1, not 0)
@ -441,11 +443,11 @@ XDOS.SetBuf ldy #$03
ldx #$03
.1 lda (usrbuf),y move all 4 pages of the buffer to
sta (datptr),y new location.
sta (ZP.DataPtr),y new location.
iny
bne .1
inc datptr+1
inc ZP.DataPtr+1
inc usrbuf+1
dex
bpl .1
@ -519,16 +521,24 @@ XDOS.CallDisp lda IO.RRAMWRAMBNK2 read/write RAM bank 2
eor #$A5
sta ROM.PWREDUP power up byte
.DO AUXLC=1
jmp GP.SELJMP
.ELSE
jmp $1000
.FIN
*--------------------------------------
XDOS.SPREMAP ldx #$03 assume 3 parameters.
lda ZP.CMDNUM
sta .5
bne .1 taken if not status call
ldy #XDOS.SPStatus set up memory for the status list buffer
ldy #XDOS.SPStatusBuf set up memory for the status list buffer
sty ZP.BUFPTR fake up the prodos parameters
ldy /XDOS.SPStatus
ldy /XDOS.SPStatusBuf
sty ZP.BUFPTR+1
stz ZP.BLKNUM set statcode = 0 for simple status call
@ -568,9 +578,9 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
ldx .5 status call ?
bne .9 no...
ldx XDOS.SPStatus+1 else get the block count
ldy XDOS.SPStatus+2
lda XDOS.SPStatus get the returned status.
ldx XDOS.SPStatusBuf+1 else get the block count
ldy XDOS.SPStatusBuf+2
lda XDOS.SPStatusBuf get the returned status.
bit #$10 is there a disk present ?
beq .8
@ -585,20 +595,36 @@ XDOS.SPREMAP ldx #$03 assume 3 parameters.
sec
.9 rts
*--------------------------------------
XDOS.SPParams .HS 03 # of parms (always 3 except format)
XDOS.SPParams.U .HS 00 unit number
XDOS.SPParams.B .HS 0000 data buffer
.HS 000000 block number (3 bytes)
*--------------------------------------
XDOS.TBX bit IO.RRAMWRAMBNK1 Get RW access to LC
jsr .1
.DO AUXLC=1
stx .1+1
tsx
stx $100
ldx $101
txs
.1 ldx #$FF SELF MODIFIED
jsr .2
tsx
stx $101
ldx $100
txs
jmp GP.TBXEXIT
.ELSE
jsr .2
jmp IRQ.ToRomRTS
.FIN
.1 jmp (.2,x)
.2 .DA XDOS.TBX.MemReset
.DA XDOS.TBX.EnumBlk
.DA XDOS.TBX.EnumNext
.2 cpx #TBX.EnumNext
beq XDOS.TBX.EnumNext
bcc XDOS.TBX.EnumBlk
*--------------------------------------
XDOS.TBX.MemReset
ldx #$17
@ -641,7 +667,7 @@ XDOS.TBX.CheckFCnt
lda h_fcnt
ora h_fcnt+1
beq XDOS.TBX.SECRTS
* clc
clc
rts
*--------------------------------------
XDOS.TBX.EnumNext
@ -954,20 +980,23 @@ XRW.D2SeekTime .EQ *
XDOS.SPVectHi .HS 00000000000000 storage for high byte of smartport entry.
.HS 00
.HS 00000000000000
*--------------------------------------
XDOS.SPParams .HS 00 # of parms
XDOS.SPParams.U .HS 00 unit number
XDOS.SPParams.B .HS 0000 data buffer
.HS 000000 block number (3 bytes)
XDOS.SPStatus .HS 00000000
XDOS.SPStatusBuf .HS 00000000
*--------------------------------------
.LIST ON
XDOS.DATA.LEN .EQ *-XDOS.DATA
XDOS.FREE .EQ $FEFD-*
.LIST OFF
.BS XDOS.FREE
.ED
*--------------------------------------
* zero fill to page boundary - 3 ($FEFD). so that cortland flag stays within page boundary.
.LIST ON
XDOS.FREE .EQ $FEFD-*-XDOS.DATA.LEN (2.0.3 = $0C)
.LIST OFF
XDOS.CortDisp .EQ $FEFD
XDOS.CortFlag .EQ $FEFF cortland flag. 1 = Cortland system (must stay within page boundary)
XDOS.CortFlag .EQ $FEFF cortland flag. 1 = Cortland system (must stay within page boundary)
*--------------------------------------
.EP
*--------------------------------------