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

iic: the expansion counter is on the board, and a IIc Plus boots its disk

A IIc Plus read its disk and printed ProDOS's banner and went no further. The drive was not the trouble: it had stepped to track eleven and read what it was asked for. What stopped it was the memory expansion interface. Twice on its way up the firmware sizes that memory. The first loop zeroes the address counter, writes the data register to carry it on, and waits for the middle byte to carry; the second sets the high byte to $0f, walks the counter back down three at a time, and waits for the high byte to reach nought. Neither leaves until the counter moves. The first needs the middle byte to read back with its top nibble set, the second needs the high byte to read back with its low nibble clear, and no one value an undriven bus could give satisfies both — which is the proof that the counter is not on the card at all. It is on the board, and it answers whether or not anybody fitted memory behind it. The card adds chips; the interface is the machine's. So a IIc Plus now comes up with that interface present and no memory in it, which is what a machine nobody has expanded is. The data register still reads undriven, because there is nothing behind it, and the sizing loops still find nothing — but they find it and move on instead of turning for ever. With that, ROM 5 boots all the way to the System Utilities the disk starts, which is the same place a IIgs reaches from the same image, with or without memory fitted. The decode also stops answering nought for the registers when no card is fitted. Nought is a value; nothing driving the lines is $ff, which is what `access` already answered for itself and what the firmware's sizing depends on being able to tell from a byte it wrote. Returning nought in front of it was what hung the first loop. The test now waits for the Utilities' own menu and its copyright as well as ProDOS's banner. None of that text — "PRODOS 8", "FastCopy", either copyright, "System Utilities" — is anywhere in the ROM, raw or with the high bit off, so it can only have been read off the disk and run. With the drive left empty it fails at the banner; with this change backed out it reaches the banner and fails at the menu. Verified: zig build check, zig build test, a full build, zig fmt and reuse lint green, zig build woz unchanged at 45 of 45 read, 42 boot, every other boot still passing, and every citation resolving. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QcuxnjBzBhxoVduHTwEB51


Author jcollie.dev
Co-author Claude Opus 5 Date Commit Parent 8759cde1
+43 -19
3 changed files
+43 -19
3 changed files