Files

5.7 KiB

Memory and hardware registers — Phase 1

Technical evidence extract for the VCC Plus white paper. Only reviewed contracts, mechanisms, methods, results and limitations are retained. Original validation dates and configuration limits remain historical; this export is not a new test run.

Connections and ownership

MachineHost.h makes the remaining connections explicit: ROM provisioning, cartridge memory/ports/audio, graphics register writes, timer controls, CPU selection and interrupt lines, keyboard scans, joystick strobes, tape signals, and printer bits. Every connection is required in the interface. The Mac tests install a recording host with synthetic ROM/cartridge bytes and controlled input. It records video/timer requests; it does not render video, advance a GIME timer, decode tape files, or emulate a cartridge device.

MachineHost.cpp supplies the Windows adapter, forwarding to the original implementations. Windows printer file/console handling has moved out of the PIA source into PrinterWin.cpp. That file is included in the Windows project and excluded from the Mac project. The native Mac host and Printer Output are now implemented separately; this extraction fixture uses a recording host.

The normal CPU memory functions now dispatch to the real MMU. Isolated instruction tests explicitly install a CpuMemoryBus containing flat memory, then detach it. The machine checks leave that override unset. No synthetic ROM or test bus is linked into the application target.

Install the machine/debugger hosts before initialization and keep them alive until execution and teardown finish. Select and initialize a CPU before routing interrupts to it. Clear the isolated CPU bus override when using the real MMU. Initialization, reset, execution, inspection, host replacement, and teardown must all be serialized by the machine controller: the legacy global state and initialization flag do not provide thread-safe ownership. Accessing a missing machine host on macOS fails explicitly rather than silently discarding a hardware operation.

MmuInit validates the RAM configuration and prepares RAM/ROM before replacing the active allocation. Allocation or ROM-provider failure returns null and retains the previous memory. The provider receives a 32 KiB buffer prefilled with $FF; file selection and ROM validation belong to the host. LoadRom similarly preserves the current ROM on failure. MmuShutdown releases both allocations and can be called repeatedly. Borrowed RAM/ROM pointers are invalidated by successful reinitialization or shutdown. The Windows host still reads the configured ROM path; its existing hard-reset caller treats a null initialization result as fatal.

Added shared checks

Check Coverage
MMU mapping 128 KiB, 512 KiB, 2 MiB, and 8 MiB configurations; reset/disabled maps; both tasks; physical write isolation; bank masks and 8 MiB prefix; debugger snapshots
ROM and vectors All four internal/cartridge ROM selections, write protection, SAM RAM/ROM toggles, internal interrupt vectors, and the fixed $FE00 RAM-vector window
Memory lifecycle Power-on pattern, invalid configuration, failed ROM loading/reloading, replacement ROM, bounded page inspection, repeated teardown
GIME/SAM registers Selected-CPU floating-bus reads, palette masks, combined video offset, timer command forwarding, speed controls, bit-addressed video settings, cartridge port routing, IRQ/FIRQ masks and acknowledgement
PIA registers Data direction, keyboard column mask, joystick strobes, DAC/stereo sample, cassette output/input/motor, serial bit forwarding, mux selection
PIA interrupts Sync-edge polarity, independently asserted sources, control/data acknowledgement, cartridge FIRQ, side-effect-free debugger reads, reset
Mapped CPU execution Both CPUs execute guest writes to MMU/task registers, isolate $A5 and $5A in physical pages 5 and 6, receive a GIME IRQ through the SAM vector, stack into mapped RAM, acknowledge the interrupt, and return with RTI

These are authored source-level expectations, not a newly captured Windows reference trace. The existing Windows evidence remains separate. No ROM downloads, user media, raw logs, or binaries are added to the repository.

Corrections covered by the checks

  • GIME floating-bus reads now consult the selected CPU; previously they always consulted the 6809, including when the 6309 was running.

  • GIME and PIA resets release their asserted CPU interrupt lines as well as clearing register latches.

  • MMU initialization rejects out-of-range RAM configurations and preserves active allocations on failure. Debugger page reads are bounded, and reads after teardown cannot dereference freed memory.

  • SAM vector reads use the current internal ROM allocation, avoiding a stale cached pointer after memory reinitialization.

Validation and remaining work

The Debug console suite passes 21 checks on arm64. The Release suite passes on arm64 and as x86_64 under Rosetta. AddressSanitizer and UndefinedBehaviorSanitizer pass the combined CPU, scheduler, and machine checks. See the build guide for the current XCTest result and IDE instructions.

Graphics generation and frame/timer scheduling are now extracted. The Mac machine host and application bridge now own serialized lifecycle and frame delivery. The native boot milestone now adds ROM selection, Metal display and keyboard input. These checks validate register behavior and callback routing, not complete video/audio/tape/device timing. Windows recompilation, physical Intel testing, macOS 14 runtime testing, and full Windows/Mac trace parity remain outstanding. Phase 1 is still in progress.