diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index f4e6d8ee..4acd2792 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.TEST.po b/.Floppies/A2OSX.TEST.po index 73f4fa86..d207293a 100644 Binary files a/.Floppies/A2OSX.TEST.po and b/.Floppies/A2OSX.TEST.po differ diff --git a/INC/IO.D2.I.txt b/INC/IO.D2.I.txt index 4ad7d7a6..5732e858 100644 --- a/INC/IO.D2.I.txt +++ b/INC/IO.D2.I.txt @@ -4,7 +4,7 @@ NEW IO.D2.SeekTimeR .EQ 160 LIBBLKDEV Recalibration IO.D2.SeekTimeF .EQ 85 LIBBLKDEV Track Formatter IO.D2.SeekTimeB .EQ 85 LIBBLKDEV Boot Block -IO.D2.SeekTimeP .EQ 40 ProDOS.FX initial +IO.D2.SeekTimeP .EQ 60 ProDOS.FX initial IO.D2.SeekTimeI .EQ 20 ProDOS.FX increment -> until > 128 *-------------------------------------- IO.D2.Ph0Off .EQ $C080 diff --git a/ProDOS.FX/ProDOS.S.GP.txt b/ProDOS.FX/ProDOS.S.GP.txt index 5b8e1cbb..517307ac 100644 --- a/ProDOS.FX/ProDOS.S.GP.txt +++ b/ProDOS.FX/ProDOS.S.GP.txt @@ -6,7 +6,7 @@ jspare jmp * will be changed to point to dispatcher. clockv rts changed to jmp ($4C) if clock present. .DA XDOS.ClockDrv clock routine entry address. GP.P8errv jmp XDOS.syserr error reporting hook. -sysdeath jmp sysdeath1 system failure hook. +GP.SysDeath jmp XDOS.SysDeath system failure hook. p8error .DA #0 .DA nodevice .DA nodevice diff --git a/ProDOS.FX/ProDOS.S.IRQ.txt b/ProDOS.FX/ProDOS.S.IRQ.txt index ada16b9e..0ecbae24 100644 --- a/ProDOS.FX/ProDOS.S.IRQ.txt +++ b/ProDOS.FX/ProDOS.S.IRQ.txt @@ -34,7 +34,7 @@ XDOS.IRQV ldx #$FA save 6 bytes of page 0 bne irqdone before system death. lda #$01 bad irq so - jsr sysdeath kill the system. + jsr GP.SysDeath kill the system. .LIST ON IRQ.FREE1 .EQ $ffc8-* diff --git a/ProDOS.FX/ProDOS.S.XDOS.A.txt b/ProDOS.FX/ProDOS.S.XDOS.A.txt index ade1bfa7..9bd24b59 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.A.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.A.txt @@ -225,7 +225,7 @@ XDOS.syserr sta p8error P8 error code sec rts *-------------------------------------- -sysdeath1 tax death error code. +XDOS.SysDeath tax death error code. sta CLR80DISP disable 80 col hardware. lda SETTEXT switch in text. lda cortflag is this a Cortland? @@ -543,8 +543,7 @@ XDOS.GetFCBBufX lda FCBs+FCB.BUFID,x get page address of file buffer. sta datptr index and data buffers always on sta zpt page boundaries. - lda FCBs+FCB.DEVID,x also set up device # - sta devnum + jsr XDOS.FCBDevIDSelect lda #VCB0 @@ -563,7 +562,7 @@ nxtfvol tya adjust index to next vcb. fcbdead lda #$0B fcb error so - jsr sysdeath kill the system. + jsr GP.SysDeath kill the system. tstvopen lda VCBs,y make sure this vcb is open. beq nxtfvol branch if it is not active. diff --git a/ProDOS.FX/ProDOS.S.XDOS.B.txt b/ProDOS.FX/ProDOS.S.XDOS.B.txt index 4b906b43..2144e151 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.B.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.B.txt @@ -79,6 +79,7 @@ H37C2 lda #MLI.E.INVPATH bad path (carry set) *-------------------------------------- lookfil0 stz nofree reset free entry indicator. sec dir to be searched has header in this block. + L37C9 stz totent reset entry counter. jsr XDOS.LookupNameInDirBlk look for name pointed to by pnptr. @@ -94,7 +95,7 @@ L37C9 stz totent reset entry counter. bne L37EB or branch always. L37E2 dec entcnth should be at least one - bpl L37EB so this should be branch always... + bra L37EB branch always... errdir lda #MLI.E.BADDIR directory error fnderr sec diff --git a/ProDOS.FX/ProDOS.S.XDOS.C.txt b/ProDOS.FX/ProDOS.S.XDOS.C.txt index 3e7ed016..807be709 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.C.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.C.txt @@ -37,7 +37,7 @@ XDOS.DeallocAX stx bmcnt high address of block. lda bmcnt get map # ldx vcbptr - sta VCBs+VCB.BMAPIDX,x and make it current. + sta VCBs+VCB.BMAPIDX,x and make it current. lda bmadev jsr gtbmap read it into buffer bcs L3C8B @@ -56,6 +56,7 @@ bmbufhi ora bmbuf,y this address + 2 is used as an absolute reference to bm L3C7D lda #$80 mark bitmap as modified tsb bmastat + inc deblock inc count of blocks deallocated bne L3C8A @@ -190,14 +191,14 @@ L3D60 lda #MLI.E.VOLFULL request can't be filled *-------------------------------------- upbmap clc lda bmastat is current map modified ? - bpl L3D5F no. + bpl .9 no. jsr wrtbmap update device. - bcs L3D5F if error on writing. + bcs .9 if error on writing. stz bmastat mark bitmap buffer as free lda #0 MUST EXIT WITH A=0 - rts +.9 rts *-------------------------------------- gtbmap sta bmadev read bitmap specified by dev and vcb. @@ -230,12 +231,10 @@ wrtbmap lda #$02 write command. lda /bmbuf * lda bmbufhi+2 address of the buffer (low = 0) jsr XDOS.RWBlock - tax error code (if any). - pla restore current dev # - sta devnum - bcc L3DB6 and return it if no error. - txa error code + plx keep A=error code if CS + stx devnum + L3DB6 rts *-------------------------------------- .DO LOWERCASE=1 @@ -404,7 +403,7 @@ XDOS.PackGBuf.Bitmap .BS 2 *-------------------------------------- XDOS.GetMark ldx fcbptr index to open fcb. - ldy #$02 index to user's mark parmeter. + ldy #$02 index to user's mark parameter. .1 lda FCBs+FCB.MARK,x transfer current position sta (A3L),y to user's parameter list @@ -499,7 +498,7 @@ L3E6B ldy fcbptr test to see if current index block ldx levels is it a seed file ? dex - bne datlevel no, use current indexes. + bne datlevel1 no, use current indexes. L3E89 lda tposlh is new position < 512 ? lsr @@ -542,7 +541,7 @@ L3EA9 ldx levels be sure there is a top index sta FCBs+FCB.IBLK,y lda bloknml+1 sta FCBs+FCB.IBLK+1,y - bcc datlevel branch always +datlevel1 bra datlevel branch always L3ED4 rts @@ -570,8 +569,22 @@ saplevel sta bloknml read in next lower index block. lda (zpt),y (high address) sta bloknml+1 dec zpt+1 - jsr rfcbidx read in sapling level - bcs L3ED4 + +* jsr rfcbidx read in sapling level + + lda #$01 prepare to read index block : read command + sta A4L + + ldx #zpt address of current index buffer. + + jsr fileio1 go read index block. + bcs L3ED4 error + + ldy fcbptr + lda bloknml + sta FCBs+FCB.IBLK,y save block address of this index in fcb + lda bloknml+1 + sta FCBs+FCB.IBLK+1,y datlevel lda tposhi get block address of data block lsr @@ -589,32 +602,16 @@ datlevel lda tposhi get block address of data block lda #$01 show data block as never been allocated dec zpt+1 -L3F18 ldy fcbptr set status to show what's missing - ora FCBs+FCB.F,y - sta FCBs+FCB.F,y +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 - bcc svmark zeroed. branch if it doesn't need zeroed + jsr zipdata 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 bra svmark *-------------------------------------- -zeroindex lda #$00 - tay -L3F30 sta (zpt),y zero out the index half of the user's - iny i/o buffer - bne L3F30 - - inc zpt+1 - -L3F37 sta (zpt),y - iny - bne L3F37 - - dec zpt+1 restore proper address - rts -*-------------------------------------- zipdata lda #$00 tay L3F42 sta (datptr),y zero out data area @@ -644,6 +641,7 @@ svmark ldy fcbptr update position in fcb iny iny ldx #$02 + L3F68 lda FCBs+FCB.MARK,y save old mark in case calling routine sta oldmark,x fails later. lda tposll,x @@ -670,8 +668,13 @@ dirmark cmp #$0D is it a directory ? L3F9C lda scrtch recover results of previous subtraction. lsr use difference as counter for how many sta cntent blocks must be read to get to new pos'n. + lda FCBs+FCB.MARK+1,y test for positive direction cmp tposlh indicated by carry. + + lda FCBs+FCB.MARK+2,y + sbc tposhi + bcc L3FB9 if set, position forward. otherwise, L3FAB ldy #$00 read directory file in reverse order. @@ -691,7 +694,7 @@ L3FB9 ldy #$02 position is forward from current. bne L3FB9 loop if position not found in this block beq svmark branch always. - +*-------------------------------------- dirpos1 lda (datptr),y get link address of previous or next sta bloknml directory block. cmp #$01 test for null byte into carry @@ -726,23 +729,23 @@ XDOS.ReadFCB.DBLK L3FF2 rts *-------------------------------------- -rfcbidx lda #$01 prepare to read index block : read command - sta A4L +*rfcbidx lda #$01 prepare to read index block : read command +* sta A4L - ldx #zpt address of current index buffer. +* ldx #zpt address of current index buffer. - jsr fileio1 go read index block. - bcs L400C error +* jsr fileio1 go read index block. +* bcs L400C error - ldy fcbptr - lda bloknml - sta FCBs+FCB.IBLK,y save block address of this index in fcb - lda bloknml+1 - sta FCBs+FCB.IBLK+1,y +* ldy fcbptr +* lda bloknml +* sta FCBs+FCB.IBLK,y save block address of this index in fcb +* lda bloknml+1 +* sta FCBs+FCB.IBLK+1,y -* clc +** clc -L400C rts +*L400C rts *-------------------------------------- wfcbfst jsr upbmap update the bitmap and write file's 1st block. @@ -752,33 +755,35 @@ wfcbfst jsr upbmap update the bitmap and write file's 1st block. rfcbfst lda #$01 read command. pha save the command - lda #$0C + lda #FCB.1stBLK ora fcbptr add offset to fcbptr tay pla - ldx #$48 rd block into index portion of file buf + ldx #zpt rd block into index portion of file buf +*-------------------------------------- dofileio sta A4L command + lda FCBs,y get disk block address from fcb. sta bloknml block 0 not legal - cmp FCBs+FCB.DEVID,y - bne L4031 - cmp #$00 are both bytes 0 ? - bne L4031 no, continue request + bne .1 + + lda FCBs+1,y high address of disk block + bne .2 - lda #$0C otherwise, allocation error. - jsr sysdeath doesn't return... - -L4031 lda FCBs+FCB.DEVID,y high address of disk block - sta bloknml+1 + lda #$0C Block = $0000, allocation error. + jsr GP.SysDeath doesn't return... +.1 lda FCBs+1,y +.2 sta bloknml+1 +*-------------------------------------- fileio1 lda $00,x get memory address of buffer from sta buf page zero pointed to by x register lda $01,x sta buf+1 and pass address to device handler - ldy fcbptr - lda FCBs+FCB.DEVID,y - sta devnum along with device #. + + jsr XDOS.FCBDevIDSelect + lda #$FF also, set to indicate reg call made to sta ioaccess device handler. lda devnum transfer device # for dispatcher @@ -787,18 +792,20 @@ fileio1 lda $00,x get memory address of buffer from jmp XDOS.DevCall call the driver. *-------------------------------------- wfcbdat ldx #datptr point at memory address with x and - lda #$10 disk address with y. + 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 bcs L4096 if errors. + lda #$BF mark data status as current. - bra L408D + bra XDOS.ResetFCBStatus wfcbidx jsr upbmap update bitmap. - ldx #$48 point to address of index buffer - lda #$0E and block address of that index block. + + ldx #zpt point to address of index buffer + lda #FCB.IBLK and block address of that index block. ora fcbptr tay lda #$02 @@ -806,10 +813,12 @@ wfcbidx jsr upbmap update bitmap. bcs L4096 if errors. lda #$7F mark index status as current. +*-------------------------------------- +XDOS.ResetFCBStatus + ldx fcbptr + and FCBs+FCB.F,x + sta FCBs+FCB.F,x -L408D ldy fcbptr change status byte to reflect - and FCBs+FCB.F,y successful disk file update. - sta FCBs+FCB.F,y (carry is unaffected) L4096 rts *-------------------------------------- XDOS.Open jsr XDOS.FindFileOrVol look up the file. @@ -933,16 +942,17 @@ L4163 ldx vcbptr index to vcb. inc VCBs+VCB.OFCNT,x add 1 to # of files currently open ldx fcbptr index to fcb. - lda FCBs,x return ref # to user. + lda FCBs+FCB.ID,x return ref # to user. ldy #$05 sta (A3L),y * clc open is successful rts *-------------------------------------- -tstopen lda #$00 - sta cntent returns the ref # of a free fcb. - sta totent flag to indicate file already open. - sta fcbflg flag indicates a free fcb is available. +tstopen stz cntent returns the ref # of a free fcb. + stz totent flag to indicate file already open. + stz fcbflg flag indicates a free fcb is available. + + lda #$00 L4188 tay index to next fcb. ldx fcbflg test for free fcb found. diff --git a/ProDOS.FX/ProDOS.S.XDOS.D.txt b/ProDOS.FX/ProDOS.S.XDOS.D.txt index 47faa420..58865064 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.D.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.D.txt @@ -56,7 +56,7 @@ L421F jsr rdposn set up data pointer. beq L421F sta cmdtemp save bulk block count. - jsr XDOS.GetFCBStatus 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 bne L421F read into user's area. branch if data @@ -133,7 +133,7 @@ errfix1 pha save error code pla sec error rts - +*-------------------------------------- rwdone ldy #$06 return total # of bytes actually read sec derived from cbytes-rwreq. lda cbytes @@ -144,7 +144,7 @@ rwdone ldy #$06 return total # of bytes actually read sbc rwreqh sta (A3L),y jmp rdposn leave with valid position in fcb. - +*-------------------------------------- preprw ldy fcbptr adj pointer to user's buffer to make sec the transfer lda usrbuf @@ -166,7 +166,7 @@ L42F9 ldy tposll index to 1st data. sta sos beginning of page. ldx rwreql get low order count of requested bytes. rts return statuses. - +*-------------------------------------- readpart txa x = low count of bytes to move. bne L430F branch if request is not an even page. @@ -174,7 +174,9 @@ readpart txa x = low count of bytes to move. beq L435D branch if nothing to do. dec rwreqh + L430F dex + L4310 lda (sos),y move data to user's buffer sta (usrbuf),y bcs tstnewl test for newline 1st ! @@ -246,7 +248,7 @@ L4366 stx rwreql and remainder of request count. 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 sta usrbuf lda datptr+1 @@ -277,7 +279,6 @@ XDOS.ReadDir jsr rdposn L43A6 lda FCBs+FCB.DBLK,x sta (datptr),y - stz FCBs+FCB.DBLK,x mark current block as impossible inx iny inc indexes to do both hi and low bytes @@ -288,7 +289,7 @@ L43B6 clc no error L43B7 rts L43B8 jmp errfix1 report how much xfer'd before error. - +*-------------------------------------- mvcbytes ldy #$04 move request count to a more accessable location lda (A3L),y sta cbytes @@ -301,7 +302,7 @@ mvcbytes ldy #$04 move request count to a more accessable location lda FCBs+FCB.ACCESS,y a = attributes clc and carry clear... rts - +*-------------------------------------- mvdbufr ldy #$02 move the pointer to user's buffer lda (A3L),y to the block file manager sta usrbuf z-page area @@ -312,14 +313,14 @@ mvdbufr ldy #$02 move the pointer to user's buffer gfcbstyp ldy fcbptr return storage type lda FCBs+FCB.STYPE,y rts - +*-------------------------------------- * this subroutine adds the requested byte count to mark and returns sum * in scrtch and also returns mark in tpos and oldmark. * * on exit: * y,x,a is unknown * carry set indicates scrtch > eof - +*-------------------------------------- calcmrk ldx #$00 ldy fcbptr clc @@ -346,7 +347,7 @@ eoftest lda scrtch,x new mark in scrtch. bpl eoftest no, test next lowest L4414 rts - +*-------------------------------------- werreof jsr plus2fcb reset eof to pre-error position. L4418 lda oldeof,x place oldeof back into fcb @@ -426,7 +427,7 @@ L4487 iny indexes and data block ? jsr tstfrblk bcs L44A2 pass back any errors. - jsr XDOS.GetFCBStatus now get more specific. + jsr XDOS.GetFCBStatus now get more specific. and #$04 are we lacking a tree top ? beq L44AC no, test for lack of sapling level index @@ -589,9 +590,22 @@ L457A jsr alcwblk get another block address for the sap sta FCBs+FCB.IBLK,y jsr wfcbfst save new top of tree bcs L45B1 +*-------------------------------------- +zeroindex lda #$00 + tay +L3F30 sta (zpt),y zero out the index half of the user's + iny i/o buffer + bne L3F30 - jmp zeroindex zero index block in user's i/o buffer. + inc zpt+1 +L3F37 sta (zpt),y + iny + bne L3F37 + + dec zpt+1 restore proper address + rts +*-------------------------------------- sapdown jsr gfcbstyp find out if dealing with a tree. cmp #$01 if seed then adj to file type is needed. beq swapdown branch if seed @@ -651,8 +665,7 @@ tstwprot jsr XDOS.GetFCBStatus check for 'never been modified' condition and #$F0 bne tstwprot.8 ordinary rts if known write ok. - lda FCBs+FCB.DEVID,x get file's dev #. - sta devnum get current status of block device. + jsr XDOS.FCBDevIDSelect twrprot1 sta unitnum make the device status call diff --git a/ProDOS.FX/ProDOS.S.XDOS.E.txt b/ProDOS.FX/ProDOS.S.XDOS.E.txt index 80bb4e69..4e7f3798 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.E.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.E.txt @@ -44,12 +44,10 @@ close2 ldx fcbptr jsr relbuffr bcs L46B6 -* lda #$00 - ldx fcbptr + jsr XDOS.FCBDevIDSelect + stz FCBs,x free fcb too - lda FCBs+FCB.DEVID,x - sta devnum go look for associated vcb jsr XDOS.FindVCBForDevNum get vcb pointer. dec VCBs+VCB.OFCNT,x indicate one less file open. @@ -102,7 +100,7 @@ L46F1 lda FCBs+FCB.ACCESS,x test to see if file is modified. lda FCBs+FCB.DIRTY,x has eof been modified ? bmi L4704 if yes. - jsr XDOS.GetFCBStatus has data been modified ? + jsr XDOS.GetFCBStatus has data been modified ? and #$70 (was written to while it's been open?) beq L46D9 if not. @@ -113,18 +111,16 @@ L4704 jsr XDOS.GetFCBStatus jsr wfcbdat if so, go write it. bcs L46E6 if error. -L4710 jsr XDOS.GetFCBStatus 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. beq L471C branch if not. jsr wfcbidx bcs L46E6 return any errors. -L471C ldx fcbptr - - lda FCBs+FCB.DEVID,x - sta devnum A = d_dev - ldy #0 +L471C ldy #0 + + jsr XDOS.FCBDevIDSelect X = FCBPtr 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 @@ -223,6 +219,12 @@ glberr ldy #$01 L47C1 pla rts *-------------------------------------- +XDOS.FCBDevIDSelect + ldx fcbptr + lda FCBs+FCB.DEVID,x + sta devnum + rts +*-------------------------------------- XDOS.SetFCBSType lsr lsr diff --git a/ProDOS.FX/ProDOS.S.XDOS.F.txt b/ProDOS.FX/ProDOS.S.XDOS.F.txt index e33b43a0..68e8df54 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.F.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.F.txt @@ -186,7 +186,7 @@ detree lda stortyp which kind of tree ? bcc L4C59 branch if it is. lda #$0C block allocation error. - jsr sysdeath P8 system death vector + jsr GP.SysDeath P8 system death vector * seedling file type - make sure first desirable block is the only * block available in a seedling file. @@ -537,7 +537,7 @@ cmembit txa page address tay return it in y. pla restore bit mask. return bit position rts in a & y, pointer to memtabl in x. - +*-------------------------------------- valdbuf lda usrbuf+1 high address of user's buffer cmp #$02 must be greater than page 2. bcc L4E1E report bad buffer diff --git a/SYS/KERNEL.S.DIRENT.txt b/SYS/KERNEL.S.DIRENT.txt index bfe501da..88a16c2e 100644 --- a/SYS/KERNEL.S.DIRENT.txt +++ b/SYS/KERNEL.S.DIRENT.txt @@ -314,6 +314,7 @@ K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block bcc .3 inc K.ReadDir.BufSize+1 + .3 inx bne .7