mrvan Posted March 2 Share Posted March 2 Is there a way to read the list of files in a directory and perhaps determine their type and format? I have a 256MB virtual hard drive using MAME so organization using directories is desirable. External to the TI environment I use TI Image Tool and that works just fine, but I'd like to perform file and directory maintenance while in the extended basic environment, particularly while in a running program. I'm only aware of call dir() and delete "file" that can be used in immediate mode. I read a post that indicated one can read a directory by opening it with some fixed format but simply made the claim that there's basic programs and the format out there, but I find nothing anywhere. It doesn't help that this is such a small community so googling is highly limited, nothing like finding solutions in C and C++ using GoogleFu. ASM methods that can be called from XB would also be fine. I sense these may be the only way, but maybe I'll be wrong. Thanks and hopefully I will not annoy folks too much with my questions. Again my GoogleFu with Ti99 questions is fairly ineffective. Quote Link to comment Share on other sites More sharing options...
WhataKowinkydink Posted March 2 Share Posted March 2 In TI XB you have to write a program to read the disk catalog. CALL DIR is in RXB. 1 Quote Link to comment Share on other sites More sharing options...
+pixelpedant Posted March 2 Share Posted March 2 You can catalogue a disk in either TI BASIC or XB with no special routines. The salient point being that (for DSK1, for example) "DSK1." is a special file representing disk metadata. Note the "." which is significant and required. For the details on its use, see this page from the Disk Memory System manual: 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted March 2 Share Posted March 2 1 hour ago, pixelpedant said: ...from the Disk Memory System manual: ...and here is a CATALOG program from a subsequent page: 100 CALL CLEAR 110 DIM TYPE$(5) 120 TYPE$(1)="DIS/FIX" 130 TYPE$(2)="DIS/VAR" 140 TYPE$(3)="INT/FIX" 150 TYPE$(4)="INT/VAR" 160 TYPE$(5)="PROGRAM" 170 INPUT "MASTER DISK(1-3)? ":A 180 A=INT(A) 190 IF A<1 THEN 170 200 IF A>3 THEN 170 210 OPEN #1:"DSK"&STR$(A)&".",INPUT, RELATIVE,INTERNAL 220 INPUT #1:A$,J,J,K 230 DISPLAY "DSK";STR$(A); " - DISKNAME = ";A$:"AVAILABLE = ";K;"USED = ";J-K 240 DISPLAY:"FILENAME SIZE TYPE P":"---------- ---- ---------- -" 250 FOR LOOP=1 TO 127 260 INPUT #1:A$,A,J,K 270 IF LEN(A$)=0 THEN 350 280 DISPLAY:A$;TAB(12);J;TAB(17);TYPE$(ABS(A)); 290 IF ABS(A)=5 THEN 320 300 B$=" "&STR$(K) 310 DISPLAY SEG$(B$,LEN(B$)-2,3); 320 IF A>0 THEN 340 330 DISPLAY TAB(28);"Y"; 340 NEXT LOOP 350 CLOSE #1 ...lee 5 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 2 Share Posted March 2 It still baffles me to this day why TI did not think of including a directory function in ROM for XB, or even TI Basic... If someone has a logical explanation I'd love to hear it. 2 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted March 2 Share Posted March 2 24 minutes ago, Vorticon said: It still baffles me to this day why TI did not think of including a directory function in ROM for XB, or even TI Basic... If someone has a logical explanation I'd love to hear it. My money would be on management pressure to get it in market. But that's total conjecture. (based on managing a S/W dev. team) 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted March 2 Share Posted March 2 Evolution - hardware meets software. Quote Link to comment Share on other sites More sharing options...
+arcadeshopper Posted March 2 Share Posted March 2 2 hours ago, Vorticon said: It still baffles me to this day why TI did not think of including a directory function in ROM for XB, or even TI Basic... If someone has a logical explanation I'd love to hear it. There are two camps.. catalog routines in rom are not extendible or programmable catalog routines in software are easily extendable and programmable It seems short sighted however they included a catalog routine in the disk manager cart with the controllers right? That was their solution. Greg 2 Quote Link to comment Share on other sites More sharing options...
+mizapf Posted March 2 Share Posted March 2 I sometimes get the impression that "comfort" was not TI's primary goal for defining feature sets. 3 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 2 Share Posted March 2 4 hours ago, arcadeshopper said: It seems short sighted however they included a catalog routine in the disk manager cart with the controllers right? That was their solution. I can't tell you how many times I wanted to run a Basic or XB program but did not have the exact name for it. Not having a built-in directory function meant turning off the computer, removing the XB cart, replacing it with a DM one, listing the directory, turning off the computer again, removing the DM cart and replacing it with the XB cart and trying to run the darn program only to realize that by that point I had already forgotten its name... And I can assure you it's not getting any better with time... 4 1 Quote Link to comment Share on other sites More sharing options...
+pixelpedant Posted March 2 Share Posted March 2 Really, the tools TI BASIC gave buyers on Day 1 in 1979 with the base machine - in terms of disk and file and record-level access conventions and file structures and commands for taking advantage of these in TI BASIC - they go far beyond anything its home computer competitors were building into ROM BASICs in its era. You could build yourself a pretty full-featured file browser in pure TI ROM BASIC, with no additional software required. I figure I wouldn't trade that for a CAT command in a million years. 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted March 2 Share Posted March 2 I tend to always have cat on drive 1 of tipi and floppy.. 1 Quote Link to comment Share on other sites More sharing options...
+InsaneMultitasker Posted March 2 Share Posted March 2 2 hours ago, Vorticon said: I can't tell you how many times I wanted to run a Basic or XB program but did not have the exact name for it. Not having a built-in directory function meant turning off the computer, removing the XB cart, replacing it with a DM one, listing the directory, turning off the computer again, removing the DM cart and replacing it with the XB cart and trying to run the darn program only to realize that by that point I had already forgotten its name This was a pet peeve of mine: having no easy, built-in way to catalog the disk without changing carts or loading a program. There are a few enhanced XB carts (XB 2.7 for example) with CALL CAT or CALL DIR subroutines, as well as a few XB assembly-language addons back in the day that would let you catalog from XB. Those were godsends, as was the inclusion of CALL DIR in the Myarc controllers. Edit: link to the manual describing the enhancements in XB 2.7, including CALL CAT and the XXB file routines written by Barry Traver. XB V 2.7 Suite : Tony Knerr : Free Download, Borrow, and Streaming : Internet Archive 1 Quote Link to comment Share on other sites More sharing options...
+RXB Posted March 3 Share Posted March 3 RXB catalog puts every other Cat to shame: CAT subprogram PAGE C1 ------------------------------------------------------------- Format CALL CAT("#"[,...]) CALL CAT("DSK#."[,...]) CALL CAT("DSK.DISKNAME."[,...]) CALL CAT(string-variable[,...]) CALL CAT(number[,...]) CALL CAT(numeric-variable[,...]) CALL CAT(ASC II value[,...]) Description The CAT command catalogs the disk drive indicated by the # which can be 1 to z or by path name. The path name may be up to 30 characters long. A numeric variable or number can be used for drives 1 to 9 or if higher then it is assumed that the numeric-variable or number is a ASCII value between 30 to 255. This allows a catalog of a RAM-DISK designated by letters or control characters. Also CAT can catalog up to 32 drives in one command. The SPACE BAR will pause the catalog routine, then when the pressed again continues the catalog listing. ANY OTHER KEY WILL ABORT THE CATALOG. Programs This line has pathname in A$ | >100 A$="DSK.ADISKNAME" This line uses A$ for the name| >110 CALL CAT(A$) of the device to catalog. | This line will catalog drive 4| >100 CALL CAT(N) if N=4 | This line will catalog drive C| >100 CALL CAT(X) if X=67 (ASCII 67 is C) | This line is path name. | >10 V$="WDS1.VOLUME.SUB-DIR." This line will catalog device | >20 CALL CAT(V$) WDS1 for directory VOLUME and| catalog SUB-DIR | This line catalogs drives 1 | >100 CALL CAT(1,2,3,"WDS1.") then 2 then 3 then WDS1l | The idea is to make something as easy to use as possible so it is very AI like smart cataloger. 4 Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted March 3 Share Posted March 3 @RichI’ve got a question to this. Is it possible to write the output to a DV80 file somehow? Quote Link to comment Share on other sites More sharing options...
+RXB Posted March 3 Share Posted March 3 1 hour ago, retroclouds said: @RichI’ve got a question to this. Is it possible to write the output to a DV80 file somehow? Yea not a problem but older version of RXB had that but no one seemed to care, thus I removed it. 1 Quote Link to comment Share on other sites More sharing options...
mrvan Posted March 5 Author Share Posted March 5 On 3/1/2023 at 11:37 PM, Lee Stewart said: ...and here is a CATALOG program from a subsequent page: 100 CALL CLEAR 110 DIM TYPE$(5) 120 TYPE$(1)="DIS/FIX" 130 TYPE$(2)="DIS/VAR" 140 TYPE$(3)="INT/FIX" 150 TYPE$(4)="INT/VAR" 160 TYPE$(5)="PROGRAM" 170 INPUT "MASTER DISK(1-3)? ":A 180 A=INT(A) 190 IF A<1 THEN 170 200 IF A>3 THEN 170 210 OPEN #1:"DSK"&STR$(A)&".",INPUT, RELATIVE,INTERNAL 220 INPUT #1:A$,J,J,K 230 DISPLAY "DSK";STR$(A); " - DISKNAME = ";A$:"AVAILABLE = ";K;"USED = ";J-K 240 DISPLAY:"FILENAME SIZE TYPE P":"---------- ---- ---------- -" 250 FOR LOOP=1 TO 127 260 INPUT #1:A$,A,J,K 270 IF LEN(A$)=0 THEN 350 280 DISPLAY:A$;TAB(12);J;TAB(17);TYPE$(ABS(A)); 290 IF ABS(A)=5 THEN 320 300 B$=" "&STR$(K) 310 DISPLAY SEG$(B$,LEN(B$)-2,3); 320 IF A>0 THEN 340 330 DISPLAY TAB(28);"Y"; 340 NEXT LOOP 350 CLOSE #1 ...lee Oh, thank you so very much! This makes my day. Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted March 5 Share Posted March 5 (edited) Here is a 1 line XB program that catalogs a disk. Not a lot of bells and whistles, but it is one of the most amazing XB programs I have ever seen. 1 IF B=0 THEN INPUT B :: GOTO 1 ELSE C=C+1 :: OPEN #1:"DSK"&STR$(B)&".",INPUT ,RELATIVE,INTERNAL :: INPUT #1,REC C:A$,A,J,K :: IF LEN(A$)=0 THEN CLOSE #1 ELSE PRINT USING "########## ### #":A$,J,A :: CLOSE #1 :: GOTO 1 (edit) Here it is with the type of files spelled out instead of numbers (DV, DF, IV, IF, PG) 1 IF B=0 THEN INPUT B :: GOTO 1 ELSE C=C+1 :: OPEN #1:"DSK"&STR$(B)&".",INPUT ,RELATIVE,INTERNAL :: INPUT #1,REC C:A$,A,J,K :: IF LEN(A$)=0 THEN CLOSE #1 ELSE PRINT USING "########## ### ##":A$,J,SEG$("DFDVIFIVPG",A*2-1,2):: CLOSE #1 :: GOTO 1 Edited March 5 by senior_falcon 5 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted March 5 Share Posted March 5 1 hour ago, senior_falcon said: Here is a 1 line XB program that catalogs a disk. Not a lot of bells and whistles, but it is one of the most amazing XB programs I have ever seen. 1 IF B=0 THEN INPUT B :: GOTO 1 ELSE C=C+1 :: OPEN #1:"DSK"&STR$(B)&".",INPUT ,RELATIVE,INTERNAL :: INPUT #1,REC C:A$,A,J,K :: IF LEN(A$)=0 THEN CLOSE #1 ELSE PRINT USING "########## ### #":A$,J,A :: CLOSE #1 :: GOTO 1 (edit) Here it is with the type of files spelled out instead of numbers (DV, DF, IV, IF, PG) 1 IF B=0 THEN INPUT B :: GOTO 1 ELSE C=C+1 :: OPEN #1:"DSK"&STR$(B)&".",INPUT ,RELATIVE,INTERNAL :: INPUT #1,REC C:A$,A,J,K :: IF LEN(A$)=0 THEN CLOSE #1 ELSE PRINT USING "########## ### ##":A$,J,SEG$("DFDVIFIVPG",A*2-1,2):: CLOSE #1 :: GOTO 1 Who wrote them? 1 Quote Link to comment Share on other sites More sharing options...
mrvan Posted March 5 Author Share Posted March 5 I spent a bit of time with this program and found some interesting details. On classic99, I'm using a FIAD file system on disk0. With a slight mod to the program I can read the disk but it doesn't report directories, nor can I modify the program in any way to read anything beyond the root directory. Any ideas what one needs to do to read directories? I loaded the same program on MAME, with mods, and was able to see the directories on my virtual hard drive and the types reported were 6. And with further mods I could also read the contents of the directories. 1 Quote Link to comment Share on other sites More sharing options...
jrhodes Posted March 5 Share Posted March 5 55 minutes ago, mrvan said: I spent a bit of time with this program and found some interesting details. On classic99, I'm using a FIAD file system on disk0. With a slight mod to the program I can read the disk but it doesn't report directories, nor can I modify the program in any way to read anything beyond the root directory. Any ideas what one needs to do to read directories? I loaded the same program on MAME, with mods, and was able to see the directories on my virtual hard drive and the types reported were 6. And with further mods I could also read the contents of the directories. Could you post your modified program here, please? I'm interested. Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted March 5 Share Posted March 5 (edited) 9 hours ago, TheBF said: Who wrote them? This was written by that most prolific of authors: "Anonymous" The edit was where I adjusted it a bit, and here is yet another improvement on the program so it now reports DV 80, IF 254, and so on. 1 IF B=0 THEN INPUT B :: GOTO 1 ELSE C=C+1 :: OPEN #1:"DSK"&STR$(B)&".",INPUT ,RELATIVE,INTERNAL :: INPUT #1,REC C:A$,A,J,K :: IF LEN(A$)=0 THEN CLOSE #1 ELSE PRINT USING "########## ### ## ###":A$,J,SEG$(" DFDVIVIFPG",A*2,2),K :: CLOSE #1 :: GOTO 1 Edited March 5 by senior_falcon 2 3 Quote Link to comment Share on other sites More sharing options...
mrvan Posted March 6 Author Share Posted March 6 12 hours ago, jrhodes said: Could you post your modified program here, please? I'm interested. Not a signifiant mod. I updated line 170 and 210 to use a path rather than asking for a disk number, and removed the lines checking the disk number. In MAME, this will allow listing directories, by using WSD1. for root level WDS1.dirname for first subdirectory WDS1.dirname1.dirname2 for second, etc. I can't find a way to read subdirectories in classic99. It supports old/save and reading/writing files in subdirectories but I can't seem to find the right string that will read a subdirectory. Anyone have an idea how what path will work to read subdirectories? 100 CALL CLEAR 110 DIM TYPE$(5) 120 TYPE$(1)="DIS/FIX" 130 TYPE$(2)="DIS/VAR" 140 TYPE$(3)="INT/FIX" 150 TYPE$(4)="INT/VAR" 160 TYPE$(5)="PROGRAM" 170 LINPUT "path:":P$ 210 OPEN #1:P$,INPUT ,RELATIVE,INTERNAL 220 INPUT #1:A$,J,J,K 230 DISPLAY "DSK";STR$(A);" - DISKNAME = ";A$:"AVAILABLE = ";K;"USED = ";J-K 240 DISPLAY :"FILENAME SIZE TYPE P":"---------- ---- ---------- -" 250 FOR LOOP=1 TO 127 260 INPUT #1:A$,A,J,K 270 IF LEN(A$)=0 THEN 350 280 DISPLAY :A$;TAB(12);J;TAB(17);TYPE$(ABS(A)); 290 IF ABS(A)=5 THEN 320 300 B$=" "&STR$(K) 310 DISPLAY SEG$(B$,LEN(B$)-2,3); 320 IF A>0 THEN 340 330 DISPLAY TAB(28);"Y"; 340 NEXT LOOP 350 CLOSE #1 I also compiled and linked using the XB Compiler but found that it would not work, failing at the open #1 statement. I imagine different code might be needed reading from a file vs a directory. Maybe unhandled? It sure would be nice to have the speed reading the disk and access to the file names and attributes within an XB program. Anyone know? Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted March 6 Share Posted March 6 1 hour ago, mrvan said: 210 OPEN #1:P$,INPUT ,RELATIVE,INTERNAL I also compiled and linked using the XB Compiler but found that it would not work, failing at the open #1 statement. I imagine different code might be needed reading from a file vs a directory. Maybe unhandled? It sure would be nice to have the speed reading the disk and access to the file names and attributes within an XB program. Anyone know? One of its limitations is that the compiler can only handle Display,Variable type files. The disk catalog program in T40XB is written in assembly and it works fine when compiled, so an assembly language disk cataloger is possible, but then you have to go to the trouble of using assembly subs with compiled code. Quote Link to comment Share on other sites More sharing options...
mrvan Posted March 6 Author Share Posted March 6 18 hours ago, senior_falcon said: One of its limitations is that the compiler can only handle Display,Variable type files. The disk catalog program in T40XB is written in assembly and it works fine when compiled, so an assembly language disk cataloger is possible, but then you have to go to the trouble of using assembly subs with compiled code. The display format generally is better for most purposes as it greatly helps in debugging. I’d probably not use internal format if reading directories didn’t require it. I’m also not developing production software for a 40 year old computer. I'm not yet sure what it would take to call the assembly language routines but could look into that. I could potentially cheat and run a small service on the underlying OS that monitors the file system for changes and writes a directory file that can be read. Or I can chain programs to an Xb program uncompiled that can list the files. Probably a few other clever ways to keep track of files and dirs without explicitly reading the dirs. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.