Assembly Disc Access Primer, a TatungBytes course: DISKMON reading the hidden sector IDs of the course's own practice disc, on a rainbow sunburst
← Back to Modules
module
14

Any Sector, by Its ID

Introduction

On every disc you have read so far, it did not matter whether "sector 8" meant the sector called 8 or the eighth one round the track. On some discs it matters a great deal.

IDs, Not Positions

When a disc is formatted, each sector is given an ID, and the formatting program chooses the order they go round the track. ORDER.DSK, from Inside the Einstein: The Disc, has them stored 0, 5, 1, 6, 2, 7, 3, 8, 4, 9 on every track. Its file SECOND.TXT starts in block 2: track 2, sector 8 (S3). The eighth sector stored on that track is ID 4, which belongs to the other file.

So if the MOS took FB52h as a position, S 1 2 8 would show ORDER.TXT; as an ID, SECOND.TXT.

The Code

+ reads the next sector: the next ID, and after 9, sector 0 of the next track - the order blocks use.

After the line JP Z,CMDS, add:

        CP '+'
        JP Z,CMDNXT

After the last line of SETPAD (RET), add:

; +: the next sector - the next ID, then sector 0 of the next track.
CMDNXT: LD HL,SSEC
        INC (HL)
        LD A,(HL)
        CP 10
        JP C,CMDS1
        LD (HL),0
        LD HL,STRK
        INC (HL)
        JP CMDS1

Run it with a copy of ORDER.DSK (from the download for Inside the Einstein: The Disc) in drive 1, DISKMON added:

S 1 2 8
+

What you should see

> S 1 2 8
0000 41 20 73 65 63 6F 6E 64 A second
0008 20 66 69 6C 65 2C 20 69  file, i
0010 6E 20 62 6C 6F 63 6B 20 n block
0018 32 2E 0D 0A 42 6C 6F 63 2...Bloc
0020 6B 20 32 20 73 74 61 72 k 2 star
0028 74 73 20 6F 6E 20 74 72 ts on tr
0030 61 63 6B 20 32 0D 0A 61 ack 2..a
0038 6E 64 20 65 6E 64 73 20 nd ends
0040 6F 6E 20 74 72 61 63 6B on track
0048 20 33 2E 0D 0A 1A 1A 1A  3......
0050 1A 1A 1A 1A 1A 1A 1A 1A ........
0058 1A 1A 1A 1A 1A 1A 1A 1A ........
0060 1A 1A 1A 1A 1A 1A 1A 1A ........
0068 1A 1A 1A 1A 1A 1A 1A 1A ........
0070 1A 1A 1A 1A 1A 1A 1A 1A ........
0078 1A 1A 1A 1A 1A 1A 1A 1A ........
  (KEY)

A second file - SECOND.TXT. The MOS found the sector by its ID. Then + reads sector 9: the rest of SECOND.TXT's block, unused (E5h).

Change One Thing

  • S 1 2 4. Which file's text appears?
  • Step with + from S 1 2 9. Which track and sector does it read next, and why is that the right one for a block that starts at sector 8?

Summary

The MOS finds a sector by its ID, whatever order the IDs go round the track. DISKMON can step through a disc in the order the filesystem uses.

Next

S15: what a MOS call leaves behind - and what it says when it fails.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.