memory: fit Ramsey-controlled motherboard fast RAM on the A3000/A4000#242
Merged
Conversation
The Ramsey register file has been modelled since the profiles landed, but the RAM it fronts was missing: the big-box machines' 32-bit local memory that ends at $08000000 and grows downward (a full 16 MiB reaches $07000000). Kickstart sizes it with its own probe rather than autoconfig, reading Ramsey's control register for the DRAM geometry and pattern-testing the banks, with Fat Gary timing out the unfitted space. - Memory gains the mb_ram bank (fit_mb_ram/mb_ram_base); a new PlainMemRegion::MbRam decodes it in the CPU read/write/peek/debug-write paths at uncontended external speed, cacheable by both CPU caches like expansion RAM. peek_word_any and writable_ram_regions reach it for the debugger, GDB stub, and control protocol. - [memory] motherboard / --motherboard size the bank; the A3000/A4000 profiles fit their stock 4M by default. Validation requires a Ramsey and a 32-bit CPU, and the size must fill whole Ramsey banks (1M-4M in 1M steps, or 8M/12M/16M). - Ramsey's control register is now seeded from the fitted total (RamseyRevision::bank_bytes_for) instead of the hardcoded stock geometry, so Kickstart's probe and the diagnostic tools read a description matching the RAM that answers. - The launcher Memory tab gains a Motherboard RAM row, greyed with "needs A3000/A4000" elsewhere; MachineDescriptor carries the size, and STATE_VERSION moves to 35 for the Memory/descriptor shape change. Verified against the real Kickstart 3.1 A4000 ROM: exec lists "expansion memory" $07C00020-$08000000 (attrs $0505, PUBLIC|FAST| LOCAL|KICK) and relocates ExecBase into the bank; 16M gives $07000020-$08000000, and the A3000 profile sizes its Ramsey-04 banks the same way. tests/mb_ram.rs pins this as an asset-gated integration test that walks exec's memory list.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds emulation support for Ramsey-controlled “motherboard fast RAM” on big-box Amigas (A3000/A4000), including configuration/CLI/UI wiring, address decoding/cacheability, debugger visibility, and save-state shape updates.
Changes:
- Introduce a new
Memory::mb_rambank (top-down, ending at$0800_0000) and decode it across CPU + debugger access paths. - Add config/CLI/UI support for sizing motherboard RAM (defaults to 4 MiB on A3000/A4000) plus validation and Ramsey control-register seeding based on fitted geometry.
- Update save-state descriptor/versioning and add unit/integration tests covering decode, geometry selection, and debugger helpers.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mb_ram.rs | New asset-gated integration test that boots KS 3.1 and verifies Exec sizes the motherboard RAM bank. |
| src/zorro_device.rs | Update test Memory literals to include the new mb_ram field. |
| src/z3660.rs | Update multiple test Memory literals to include mb_ram. |
| src/wasmboard.rs | Update test Memory literal to include mb_ram. |
| src/video/window/tests.rs | Update test Memory literal to include mb_ram. |
| src/video/launcher.rs | Add “Motherboard RAM” row/presets and persist it into generated config overrides. |
| src/savestate.rs | Bump STATE_VERSION and extend MachineDescriptor tests/data to include mb_ram_bytes. |
| src/ramsey.rs | Add bank_bytes_for(total) helper and tests to seed Ramsey control geometry from fitted motherboard RAM. |
| src/memory.rs | Add mb_ram, fit_mb_ram, mb_ram_base, and reset handling + unit test. |
| src/main.rs | Add --motherboard SIZE CLI override and help text. |
| src/gdbstub.rs | Update test Memory literal to include mb_ram. |
| src/filesys.rs | Update test Memory literal to include mb_ram. |
| src/emulator.rs | Fit mb_ram during machine build and seed Ramsey geometry from fitted size. |
| src/cpu.rs | Add motherboard RAM to plain-memory decode, debugger writes, cacheability, and add a CPU-level decode test. |
| src/control.rs | Update test Memory literal to include mb_ram. |
| src/config.rs | Add [memory] motherboard + overrides, validation, profile defaults (A3000/A4000), and description string updates. |
| src/cdtv.rs | Update test Memory literal to include mb_ram. |
| src/bus/tests.rs | Add test ensuring debugger helpers (peek_word_any, writable_ram_regions) reach motherboard RAM. |
| src/bus.rs | Extend writable_ram_regions and peek_word_any to include motherboard RAM. |
| src/a4091.rs | Update test Memory literal to include mb_ram. |
| src/a2091.rs | Update test Memory literal to include mb_ram. |
| src/a2065.rs | Update test Memory literal to include mb_ram. |
| docs/guide/ui.md | Document launcher Memory tab now includes motherboard RAM. |
| docs/guide/configuration.md | Document [memory] motherboard/--motherboard and remove stale “not emulated” note. |
| copperline.example.toml | Add commented example/docs for motherboard RAM setting. |
Comments suppressed due to low confidence (1)
src/savestate.rs:581
- In
round_trips_the_machine_descriptor, the test constructs aMachineDescriptorwithmb_ram_bytesset but uses a 24-bitM68EC020CPU andMachineModel::A1200, which is an impossible combination for motherboard RAM per the new semantics. This makes the test harder to read/maintain and could become misleading if descriptor semantics tighten later. Use an A3000/A4000 + 32-bit CPU pairing in the test data.
let descriptor = MachineDescriptor {
cpu: CpuModel::M68EC020,
chip_ram_bytes: 2 * 1024 * 1024,
fast_ram_bytes: 8 * 1024 * 1024,
slow_ram_bytes: 0,
mb_ram_bytes: 4 * 1024 * 1024,
chipset: crate::config::Chipset::Aga,
video_standard: crate::chipset::agnus::VideoStandard::Ntsc,
machine: Some(crate::config::MachineModel::A1200),
rom: crate::config::RomId::of(b"a fake kickstart image"),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two review points from PR #242, plus a pre-existing hole the second one exposed: - fit_mb_ram now asserts Ramsey's 16 MiB maximum at the only mutation point, so mb_ram_base can never underflow its subtraction from MB_RAM_TOP. Config validation already rejects such sizes; this pins the invariant for any other caller. - The launcher's Motherboard RAM row is also gated on the CPU's address reach, and cycling the CPU down to a 24-bit part drops the profile-default bank (not just the row's editability) so the emitted config still validates. - The same downgrade also left the big-box profiles' default Zorro III RTG card (Z3660) in the config, which failed validation the same way before this branch: the RTG row now greys on a 24-bit CPU and the card is dropped on downgrade, mirroring Zorro III RAM.
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Ramsey register file has been modelled since the big-box profiles landed, but the RAM it fronts was missing. This adds the motherboard fast RAM bank: 32-bit local memory off the chip bus that ends at $08000000 and grows downward (a full 16 MiB reaches $07000000), on both the A3000 and A4000. It is not autoconfig -- Kickstart sizes it with its own probe, reading Ramsey's control register for the DRAM geometry and pattern-testing the banks, with Fat Gary timing out the unfitted space -- so the decode, the register seeding, and the timeout all have to line up for the guest to see it.
Memorygains themb_rambank; a newPlainMemRegion::MbRamdecodes it in the CPU read/write/peek/debug-write paths at uncontended external speed, cacheable by both CPU caches like expansion RAM.peek_word_anyandwritable_ram_regionsreach it for the debugger, GDB stub, and control protocol.[memory] motherboard/--motherboardsize the bank; the A3000/A4000 profiles fit their stock 4M by default (motherboard = "0"removes it). Validation requires a Ramsey and a 32-bit CPU, and the size must fill whole Ramsey banks: 1M-4M in 1M steps, or 8M/12M/16M.RamseyRevision::bank_bytes_for) instead of the hardcoded stock geometry, so Kickstart's probe and the diagnostic tools read a description matching the RAM that answers. This retires theTODO(codewiz)in emulator.rs.MachineDescriptorcarries the size for the savestate shape guard, andSTATE_VERSIONmoves to 35.--help.Note the behavior change: existing A3000/A4000 configs now boot with 4M of fast RAM fitted, matching the stock machines.
Verification
Booted the real Kickstart 3.1 A4000 ROM headless and walked exec's memory list over the control protocol:
"expansion memory": $07C00020-$08000000, attrs $0505 (PUBLIC|FAST|LOCAL|KICK), ExecBase relocated into the bank.--motherboard 16M:$07000020-$08000000, 16320 KB free.tests/mb_ram.rspins this as an asset-gated#[ignore]integration test (boots the KS 3.1 A4000 ROM, walks the MemList, ~1.6s in release; skips cleanly without the ROM). New unit tests cover the bank geometry helper, the base/reset math, config defaults and constraints, the debugger helpers, and a CPU-level test showing a 68030 store lands in the bank while a 68000's 24-bit bus wraps past it.cargo test(1706 unit tests + suites),cargo clippy, andcargo fmt --checkare all clean.