[Coco] OS9 directory from BASIC

Robert Gault robert.gault at worldnet.att.net
Thu Aug 2 10:12:14 EDT 2007


Bob Devries wrote:
> Hi people,
> 
> Has anyone here ever tried to write a BASIC programme to read a 
> directory from an OS9 disk?
> 
> I'm thinking about all the times I've wanted to see what's on an os9 
> disk, but really didn't want to take the time to boot up into OS9.
> 

Here is a prototype to get you or anyone else going. It will read the 
OS-9 root directory for most any type of OS-9 disk whether single or 
double sided as long as the sector size is 256bytes. It also assumes 
that the maximum number of entries in the root directory fit in one 
sector. It assumes that the root directory immediately follows the 
descriptor, which probably is always true but does not need to be.

Things needed to be done.
1) Read the actual size of the root directory and then read the entire 
directory skipping deleted entries.
2) Determine when an entry is a sub-directory, find it and read it.
3) If sub-directories are to be read, handle 40 and 80 track disks and 
double sided disks.
4) Handle directories that have separated desciptors and contents.

10 WIDTH80:CLS:PRINT" OS-9 DISK DIRECTORY READER "
20 CLEAR1000
30 PRINT:INPUT"SELECT DRIVE# TO BE USED <0-3>";DR
40 PRINT"INSERT DISK AND HIT ANY KEY WHEN READY"
50 PRINT"HIT ANY KEY WHEN READY"
60 A$=INKEY$:IFA$=""THEN60
70 DSKI$DR,0,1,A$,B$
80 SC=0:FORI=1TO3:SC=SC+ASC(MID$(A$,8+I,1))*10^(3-I):NEXT
90 SC=SC+2
100 TK=INT(SC/18):SS=SC-TK*18:DSKI$DR,TK,SS,A$,B$
110 FORI=1TO128STEP32:PRINTMID$(A$,I,16):NEXT
120 FORI=1TO128STEP32:PRINTMID$(B$,I,16):NEXT



More information about the Coco mailing list