The 8-bit Apple II had two disk operating systems with different disk access semantics.
DOS used tracks and sectors. A sector is 256 bytes.
ProDOS used blocks. A block is 512 bytes.
But mapping from ProDOS blocks to tracks and sectors seems to use some kind of interleaving. And, confusingly, I find two different mappings when trying to Google how this worked:
Just Solve the File Format Problem
Figure B-15 shows how to determine a block number from a given track and sector. First multiply the track number by 8, then add the Sector Offset that corresponds to the sector number. The half of the block in which the sector resides is determined by the Half-of-Block line (1 is the first half; 2 is the second).
Figure B-15. Tracks and Sectors to Blocks
Block = (8 * Track) + Sector Offset Sector : 0 1 2 3 4 5 6 7 8 9 A B C D E F Sector Offset : 0 7 6 6 5 5 4 4 3 3 2 2 1 1 0 7 Half of Block: 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2
- Block 0 -> Track 0 Sector 0 + Track 0 Sector 14
- Block 1 -> Track 0 Sector 12 + Track 0 Sector 13
- Track 0 Sector 0 -> Block 0 (first half)
- Track 0 Sector 1 -> Block 7 (first half)
Apple ][ ProDOS Operating System Technical Information
1390 * READ/WRITE A BLOCK
1400 *
1410 * 1. ASSURE VALID BLOCK NUMBER (0...279)
1420 * 2. CONVERT BLOCK NUMBER TO TRACK/SECTOR
1430 * TRACK = INT(BLOCK/8)
1440 * BLOCK SECTORS
1450 * ----- ---------
1460 * 0 0 AND 2
1470 * 1 4 AND 6
1480 * 2 8 AND 10
1490 * 3 12 AND 14
1500 * 4 1 AND 3
1510 * 5 5 AND 7
1520 * 6 9 AND 11
1530 * 7 13 AND 15
1540 * 3. CALL RWTS TWICE
- Block 0 -> Track 0 Sector 0 + Track 0 Sector 2
- Block 1 -> Track 0 Sector 4 + Track 0 Sector 6
- Track 0 Sector 0 -> Block 0 (first half)
- Track 0 Sector 1 -> Block 4 (first half)
What am I missing?? Is there some other level of indirection? Does one or both actually use logical blocks and sectors as well as physical blocks and sectors?
I'm actually trying to work with .dsk disk image files if that makes a difference. They are raw disk images with no headers but come in two flavours, a raw dump of DOS tracks and sectors in order or a raw dump of ProDOS blocks in order. Perhaps there is something about how these image formats relate to the actual disks or to each DOS that I am missing??