A cycle-accurate Apple II and Apple IIgs emulator written in Zig, usable as both a program and a library.

iic: the UniDisk answers STATUS properly instead of with an empty packet

The firmware asks for it once ProDOS is running, never while booting, which is why it took a trace of a machine saving a file to find the call at all. Status code nought now returns the four bytes the manual describes: a general status byte, and then "the size in 512-byte blocks", low byte first. The codes a UniDisk does not answer are refused with `$21 BADCTL` rather than guessed at, which is what the manual says should happen to `$01` and `$02`. Two bits of that byte run the opposite way to the other six — "3 — 0 = format allowed" and "2 — 0 = medium write protected" — so a one in bit three says formatting is *not* allowed, which is the truth here until `FORMAT` is modelled, and a one in bit two says the medium is *not* protected. That is odd enough, and inconsistent enough with its neighbours, to look like a misprint, so it was read off the page image rather than the OCR of it; the page says exactly that. It is not left to argument either way. With `STATUS` answered, the machine still saves a file to the disk, which it would not do had it just been told the medium was write protected. Three unit tests hold the rest: what a drive with a disk in it says, what a protected one and an empty one say, and that the unsupported codes come back refused. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GgsYL8D46Cd7iQEZG7Z76J


Author jcollie.dev
Co-author Claude Opus 5 (1M context) Date Commit Parent a2e44794
+127 -3
2 changed files
+127 -3
2 changed files