-
Notifications
You must be signed in to change notification settings - Fork 2
The TOS file system
This is not an exhaustive list, but is provided to demonstrate why 32MiB is the maximum virtual disk size without using additional drivers.
The partition type is set in the disk boot sector in the partition header.
Partition header 0 a 12 byte structure located at offset 0x01C6.
Within the header, the three bytes at offset 0x01 determine the partition type: 'GEM' Regular Partition 'BGM' Big Partition 'XGM' Extended Partition
GEM is the default partition type and requires no additional drivers.
Supported sector sizes | Maximum clusters | Maximum disk size (bytes) |
---|---|---|
512 bytes ONLY | 0x7FFF (15 bits) | 33,553,408 bytes (approx 32MiB) |
I have tested GEM partitions with 0xFFFF clusters and have confirmed they do not work.
Apparently TOS versions below 1.04 can only address 0x3FFF (14 bits) clusters, but I have not been able to confirm this.
This partition type requires additional drivers.
Supported sector sizes | Maximum clusters | Maximum disk size (bytes) |
---|---|---|
512 - 8192 bytes | 0xFFFF (16 bit word) | 536,862,720 bytes (approx 512MiB) |
Offset | Length (bytes) | Value |
---|---|---|
0 | 2 | Bytes per sector |
2 | 2 | Sectors per cluster |
4 | 2 | Bytes per cluster |
6 | 2 | Root Directory length |
8 | 2 | Length of the FAT in sectors |
10 | 2 | Start of the 2nd FAT |
12 | 2 | 1st free sector |
14 | 2 | Total numbr of clusters |
16 | 2 | Flags as bit-vector |
Flags:
Bit 0: 0 (12-Bit-FAT), 1 16-Bit-FAT
Bit 1: 0 (two FATs), 1 (one FAT)
Two important parameters in the BIOS Parameter Block (BPB) are the number of bytes per sector (BPS) and the number of sectors per cluster (SPC). They are interpreted differently by TOS and DOS/FAT but together they define the notion of Logical Sector1.
On a TOS file system a Logical Sector = BPS and can range from 1024 to 81922 Bytes and the SPC is always equal to 2. On a DOS/FAT file system a Logical Sector = BPS * SPC. The BPS is always 512 bytes but the SPC can range from 2 to 128 resulting to logical sector of 1024 to 65536 Bytes. Therefore we can see that the two file systems use a different scheme to define logical sectors bigger than 512 bytes. For example a logical sector of 8192 bytes is achieved with a BPS = 8192 and a SPC = 2 on the TOS file system. The same 8192 bytes logical sector is achieved with a BPS = 512 and a SPC = 16 on the DOS file system.
Another important parameter in the BPB is the total number of sectors. On a TOS file system this number is stored as a 16-bit quantity (NSECTS parameter). This results in a maximum size of 512MB (2^16 * 8192 bytes) for a TOS partition. On DOS/FAT file system the number of sectors can be stored as a 32-bit quantity (HSECTS parameter) allowing definition of partitions up to 2TB.
Cluster values are slightly different to DOS FAT16.
value | meaning |
---|---|
0x0000 | free cluster |
0x0001 | (impossible) |
0x0002 - 0x7FFF | next cluster number |
0x8000 - 0xFFEF | (impossible) |
0xFFF0 - 0xFFF7 | bad sector |
0xFFF8 - 0xFFFF | end of cluster chain |
References
http://www.yardley.cc/atari/compendium/atari-compendium-chapter-4-XBIOS.htm
http://toshyp.atari.org/en/00300b.html#BPB
http://joo.kie.sk/wp-content/uploads/2013/05/Atari_HD_File_Sytem_Reference_Guide.pdf
https://archive.org/details/Atari_GEMDOS_Reference_Manual_Apr_4_1986