Block Availability Map
Directory track 18 sector 0, the BAM and disk details
Categories:
Track 18 sector 0 contains the Block Availability Map (BAM) and details about the disk including it's title.
Track 18 Sector 0
Byte | Content | ||||||||
---|---|---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ||
00 | 15 | Location of first directory sector | 8 | Header | |||||
01 | 7 | 0 | |||||||
02 | DOS version type, normally 0x41 "A" | ||||||||
03 | |||||||||
04 | Free sector count Track 1 | Block Availability Map | |||||||
05 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
06 | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
07 | S20 | S19 | S18 | S17 | S16 | ||||
08 | Free sector count Track 2 | ||||||||
09 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
0A | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
0B | S20 | S19 | S18 | S17 | S16 | ||||
44 | Free sector count Track 17 | ||||||||
45 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
46 | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
47 | S20 | S19 | S18 | S17 | S16 | ||||
48 | Directory Track 18 = 0 Free | ||||||||
49 | All allocated so should be set to 0 | ||||||||
4A | as entire track is reserved for the directory | ||||||||
4B | |||||||||
4C | Free sector count Track 19 | ||||||||
4D | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
4E | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
4F | S18 | S17 | S16 | ||||||
60 | Free sector count Track 24 | ||||||||
61 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
62 | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
63 | S18 | S17 | S16 | ||||||
64 | Free sector count Track 25 | ||||||||
65 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
66 | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
67 | S17 | S16 | |||||||
78 | Free sector count Track 30 | ||||||||
79 | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
7A | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
7B | S17 | S16 | |||||||
7C | Free sector count Track 31 | ||||||||
7D | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
7E | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
7F | S16 | ||||||||
8C | Free sector count Track 35 | ||||||||
8D | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | |
8E | S15 | S14 | S13 | S12 | S11 | S10 | S9 | S8 | |
8F | S16 | ||||||||
90 | Disk Name padded with 0xA0 | Disk title & type | |||||||
91 | |||||||||
92 | |||||||||
93 | |||||||||
94 | |||||||||
95 | |||||||||
96 | |||||||||
97 | |||||||||
98 | |||||||||
99 | |||||||||
9A | |||||||||
9B | |||||||||
9C | |||||||||
9D | |||||||||
9E | |||||||||
9F | |||||||||
A0 | Unused set to 0xA0A0 | ||||||||
A1 | |||||||||
A2 | 7 | Disk ID | 0 | ||||||
A3 | 15 | 8 | |||||||
A4 | Unused set to 0xA0 | ||||||||
A5 | DOS type, usually ASCII "2A" | ||||||||
A6 | |||||||||
A7 | Unused set to 0xA0 | ||||||||
A8 | |||||||||
A9 | |||||||||
AA | |||||||||
AB | Unused, set to 0x00 | Reserved | |||||||
FF |
Offset for each Track BAM entry
Track | Offset |
---|---|
01 | 04 |
02 | 08 |
03 | 0C |
04 | 10 |
05 | 14 |
06 | 18 |
07 | 1C |
08 | 20 |
09 | 24 |
10 | 28 |
11 | 2C |
12 | 30 |
13 | 34 |
14 | 38 |
15 | 3C |
16 | 40 |
17 | 44 |
18 | 48 |
19 | 4C |
20 | 50 |
21 | 54 |
22 | 58 |
23 | 5C |
24 | 60 |
25 | 64 |
26 | 68 |
27 | 6C |
28 | 70 |
29 | 74 |
30 | 78 |
31 | 7C |
32 | 80 |
33 | 84 |
34 | 88 |
35 | 8C |
How BAM entries work
Each track has a BAM entry, which consists of 4 bytes. The first byte is the number of free sectors on that track.
The next three bytes form a bit map of the available sectors in little endian format. A 1 represents a free sector, whilst a 0 represents an allocated sector.
As there are 24 bits available but tracks range from 16 to 21 sectors then the unavailable sectors are marked as allocated, i.e. 0.
Last modified November 1, 2021: Add D64 image format, move entire section out of kernal as it's not specific to it (ee252da)