diff --git a/README.md b/README.md index 0e4d580..a13750f 100644 --- a/README.md +++ b/README.md @@ -276,17 +276,25 @@ the firmware fills it thirty-two bytes at a time with `LDX #$e0 / STA $cd21,X`, and `$cd21 + $ff` is `$ce20`, so every thirty-second byte lands one past the window — which is the next page, and reaching it is what carries the page on. Throw that byte away and each sector loses one in thirty-two, fails its -checksum and is read again for ever. Keep it and the disk reads: ProDOS loads -off the 3.5-inch drive and prints its own banner, which is text that appears -nowhere in the ROM. - -Two things are still open. Which of the glue's outputs is `3.5 DRIVE*` — the -one that says which kind of drive the port is talking to — is not settled; -what is modelled is a IIc Plus coming up pointed at the 3.5-inch drive built -into it, which is right for that drive and means a five-and-a-quarter drive on -the back of one is not reachable yet. And the boot stops at the ProDOS banner -rather than going on to what it would load next. The four-megahertz -accelerator is still to come, and is not in the way of any of this. +checksum and is read again for ever. Keep it and the disk reads. + +What then stopped it was not the drive at all but the memory expansion +interface. Twice on its way up the firmware sizes that memory, once walking +the address counter forward until the middle byte carries and once walking it +back until the high byte reaches nought, and it will not leave either loop +until the counter moves. No value an undriven bus could give satisfies both +tests, which is the proof that the counter is not on the card: it is on the +board, and it answers whether or not anybody fitted memory behind it. Model it +that way and a IIc Plus boots all the way to the System Utilities the disk +starts — the same place a IIgs reaches from the same image — with or without +memory fitted. + +One thing is still open. Which of the glue's outputs is `3.5 DRIVE*` — the one +that says which kind of drive the port is talking to — is not settled; what is +modelled is a IIc Plus coming up pointed at the 3.5-inch drive built into it, +which is right for that drive and means a five-and-a-quarter drive on the back +of one is not reachable yet. The four-megahertz accelerator is still to come, +and is not in the way of any of this. Nothing else needs a ROM. The block device in slot 7, the clock card, the mouse card and the Mockingboard all answer with firmware written for this diff --git a/src/memory8/apple2e.zig b/src/memory8/apple2e.zig index 460271c..73640bb 100644 --- a/src/memory8/apple2e.zig +++ b/src/memory8/apple2e.zig @@ -1045,7 +1045,20 @@ fn Machine(comptime kind: Kind, comptime options: Options) fn (type) type { // except on a IIc, where there is no firmware page to // touch and the card is wired to answer always. self.memory_card.reset(); - if (comptime kind == .iic) self.memory_card.enabled = true; + if (comptime kind == .iic) { + self.memory_card.enabled = true; + // On a IIc Plus the expansion interface is on the + // board, not on the card: the address counter answers + // whether or not anybody fitted memory behind it, and + // the firmware's two sizing loops prove it. The first + // (`$da4e`) walks the counter up and leaves only when + // the middle byte carries; the second (`$d9af`) walks + // it down and leaves only when the high byte reaches + // nought. No single value an undriven bus could give + // satisfies both, so the counter cannot be absent. + // Read out of the ROM 5 firmware at $da4e and $d9af. + if (self.mig_fitted) self.memory_card.fitted = true; + } self.card_switches.reset(); self.altzp = false; self.ramrd = false; @@ -1992,8 +2005,7 @@ fn Machine(comptime kind: Kind, comptime options: Options) fn (type) type { // p. 7); the rest of the sixteen it does not // decode, which `access` answers for itself. if (comptime kind == .iic) { - if (!self.memory_card.fitted) return 0; - if (low > memory_expansion_switch_base + 3) return 0; + if (low > memory_expansion_switch_base + 3) return ramfactor.undriven; return self.memory_card.access( @truncate(address & 0x0f), is_write, diff --git a/src/system_tests.zig b/src/system_tests.zig index 2d92008..5703e38 100644 --- a/src/system_tests.zig +++ b/src/system_tests.zig @@ -773,7 +773,7 @@ test "an Apple IIc Plus runs its firmware instead of falling into the Monitor" { try testing.expect(written > 0); } -test "an Apple IIc Plus reads its internal 3.5-inch drive and boots ProDOS" { +test "an Apple IIc Plus boots its internal 3.5-inch drive to the System Utilities" { const alloc = testing.allocator; // ROM 5 talks to the drive built into the case as a 3.5-inch drive: the // phase lines stop being magnets and become an address, with SEL for a @@ -796,12 +796,16 @@ test "an Apple IIc Plus reads its internal 3.5-inch drive and boots ProDOS" { system.cpu.memory.disk.disks35.insert(0, floppy); system.cpu.reset(); - // It reads the disk and runs what it finds there: ProDOS loads off the - // 3.5-inch drive and prints its own banner. None of that text is in the - // ROM — not "PRODOS 8", not the date, not the copyright — so it can only - // have been read off the disk through the drive and executed. + // It reads the disk and runs what it finds there, all the way to the + // program the disk starts: ProDOS loads off the 3.5-inch drive, and the + // System Utilities put up their own menu. None of that text is in the + // ROM — not "PRODOS 8", not "FastCopy", not either copyright — so it can + // only have been read off the disk through the drive and executed. It is + // the same place the IIgs reaches from the same image. try system.waitFor("PRODOS 8", 120 * second); try system.expect("COPYRIGHT APPLE COMPUTER, INC., 1983-90"); + try system.waitFor("FastCopy", 300 * second); + try system.expect("Copyright Apple Computer, Inc. 1987-90"); // And it got there by working the drive. const drives35 = &system.cpu.memory.disk.disks35;