From df21d8da24642882df1713fadb33f0aa29050205 Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Wed, 23 Oct 2019 12:01:02 -0400 Subject: [PATCH] Fixup to F_SFIRST/F_SNEXT stack management --- SOFTCARD80.ASM#040000 | 24 ++++++++++-------------- SOFTCARD80.BIN#041000 | Bin 32771 -> 32771 bytes zapple2.po | Bin 819200 -> 819200 bytes 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/SOFTCARD80.ASM#040000 b/SOFTCARD80.ASM#040000 index c64402a..46324ed 100644 --- a/SOFTCARD80.ASM#040000 +++ b/SOFTCARD80.ASM#040000 @@ -88,6 +88,7 @@ RVEC7 DEFW 0000H ; Restart vector 7 DMAADDR DEFW 0080H ; DMA address defaults to FILEBUF (0080H) LOGVEC DEFW 0000H ; Vector of logged in drives ROVEC DEFW 0000H ; Vector of read-only drives +TEMPWORD DEFW 0000H ; Used by routines as a scratch space TEMPBYTE DEFB 0 ; Used by routines as a scratch space ; End of private, implementation dependent space @@ -793,7 +794,9 @@ DSRET LD L,A ; Return code in L too ; Returns 0FFH if file not found ; TODO: F_OPEN should use the record count field of the FCB and (if non zero) seek ; to appropriate point in the file -F_OPEN CALL F_SFIRST +F_OPEN PUSH DE ; Preserve pointer to FCB + CALL F_SFIRST ; Find first matching directory entry + POP DE ; Restore pointer to FCB ; Alternative entrypoint used for opening ProDOS directory file only _F_OPEN LD IX,PATHBUF ; Destination buffer @@ -906,7 +909,7 @@ ENTPERBLK EQU 0DH ; Number of file entries per block ; Returns error codes in A and L: 0 for success, 0FFH for not found ; The matching FCB is always in slot 0, so success return code always 0 ; TODO: Should handle '?' in extent field also -F_SFIRST PUSH DE ; Store pointer to search FCB +F_SFIRST LD (TEMPWORD),DE ; Store pointer to search FCB LD A,(DE) ; Obtain drive number LD (DFCBDRV),A ; Copy to directory FCB LD DE,DFCB ; Use this FCB to open the directory @@ -914,8 +917,7 @@ F_SFIRST PUSH DE ; Store pointer to search FCB LD DE,DFCB ; Use this FCB to open the directory CALL _F_OPEN ; Open the directory (avoiding recursion!) -FSFL1 LD DE,DFCB ; Use this FCB to read the directory - CALL RDDIRBLK ; Read first 512 byte block +FSFL1 CALL RDDIRBLK ; Read first 512 byte block CP 0 ; See if it was an error JP NZ,FSFS2 ; If error, assume EOF & just return @@ -926,10 +928,8 @@ FSFL1 LD DE,DFCB ; Use this FCB to read the directory XOR A ; Set file count to zero LD (CDBCOUNT),A ; ... - POP DE ; Get ptr to search FCB back - PUSH HL ; Preserve HL + LD DE,(TEMPWORD) ; Get ptr to search FCB back CALL CHKDIRBLK ; Search directory block - POP HL ; Restore HL CP 0 ; See if it was a match JP Z,FSFS1 ; If so, return JP FSFL1 ; Loop @@ -944,17 +944,13 @@ FSFS2 LD A,0FFH ; No match ; Returns error codes in A and L: 0 for success, 0FFH for not found ; The matching FCB is always in slot 0, so success return code always 0 ; TODO: Should handle '?' in extent field also -F_SNEXT PUSH DE ; Store pointer to search FCB +F_SNEXT LD (TEMPWORD),DE ; Store pointer to search FCB LD HL,(CDBPTR) ; Pointer into current block LD A,(CDBCOUNT) ; File count for current block -FSNL1 PUSH HL ; Preserve HL - CALL CHKDIRBLK ; Search directory block - POP HL ; Restore HL - POP DE ; Restore DE +FSNL1 CALL CHKDIRBLK ; Search directory block CP 0 ; See if it was a match JP Z,FSNS1 ; If so, return - LD DE,DFCB ; Use this FCB to read the directory CALL RDDIRBLK ; Read next 512 byte block CP 0 ; See if it was an error JP NZ,FSNS2 ; If error, assume EOF & just return @@ -1661,7 +1657,7 @@ MFS2 LD A,0FFH ; No match ; DE is the address of the FCB describing the file to look for ; HL points to the first file entry in the ProDOS directory ; Returns A=0 if entry matches, A=FFH if no match -CHKDIRENT LD B,0 ; Hardcode drive A: for now. TODO: fix! +CHKDIRENT LD B,0 ; Hardcode drive A: MATCHFCB ignores it LD A,(HL) ; Get first byte of file entry AND 0FH ; Mask to get the filename length CP 0 ; If zero ... diff --git a/SOFTCARD80.BIN#041000 b/SOFTCARD80.BIN#041000 index 5aedf9f73f6257aceb50d01fe8b11e1a4ebec121..6668fecf560fc3fe46f4f7ab6be621eed1dbb913 100644 GIT binary patch delta 310 zcmZo}U}|n)nxMeMz%WtKc4ItK0xL_BLsH%5v;=3y`m1Lhk}lp=+>?3saO%~+57(dd zPyhG-6ho4c90MbR0H=~shN4Es*$t`x7!ENcS(#+~E$1_8%}}fbiD|WGoNZ74Th71! zZ@Ge%9D|~578`>Va4Q delta 307 zcmZo}U}|n)nxHUI$#!EbO9CrXl3h~u=ClN7#`?2%Np}_ZWS%{odiC$a^=JLl|NTGp zFVRSbfssLgQ^_bpQ6uB*hSYxyhyEp6nPmJe=QC=}P^<-sX|-pZZBPGO&cFU|xq_7p zgQ9H~8-qV5P*wT*{F8S7^G_yaGx9NT*8O8RWu9adouL>EHOeZQgqK^)MnsR@=0HB0} zhd^7(k`DVPtp{3t@~W0kx|Lr#SmGj3W+m7Ruv*doVDA$IZ2w4(Qfnk HWD^+xYm0_I diff --git a/zapple2.po b/zapple2.po index ec9b3f934d29e770277b33b6f9a994fc269e286d..2948089c10dddd75f7112707245b499017a94b9c 100644 GIT binary patch delta 381 zcmZo@FluNp+7QCZ8?J82&A{-OK>);PPGoIQWMu?mCLm@8Viq6JX)xQtdpY>1w z_x}__l93z(BZB~^l2L}DM#k9OD}qs|P$&Wy7xNg#4{;@O@wpi8Qg6y38JwHY{-eA3q& z`K7;&mSH%nm=3h2GU;$g(t4oXCqcTkeA2D_(jhV{lOTFmqv+-FOF!HJ(Qwvb`{rw$ W(u|A_?dPv^0x{S2^VhizR{#Li^p~Rm delta 378 zcmZo@FluNp+7QCZ8>X(o#lY~GK>);PPGoIQWMu?mCLm@8Viq6u!XV>o4=WE7pD7z{PaD#e(~v9#q@_j zTgs9S`zNgjT7B}WmQT8sUpiRgB2Z=}*bK1l)hN1o{L&9MLG+xp+rIf4r!*s@UHkd# OoIuRA{rq)q!xaF=^PFM;