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
24

A Sector Called "C"

Introduction

When a disc is formatted, each sector's ID is written in front of it. It is one byte. Nothing makes it 0 to 9 except the program that formatted the disc - and Dragon's Lair's protector chose letters.

Any Byte

The MOS's call 162 hands FB52h to the controller as it is, and the controller looks for a sector whose ID matches. So reading a sector called "C" is reading sector 43h - its ASCII code. That is how the MOS's own monitor reads a Dragon's Lair sector: R 8200 83FF 4300 0, track 0, sector 43h.

The course's SECRET.DSK (from the download) is PRIMER.DSK with tracks 30-33 formatted the same way: letters and punctuation for IDs, and in each sector a line saying which ID it carries.

The Code

GETDTS now looks at the sector argument: if it starts with a letter, that letter's code is the ID.

After the last line of GETDTS (LD (STRK),A), add:

        CALL SKIPSP             ; a letter is an ID in itself
        CP 'A'
        JR C,GDT1
        INC HL
        LD (LPTR),HL
        LD (SSEC),A
        OR A
        RET
GDT1:

Run it with a copy of SECRET.DSK in drive 1:

S 1 30 W
S 1 30 Z

What you should see

> S 1 30 W
0000 54 52 41 43 4B 20 33 30 TRACK 30
0008 3A 20 54 48 49 53 20 53 : THIS S
0010 45 43 54 4F 52 27 53 20 ECTOR'S
0018 49 44 20 49 53 20 27 57 ID IS 'W
0020 27 20 28 35 37 48 29 0D ' (57H).
0028 0A 1A 1A 1A 1A 1A 1A 1A ........
0030 1A 1A 1A 1A 1A 1A 1A 1A ........
0038 1A 1A 1A 1A 1A 1A 1A 1A ........
0040 1A 1A 1A 1A 1A 1A 1A 1A ........
0048 1A 1A 1A 1A 1A 1A 1A 1A ........
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)

and, after the MOS has tried for a while:

> S 1 30 Z
DISC ERROR 03: NO SECTOR
>

There is a sector called "W" on track 30, and none called "Z".

Change One Thing

  • Find a sector called "Y" with S. Which track is it on?
  • What are you missing? You could try every letter on every track, as you might once have done in BASIC - but you would not learn which order they come round in, and that order is the message.

Summary

A sector ID is any byte. The MOS reads a sector by whatever ID you give it - if you know it.

Next

S25 goes past the MOS to the controller itself.

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.