Copy Link
Add to Bookmark
Report
Atari Harddisk structure
ATARI HARDDISK STRUCTURE
""""""""""""""""""""""""
absolute sector
0 Root sector
1-2 Defect sector list (default size)
3 Boot sector partition 0
4 Partition 0
...
x Boot sector partition 1
x+1 Partition 1
... etc
For all practical purposes, GEM sees each partition as a separate drive, with its own boot sector and FAT tables. It is for this reason that several different operating systems with dedicated (and uniquely formatted) partitions may coexist on the same physical unit.
Root Sector
offset (most format variables from WINCAP)
$ 0- Root program
-1B5 (this is the boot routine for a bootable partition)
--- Global parameters:
1B6 W:cy#count number of cylinders (typ 612 or 809)
1B8 B:hd#count number of heads (typ 4 or 6)
1B9 reserved (00)
1BA W:rw#cylno reduced-write current cylinder (cy + 1)
1BC W:wp#cylno write precomp cylinder (cy + 1)
1BE B:lz#n landing zone (10)
1BF B:rt#n seek rate code (2)
1C0 B:in#n interleave factor (1)
1C1 B:sp#count number of sectors/track (MF20 17, MF30-60 26)
1C2 L:ms#count Maximum partition size in sectors (fixed= 32760)
(actually clusters with the newer extended HDX versions)
Note: Stacy4 has section 1B6-1C1 zeroed out (!). Params elsewhere?
--- Partition 0:
1C6 B:p0_flag partition 0 flags (bit0=exists, bit7=bootable)
1C7 $3:p0_ID partition 0 identifier (GEM, else ignored by TOS)
(others used: OS9 MAC CPM...)
1CA L:p0_start start (boot) sector number of partition 0
1CE L:p0_size number of sectors in partition 0
--- Partition 1:
1D2 B:p1_flag partition 1 flags (bit0=exists, bit7=bootable)
1D3 $3:p1_ID partition 1 identifier (GEM)
1D6 L:p1_start start (boot) sector number of partition 1
1DA L:p1_size number of sectors in partition 1
--- Partition 2:
1DE B:p2_flag partition 2 flags (bit0=exists, bit7=bootable)
1DF $3:p2_ID partition 2 identifier (GEM)
1E2 L:p2_start start (boot) sector number of partition 2
1E6 L:p2_size number of sectors in partition 2
--- Partition 3:
1EA B:p3_flag partition 3 flags (bit0=exists, bit7=bootable)
1EB $3:p3_ID partition 3 identifier (GEM)
1EE L:p3_start start (boot) sector number of partition 3
1F2 L:p3_size number of sectors in partition 3
---
1F6 L:bsl_start start sector number of (vendor) bad sector list (1)
1FA L:bsl_count number of sectors in list (1)
---
1FE W:checksum $1234 for bootable
===
Bootsector C: (W:Intel LSB,MSB format)
(follows MS-DOS diskett format, FD: typical diskett values)
offset
$ 00 W:$EB34 (6038) branch bootstart (else $0000, $E900 MS-compat)
--- Disk (volume) identification:
02 $6:...... 6-byte volume OEM ID (Stacy C: 9000 6018 0000)
08 B:$ls,nn,ms (disk)ID# (random serial number, Intel format)
--- Disk parameters:
0B B:$00,02 bytes/sector (W:Intel 512)
0D B:$02 sectors/cluster
0E B:$01,00 reserved sectors (W:Intel 1, ie this one)
10 B:$02 number of FATS (2)
11 B:$00,01 number of entries in rootdir (W:Intel 256, FD 112)
13 B:$28,28 number of sectors (10280, 5MB here)
15 B:$F8 media descriptor (see below, $F8 for HD!?)
16 B:$15,00 sectors/FAT (here 21 for 5MB, FD:5)
18 B:$00,00 sectors/track, FD:09,00 or 0A,00
1A B:$00,00 number of sides, FD:02,00
1C B:$00,00 "hidden" sectors (n/a in TOS)
--- Boot code (or anything else if not a bootable disk):
1E W:"execflag" ... m/c... (may start with $EB34 bra)
20 W:"loadmode" 0=filename seek, 1=sector load (params below)
22 W:"first sector" ie source if sector load mode
24 W:"sector count"
26 L:"load address" ie destination in memory
2A L:"FAT-buffer" location of FAT&dir in memory
2E $11/12 (the IMG-filename of code, possibly less ".")
3A-... normal start of boot code
...
1FE W:xxxx "magic" checksum-$1234 if boot active
===
Media descriptors:
$FC= SS 40-track (180K) 11111100
$FD= DS 40-track (360K) 11111101
$F8= SS 80-track (360K) 11111000
$F9= DS 80-track (720K) 11111001
? $F1= DSHD (1.44M)
? $E1= DSQD (2.88M)
Formatting:
datapattern given in wincap
MFM: 0x6cd6
RLL: 0x6333
Stacy: 0xc623a5ab (CON3042)
FAT-tables
While diskettes generally have 5 sectors/FAT and a 12-bit entry, harddisks (ramdisks) use 16-bit entries and a sector count depending on how large the partition is. Entries are based on "clusters", and the maximum number of clusters in a partition is currently 32760.
Comparison:
12-bit "nibbles" $bc Ca AB -> abc, ABC
16-bit format: $cd ab CD ab -> abcd ABCD
$000 $0000 free
$001 $0001 illegal (reserved)
$002- $0002- cluster thread
-7FF -7FFF
$800- $8000- illegal
-FEF -FFEF range
$FF0-7 $FFF0-7 damaged clusters (normally FFF7, ie -9)
$FF8-F $FFF8-F valid endmarkers (normally FFFF, ie -1)