XL1200-EMU Symbolics XL1200 Emulator
Archive & Legacy Notes docs/history/PROJECT.md
NOTE

Historical document. Planning/test artifact from the removed Rust prototype (crates/xl1200-emu). Paths, cargo commands and the 1 GB test_1gb.sh rule no longer apply; the current emulator is the C11 tree in emu/ (make -C emu test, make -C emu test-e2e).

Project: Ivory Emulator (xl1200-emu) — Phases 1 & 2 Implementation

Architecture

  • Boot Pipeline Subsystem (cpu.rs, subprimitives/frame.rs, rom.rs):
    • Authentic reset vector resolution: Address::BOOT_ROM_START + target_idx without double-adding PROM word count.
    • Elimination of synthetic PC overrides (0x0000_C010) to ensure genuine hardware reset vector execution from 0o777400100.
    • Harmonization of coprocessor reset vector dispatch across both --ux1200 (solstice-device.prom, 18,464 words) and --macivory (Device-PROM, 17,120 words).
    • Alpha VLM ground-truth alignment for StartCall on DataType::Symbol: when symbol function cell is uninitialized/null, dispatch start-call-escape trap vector instead of fatal emulator crash.
  • Storage & DiskChannel Subsystem (life_support/disk.rs, life_support/comm_area.rs, main.rs):
    • Authentic 1280-byte Ivory page size (WORDS_PER_PAGE_32 = 320 for 32-bit untagged buffered transfers, WORDS_PER_PAGE_40 = 256 for 40-bit tagged transfers).
    • Multi-DAP scatter-gather support in EmbDiskQueueElement: iterate over all buffer address pairs (0..n_addresses) and transfer up to 16 DAPs per command.
    • Handshake signal completion: assert DiskSignal (bit 4, 0x0000_0010) in HOST_TO_GUEST_SIGNALS (slot::HOST_TO_GUEST_SIGNALS / 0o001011014) upon disk transaction completion.
    • Partition base offset support: automatic discrimination of Apple Partition Map (APM) partition 6 FEP0 (0x87d4bb00 / 0x87d4c000) on MacIvory_Virginal_9GB.img, and byte 1024 on raw partition slices (macivory_fep0.raw).
    • Streaming FileBlockDevice I/O: on-demand seek and read_exact without loading entire disk images into memory, strictly adhering to the 1GB host address space ceiling.
  • Overlay & World Loading Subsystem (life_support/cold_load.rs, fepfs, Genera entry):
    • FEP filesystem directory traversal (FEPD at DPN 65) via authentic guest execution and DiskChannel.
    • Dynamic loading and execution of .flod overlays (I328-LOADERS.FLOD) exposing Load World (entry 0o37000024304) and Start (entry 0o37000015335).
    • .ilod world image parsing and population of guest memory and Page Hash Table (PHT) wired pages using authentic 20-byte/4-word packing.
    • Cold boot transition into Genera execution via Start.
  • Integrity, Testability & Containment:
    • Strict compliance with AGENTS.md § 6: zero synthetic guest code, zero mock string emitters, zero fake bootloaders in platform verification.
    • All tests must pass under nix develop --command ./scripts/test_1gb.sh (prlimit --as=1GB).

Feature Inventory

#FeatureDescriptionMilestoneSource
1Remove Reset Vector Double-Offset BugFix cpu.rs:138-142 to set target_addr = Address::BOOT_ROM_START + target_idx without double-adding bus.rom.word_count()M1ORIGINAL_REQUEST R1
2Eliminate Synthetic PC OverridesRemove synthetic override at cpu.rs:116-120 (Address(0x0000_C010)) to enforce authentic reset from 0o777400100M1ORIGINAL_REQUEST R1
3Harmonize UX1200 & MacIvory Boot PipelineHarmonize PROM entry alignment and kernel loading so both --ux1200 and --macivory advance cleanly into FEP command loopM1ORIGINAL_REQUEST R1
4Alpha VLM StartCall Symbol TrapIn FrameSubprimitives::start_call, handle uninitialized Symbol function cell via start-call-escape trap instead of fatal abortM1explorer_survey_1
5Update Obsolete Test AssertionsUpdate tests in ux1200_terminal_streaming_tests.rs and ux1200_m3_flow_signal_challenger_tests.rs to assert clean stepping instead of cycle 20 haltM1explorer_survey_1
6Authentic 1280-Byte Disk Page SizingUpdate disk.rs to calculate page * 1280 (320 * 4 bytes untagged buffered, 256 * 5 bytes tagged)M2ORIGINAL_REQUEST R2
7Multi-DAP Scatter-Gather TransfersIterate through all buffer address pairs (0..n_addresses) in EmbDiskQueueElement and transfer up to 16 DAPsM2ORIGINAL_REQUEST R2
8DiskSignal Completion HandshakeAssert DiskSignal (bit 4, 0x0000_0010) in HOST_TO_GUEST_SIGNALS upon disk transaction completionM2ORIGINAL_REQUEST R2
9APM & Raw Partition Offset SupportSupport partition base offset 0x87d4bb00 / 0x87d4c000 for MacIvory_Virginal_9GB.img and byte 1024 for macivory_fep0.rawM2ORIGINAL_REQUEST R2
10Streaming FileBlockDevice under 1GB CeilingReplace whole-file std::fs::read in main.rs with streaming on-demand file block deviceM2ORIGINAL_REQUEST R2
11FEP0 Directory Traversal via DiskChannelGuest FEP reads DPN 65 root directory and authentic file extents via DiskChannelM3ORIGINAL_REQUEST R3
12Dynamic .flod Overlay LoadingDynamically load I328-LOADERS.FLOD into Zone 31 RAM and register authentic commands (Load World, Start)M3ORIGINAL_REQUEST R3
13World Loading (.ilod) & PHT PopulationParse .ilod 20-byte/4-word packing, populate wired memory and PHT entriesM3ORIGINAL_REQUEST R3
14Genera Start TransitionExecute Start command to initialize Ivory registers and transition into Genera cold-boot vectorM3ORIGINAL_REQUEST R3
15100% E2E Test Suite Pass under 1GBPass 100% of unit, integration, and E2E tests under ./scripts/test_1gb.sh (prlimit --as=1GB)M4ORIGINAL_REQUEST R4
16Anti-Cheating Forensic VerificationVerify zero synthetic instructions, zero mock prompt emitters, pure authentic executionM4ORIGINAL_REQUEST R4
17Adversarial Coverage HardeningWhite-box adversarial testing verifying edge cases in disk boundaries, memory limits, and trapsM4Project Pattern Phase 2

Milestones

#NameScopeDependenciesStatus
M1UX1200 & MacIvory Boot Pipeline StabilizationFeatures 1–5: double-offset fix, synthetic override removal, boot harmonization, symbol trap, test assertion updatesnoneDONE
M2Authentic 1280-Byte DiskChannel & Partition MountingFeatures 6–10: 1280B page sizing, multi-DAP scatter-gather, DiskSignal handshake, APM offset, streaming FileBlockDevicenonePLANNED
M3FEP Overlay Loading (.flod) & World Loading (.ilod)Features 11–14: FEP0 directory read, I328-LOADERS.FLOD execution, .ilod parsing, Genera Start transitionM1, M2PLANNED
M4Final Milestone: 100% E2E Pass & Adversarial HardeningFeatures 15–17: test_1gb.sh pass, forensic anti-cheating audit, adversarial coverage hardeningM1, M2, M3PLANNED

Interface Contracts

crates/xl1200-emu/src/cpu.rs ↔ ROM / Hardware Bus

  • Reset vector contract:
    • target_addr = Address::BOOT_ROM_START + target_idx where target_idx = raw_data & 0x7_FFFF.
    • No synthetic PC overrides. PC initialized to Pc::new(Address::BOOT_ROM_START + 0o100, Phase::Even).

crates/xl1200-emu/src/subprimitives/frame.rs ↔ cpu.rs

  • FrameSubprimitives::start_call:
    • When target is DataType::Symbol with DataType::Null function cell, trigger start-call-escape via trap vector dispatch (Address(0o37000000000 | 0x00)) matching Alpha VLM fcallmac.lisp:114-155.

crates/xl1200-emu/src/life_support/disk.rs ↔ Guest Ivory CPU

  • Logical page size: FEP_PAGE_BYTES = 1280 (WORDS_PER_PAGE_32 = 320 for untagged, WORDS_PER_PAGE_40 = 256 for tagged).
  • Byte offset calculation: byte_offset = self.base_offset + (cmd.page as u64 * 1280).
  • Scatter-gather: iterate over 0..n_addresses, transferring n_words per address pair.
  • Completion signaling: assert comm_area::signal::DiskSignal (0x0000_0010) in slot::HOST_TO_GUEST_SIGNALS (0o001011014).

Code Layout

  • crates/xl1200-emu/src/cpu.rs: Hardware reset vector resolution, execution loop, trap dispatch.
  • crates/xl1200-emu/src/subprimitives/frame.rs: Function calling, StartCall, FinishCall, symbol trap dispatch.
  • crates/xl1200-emu/src/life_support/disk.rs: Authentic 1280-byte DiskChannel, multi-DAP scatter-gather, DiskSignal handshake, partition offset.
  • crates/xl1200-emu/src/life_support/comm_area.rs: Shared memory communication area slots and signals.
  • crates/xl1200-emu/src/main.rs: CLI flags, streaming FileBlockDevice initialization, --debugger-on-halt integration.
  • crates/xl1200-emu/tests/: Boot pipeline tests, DiskChannel tests, autoboot & world load tests, anti-cheating audit.