Files

5.6 KiB
Raw Permalink Blame History

Native ROM cartridges and Multi-Pak Interface

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.

Routing and retained behavior

devices/CartridgeDevice.h implements the single-slot/MPI bus without host UI or dynamic libraries. devices/RomCartridge.h retains the memory mapping and bank-switch behavior from platforms/windows/libcommon/vcc/bus/rom_cartridge.cpp:

  • ROM addressing uses ((address & 32767) + bankOffset) % imageSize.

  • Writes to $FF40 select one of sixteen 16 KiB bank offsets. Reset selects bank zero. Bank switching remains enabled as in the Windows ROM loader.

  • Raw ROMs assert the cartridge-present line for the retained PIA auto-start mechanism; FD-502 does not assert it.

MPI routing follows pakrouter.cpp: $FF7F bits 4–5 select the ROM (CTS) slot, and bits 0–1 select the disk-port (SCS) slot. The register reads back those selected fields, with unused bits zero. $FF40–$FF5F accesses go only to SCS; ROM reads go only to CTS. Other port writes broadcast to active MPI slots, and reads return the first nonzero response in slot order. All active devices receive horizontal-sync callbacks; NMI is not gated by the ROM selection. Packed stereo samples mix each channel independently with saturation. Empty ROM slots read $FF; empty ports read zero.

Reset restores CTS and SCS to the physical startup selector. Software routing is runtime state, not a remembered preference. The native window shows current ROM and disk-port slots. Cartridge-line state follows CTS, including software changes: the Windows router updates it on physical selection but omits the update in its $FF7F write path. This port deliberately updates it on both paths so a deselected ROM does not leave a stale auto-start signal. Runtime reference comparison of that difference remains open.

The bridge owns one virtual hard-disk controller and one FD-502 instance that can be referenced in both retained configurations, but at most once in the active MPI. Layout changes validate before replacement, keep disk snapshots/save tokens valid, and run on the serialized emulation queue. Inactive configurations receive no ticks, port traffic or audio. All five device assignments reset when the machine resets, without clearing mounted disk bytes.

Persistence and missing files

An additive cartridges section in the existing version-1 DiskAssignments.json stores mode, first-MPI-use state, startup selector, slot device kinds and ROM file URLs. It contains no ROM bytes, disk contents or machine state. Existing disk-only settings migrate to a single FD-502 assignment when a disk ROM is remembered. Both configurations restore before emulation starts, including inactive ROMs. Corrupt layouts, invalid slots/URLs and duplicate MPI floppy or hard-disk assignments are rejected.

An unavailable ROM remains assigned, appears as Unavailable, and contributes no device to the bus. Other slots and disks can still restore. Retry Unavailable ROMs reloads only missing ROMs; it retains the owned bytes of working cartridges. Choose a replacement or Remove to change a remembered assignment. File locations are absolute URLs, with the same move/rename limitations as disk assignments. Settings-write failures remain visible with Retry Saving Settings.

Validation

Automated coverage adds four C++ cartridge checks and six bridge/model/persistence tests:

  • Raw ROM mirroring, bank wrap/reset, size rejection, independent CTS/SCS routing, empty slots, other-port broadcast/priority, ticks, ungated NMI, stereo mixing, physical selection and mode changes.

  • Authored guest programs on both 6809 and 6309 select separate ROM and disk slots and read the expected cartridge bytes/register values. A PIA check verifies cartridge-present status follows the selected ROM.

  • Old-settings migration, first MPI activation, independent configurations, slot movement/removal, all assignments and startup choice across model recreation, missing-file recovery without reloading working slots (including an unavailable ROM copied on first MPI activation), invalid selections, retained dirty disks and explicit saving while disconnected.

  • Bridge rejection of duplicate floppy controllers and layout changes during an incomplete disk command, preserving the previous layout and mounted disk.

  • The existing automatic-saving test now runs guest sector writes in both single-slot and MPI mode on both CPUs, verifying exact file bytes, continued execution and clean reopen.

All 82 XCTest tests passed on Apple Silicon and on the Intel build under Rosetta with the local Xcode 27.2 toolchain on November 1, 2026. Debug and universal Release builds succeeded. The universal Release app was checked with an authored 8 KiB cartridge and a locally supplied CoCo 3 system ROM: native selection in MPI slot 1 auto-started the program and displayed CART OK on both 6809 and 6309. Slot 4 retained FD-502. Actual quit/relaunch restored MPI mode, the ROM file, FD-502 and startup slot 1. The temporary ROM was then removed, startup slot returned to 4, and single-cartridge mode restored the user's original FD-502/drive assignment, clean with automatic saving enabled. The verification app was closed. Native missing-file/busy-operation failures are covered by automated tests rather than separately forced in this UI pass. Physical Intel/macOS 14, Windows runtime comparisons and a broader commercial cartridge library remain separate compatibility work. No supplied ROMs or generated media are committed.