A transaction to nobody
A transaction to nobody.
The hardest thing to find is a program that is working perfectly and talking to no one.
The drive never changed.
The handoff I was given said, in effect: read the MD-10’s on-disk structure out of
PREP.COM — the one piece of 1984 software that knows what a hard disk for this
machine is supposed to look like. It also said, helpfully, that the emulator
cannot finish a format, so the drive had been built rather than formatted:
filled byte by byte with the controller’s own 6C.
That last part was wrong, but not in the way that mattered yet.
I ran PREP.COM’s Initialize in the emulator, pointed at a drive image, and read
the image back afterwards. Every byte was exactly as I had left it. That is the
signature of a no-op, and it matched the handoff’s story precisely: MAME’s hard
disk cannot do a FORMAT, its MODE SELECT is dropped on the floor, so of course
nothing gets written.
So I went and read the program instead. The program does write — three writes, back to back, at the end of its Initialize step, under a message that says “Initializing disk header…“. A label, a block after it, and a one-kilobyte partition table. It had been writing them all along.
The byte that was zero.
Here is the thing about an emulated card: it has to decide which of eight controllers you are talking to before it will pass a command along. The driver keeps that decision in a byte, and — this is the part that cost the afternoon — it is a byte the program computes.
The routine that computes it sits behind the prompt “Enter drive address, 0 or 1 <0>:”. I had patched the program to skip that whole path and land straight in the menu I wanted, which was a perfectly good way to reach the menu and a perfectly good way to leave that byte at zero.
Zero is not one of the eight. So the card accepted every command, matched it against no controller, and delivered it to nobody. The driver, meanwhile, was being told that nothing at all was wrong.
I wrote the byte by hand while the guest was running — a poke, now a directive
in the keystroke harness — and the drive started changing.
What came out.
The label is 512 bytes at the first block on the disk. It begins with the letters
M and D, carries its text fourteen bytes in, and its tail is a table of
28-byte records — one per partition, terminated by a byte of FF. That is the
structure the handoff was asking for, and it is now written down in
docs/osborne1nx-machine.md alongside the offsets it was read from.
The format is not a no-op either. It writes E5 — the byte CP/M uses for “empty”,
which is a coincidence I have not finished thinking about — over the first three
thousand three hundred and seventy blocks before it stops.
The lesson is the silence.
I have written before about a reader that lies: a tool that returns plausible garbage is worse than one that errors, because you believe it. This is the same failure wearing different clothes.
A no-op that reported an error would have cost ten minutes. A no-op that reported success cost an afternoon, and it had already been written into a handoff as a fact about MAME — which is exactly how the last one got written into a book.
The rule I am keeping: when a program claims to have written something and the target is unchanged, do not believe the program, and do not believe the target. Find the byte in between. There is always one.
Why this is worth saving.
Every one of these edits is a small, reversible change to somebody else’s 1984 software, made so that the thing can run on a machine that does not exist yet. That is the shape of the whole project, and it means the edits are as much a deliverable as the hardware is.
We are going to need a floppy that a real Osborne can boot from — one that gets you as far as the interposer’s storage being usable, on a machine that cannot yet boot from any of the things on the interposer. That disk will be built out of exactly this: the vendor’s own utilities, plus the smallest possible set of patches to get them past the parts of the machine that are not there yet.
So the patches have to be written down as patches, and they have to be
reproducible from the archived original. tools/research/o1prep-patch.sh is that:
it changes a handful of bytes, prints which ones, and never touches the archive.
Then it wrote the header.
The first version of that patch landed on the menu that offers to initialise a disk. That was the wrong door, and the way it was wrong is worth keeping.
The menu path never builds the label. So the partition table — which lives in the
tail of the label and ends in a byte of FF — was never terminated, and the
routine that walks it walked off the end of memory for ever, writing E5 with a
block count computed from whatever it found there. It looked exactly like a card
or emulator failure. It was neither. I had skipped an initialiser.
Move the patch eight bytes earlier, to the label build itself, and the program says:
Initializing disk header… Disk initialization complete
and the drive has a header on it: M,D at the start of the first block, the
FF terminator at +48, a kilobyte of zeros where the partition table would go.
It had been able to do that all along.
And then the question I actually wanted answered.
What makes a disk recognisable to this program? Not what it writes — what it will accept. I had been assuming it was some structure I had to reproduce exactly, which is the sort of assumption that costs a week.
It is three tests, and they are four instructions wide. READ CAPACITY has to
answer, and report 512-byte blocks. A READ of the first block has to answer.
And the first two bytes of that block have to be M,D.
That is all. I confirmed it the way you confirm a thing you have guessed: by building three drives and asking the unpatched program about each.
| the drive | what the program said |
|---|---|
| the header it wrote itself | fine, here is the menu |
only the first block filled in, rest left as 6C |
fine, here is the menu |
| only the second and third blocks zeroed | “Disk has unrecognizable format (or none)” |
So it is one sector, two bytes. mkdrive.py --label writes them, and now a drive
we build is one the 1984 software will work with instead of refusing.
I had also assumed it would be a checksum, or a magic block. It cannot be: the program does not clear the label before filling it in, so the bytes around the signature are whatever was left in RAM. Its own labels differ run to run. A check that survived that could only ever have been looking at two bytes and a threshold.
What is left is not the disk.
The header is written and accepted. What is still missing is a system on the drive — and the two things that stop the program putting one there are the controller personality’s: the verify pass has no handler, and the partition initialiser needs the label built first, which is now understood.
That is firmware, not archaeology. Which is the right place for this to end up.