TR-DOS filesystem: Difference between revisions
Line 62: | Line 62: | ||
Note2: start line for basic programs is not saved in header file, indeed, it is stored directly at the end of file: after end of basic program (symbol #80), could be placed token #AA followed by little-endian word that reflects start line. | Note2: start line for basic programs is not saved in header file, indeed, it is stored directly at the end of file: after end of basic program (symbol #80), could be placed token #AA followed by little-endian word that reflects start line. | ||
===Example file descriptors=== | |||
====BASIC==== | |||
{| class=wikitable | |||
|- | |||
! | Offset (dec) | |||
! | Offest (hex) | |||
! | Bytes | |||
! | Content | |||
! | Description | |||
|- | |||
| 0-7 | |||
| 00-07 | |||
| 62 61 73 69 63 20 20 20 | |||
| "basic " | |||
| Filename | |||
|- | |||
| 8 | |||
| 08 | |||
| 43 | |||
| "B" (Basic) | |||
| File type | |||
|- | |||
| 9-10 | |||
| 09-0A | |||
| EF 01 | |||
| 495 bytes | |||
| File size including variables area minus area at the end containing the line number. | |||
|- | |||
| 11-12 | |||
| 0a-0b | |||
| 68 01 | |||
| 360 bytes | |||
| Pointer to the start of the variables area in the file. | |||
|- | |||
| 13 | |||
| 0C | |||
| 08 | |||
| 8 sectors long | |||
| Number of sectors the file uses | |||
|- | |||
| 14 | |||
| 0D | |||
| 02 | |||
| Start sector 2 | |||
| Sector the file starts from (Note, sectors number from 0 regardless of the actual disk layout) | |||
|- | |||
| 15 | |||
| 0E | |||
| 01 | |||
| Start logical track 1 | |||
| Logical Track the file starts from. (Note, the tracks are encoded as CH, so for DS drives, track 0=C0H0, 1=C0H1, 2=C1H0, ect) | |||
|} | |||
== File types == | == File types == |
Revision as of 15:23, 12 December 2022
The filesystem described here is used with Technology Research Ltd's Beta Disc and Beta 128 Disc disk interfaces. The TR-DOS operating system uses this filesystem.
Floppy disks formatted to 16 sectors per track, with 256-byte sectors. Either single-sided or double-sided disks may be used, and 40 or 80 tracks may be used per side.
The first track of the disk (h0t0s1..h0t0s15) contains the file descriptors (h0t0s1..h0t0s8) and the disk info (h0t0s9). The remaining space on this track is unused.
Space from h0t1s1 on a single sided disk or from h1t0s1 on a double sided disk can be allocated to files. The files are not fragmented.
File descriptor format
A file descriptors are 16 bytes length, so a disk can hold maximum 128 files (8×256/16). The maximum size of a file is 65535 byte.
Offset (dec) | Offest (hex) | Length (dec) | Description |
---|---|---|---|
0 | 0x00 | 8 | Filename, padded with spaces. (If first byte is 0x01 then file is deleted.) |
8 | 0x08 | 1 | File type (extension) |
9 | 0x09 | 2 |
|
11 | 0x0b | 2 | for BASIC (B) files, start of the variables area within the file. All other files: file length. |
13 | 0x0d | 1 | File length in sectors |
14 | 0x0e | 1 | Starting sector |
15 | 0x0f | 1 | Starting (logical) track |
Note1: logical track numbering schema for double sided disks: 0 - h0t0, 1 - h1t0, 2 - h0t1 ... 79 - h1t39, 80 - h0t40 ... 159 - h1t79.
Note2: start line for basic programs is not saved in header file, indeed, it is stored directly at the end of file: after end of basic program (symbol #80), could be placed token #AA followed by little-endian word that reflects start line.
Example file descriptors
BASIC
Offset (dec) | Offest (hex) | Bytes | Content | Description |
---|---|---|---|---|
0-7 | 00-07 | 62 61 73 69 63 20 20 20 | "basic " | Filename |
8 | 08 | 43 | "B" (Basic) | File type |
9-10 | 09-0A | EF 01 | 495 bytes | File size including variables area minus area at the end containing the line number. |
11-12 | 0a-0b | 68 01 | 360 bytes | Pointer to the start of the variables area in the file. |
13 | 0C | 08 | 8 sectors long | Number of sectors the file uses |
14 | 0D | 02 | Start sector 2 | Sector the file starts from (Note, sectors number from 0 regardless of the actual disk layout) |
15 | 0E | 01 | Start logical track 1 | Logical Track the file starts from. (Note, the tracks are encoded as CH, so for DS drives, track 0=C0H0, 1=C0H1, 2=C1H0, ect) |
File types
- B: Basic
- C: Code
- D: Data (array variable)
- #: Sequential or Random access file
Disc information
Information for disc is stored at h0t0s9:
Offset (dec) | Offest (hex) | Length (dec) | Description |
---|---|---|---|
0 | 0x00 | 1 | :=0 - Signals end of catalogue (?) |
1 | 0x01 | 224 | Unused (filled with zero - 0x00) |
225 | 0xe1 | 2 | First free sector address sec:track |
227 | 0xe3 | 1 | Disk type (0x16..0x19) |
228 | 0xe4 | 1 | Number of files on disk |
229 | 0xe5 | 2 | Number of free sectors on disk |
231 | 0xe7 | 1 | :=0x10 - TR-DOS ID |
232 | 0xe8 | 1 | Unused: 0x00 |
233 | 0xe9 | 9 | Unused: 0x20 (space) |
243 | 0xf3 | 1 | Unused: 0x00 |
244 | 0xf4 | 1 | Number of deleted files on disk |
245 | 0xf5 | 8 | Disk label |
253 | 0xfd | 3 | End of disk info, filled with 0x00 (Unused?) |
Disk types
- 0x16: 80 tracks, double side
- 0x17: 40 tracks, double side
- 0x18: 80 tracks, single side
- 0x19: 40 tracks, single side
See also
- TRD format, a disk image format typically used for images of TR-DOS filesystems
- SCL format, a compact representation of TR-DOS filesystem content