I might have found a bug in CLASSIC99 when using TYPE 3 disks or I still don't understand things.
I was working over my DSRLNK and it worked perfectly when reading the file status field in the PAB while using TYPE 1 and TYPE 2 disks.
But with a type three disk I never got a change in status when I hit the EOF.
I spent a long time cursing my inability to find the problem in the Asm code.
In desperation I wanted to see what I was missing so I ran the equivalent program in BASIC and... it doesn't seem to find the EOF bits in the status flag either.
Here is the BASIC program:100 REM CATALOG DISK PROGRAM 110 PRINT "Input DSKx. :"; 120 INPUT DSK$ 130 OPEN #1:DSK$,INPUT ,INTERNAL,RELATIVE 140 INPUT #1:N$,X,Y,Z 150 PRINT N$,X;Y;Z 160 GOTO 140 170 CLOSE #1 180 END
Run it and INPUT a type 1 or 2 disk and it will error out on 140.
But on a type 3 disk it runs forever, just like my Forth programs.
Is my analysis correct?
I am not sure you have chosen the best example file for this topic. DSKx.CATALOG is not a real file. The DSR provides the user with exactly 128 “records” with null strings for nonexistent file names. These are always presented alphabetically with the null records at the end. This allows you to abort reading records at the first record with a null filename string, which is how I do it in fbForth 2.0 (ported from TurboForth). Having not yet analyzed the DSR routine that generates the “file”, I cannot say how it may differ from normal file access.
The above notwithstanding, I did try to dig through the DSR’s READ routine to see if it handled VARIABLE files differently from FIXED files regarding incrementing the PAB to the next record to be read. I think it does, but I was having a little trouble following the ALC. I do know that, for RELATIVE files in TI Basic, TI recommended to use a method different from EOF to check for the last record read. I would also say that the fault for the failure of your code to error out when it passed the end of file may lie more with TI Basic’s INPUT than with the DSR’s READ routine. I say this partly because the DSR’s READ routine only seems to distinguish between VARIABLE and FIXED files, not whether they were opened in SEQUENTIAL or RELATIVE mode. Of course, I may have missed something. I would certainly try your code on a file of your own making before concluding there is a problem with Classic99.