diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index 5ee3191c..937f3a42 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 1f3355a1..27350bdf 100644 Binary files a/.Floppies/A2OSX.TEST.po and b/.Floppies/A2OSX.TEST.po differ diff --git a/BIN/FORMAT.S.txt b/BIN/FORMAT.S.txt index a24ff5e1..d7ddf186 100644 --- a/BIN/FORMAT.S.txt +++ b/BIN/FORMAT.S.txt @@ -5,11 +5,11 @@ NEW .OR $2000 .TF bin/format *-------------------------------------- - .INB INC/MACROS.I - .INB INC/A2OSX.I - .INB INC/MLI.E.I - .INB INC/KERNEL.I - .INB INC/LIBBLKDEV.I + .INB inc/macros.i + .INB inc/a2osx.i + .INB inc/mli.e.i + .INB inc/kernel.i + .INB inc/libblkdev.i *-------------------------------------- .DUMMY .OR ZPBIN @@ -314,14 +314,12 @@ CS.RUN.LL.DISKII ldx #16 jsr CS.RUN.ZeroPtr1 16 sectors filled with 0, give some time to spin up + >PUSHB DSSS0000 + >LIBCALL hLIBBLKDEV,LIBBLKDEV.D2Recalibrate + bcs .9 + stz CurTrack - lda #162 - sta CurQTrack - - ldx #0 - jsr CS.RUN.SeekToX - lda TrkCnt sta Counter @@ -660,5 +658,5 @@ DIB .BS S.DIB DS.END .ED *-------------------------------------- MAN -SAVE USR/SRC/BIN/FORMAT.S +SAVE usr/src/bin/format.s ASM diff --git a/INC/LIBBLKDEV.I.txt b/INC/LIBBLKDEV.I.txt index 385f8a8a..99eb4c14 100644 --- a/INC/LIBBLKDEV.I.txt +++ b/INC/LIBBLKDEV.I.txt @@ -5,9 +5,10 @@ NEW LIBBLKDEV.GetProDOSCatSize .EQ 4 LIBBLKDEV.BuildProDOSCat .EQ 6 LIBBLKDEV.D2MotorControl .EQ 8 -LIBBLKDEV.D2MoveHead .EQ 10 -LIBBLKDEV.D2TrkRead16s .EQ 12 -LIBBLKDEV.D2TrkWrite16s .EQ 14 +LIBBLKDEV.D2Recalibrate .EQ 10 +LIBBLKDEV.D2MoveHead .EQ 12 +LIBBLKDEV.D2TrkRead16s .EQ 14 +LIBBLKDEV.D2TrkWrite16s .EQ 16 *-------------------------------------- MAN -SAVE INC/LIBBLKDEV.I +SAVE inc/libblkdev.i diff --git a/INC/MACROS.I.txt b/INC/MACROS.I.txt index cf1b9757..3b6a9983 100644 --- a/INC/MACROS.I.txt +++ b/INC/MACROS.I.txt @@ -114,6 +114,14 @@ NEW .DO ]1=MLIGETBUF lda #2 .FIN + + .DO ]1=MLISETFILEINFOEX + lda #2 + .FIN + .DO ]1=MLIGETFILEINFOEX + lda #2 + .FIN + jsr GP.MLICall .EM *-------------------------------------- @@ -530,4 +538,4 @@ FPU.FOUT .EQ 58 PrintF .EM *-------------------------------------- MAN -SAVE INC/MACROS.I +SAVE inc/macros.i diff --git a/INC/MLI.I.txt b/INC/MLI.I.txt index 726f6641..fa4af4d3 100644 --- a/INC/MLI.I.txt +++ b/INC/MLI.I.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 + AUTO 4,1 .LIST OFF *-------------------------------------- * PRODOS Constants @@ -65,20 +64,21 @@ S.FI.CTIME .EQ $10 * S.FI .EQ $12 *-------------------------------------- -S.FIEX.TYPE .EQ 0 -S.FIEX.KEYPTR .EQ 1 -S.FIEX.BUSED .EQ 3 -S.FIEX.EOF .EQ 5 -S.FIEX.CTIME .EQ 8 -S.FIEX.VERSION .EQ 12 -S.FIEX.MVERSION .EQ 13 -S.FIEX.ACCESS .EQ 14 -S.FIEX.AUXTYPE .EQ 15 -S.FIEX.MTIME .EQ 17 -S.FIEX.BLKPTR .EQ 21 -S.FIEX.ACL .EQ 24 +S.FIEX.FILENAME .EQ 0 +S.FIEX.TYPE .EQ 16 +S.FIEX.KEYPTR .EQ 17 +S.FIEX.BLKUSED .EQ 19 +S.FIEX.EOF .EQ 21 +S.FIEX.CTIME .EQ 24 +S.FIEX.VERSION .EQ 28 +S.FIEX.MVERSION .EQ 29 +S.FIEX.ACCESS .EQ 30 +S.FIEX.AUXTYPE .EQ 31 +S.FIEX.MTIME .EQ 33 +S.FIEX.BLKPTR .EQ 37 +S.FIEX.ACL .EQ 40 * -S.FIEX .EQ 32 +S.FIEX .EQ 48 *-------------------------------------- MLI .EQ $BF00 *JSPARE .EQ $BF03 @@ -151,4 +151,4 @@ MACHID.CLK .EQ %00000001 *KVERSION .EQ $BFFF *-------------------------------------- MAN -SAVE INC/MLI.I +SAVE inc/mli.i diff --git a/INC/NIC.I.txt b/INC/NIC.I.txt index 10ede08f..5a7e268f 100644 --- a/INC/NIC.I.txt +++ b/INC/NIC.I.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 +AUTO 3,1 .LIST OFF *-------------------------------------- * NIC Devices @@ -23,4 +22,4 @@ S.DCB.NIC.GW .EQ 18 S.DCB.NIC .EQ 22 *-------------------------------------- MAN -SAVE INC/NIC.I +SAVE inc/nic.i diff --git a/INC/NIC.W5100.I.txt b/INC/NIC.W5100.I.txt index a71092aa..add39b32 100644 --- a/INC/NIC.W5100.I.txt +++ b/INC/NIC.W5100.I.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 .LIST OFF *-------------------------------------- * WIZnet W5100 IO Registers @@ -85,4 +84,4 @@ RX.BASE .EQ $6000 RXTX.MASK .EQ $1FFF *-------------------------------------- MAN -SAVE INC/NIC.W5100.I +SAVE inc/nic.w5100.i diff --git a/INC/ZP.I.txt b/INC/ZP.I.txt index 1d248ec7..282af0c2 100644 --- a/INC/ZP.I.txt +++ b/INC/ZP.I.txt @@ -1,6 +1,5 @@ NEW -PREFIX -AUTO 4,1 + AUTO 3,1 *-------------------------------------- * ProDOS Reserved ZP Location 00-1F,56-FF *-------------------------------------- @@ -27,4 +26,4 @@ RNDL .EQ $4E RANDOM NUMBER LOW RNDH .EQ $4F RANDOM NUMBER HIGH *-------------------------------------- MAN -SAVE INC/ZP.I +SAVE inc/zp.i diff --git a/LIB/LIBBLKDEV.S.BB.txt b/LIB/LIBBLKDEV.S.BB.txt index 7e21f178..a7ca7759 100644 --- a/LIB/LIBBLKDEV.S.BB.txt +++ b/LIB/LIBBLKDEV.S.BB.txt @@ -51,17 +51,18 @@ xboot .DA #1 sec apple iii enters xboot 'ora $38' bcs BB.AppleII branch if not apple iii native mode *-------------------------------------- -BB.AppleIII lda #$9f make apple iii boot using block 1 - pha the return address is $a000 - lda #$ff - pha +BB.AppleIII bcc * +* lda #$9f make apple iii boot using block 1 +* pha the return address is $a000 +* lda #$ff +* pha - inc - tax ldx #0 +* inc +* tax ldx #0 - inc lda #1 (read block 1) +* inc lda #1 (read block 1) - jmp $f479 +* jmp $f479 *-------------------------------------- BB.AppleII stx unit save unit number cmp #$03 for disk ii @@ -231,12 +232,12 @@ bterr2 bcs booterr jmp kernel go execute kernel code. *-------------------------------------- booterr jsr clrscrn clear video - ldy #BB.MSG.ERR.Len-1 +* ldy #BB.MSG.ERR.Len-1 -.1 lda BB.MSG.ERR,y - sta scrn,y - dey - bpl .1 +*.1 lda BB.MSG.ERR,y +* sta scrn,y +* dey +* bpl .1 jmp $ff69 *-------------------------------------- @@ -256,8 +257,8 @@ endcode ldx slotz jmp BB.Read *-------------------------------------- -BB.MSG.ERR .AS -"ERR" -BB.MSG.ERR.Len .EQ *-BB.MSG.ERR +*BB.MSG.ERR .AS -"ERR" +*BB.MSG.ERR.Len .EQ *-BB.MSG.ERR BB.ProDOS .DA #$26 $20 = storage type + 6 = "PRODOS" len .AS "PRODOS" *-------------------------------------- @@ -298,60 +299,83 @@ d2io lda blok figure out track & sector. jsr BB.Read quitrd ldy IO.D2.DrvOff,x -erretrn rts return error status in carry. + rts return error status in carry. *-------------------------------------- BB.Read lda BB.HdrTrk get track we're on jsr BB.Trk2Qtrk sta BB.CurQTrk -.1 lda BB.CurQTrk - cmp BB.TargetQTrk - beq .3 + ldy #0 - bcs .2 move out, not in +.1 ldx BB.CurQTrk - inc + tya + beq .2 + + txa + jsr BB.PhaseOff + +.2 cpx BB.TargetQTrk + beq .8 + + bcs .3 + + inx .HS B0 BCS -.2 dec - - sta BB.CurQTrk - jsr BB.AllPhaseOff +.3 dex + stx BB.CurQTrk + + txa jsr BB.PhaseOn - lda #115 11.5 ms - + lda #104 jsr BB.MSWait Trash X - bcs .1 ALWAYS + + iny + + bcs .1 CS from BB.MSWait -.3 lda #0 wait 25.5 ms +.8 tya + beq seekend + + lda #0 wait 25.6 ms jsr BB.MSWait Trash X - jsr BB.AllPhaseOff - bcs seekend ALWAYS + lda BB.TargetQTrk + jsr BB.PhaseOff + bcs seekend CS from BB.MSWait *-------------------------------------- -BB.AllPhaseOff ldx slotz - bit IO.D2.Ph0Off,x - bit IO.D2.Ph3Off,x - bit IO.D2.Ph2Off,x - bit IO.D2.Ph1Off,x - rts +BB.PhaseOff bit #1 1,3,5,7 ? + beq BB.PhaseOff.2 only half track + +BB.PhaseOff.1 bit IO.D2.Ph0Off +BB.PhaseOff.2 bit IO.D2.Ph0Off + +BB.PhaseOff.8 rts *-------------------------------------- BB.PhaseOn bit #1 1,3,5,7 ? beq .7 pha + inc jsr .7 pla - inc 2,4,6,0 .7 and #6 mask for 0,2,4,6 ora slotz Slot $n0 + ora #IO.D2.Ph0On tax - lda IO.D2.Ph0On,x turn on one phase + bit $C000,x turn on one phase + + lda BB.PhaseOff.2+1 + sta BB.PhaseOff.1+1 + + dex + stx BB.PhaseOff.2+1 rts *-------------------------------------- BB.MSWait sec (6) JSR (2) @@ -375,7 +399,7 @@ BB.Trk2Qtrk asl x2 lsr x3 .1 adc #$ff SELF MODIFIED - rts +BB.Trk2Qtrk.RTS rts *-------------------------------------- seekend ldx slotz @@ -387,7 +411,7 @@ tryread plp fix stack. rdhead sec anticipate error. dec BB.RetryCnt if = 0 then give up! - beq erretrn branch if can't fine/read sector. + beq BB.Trk2Qtrk.RTS branch if can't fine/read sector. clc indicate reading header. rddata php carry set if reading sector. diff --git a/LIB/LIBBLKDEV.S.D2.txt b/LIB/LIBBLKDEV.S.D2.txt index 368c5ab2..e84d50d1 100644 --- a/LIB/LIBBLKDEV.S.D2.txt +++ b/LIB/LIBBLKDEV.S.D2.txt @@ -11,98 +11,132 @@ D2MotorControl >PULLB MotorOn lda MotorOn asl - lda #0 - adc #IO.D2.DrvOff + lda #IO.D2.DrvOff adc Slotn0 tax lda $C000,x * clc -.9 -D2MotorControl.RTS - rts +.9 rts +*/-------------------------------------- +*\-------------------------------------- +D2Recalibrate >PULLB DrvSlt + jsr CheckDiskII + bcs .9 + + stz MoveTo + lda #252 + sta MoveFrom + + jsr D2MoveHead.1 + + lda #0 + jsr D2.PhaseOn + + lda #0 wait 25.6 ms + jsr D2.Wait100msA Trash X + + lda #0 wait 25.6 ms + jsr D2.Wait100msA Trash X + + lda #0 wait 25.6 ms + jsr D2.Wait100msA Trash X + + lda #0 wait 25.6 ms + jsr D2.Wait100msA Trash X + + jsr D2.PhaseOn.2 + + clc +.9 rts */-------------------------------------- *\-------------------------------------- D2MoveHead >PULLB MoveTo >PULLB MoveFrom >PULLB DrvSlt jsr CheckDiskII - bcs D2MotorControl.RTS + bcs .9 + + php + sei + jsr D2MoveHead.1 + plp + clc +.9 rts - ldy #0 +D2MoveHead.1 ldy #0 -.1 lda MoveFrom - cmp MoveTo - beq .3 +.1 ldx MoveFrom - bcs .2 + tya + beq .2 + + txa + jsr D2.PhaseOff + +.2 cpx MoveTo + beq .8 - inc MoveFromMoveTo, must move out +.3 dex MoveFrom>MoveTo, must move out - sta MoveFrom + stx MoveFrom - pha + txa jsr D2.PhaseOn - lda #85 8.5 ms - jsr D2.Wait100msA Trash X - - pla - - jsr D2.PhaseOff - - lda #1 0.1 ms + lda #104 jsr D2.Wait100msA Trash X iny bra .1 -.3 tya +.8 tya + beq D2.PhaseOff.8 - beq D2.AllPahseOff.8 - - lda #0 wait 25.5 ms + lda #0 wait 25.6 ms jsr D2.Wait100msA Trash X - clc - rts + + lda MoveTo *-------------------------------------- -D2.AllPhaseOff ldx Slotn0 - bit IO.D2.Ph0Off,x - bit IO.D2.Ph3Off,x - bit IO.D2.Ph2Off,x - bit IO.D2.Ph1Off,x -D2.AllPahseOff.8 - clc - rts +D2.PhaseOff bit #1 1,3,5,7 ? + beq D2.PhaseOff.2 only half track + +D2.PhaseOff.1 bit IO.D2.Ph0Off SELF MODIFIED +D2.PhaseOff.2 bit IO.D2.Ph0Off SELF MODIFIED + +D2.PhaseOff.8 rts *-------------------------------------- D2.PhaseOn bit #1 1,3,5,7 ? - beq .7 only half track + bne .1 only half track - bcc .1 - - pha CS : move out jsr .7 - pla - inc - bcs .7 + bra D2.PhaseOn.2 .1 pha - inc jsr .7 pla + inc + jsr .7 + bra D2.PhaseOn.1 .7 and #6 mask for 0,2,4,6 ora Slotn0 Slot $n0 ora #IO.D2.Ph0On tax - bit $C000,x turn on one phase + + lda D2.PhaseOn.2+1 + sta D2.PhaseOn.1+1 + + stx D2.PhaseOn.2+1 lda D2.PhaseOff.2+1 sta D2.PhaseOff.1+1 @@ -111,11 +145,8 @@ D2.PhaseOn bit #1 1,3,5,7 ? stx D2.PhaseOff.2+1 rts *-------------------------------------- -D2.PhaseOff bit #1 1,3,5,7 ? - beq D2.PhaseOff.2 only half track - -D2.PhaseOff.1 bit $c000 -D2.PhaseOff.2 bit $c000 +D2.PhaseOn.1 bit IO.D2.Ph0On SELF MODIFIED +D2.PhaseOn.2 bit IO.D2.Ph0On SELF MODIFIED rts *-------------------------------------- D2.Wait100msA sec diff --git a/LIB/LIBBLKDEV.S.txt b/LIB/LIBBLKDEV.S.txt index 09e4005a..74850434 100644 --- a/LIB/LIBBLKDEV.S.txt +++ b/LIB/LIBBLKDEV.S.txt @@ -60,6 +60,7 @@ CS.START cld .DA GetProDOSCatSize .DA BuildProDOSCat .DA D2MotorControl + .DA D2Recalibrate .DA D2MoveHead .DA D2TrkRead16s .DA D2TrkWrite16s diff --git a/ProDOS.FX/ProDOS.S.LDR.txt b/ProDOS.FX/ProDOS.S.LDR.txt index 0a86487a..2d2c2ca1 100644 --- a/ProDOS.FX/ProDOS.S.LDR.txt +++ b/ProDOS.FX/ProDOS.S.LDR.txt @@ -177,7 +177,7 @@ m128k sta idapple Save MACHID in temp location .1 * stz $D700,x - stz fcbbuf,x + stz FCBs,x stz VCBs,x * stz $DA00,x * stz $DB00,x diff --git a/ProDOS.FX/ProDOS.S.XDOS.A.txt b/ProDOS.FX/ProDOS.S.XDOS.A.txt index 8abae6cb..04554794 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.A.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.A.txt @@ -7,7 +7,7 @@ XDOS cld no decimal. * pla get processor status * sta spare1 save it temporarily - ply + ply get processor status pla find out the address of the caller sta A3L @@ -22,7 +22,7 @@ XDOS cld no decimal. * lda spare1 * pha pull processor status - phy + phy pull processor status plp to re-enable interrupts. cld still no decimal @@ -84,6 +84,7 @@ godevmgr lsr shift back down for device manager. gobfmgr lsr shift back down for block file manager. and #$1F valid commands are 0-$13 tax + jsr XDOS.bfmgr exitmli stz bubit clear backup bit @@ -251,7 +252,12 @@ sysdeath1 tax death error code. *-------------------------------------- * ProDOS Block File Manager *-------------------------------------- -XDOS.bfmgr lda XDOS.CmdFlags,x translate into command address. +XDOS.bfmgr cpx #$14 + bcc .1 + +* >DEBUG + +.1 lda XDOS.CmdFlags,x translate into command address. asl bit 7 indicates pathname to process sta cmdtemp and #$3F bit 6 is refnum, 5 is time to process @@ -510,18 +516,19 @@ findfcb ldy #$01 index to ref# sta fcbptr used as an index to fcb tay pla restore ref# in acc - cmp fcbbuf,y + cmp FCBs,y bne errnoref -fndfcbuf lda fcbbuf+11,y get page address of file buffer. +fndfcbuf lda FCBs+11,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 + stx datptr+1 save ptr to data area of buffer inx inx index block always 2 pages after data stx zpt+1 - lda fcbbuf+1,y also set up device # + lda FCBs+1,y also set up device # sta devnum lda bufaddrl sta datptr index and data buffers always on @@ -529,7 +536,7 @@ fndfcbuf lda fcbbuf+11,y get page address of file buffer. fndfvol tax search for associated vcb lda VCBs+VCB.DEV,x - cmp fcbbuf+1,y is this vcb the same device? + cmp FCBs+1,y is this vcb the same device? beq tstvopen if it is, make sure volume is active. nxtfvol txa adjust index to next vcb. @@ -550,7 +557,7 @@ tstvopen lda VCBs,x make sure this vcb is open. rts errnoref lda #$00 put a zero into this fcb to - sta fcbbuf,y show free fcb. + sta FCBs,y show free fcb. badref lda #MLI.E.BADREF requested refnum is sec illegal (out of range) @@ -660,11 +667,11 @@ olinerr1 pha save error code. H34CE sec flag error rts -H34D0 lda VCBs,x get volume name count +H34D0 lda VCBs,x get volume name count sta namcnt ldy namptr index to user's buffer. -H34D9 lda VCBs,x move name to user's buffer +H34D9 lda VCBs,x move name to user's buffer sta (usrbuf),y inx iny @@ -726,7 +733,7 @@ H352A lda bloknml preserve disk address of current (last) sta gbuf+2 save block address in y,a to sty gbuf+3 current directory. - jsr XDOS.WriteGBuf update directory block with new link. + jsr XDOS.WriteGBuf update directory block with new link. bcs H351D if error ldx #$01 @@ -745,21 +752,24 @@ clrdir sta gbuf+2,x inx bne clrdir - jsr XDOS.WriteGBuf write prepared directory extension. + jsr XDOS.WriteGBuf write prepared directory extension. bcs H351D if error lda own_blk ldx own_blk+1 - jsr XDOS.ReadGBufAX read in parent directory block + jsr XDOS.ReadGBufAX read in parent directory block ldx own_ent and calc entry address. lda /gbuf sta zpt+1 lda #$04 + ocalc clc dex has entry address been calulated? beq H3584 if yes. + adc own_len next entry address bcc ocalc + inc zpt+1 entry must be in 2nd 256 bytes of block bcs ocalc always taken. @@ -811,6 +821,7 @@ cmvname lda (A3L),y y = index to file kind. cmp #$04 lda #$10 assume tree type bcc csvfkind + lda #$D0 it's directory. csvfkind ldx namptr index to local name of pathname. @@ -919,7 +930,7 @@ cralcblk jsr alc1blk get address of file's data block sty d_frst+1 sta bloknml sty bloknml+1 - jsr XDOS.WriteGBuf go write data block of file + jsr XDOS.WriteGBuf go write data block of file bcs crerr3 inc h_fcnt add 1 to total # of files in this dir @@ -994,7 +1005,7 @@ H36E0 jsr XDOS.WriteGBuf go write updated directory block. lda d_head get address of header block and ldx d_head+1 - jsr XDOS.ReadGBufAX go read in header block to modify. + jsr XDOS.ReadGBufAX go read in header block to modify. bcs crerr3 uphead ldy #$01 update current # of files in this dir. @@ -1006,7 +1017,7 @@ H36F2 lda h_fcnt,y lda h_attr also update header's attributes. sta gbuf+34 - jsr XDOS.WriteGBuf go write updated header + jsr XDOS.WriteGBuf go write updated header bcs H375A ripple lda gbuf+4 test for 'root' directory because @@ -1021,7 +1032,7 @@ ripple lda gbuf+4 test for 'root' directory because lda gbuf+39 get addr of parent entry's dir block ldx gbuf+40 - jsr XDOS.ReadGBufAX read it + jsr XDOS.ReadGBufAX read it bcs H375A jsr entcalc get indirect ptr to parent entry in gbuf @@ -1038,7 +1049,7 @@ H3732 lda p8date,x dex bpl H3732 -H373B jsr XDOS.WriteGBuf write updated entry back to disk. +H373B jsr XDOS.WriteGBuf write updated entry back to disk. bcs H375A if error. ldy #$25 compare current block # to this diff --git a/ProDOS.FX/ProDOS.S.XDOS.C.txt b/ProDOS.FX/ProDOS.S.XDOS.C.txt index 6b51a0f3..3257fd30 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.C.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.C.txt @@ -238,18 +238,17 @@ wrtbmap lda #$02 write command. txa error code L3DB6 rts *-------------------------------------- -rdblk XDOS.ReadGBufAX sta bloknml stx bloknml+1 -rdgbuf + XDOS.ReadGBuf lda #$01 read command. .HS 2C BIT ABS -wrtgbuf + XDOS.WriteGBuf lda #$02 write command sta A4L pass to device handler. lda /gbuf general buffer. -dobitmap + XDOS.RWBlock php no interrupts sei sta buf+1 buffer high. @@ -277,7 +276,7 @@ XDOS.GetMark ldx fcbptr index to open fcb. ldy #$02 index to user's mark parmeter. -.1 lda fcbbuf+18,x transfer current position +.1 lda FCBs+18,x transfer current position sta (A3L),y to user's parameter list inx iny @@ -301,7 +300,7 @@ XDOS.SetMark ldy #$04 index to user's desired position. sta tposll-2,y bcc .2 branch if mark < eof - cmp fcbbuf+21,x + cmp FCBs+21,x bcc .2 branch if mark qualifies. bne L3DFD branch if mark > eof (invalid position) @@ -314,7 +313,7 @@ XDOS.SetMark ldy #$04 index to user's desired position. bne .1 branch if more. rdposn ldy fcbptr test to see if new position is - lda fcbbuf+19,y within the same (current) data block. + lda FCBs+19,y within the same (current) data block. and #$FE sta scrtch lda tposlh middle byte of new position @@ -322,81 +321,105 @@ rdposn ldy fcbptr test to see if new position is sbc scrtch sta scrtch bcc L3E44 branch if < current position. + cmp #$02 must be within 512 bytes of beginning bcs L3E44 of current position. + lda tposhi make sure within the same 64k. - cmp fcbbuf+20,y + cmp FCBs+20,y bne L3E44 branch if not. + jmp svmark if so, adj fcb, position ptr and return. -L3E44 lda fcbbuf+7,y determine file type for positioning. + +L3E44 lda FCBs+7,y determine file type for positioning. beq L3E50 0 = invalid file type. + cmp #$04 tree class file? bcc L3E59 yes, go position. + jmp dirmark no, test for dir type. + L3E50 ldy #$A4 clear illegal filetype entry in fcb - sta fcbbuf,y + sta FCBs,y lda #$43 and report error sec rts -L3E59 lda fcbbuf+7,y use storage type as # of index levels +L3E59 lda FCBs+7,y use storage type as # of index levels sta levels since 1=seed, 2=sapling, 3=tree. - lda fcbbuf+8,y + lda FCBs+8,y and #$40 if previous data was modified then beq L3E6B disk must be updated. + jsr wfcbdat + bcs L3ED4 if error. + L3E6B ldy fcbptr test to see if current index block - lda fcbbuf+20,y is usable by checking if new + lda FCBs+20,y is usable by checking if new and #$FE position is within 128k of the sta scrtch beginning of current sapling level lda tposhi chunk. sec sbc scrtch bcc L3E9D branch if a new index block is needed. + cmp #$02 is new position within 128k of old ? bcs L3E9D branch if not. + ldx levels is it a seed file ? dex bne datlevel no, use current indexes. + L3E89 lda tposlh is new position < 512 ? lsr ora tposhi bne L3EEF no, mark both data and index block as - lda fcbbuf+12,y unallocated. 1st block is only block + + lda FCBs+12,y unallocated. 1st block is only block sta bloknml and it's data. - lda fcbbuf+13,y high block address. + lda FCBs+13,y high block address. jmp rnewpos go read in block and set statuses. -L3E9D lda fcbbuf+8,y check to see if previous index block + +L3E9D lda FCBs+8,y check to see if previous index block and #$80 was modified. beq L3EA9 read in over it if current up to date. + jsr wfcbidx go update index on disk (fcb block addr) bcs L3ED4 + L3EA9 ldx levels be sure there is a top index cpx #$03 before reading it... beq posindex branch if file is a tree. + lda tposhi is new position within range of a lsr sapling file (less than 128k) ? php save results lda #$07 (no level is allocated for new pos'n) plp restore z-flag. bne L3F18 go mark all as dummy. + jsr clrstats clr status bits 0,1,2 (index/data/alloc) + dex check for seed beq L3E89 if seed, check for position < 512. + jsr rfcbfst go get only index block. bcs L3ED4 if error. + ldy fcbptr save newly loaded index block's address. lda bloknml - sta fcbbuf+14,y + sta FCBs+14,y lda bloknml+1 - sta fcbbuf+15,y + sta FCBs+15,y bcc datlevel branch always + L3ED4 rts posindex jsr clrstats clr all alloc requirements for previous jsr rfcbfst position. get highest level index block bcs L3ED4 + lda tposhi then test for a sap level index block lsr tay @@ -404,17 +427,22 @@ posindex jsr clrstats clr all alloc requirements for previous inc zpt+1 cmp (zpt),y (both high and low = 0 if no index exists) bne saplevel + tax are both bytes 0 ? bne saplevel + dec zpt+1 + L3EEF lda #$03 show neither index or data block alloc'd bra L3F18 + 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 + datlevel lda tposhi get block address of data block lsr lda tposlh ( if there is one ) @@ -424,17 +452,21 @@ datlevel lda tposhi get block address of data block inc zpt+1 cmp (zpt),y bne L3F51 + tax bne L3F51 + lda #$01 show data block as never been allocated dec zpt+1 + L3F18 ldy fcbptr set status to show what's missing - ora fcbbuf+8,y - sta fcbbuf+8,y + ora FCBs+8,y + sta FCBs+8,y 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 zeroindex zero index block in user's i/o buffer bra svmark @@ -458,30 +490,38 @@ zipdata lda #$00 L3F42 sta (datptr),y zero out data area iny bne L3F42 + inc datptr+1 + L3F49 sta (datptr),y iny bne L3F49 + dec datptr+1 rts + L3F51 sta bloknml get data block of new position lda (zpt),y (high address) dec zpt+1 + rnewpos sta bloknml+1 jsr rfcbdat bcs L3F86 if error. + jsr clrstats show whole chain is allocated. + svmark ldy fcbptr update position in fcb iny iny ldx #$02 -L3F68 lda fcbbuf+18,y save old mark in case calling routine +L3F68 lda FCBs+18,y save old mark in case calling routine sta oldmark,x fails later. lda tposll,x - sta fcbbuf+18,y + sta FCBs+18,y dey dex move 3 byte position marker bpl L3F68 + clc set up indirect address to buffer lda datptr page pointed to by the current sta sos position marker. @@ -490,10 +530,11 @@ L3F68 lda fcbbuf+18,y save old mark in case calling routine adc datptr+1 sta sos+1 L3F86 rts carry set if error + clrstats ldy fcbptr clear allocation states for data block - lda fcbbuf+8,y and both levels of indexes/ + lda FCBs+8,y and both levels of indexes/ and #$F8 - sta fcbbuf+8,y indicates that either they exist now + sta FCBs+8,y indicates that either they exist now rts or unnecessary for current position. dirmark cmp #$0D is it a directory ? @@ -505,27 +546,35 @@ 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 fcbbuf+19,y test for positive direction + lda FCBs+19,y test for positive direction cmp tposlh indicated by carry. bcc L3FB9 if set, position forward. otherwise, + L3FAB ldy #$00 read directory file in reverse order. jsr dirpos1 read previous block. bcs L3FD6 if error. + inc cntent count up to 128. bpl L3FAB loop if more blocks to pass over. + bmi svmark always. + L3FB9 ldy #$02 position is forward from current. jsr dirpos1 read next directory block bcs L3FD6 if error. + dec cntent 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 iny but first be sure there is a link. lda (datptr),y get the rest of the link. bne L3FD8 branch if certain link exists. + bcs L3FD8 was the low part null as well ? lda #MLI.E.EOF something is wrong with directory file! @@ -541,11 +590,12 @@ rfcbdat lda #$01 read command ldx #datptr points at address of data buffer. jsr fileio1 go do file input. bcs L3FF2 error. + ldy fcbptr lda bloknml - sta fcbbuf+16,y save block # just read in fcb. + sta FCBs+16,y save block # just read in fcb. lda bloknml+1 - sta fcbbuf+17,y + sta FCBs+17,y L3FF2 rts rfcbidx lda #$01 prepare to read index block : read command @@ -553,11 +603,12 @@ rfcbidx lda #$01 prepare to read index block : read command ldx #$48 address of current index buffer. jsr fileio1 go read index block. bcs L400C error + ldy fcbptr lda bloknml - sta fcbbuf+14,y save block address of this index in fcb + sta FCBs+14,y save block address of this index in fcb lda bloknml+1 - sta fcbbuf+15,y + sta FCBs+15,y clc L400C rts @@ -576,9 +627,9 @@ rfcbfst lda #$01 read command. ldx #$48 rd block into index portion of file buf dofileio sta A4L command - lda fcbbuf,y get disk block address from fcb. + lda FCBs,y get disk block address from fcb. sta bloknml block 0 not legal - cmp fcbbuf+1,y + cmp FCBs+1,y bne L4031 cmp #$00 are both bytes 0 ? bne L4031 no, continue request @@ -586,7 +637,7 @@ dofileio sta A4L command lda #$0C otherwise, allocation error. jsr sysdeath doesn't return... -L4031 lda fcbbuf+1,y high address of disk block +L4031 lda FCBs+1,y high address of disk block sta bloknml+1 fileio1 php no interrupts @@ -596,7 +647,7 @@ fileio1 php no interrupts lda $01,x sta buf+1 and pass address to device handler ldy fcbptr - lda fcbbuf+1,y + lda FCBs+1,y sta devnum along with device #. lda #$FF also, set to indicate reg call made to sta ioaccess device handler. @@ -634,8 +685,8 @@ wfcbidx jsr upbmap update bitmap. bcs L4096 if errors. lda #$7F mark index status as current. L408D ldy fcbptr change status byte to reflect - and fcbbuf+8,y successful disk file update. - sta fcbbuf+8,y (carry is unaffected) + and FCBs+8,y successful disk file update. + sta FCBs+8,y (carry is unaffected) L4096 rts *-------------------------------------- XDOS.Open jsr findfile look up the file. @@ -663,7 +714,7 @@ L40B9 ldx #$1F assign fcb, lda #0 -L40BD sta fcbbuf,y but clean it first. +L40BD sta FCBs,y but clean it first. iny dex bpl L40BD @@ -674,7 +725,7 @@ L40BD sta fcbbuf,y but clean it first. tay L40CB lda d_dev-1,x move ownership info. - sta fcbbuf,y note: this code depends upon the defined + sta FCBs,y note: this code depends upon the defined dey order of both the fcb and directory dex entry buffer. bne L40CB @@ -685,7 +736,7 @@ L40CB lda d_dev-1,x move ownership info. lsr lsr tax save in x for later comparison - sta fcbbuf+7,y and in fcb for future access. + sta FCBs+7,y and in fcb for future access. lda d_attr get file's attributes and use it and #$03 as a default access request. cpx #$0D if directory, don't allow write enable. @@ -693,7 +744,7 @@ L40CB lda d_dev-1,x move ownership info. and #$01 read enabled bit -L40EB sta fcbbuf+9,y +L40EB sta FCBs+9,y and #$02 check for write enabled request. beq L40F7 branch for open as read-only @@ -713,25 +764,25 @@ L4101 sta bloknml+1 of file and current usage count. ora ofcbtbl,x this is done via a translation table tay between directory info and fcb. lda d_frst,x - sta fcbbuf,y + sta FCBs,y dex bpl L4101 last loop stores hi address of 1st block sta bloknml and this is the low one. ldy fcbptr lda cntent this was set up by 'tstopen'. - sta fcbbuf,y claim fcb for this file. + sta FCBs,y claim fcb for this file. jsr alcbuffr go allocate buffer in memory tables. bcs L4147 if errors. jsr fndfcbuf rtn addr of bufs in data & index ptrs. lda flevel mark level at which - sta fcbbuf+27,y file was opened. - lda fcbbuf+7,y file must be positioned at beginning. + sta FCBs+27,y file was opened. + lda FCBs+7,y file must be positioned at beginning. cmp #$04 is it a tree file ? bcs L415E no, assume a directory. lda #$FF fool the position routine into giving - sta fcbbuf+20,y a valid position with preloaded data, + sta FCBs+20,y a valid position with preloaded data, ldy #$02 etc. set desired position to 0. lda #$00 @@ -745,14 +796,14 @@ L413C sta tposll,y L4147 pha save error code. ldy fcbptr free buffer space. - lda fcbbuf+11,y + lda FCBs+11,y beq L4156 if no bufnum, ok because never alloc'd. jsr relbuffr go release buffer. ldy fcbptr since error was before file was L4156 lda #$00 successfully opened, then it is - sta fcbbuf,y necessary to release fcb also. + sta FCBs,y necessary to release fcb also. pla error code. sec rts @@ -767,7 +818,7 @@ L4163 ldx vcbptr index to vcb. * ror VCBs+VCB.OF,x least 1 file active. ldy fcbptr index to fcb. - lda fcbbuf,y return ref # to user. + lda FCBs,y return ref # to user. ldy #$05 sta (A3L),y clc open is successful @@ -784,7 +835,7 @@ L4188 tay index to next fcb. inc cntent -L4191 lda fcbbuf,y is this fcb in use ? +L4191 lda FCBs,y is this fcb in use ? bne L41A3 yes. txa if not, should we claim it ? @@ -800,7 +851,7 @@ L41A3 tya add offset to index to ownership info tay and put it back in y. ldx #$06 index to directory entry owner info. -L41A9 lda fcbbuf,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. bne L41C1 if not, then next fcb. @@ -809,7 +860,7 @@ L41A9 lda fcbbuf,y all bytes must match to say that it's bne L41A9 loop to check all owner info. inc totent file is already open, now see - lda fcbbuf+9,y if it's already opened for write. and #$02 if so report file busy (with carry set). + lda FCBs+9,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). beq L41C1 branch if this file is read access only. sec diff --git a/ProDOS.FX/ProDOS.S.XDOS.D.txt b/ProDOS.FX/ProDOS.S.XDOS.D.txt index a698e52d..d0ed2d85 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.D.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.D.txt @@ -12,11 +12,11 @@ XDOS.Read jsr mvdbufr xfer buffer address and request count bcc L4205 branch if result mark < eof. adjust ldy fcbptr request to read until just before eof. - lda fcbbuf+21,y result = (eof-1) - position + lda FCBs+21,y result = (eof-1) - position sbc tposll sta cbytes sta rwreql - lda fcbbuf+22,y + lda FCBs+22,y sbc tposlh sta cbytes+1 sta rwreqh @@ -158,12 +158,12 @@ preprw ldy fcbptr adj pointer to user's buffer to make sta usrbuf bcs L42E9 if no adjustment to hi address needed dec usrbuf+1 -L42E9 lda fcbbuf+31,y test for new line enabled. +L42E9 lda FCBs+31,y test for new line enabled. clc beq L42F9 if new line not enabled. sec carry indicates new line enabled sta nlmask - lda fcbbuf+10,y move newline character to more + lda FCBs+10,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 @@ -279,10 +279,10 @@ dread jsr rdposn ldy #$00 provide dummy back pointer for future ldx fcbptr re-position. x = hi byte of last block -L43A6 lda fcbbuf+16,x +L43A6 lda FCBs+16,x sta (datptr),y - stz fcbbuf+16,x mark current block as impossible + stz FCBs+16,x mark current block as impossible inx iny inc indexes to do both hi and low bytes cpy #$02 @@ -302,7 +302,7 @@ mvcbytes ldy #$04 move request count to a more accessable location sta cbytes+1 sta rwreqh ldy fcbptr return y = val(fcbptr), - lda fcbbuf+9,y a = attributes + lda FCBs+9,y a = attributes clc and carry clear... rts @@ -314,7 +314,7 @@ mvdbufr ldy #$02 move the pointer to user's buffer sta usrbuf+1 gfcbstyp ldy fcbptr return storage type - lda fcbbuf+7,y + lda FCBs+7,y rts * this subroutine adds the requested byte count to mark and returns sum @@ -327,7 +327,7 @@ gfcbstyp ldy fcbptr return storage type calcmrk ldx #$00 ldy fcbptr clc -L43EE lda fcbbuf+18,y +L43EE lda FCBs+18,y sta tposll,x sta oldmark,x adc cbytes,x @@ -341,7 +341,7 @@ L43EE lda fcbbuf+18,y bne L43EE always. eoftest lda scrtch,x new mark in scrtch. - cmp fcbbuf+21,y is new position > eof ? + cmp FCBs+21,y is new position > eof ? bcc L4414 no, proceed. bne L4414 yes, adjust 'cbytes' request @@ -354,9 +354,9 @@ L4414 rts werreof jsr plus2fcb reset eof to pre-error position. L4418 lda oldeof,x place oldeof back into fcb - sta fcbbuf+21,y + sta FCBs+21,y lda oldmark,x also reset mark to last best - sta fcbbuf+18,y write position + sta FCBs+18,y write position sta scrtch,x and copy mark to scrtch for test of dey eof less than mark. dex @@ -369,12 +369,12 @@ L4418 lda oldeof,x place oldeof back into fcb wadjeof jsr plus2fcb get y=fcbptr+2, x=2, a=y. -L4434 lda fcbbuf+21,y copy eof to old eof +L4434 lda FCBs+21,y copy eof to old eof sta oldeof,x bcc L4442 and if carry set... lda scrtch,x then copy scrtch to fcb's eof. - sta fcbbuf+21,y + sta FCBs+21,y L4442 dey dex copy all 3 bytes @@ -457,7 +457,7 @@ L44B8 jsr alcwblk go allocate for data block. jsr gfcbstat clear allocation required bits in status ora #$80 but first indicate index block is dirty. and #$F8 - sta fcbbuf+8,y + sta FCBs+8,y lda tposhi calculate position within index block. lsr lda tposlh @@ -471,9 +471,9 @@ L44B8 jsr alcwblk go allocate for data block. lda scrtch block. get low block address. sta (zpt),y store low address. ldy fcbptr update fcb to indicate that this block - sta fcbbuf+16,y is allocated. + sta FCBs+16,y is allocated. txa get high address again. - sta fcbbuf+17,y + sta FCBs+17,y L44E9 jsr preprw jsr wrtpart @@ -541,7 +541,7 @@ L4549 sty tposll save low position php save statuses jsr gfcbstat ora #$50 - sta fcbbuf+8,y + sta FCBs+8,y clc adjust user's low buffer address lda tposll adc usrbuf @@ -583,9 +583,9 @@ L457A jsr alcwblk get another block address for the sap sta (zpt),y save hi address dec zpt+1 ldy fcbptr make newly allocated block the current - sta fcbbuf+15,y index block. + sta FCBs+15,y index block. txa - sta fcbbuf+14,y + sta FCBs+14,y jsr wfcbfst save new top of tree bcs L45B1 @@ -604,18 +604,18 @@ swapdown jsr alcwblk make current seed into a sapling, allocate a block befo bcs L45F6 return errors. ldy fcbptr get previous first block - lda fcbbuf+12,y address into index block. + lda FCBs+12,y address into index block. pha save temporarily while swapping in new lda scrtch top index. get new block address (low) tax - sta fcbbuf+12,y - lda fcbbuf+13,y + sta FCBs+12,y + lda FCBs+13,y pha lda scrtch+1 and high address too - sta fcbbuf+13,y - sta fcbbuf+15,y make new top also the current index in + sta FCBs+13,y + sta FCBs+15,y make new top also the current index in txa memory. get low address again. - sta fcbbuf+14,y + sta FCBs+14,y inc zpt+1 make previous the 1st entry in sub index pla sta (zpt) @@ -627,10 +627,10 @@ swapdown jsr alcwblk make current seed into a sapling, allocate a block befo jsr gfcbstyp now adjust storage type by adding 1 adc #$01 (seed becomes sapling becomes tree) - sta fcbbuf+7,y - lda fcbbuf+8,y mark storage type modified + sta FCBs+7,y + lda FCBs+8,y mark storage type modified ora #$08 - sta fcbbuf+8,y + sta FCBs+8,y clc no error L45F6 rts @@ -641,14 +641,14 @@ alcwblk jsr alc1blk jsr gfcbstat mark usage as modified ora #$10 - sta fcbbuf+8,y - lda fcbbuf+24,y inc current usage count by 1 + sta FCBs+8,y + lda FCBs+24,y inc current usage count by 1 clc adc #$01 - sta fcbbuf+24,y - lda fcbbuf+25,y + sta FCBs+24,y + lda FCBs+25,y adc #$00 - sta fcbbuf+25,y + sta FCBs+25,y L4615 clc no error L4616 rts @@ -657,7 +657,7 @@ tstwprot jsr gfcbstat check for 'never been modified' condition and #$F0 bne L4615 ordinary rts if known write ok. - lda fcbbuf+1,y get file's dev #. + lda FCBs+1,y get file's dev #. sta devnum get current status of block device. 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 38ea898d..718dcdfb 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.E.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.E.txt @@ -10,11 +10,11 @@ XDOS.Close ldy #$01 close all ? L4654 sta fcbptr save current low byte of pointer. tay get the level at which the file - lda fcbbuf+27,y was opened. + lda FCBs+27,y was opened. cmp flevel if file's level is < global level bcc L4675 then don't close. - lda fcbbuf,y is this reference file open ? + lda FCBs,y is this reference file open ? beq L4675 no, try next. jsr flush2 clean it out... @@ -40,14 +40,14 @@ L4683 jsr flush1 flush file 1st (including updating bcs L46B6 bitmap). branch if errors. close2 ldy fcbptr - lda fcbbuf+11,y release file buffer + lda FCBs+11,y release file buffer jsr relbuffr bcs L46B6 lda #$00 ldy fcbptr - sta fcbbuf,y free fcb too - lda fcbbuf+1,y + sta FCBs,y free fcb too + lda FCBs+1,y sta devnum go look for associated vcb jsr fnddvcb @@ -71,7 +71,7 @@ XDOS.Flush ldy #$01 flush all ? lda #$00 start at the beginning. L46C3 sta fcbptr save current low byte of pointer. tay index to ref #. - lda fcbbuf,y is this reference file open ? + lda FCBs,y is this reference file open ? beq L46D1 no, try next. jsr flush2 clean it out... @@ -97,11 +97,11 @@ flush1 stz cferr for normal refnum flush, clear global error. jsr findfcb setup pointer to fcb user references. bcs L46E6 return any errors. -L46F1 lda fcbbuf+9,y test to see if file is modified. +L46F1 lda FCBs+9,y test to see if file is modified. and #$02 is it write enabled ? beq L46D9 branch if 'read only' - lda fcbbuf+28,y has eof been modified ? + lda FCBs+28,y has eof been modified ? bmi L4704 if yes. jsr gfcbstat has data been modified ? @@ -126,7 +126,7 @@ L471C lda #$06 prepare to update directory tax ora fcbptr tay -L4723 lda fcbbuf,y note: this code depends on the defined +L4723 lda FCBs,y note: this code depends on the defined sta d_dev-1,x order of the file control block and the dey temporary directory area in 'work space' dex @@ -155,24 +155,24 @@ L4755 jsr entcalc buffer. set up pointer to entry. jsr moventry move entry to temp entry buffer in ldy fcbptr 'work space'. update 'blocks used' count - lda fcbbuf+24,y + lda FCBs+24,y sta d_usage - lda fcbbuf+25,y + lda FCBs+25,y sta d_usage+1 ldx #$00 and move in end of file mark whether -L476C lda fcbbuf+21,y needed or not. +L476C lda FCBs+21,y needed or not. sta d_eof,x inx cpx #$03 move all 3 bytes beq L4780 - lda fcbbuf+12,y also move in the address of the file's + lda FCBs+12,y also move in the address of the file's sta d_filid,x first block since it might have changed iny since the file first opened. bne L476C branch always. -L4780 lda fcbbuf+5,y the last thing to update is storage +L4780 lda FCBs+5,y the last thing to update is storage asl type (y=fcbptr+2). shift into high asl nibble. asl @@ -186,9 +186,9 @@ L4780 lda fcbbuf+5,y the last thing to update is storage bcs glberr error. ldy fcbptr mark - lda fcbbuf+28,y fcb/directory + lda FCBs+28,y fcb/directory and #$7F as - sta fcbbuf+28,y undirty. + sta FCBs+28,y undirty. lda d_dev see if bitmap should be written. cmp bmadev is it in same as current file ? bne L47B2 yes, put it on the disk if necessary. @@ -216,7 +216,7 @@ L47C1 pla rts gfcbstat ldy fcbptr index to fcb. - lda fcbbuf+8,y return status byte. + lda FCBs+8,y return status byte. rts L47CA lda #MLI.E.LOCKED access error @@ -232,7 +232,7 @@ XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed. asl asl sta stortyp may be used later. - lda fcbbuf+9,y + lda FCBs+9,y and #$02 is write enabled to set new eof ? beq L47CA no, access error. @@ -244,7 +244,7 @@ XDOS.SetEOF jsr gfcbstyp can only move end of tree, sapling or seed. iny upon contraction. ldx #$02 all 3 bytes of the eof -L47EF lda fcbbuf+21,y +L47EF lda FCBs+21,y sta oldeof,x dey dex @@ -275,7 +275,7 @@ eofset ldy #$04 inx L481C lda (A3L),y - sta fcbbuf+21,x + sta FCBs+21,x dex dey cpy #$02 all 3 bytes moved ? @@ -297,7 +297,7 @@ purge jsr flush1 make sure file is current iny ldx #$02 -L4840 lda fcbbuf+18,y +L4840 lda FCBs+18,y cmp tposll,x compare until not equal or carry clear. bcc L485F branch if eof > mark. @@ -311,7 +311,7 @@ L484E ldy fcbptr ldx #$00 L4853 lda tposll,x fake position, correct position will - sta fcbbuf+18,y be made below... + sta FCBs+18,y be made below... iny inx cpx #$03 move all 3 bytes @@ -348,9 +348,9 @@ L485F jsr tkfrecnt force free block count before releasing L489F sta dseed+1 L48A2 ldy fcbptr also must pass file's 1st block address. - lda fcbbuf+12,y + lda FCBs+12,y sta firstbl - lda fcbbuf+13,y + lda FCBs+13,y sta firstbh stz deblock lastly, initialize # of blocks to stz deblock+1 be free'd. @@ -362,10 +362,10 @@ L48A2 ldy fcbptr also must pass file's 1st block address. ldx #$00 L48C2 lda firstbl,x - sta fcbbuf+12,y move in possible new first file block - lda fcbbuf+24,y address. adjust usage count also + sta FCBs+12,y move in possible new first file block + lda FCBs+24,y address. adjust usage count also sbc deblock,x - sta fcbbuf+24,y + sta FCBs+24,y iny inx txa @@ -378,7 +378,7 @@ L48C2 lda firstbl,x lsr lsr ldy fcbptr and save it in fcb. - sta fcbbuf+7,y + sta FCBs+7,y jsr clrstats make it look as though position has jsr dvcbrev nothing allocated, update total blocks ldy fcbptr in fcb and correct position. @@ -386,10 +386,10 @@ L48C2 lda firstbl,x iny ldx #$02 -L48F2 lda fcbbuf+18,y tell 'rdposn' to go to correct +L48F2 lda FCBs+18,y tell 'rdposn' to go to correct sta tposll,x eor #$80 position from incorrect place. - sta fcbbuf+18,y + sta FCBs+18,y dey dex bpl L48F2 @@ -427,7 +427,7 @@ XDOS.GetEOF ldx fcbptr index to end of file mark ldy #$02 and index to user's call parameters -L4924 lda fcbbuf+21,x +L4924 lda FCBs+21,x sta (A3L),y inx iny @@ -441,49 +441,49 @@ XDOS.NewLine ldy #$02 adjust newline status for open file. lda (A3L),y on or off ? ldx fcbptr it will be 0 if off. - sta fcbbuf+31,x set new line mask + sta FCBs+31,x set new line mask iny lda (A3L),y and move in 'new-line' byte - sta fcbbuf+10,x + sta FCBs+10,x clc no error possible rts *-------------------------------------- XDOS.GetFileInfoEx jsr findfile see if file exists - bcs .9 + bcc .1 - ldy #3 - lda (A3L),y - sta zpt - iny - lda (A3L),y - sta zpt+1 - -* ldy #S.FIEX.BLKPTR+2-1 - -*.1 lda d_filid,y -* sta (zpt),y -* dey -* bpl .1 - -* ldx #7 -* ldy #S.FIEX.ACL+7 - -*.2 lda h_acl,x -* sta (zpt),y -* dex -* dey -* bpl .2 + cmp #MLI.E.INVPATH + sec + bne .9 + +.1 ldx #S.FIEX.BLKPTR+2-1 + ldy #S.FIEX.BLKPTR+2-1+3 + +.2 lda d_stor,x + sta (A3L),y + dey + dex + bpl .2 + + ldx #7 + ldy #S.FIEX.ACL+7+3 + +.3 lda h_acl,x + sta (A3L),y + dey + dex + bpl .3 +* clc .9 rts *-------------------------------------- XDOS.GetFileInfo jsr findfile look for file. bcc L4988 no error. - cmp #$40 was it a root directory file ? + cmp #MLI.E.INVPATH was it a root directory file ? sec (in case of no match) bne L49A4 if not, then error. @@ -535,9 +535,30 @@ L4994 lda inftabl-3,y L49A4 rts *-------------------------------------- XDOS.SetFileInfoEx - - clc - rts + jsr findfile + bcs .9 + + ldx #S.FIEX.BLKPTR+2-1 + ldy #S.FIEX.BLKPTR+2-1+3 + +.2 lda (A3L),y + sta d_stor,x + dey + dex + bpl .2 + + ldx #7 + ldy #S.FIEX.ACL+7+3 + +.3 lda (A3L),y + sta h_acl,x + dey + dex + bpl .3 + + jmp drevise1 + +.9 rts *-------------------------------------- XDOS.SetFileInfo jsr findfile get the file to work on. diff --git a/ProDOS.FX/ProDOS.S.XDOS.F.txt b/ProDOS.FX/ProDOS.S.XDOS.F.txt index 511a5be3..e419c92d 100644 --- a/ProDOS.FX/ProDOS.S.XDOS.F.txt +++ b/ProDOS.FX/ProDOS.S.XDOS.F.txt @@ -144,9 +144,9 @@ fcbused pha mark fcb as dirty so the directory will be flushed on 'flush tya save regs. pha ldy fcbptr - lda fcbbuf+28,y fetch current fcb dirty byte. + lda FCBs+28,y fetch current fcb dirty byte. ora #$80 mark fcb as dirty. - sta fcbbuf+28,y save it back + sta FCBs+28,y save it back pla and restore regs. tay pla @@ -477,9 +477,9 @@ L4DFE dex set proper bits to 1 bne L4DFE ldy fcbptr calculate buffer number - lda fcbbuf,y + lda FCBs,y asl buffer number = (entnum) * 2. - sta fcbbuf+11,y save it in fcb. + sta FCBs+11,y save it in fcb. tax use entnum * 2 as index to global lda datptr+1 buffer addr tables. get addr already sta buftbl-1,x validated as good. store hi addr @@ -828,13 +828,13 @@ XDOS.ParamCnt .HS 020202FF parameter counts for the calls .HS 070102070A0201010303040401010202 .HS FF .HS 020202 - -* corresponding command function bytes - -XDOS.CmdFlags .HS A0A1A2A3 - .HS 84050607 + +XDOS.CmdFlags .HS A0A1A2 + .HS A384 + .HS 050607 .HS 88494A4B - .HS 2C2D4E4F + .HS 2C2D + .HS 4E4F .HS 50515253 .HS 9495 @@ -885,13 +885,11 @@ deathmsg .AS "SYS ERR-$0" deathmsg.LEN .EQ *-deathmsg *-------------------------------------- XDOS.DATA .DUMMY - -* note: this area is accessed by code that depends on the order of these -* variables in the file control block and temporary directory. - +*-------------------------------------- own_blk .HS 0000 own_ent .HS 00 own_len .HS 00 +*-------------------------------------- .DO ACL=1 h_acl .BS 8 .FIN @@ -903,7 +901,6 @@ h_attr .HS 00 attributes (protect bit, etc.) h_entln .HS 00 length of each entry in this directory h_maxent .HS 00 maximum number of entries per block h_fcnt .HS 0000 current # of files in this directory - h_bmap .HS 0000 address of first allocation bitmap h_tblk .HS 0000 total number of blocks on this unit *-------------------------------------- @@ -911,9 +908,8 @@ d_dev .HS 00 device number of this directory entry d_head .HS 0000 address of directory header d_entblk .HS 0000 address of block which contains entry d_entnum .HS 00 entry number within block - +*-------------------------------------- d_stor .BS 16 file name - d_filid .HS 00 user's identification byte d_frst .HS 0000 first block of file d_usage .HS 0000 # of blocks allocated to this file diff --git a/ProDOS.FX/ProDOS.S.XRW.txt b/ProDOS.FX/ProDOS.S.XRW.txt index ecf540ba..2b088808 100644 --- a/ProDOS.FX/ProDOS.S.XRW.txt +++ b/ProDOS.FX/ProDOS.S.XRW.txt @@ -40,7 +40,12 @@ L59A6 lda XRW.LastUnitUsed lda montimeh bne L59A6 -L59BD jsr XRW.AllPhaseOff make sure all motor phases are off. +L59BD ldx A2L + + bit IO.D2.Ph0Off,x make sure all motor phases are off + bit IO.D2.Ph3Off,x + bit IO.D2.Ph2Off,x + bit IO.D2.Ph1Off,x lda IO.D2.ReadMode,x turn off write enable X = slot $S0 nop @@ -142,6 +147,7 @@ L537C plp was motor on ? * motor was off, wait for it to speed up L537F jsr XRW.Wait100ms wait 100us for each count in montime + lda montimeh bmi L537F count up to 0000 @@ -745,73 +751,77 @@ XRW.Seek ldx XRW.UnitIndex ldy #0 -.1 lda XRW.CurrentQTrack - cmp XRW.TargetQTrack - beq .3 +.1 ldx XRW.CurrentQTrack + + tya + beq .2 + + txa + jsr XRW.PhaseOff - bcs .2 +.2 cpx XRW.TargetQTrack + beq .8 - inc CC, CurrentQTrack>TargetQTrack, must move in + bcs .3 + + inx CC, CurrentQTrack>TargetQTrack, must move in .HS B0 BCS -.2 dec CS, CurrentQTrackPULLW ZPPtr1 pathname rts *-------------------------------------- -SHARED.Stat.I >MLICALL MLIGETFILEINFO +SHARED.Stat.I bit CORE.FSID + bpl .1 + + >MLICALL MLIGETFILEINFOEX + bcs K.Pipe.RTS + + >LDYAI K.MLI.PARAMS+3 + >STYA ZPPtr3 + + bra SHARED.DirEnt2Stat + +.1 >MLICALL MLIGETFILEINFO bcs K.Pipe.RTS SHARED.GFI2Stat jsr SHARED.ClrStat @@ -381,17 +392,6 @@ SHARED.DirEnt2Stat ldx #K.S.STAT+S.STAT.MTIME jmp SHARED.PTime2StatAX *-------------------------------------- -SHARED.ClrStat ldx #S.STAT-1 - -.1 stz K.S.STAT,x - dex - bpl .1 - - lda CORE.FSID - sta K.S.STAT+S.STAT.FSID - - rts -*-------------------------------------- SHARED.Mode2Access clc rts @@ -457,6 +457,6 @@ SHARED.Stat.Dst .DA #S.STAT.P.TYPE,#S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1 .DA #S.STAT.SIZE,#S.STAT.SIZE+1,#S.STAT.SIZE+2 *-------------------------------------- MAN -SAVE USR/SRC/SYS/KERNEL.S.STAT -LOAD USR/SRC/SYS/KERNEL.S +SAVE usr/src/sys/kernel.s.stat +LOAD usr/src/sys/kernel.s ASM