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
23

What the DOS Was Doing

Introduction

DISKMON now does with sectors most of what it did with files in Part two. Before going further down, it is worth seeing the two side by side.

Side by Side

Through the BDOS By hand, through the MOS
Open (15): find the entry, fill the FCB FINDEXT: search the 64 entries for the name and extent
Read sequential (20) L: blocks → sectors → records, as many as byte 15 says
Read random (33) J: record → extent, block, sector, offset
DIR D: four sectors, one line per entry
Rename (23) S, K, M: change the name in the entry and write the sector
Delete (19) the same, with E5h in byte 0
Make (22), write (21), close (16) -

The last row is the hard one. To write a new file by hand you would have to find a free directory slot, find free blocks - which means reading every entry to see which blocks are taken - write the data, and write the entry with the right count. The BDOS does all of that for you. DISKMON never writes a new file without it, and nor should your own programs unless they have a good reason: let the DOS do the bookkeeping when it is there.

What DISKMON does have, that a program using the BDOS never sees, is the disc's raw sectors - every one, by any ID you care to give.

What Neither Has Shown You

Both the BDOS and the MOS ask for a sector by its ID. Neither will tell you what IDs a track actually has, or in what order they pass under the head. You saw in S14 that the order varies; you have only ever guessed at the IDs.

On one Einstein game disc - Dragon's Lair - the sector IDs are not 0 to 9 at all but letters, and read in the order they come round the track they spell a message from the programmer who protected the disc. To read it you have to go one layer further down, to the chip that drives the disc, and ask it directly.

That is Part five.

Summary

DISKMON reads and changes files by hand with the MOS; only making new files is the BDOS's alone. And there is a layer below both.

Next

S24: a sector called "C".

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.