[Coco] Are the files in the /dd/SYS directory always ASCII ?

Bill Pierce ooogalapasooo at aol.com
Fri Sep 25 20:14:10 EDT 2020


The file descriptor is part of the directory structure.
Each directory entry is 32 bytes. The first 29 bytes is the directory name including a zero terminator (terminator is not used if the name is 29 characters). The next 3 bytes point to the LSN of the file descriptor which contains (first 32 bytes) file info and followed by the File Allocation Table which can be any needed length (in 256 byte sector increments).
The info on the file descriptor is in the OS-9 Technical Reference.


-----Original Message-----
From: coco at jechar.ca
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Cc: Jeff Teunissen <deek at d2dc.net>
Sent: Fri, Sep 25, 2020 3:56 pm
Subject: Re: [Coco] Are the files in the /dd/SYS directory always ASCII ?


Is this "file descriptor" part of the file or part of the os9 directory 
info?

On 2020-09-25 13:15, Jeff Teunissen wrote:
> You've probably never seen "C-code" because Tandy never sold the CIS
> COBOL package from Micro Focus. That's what it's for. The C compiler
> never produced an intermediate code that could be run like that, but
> COBOL did.
> 
> On Fri, Sep 25, 2020 at 8:47 AM Bill Pierce via Coco
> <coco at maltedmedia.com> wrote:
>> 
>> FWIW, you can "sorta" ID OS-9 files by looking at the file descriptor 
>> and the file header.
>> 
>> In the file descriptor (the first 32 bytes in the sector pointed to by 
>> the last 3 bytes of the 32 byte directory entry, which is also 
>> followed by the FAT for the file), you'll find the file attributes 
>> (which can distinguish if it's executable or read/write only and also 
>> flag directory entries), file creation date, file last modified date, 
>> calculate file size, and determine the owner of the file.
>> 
>> The header can identify the file type as "Program/Object", "P-Code" 
>> (pascal), "I-Code" (basic09), "C-Code" (never seen this used in Coco 
>> OS-9), and "Data" (rare), as well as the version/revision. The file ID 
>> bytes at the beginning (first 2 bytes of any file) of the header can 
>> help as well. If the first 2 bytes are "$87 $CD", then it is some sort 
>> of executable module. If they are "62 $CD", then the file is an ROF 
>> (relocatable object file) for use in compiling C code (it can also be 
>> a C library file which is nothing but a merged ROF). There may be 
>> other OS-9 defined ID bytes, but those are the only 2 I've seen used 
>> in Coco OS-9. Basically, if the 2nd byte is NOT $CD, then it is most 
>> likely a text file or raw binary data file.
>> 
>> There are a few utilities out there (with sources) that can access 
>> this info (ident, id, attr, vfy, verify, etc.).
>> Bob Devries wrote a nice utility to read the file descriptor 
>> "fileinfo", in which the C source explains how to read the file 
>> descriptor.
>> 
>> I used these sources (and more) to help write my file identification 
>> routines in my MShell project.
>> 
>> Bill
>> 
>> 
>> 
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco

-- 
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list