Page Menu:
- Overview of the TRSDOS v1.3 Directory Structure
- The Granule Allocation Table
- The Hash Index Table
- Directory Entries
- The File Control Block
- The System Files/Overlays
Overview of the TRSDOS v1.3 Directory Structure
The TRSDOS v1.3 directory is located on Track #17 (11H), and occupies the entire track. Because of the Model-III’s double density format, this amounts to 18, 256 byte sectors. The first sector (#0) contains the Granule Allocation Table (GAT), the diskette Master Password encode, the diskette name and any AUTO command which may be active. Sector #1 contains the Hash Index Table (HIT) and the information by which TRSDOS is able to locate the SYSTEM files. The remaining sixteen sectors of the directory track contain the directory entries for the diskettes user files, five entries per sector.
The Granule Allocation Table
The GAT is stored at sector 01 of Track 17. The first 40 bytes (00H to 27H) make up the GAT and represent Tracks 0 to 39 on the diskette. Each byte is a “bit map” of the allocated granules in the corresponding track. Bits 0 through 5 represent the 6 granules of the track and bits 6 and 7 are not used (always 0). Thus, a fully allocated track would appear as a ‘3F’ in the GAT. In binary this would be 00111111. If a byte is ’25’, a binary 00100101, it means that the first, third and sixth granules are allocated.
Bytes CEH and CFH of Sector #0 are the encoded Master Password for the diskette. This is normally D38F for “PASSWORD”. Bytes D0H – DFH are the diskette’s name in ASCII and the creation date in MM/DD/YY format. Bytes E0H – FFH are used to store any AUTO command which may have been set up for the diskette. If byte E0H is a ‘0D’ (carriage return), no AUTO command is in effect.
The detailed layout is:



The Hash Index Table
The HIT sector is stored in sector 02 of Track 17. The detailed layout is:

The first 80 bytes (00H to 4FH) make up the Hash Index Table (HIT). Each non-zero byte is the hash code for an active file in the directory, and its position in the HIT indicates in which sector and where in the sector the directory entry is located. For example, on a standard Radio Shack TRSDOS diskette, the first two bytes are ‘F0’ and ‘F4’, which are the hash codes for BASIC/CMD and CONVERT/CMD. A glance at Sector #2 will confirm that these files are the first two entries in that sector. The Model-III uses the same algorithm as the Model-I for computing hash codes.

Bytes E0H – FDH are used to store the size and location of the TRSDOS SYSTEM files. There are 15 pairs of bytes and each pair represent one of the SYS files. The first byte of the pair contains the granule offset and the size of the file in granules. The second byte of the pair is the number of the track in HEX where the file starts. To see how this works, let’s take a look at bytes E4H-E5H which are ‘4210’. The ’42’ is 01000010 in binary notation. Because the byte has two pieces of information embedded in it, we’ll write it as 010 00010. The ‘00010’ is the granule count for the file, which is TWO. The ‘010’ is the granule offset from the start of the track which is also TWO. Remember that a granule is three sectors in the Model-III. The second byte of the pair is ’10’ which means that the file starts on Track #16 (10H). Putting it all together, we see that the file starts on Track #16 (10H), beginning on Sector #6 (offset of TWO granules) and occupies TWO granules or six sectors. This particular file, by the way, is very similar to SYS2/SYS on the Model-I. The fifteen pairs of bytes in this area represent the TRSDOS resident module and fourteen overlay modules making up the entire DOS. The sixteenth pair is presently ‘FFFF’ and is not in use, no doubt being reserved for a future overlay, like a spooler (just a guess). Since the user never calls the DOS modules directly, they need not have names and the information in these byte pairs is all that TRSDOS needs in order to locate them when program execution calls for them.
The Directory

The directory is stored in sectors 3-17 of Track 17, with 5 entries per sector. There is room for five, three line (48 byte) directory entries on each of these sixteen sectors. This gives a total capacity of 80 named files. The sixteenth line on each sector is not used, so Radio Shack placed a ‘(c) 1980 Tandy’ on it as a filler.
It is important to note that the order of the extents is switched between the directory and the overlays. A detailed explanation of extents is found in the overlays section, below, but in the directory the order is TRACK NUMBER / ENCODED GRANS instead of ENCODED GRANS / TRACK NUMBER
The detailed layout is:
for BASIC
for BASIC
0=Primary Directory Entry
1=Extended Directory Entry
Bit 6: 1=SYSTEM FILE, 0=User
Bit 5: 1=Limited Backups
Bit 4: 1=Is Assigned a HIT entry
Bit 3: 1=Invisible
Bits 2,1,0 = Security Access Level
Bit 7: Primary Directory Entry
Bit 6: 1=SYSTEM FILE
Bit 5: 0=Unlimited Backups
Bit 4: 1=Entry is Assigned
Bit 3: 1=Invisible
Bits 2,1,0 = 110 = 6 (i.e., Execute only)
Line 2
13 sets of 2-bytes each.
First is Track #
2nd is Encoded Grans
87H = 100 00111 = 4/7
Starts at Gran 12 (4*3) and continues for 21 (7*3) Grans.
The File Control Block
1=Read Only
Bit 1: 1=Write Only
Bit 4: 1=The next 2 bytes are simply the address of another FCB
Bit 7=1: Then the next 50 bytes are the description of an open file.
Bit 7: 0=Full Sector I/O
Bit 6: 0=Update the EOF when done
Bit 5: 1=Sector is already loaded into the RAM buffer
Bit 4: 1=The RAM buffer needs to be written to disk
Bit 3: 1=Remove all unused grans after the EOF on CLOSE
Bits 2-0: File Access Level (0-7)
OVERLAY FILES
What each System/Overlay file does
Location of each System/Overlay File
The HIT table for the overlays are found in bytes E0-FF of sector 02 of Track 17. They are 2 byte pairs in the order of the overlay. The first byte in each pair is the coded for the starting granule on the track and the number of grans it takes, and the second byte in each pair is the track.

Since TRSDOS v1.3 uses Granule sizes of 3, every item dealing with Granules must be multplied by 3.
A HIT entry of FF means Not Present.
Number
Entry
=Track #
a/k/a Starting Granule
a/k/a Gran Count
So … Overlay 1 starts at Granule 0 on track 10H, and goes for 6 granules.
Calling an Overlay in Assembly
TRSDOS v1.3 operates via OVERLAYS which are loaded into RAM as called. To trigger an OVERLAY load, the RST 28H instruction is used, with Register A pre-loaded with a value signifying what is wanted. Register A is set as follows:
Examples:
06-04
03-00
Note: If a routine is called which does not exist, the overlay load routine returns right back; albeit with the overlay having been loaded.