XL1200-EMU Symbolics XL1200 Emulator

Symbolics XL1200 Emulator (emu/)

The emu/ subsystem is a from-scratch C11 (plus optional x86-64 Zen 4 AVX-512 assembly) implementation of the Symbolics XL1200 Lisp Machine workstation: 40-bit tagged Ivory Rev 4 CPU, W3x64 floating-point accelerator, Merlin-II VMEbus/memory controller, monochrome console framebuffer, WD33C93 SCSI-2 host adapter, Intel 82586 Ethernet, MK48T02 NVRAM/RTC, Signetics SCN68562 DUSCC dual serial UARTs (+ Intel 8237A DMAC), and an SDL3 + microui + s7 Scheme workstation shell.


Architecture Overview

ivory-xl1200 strictly separates the Host Shell (OS threads, SDL3 display, microui workbench, s7 Scheme runtime, file/socket/named-pipe I/O, snapshots, SLIRP/TAP networking) from the Hardware Core (libivory_core.so / libivory_core.dll) across the versioned C ABI (IVORY_CORE_ABI_VERSION = 4 in ivory_core_api.h). Core object files (core/*.o) carry zero writable static .data/.bss state so the hardware engine is hot-reloadable live via --core-so, the Debug -> Hot-Reload Core menu action, or the reload debug command.

In continuous interactive and --puppet execution, the Host Shell runs a strict 2-thread runtime (emu/src/main.c):

  • Main Thread: owns SDL3 window/renderer, keyboard/mouse events, microui UI workbench overlays, native SDL3 file dialogs, s7 Scheme config/REPL/action coroutine scheduler, debug_ctl IPC polling, and host serial polling.
  • Emulation Thread (emu_thread): holds EmuRuntime.state_mu while stepping the CPU in bounded slices (IvoryCoreApi), wakes on EmuRuntime.wake_cv on input/debug events, and pauses cleanly when ctl_waiters > 0 or dbg->paused is set.
flowchart TD
    subgraph Host["Host Shell Binary (ivory-xl1200 / ivory-xl1200.exe)"]
        MAIN["main.c (CLI, 2-Thread EmuRuntime, Lifecycle)"]
        SDL["sdl_console.c + keymap.c (SDL3 Console, LED Bezel, Y4M Rec)"]
        UI["ui_workbench.c + vendor/microui (Top Menu Bar, 6 Floating Windows)"]
        S7["emu_script.c + vendor/s7 (define-machine, Actions, call/cc Scheduler)"]
        DBG["debug_ctl.c + emu_ipc.c + ivory_disasm.c + ivory_sym_walk.c (IPC & Symbolic Debug)"]
        SNAP["snapshot.c (COW Checkpoints, Input Replay, Sparse .snap)"]
        NETSER["eth_slirp.c / eth_tap_linux.c + serial_host.c (Host Backends)"]
        LOAD["loader.c + fep_convert.c + core_loader.c (PROM/IFEP Load, ABI Loader)"]
    end

    ABI["Versioned ABI v4 Boundary (ivory_core_get_api -> IvoryCoreApi)"]

    subgraph Core["Hot-Reloadable Hardware Core (libivory_core.so / libivory_core.dll)"]
        CPU["cpu.c + cpu_decode.c (Ivory Rev 4 Loop, Stack Cache, Trap Engine)"]
        ZEN["cpu_zen4_avx512.c + cpu_zen4_loop.S (AVX-512 Tagged Dispatch)"]
        ISA["isa_stack.c, isa_arith.c, isa_lisp.c, isa_call.c, isa_sys.c, fpa_w3x64.c"]
        MEM["mem.c (RAM, Boot PROM, VRAM, Zone 31, PHT, Watchpoints)"]
        MERLIN["merlin.c + nvram_mk48t02.c + console_hw.c (Merlin-II Bus, RTC, VRAM/SLB)"]
        SCSI["scsi_wd33c93.c + eth_82586.c (WD33C93 SCSI-2, Intel 82586 NIC)"]
    end

    MAIN --> SDL
    MAIN --> UI
    MAIN --> S7
    MAIN --> DBG
    MAIN --> SNAP
    MAIN --> NETSER
    MAIN --> LOAD
    LOAD -->|dlopen / LoadLibrary| ABI
    MAIN -->|IvoryCoreApi calls| ABI
    ABI --> CPU
    ABI --> MERLIN
    CPU --> ZEN
    CPU --> ISA
    CPU --> MEM
    MERLIN --> SCSI
    MERLIN --> MEM

Documentation Index

Emulator Subsystem Guides

  • Core CPU, ISA & Acceleration — IvoryCpu, IvoryMem, instruction decode & execution, W3x64 FPA, PHT/Zone 31 paging, runtime ISA detection, Zen 4 AVX-512 assembly fast path, and the versioned libivory_core ABI.
  • Peripherals, Buses & Host Backends — Merlin-II bus & interrupts, MK48T02 NVRAM/RTC, monochrome console hardware, WD33C93 SCSI-2 (disk/CD-ROM/tape + QCOW-style sparse overlay), Intel 82586 NIC + SLIRP/TAP/packet backends, Signetics SCN68562 DUSCC dual serial UARTs (+ Intel 8237A DMAC) & host tcp-listen/tcp/pipe/file bridges, and IFEP/EPROM image conversion.
  • GUI, Scripting, Debug IPC & Snapshots — 2-thread host runtime (emu_os.h, emu_io.h, emu_ipc.h), SDL3 console & LED strip, microui workbench windows & file dialogs, s7 Scheme machine config & cooperative call/cc scheduler, live debug_ctl IPC, COW checkpoints, time-travel rewind/replay, and sparse .snap persistence.
  • Engineering Roadmap — Completed milestones and remaining priority-ordered next-phase plans (audio-plan.md, networking-chaosnet-plan.md, memory-expansion-plan.md, vme-bus-plan.md, genera-pv.md, color-graphics-plan.md, platforms-and-ci-plan.md).
  • Clean-Room XL1200 Boot PROM & Overlays — Open-source IFEP promJ firmware (prom/, 3s interruptible SCSI 0..6 boot menu, framebuffer console) and custom-diag.flod.
  • Ivory Assembler & Disassembler — Portable ANSI CL tools/ivasm/ (SBCL/ECL/CLISP), canonical S-expression syntax shared with ivory_disasm.c, and container formats.
  • Troubleshooting & Live Debug Guide — Beta-tester Bug Dump workflow, scripts/xl1200-ctl.py, sample-sym flamegraphs, and triage playbook.
  • Developer Guide — Master hardware/Genera bringup reference and reverse-engineering invariants.
  • Hardware Reference — Hardware specification (01 through 06 + ivory_hw.h).
  • Keyboard Reference — Symbolics SLB scancodes and host keymap profiles.
  • GUI, Scripting & Windows Plan — Completed implementation specification (Phase 1–4).

Module Inventory

Hardware Core (emu/src/ -> CORE_SRCS / CORE_ASM_OBJS)

FileRole
cpu.cCPU reset (ivory_cpu_reset to entry_vma, e.g., 0xF8007162 for IFEP promJ), interpreter step loop, stack cache, traps, hardware parity (sizeof(IvoryCpu) == 4096)
cpu_decode.c40-bit word / 18-bit halfword instruction decode, CDR-Jump & fullword call decoding
cpu_zen4_avx512.cRuntime CPUID dispatch (avx512f/cd/vl/bw/dq/vbmi2), Zen 4 dispatch table & C slow-path bridge
cpu_zen4_loop.SNative x86-64 SysV/Win64 AVX-512 fast-path dispatch loop (ISA_MODE=runtime|native, compiled when ASM_ENABLED=1)
asm_abi.hPortable SysV AMD64 vs Windows x64 register calling-convention macros for cpu_zen4_loop.S
isa_stack.cStack/FP/LP/TOS push-pop, %instance-ref, car/cdr/rplaca/rplacd, block & array helpers
isa_arith.cFixnum/double arithmetic, ALU condition evaluations, bitfields (ldb/dpb), logical shifts
isa_lisp.cType predicates, equality (eq/eql), GC/forwarding checks, %allocate-* primitives
isa_call.cStartCall (0o50..0o57), FinishCall*, Return*, lexical closures, generic/message dispatch
isa_sys.cInternal register R/W (%register-*), PHT & map-cache instructions, %halt, traps, NMI (0o5101)
fpa_w3x64.cWeitek W3x64 floating-point accelerator model & IEEE-754 single/double execution
mem.cPhysical RAM, Boot PROM (64 KW), Boot Comm Area, I/O SRAM, VRAM, PHT lookup, write watchpoints
merlin.cMerlin-II motherboard registers, VMEbus I/O map, PIT/microsecond timers, interrupt controller, LEDs, idle detection
nvram_mk48t02.cSGS-Thomson MK48T02 2 KiB battery-backed NVRAM/RTC, serial/ID EEPROM formatting, historical RTC offset
scsi_wd33c93.cWD33C93 SBIC SCSI-2 controller, target backing (disk, ISO/raw CD-ROM, QIC/DAT tape), sparse COW write overlay
eth_82586.cIntel 82586 LAN coprocessor DMA ring (SCP/ISCP/SCB/CB/RFA), TX/RX callbacks
console_hw.cXL1200 1152x896 1-bit VRAM, mouse/cursor registers, SLB keyboard FIFO, dual serial UART TX/RX rings
core_api.civory_core_get_api() table export (IVORY_CORE_ABI_VERSION = 4), zero static globals in core objects

Host Shell & Utilities (emu/src/ -> SHELL_SRCS & CLI tools)

FileRole
main.cCLI parser (EmuCliConfig), 2-thread EmuRuntime coordinator, headless/step/puppet/GUI startup
core_loader.cDynamic shared-library loader (dlopen / LoadLibraryA) & ABI v4 validation for libivory_core
loader.c5-byte EPROM split/combined loader (115988 + 115989 or rom.dump), IFEP .fep/.flod installer
fep_convert.cDual-use IFEP/EPROM toolkit (fep_convert_lib.o + standalone ivory-fep-convert CLI): unpack, inspect, create, --extract/--inject, MacIvory raw/APM/HFS multi-volume conversion
sdl_console.cSDL3 window/renderer, VRAM overscan crop (:trim / :full), passive LED bezel, mouse capture, async .y4m recorder
keymap.cMulti-profile host-to-Symbolics SLB translator (9 built-in keyboard profiles, oneshot ASCII modifiers)
ui_workbench.cmicroui top menu bar (28 px), 6 floating workbench windows (incl. 4-tab symbolic Debug & Snapshots & Video Recording), SDL3 native file dialogs, focus/capture arbitration
ivory_disasm.c40-bit Ivory Rev 4/4A disassembler (human and canonical Lisp S-expression output shared with tools/ivasm/)
ivory_sym_walk.cRead-only Genera symbol, function-header, stack-backtrace, object-summary, and trap-context walker
bug_report.cPKZIP + RFC 1951 DEFLATE single-button beta-tester diagnostic archiver (Bug Dump) with symbolic PC disasm & backtraces
emu_script.cEmbedded s7 Scheme runtime: (define-machine ...) parser, surgical config saver, (define-action ...), call/cc scheduler
debug_ctl.cLine-oriented debug/puppet protocol (AF_UNIX / Named Pipe / TCP / --puppet), breakpoints, disasm/bt-sym/inspect/trap-info/sample-sym, screenshot dump
emu_ipc.cPortable non-blocking local socket / Win32 Named Pipe (CreateNamedPipeA) / dual-stack TCP server
snapshot.cCOW 256-word dirty-page checkpoints (IvoryCheckpointStore), deterministic input log/replay, sparse .snap I/O
serial_host.cNon-blocking host serial backends (none, tcp-listen:<[a]:port>, tcp:<[a]:port>, pipe:<name_or_path>, file:<path>)
eth_slirp.cUserspace NAT networking backend (libslirp) with guest CIDR & host port-forwarding
eth_tap_linux.cLinux TAP (IFF_TAP) / AF_PACKET (--eth-veth) raw L2 bridge (stubbed cleanly on non-Linux hosts)

Headers (emu/include/) & Vendored Libraries (emu/vendor/)

PathPurpose
ivory_core_api.hVersioned IvoryCoreApi function table (IVORY_CORE_ABI_VERSION = 4U) & IvoryCoreLoader
ivory_emu.hCore struct definitions (IvoryCpu, IvoryMem, MerlinBoard, Xl1200Console, Wd33c93Scsi, Eth82586)
ivory_asm_offsets.hShared C / x86-64 ASM offsets verified via _Static_assert in cpu.c (IvoryCpu == 4096, MerlinBoard == 278528, IvoryAsmLoopCtx == 112)
ivory_hw.hShared XL1200/Merlin-II address, register, CSR, opcode, and DTP tag constants
ivory_fep_tools.hProgrammatic IFEP inspection/creation/extraction API consumed by fep_convert.c and emu_script.c
ivory_keymap.hIvoryKeymapId enum (IVORY_KEYMAP_COUNT = 9), IvoryKeymapInfo, SLB key event emitter types
ivory_serial_host.hXl1200SerialHost backend configuration and polling API
ivory_script.hEmuMachineConfig, EmuScriptAction, EmuScriptHost, and emu_script_* lifecycle/API
ivory_ui.hXL1200_TOP_MENUBAR_HEIGHT (28), Xl1200UiOverlay hook struct, UiWorkbenchHost, UiWorkbenchTestState
ivory_disasm.h40-bit Ivory Rev 4/4A disassembler API (IVORY_DISASM_HUMAN, IVORY_DISASM_LISP)
ivory_sym_walk.hRead-only Genera symbol/function/backtrace/object/trap inspection API
ivory_bug_report.hIvoryBugReportParams, ivory_bug_report_default_filename(), ivory_bug_report_save_zip()
ivory_snapshot.hIVORY_SNAP_MAGIC ("IVRY"), IvoryInputEvent, IvoryCheckpoint, IvoryCheckpointStore
emu_os.hCross-platform mutex, condvar, thread, monotonic ns timer, aligned alloc, mlock, dlopen/LoadLibraryA helpers
emu_io.hPortable 64-bit fopen/fseek64/ftell64/ftruncate64, pread/pwrite (OVERLAPPED on Win32), atomic replace
emu_ipc.hEmuEndpoint, EmuLocalServer, EmuTcpListener portable non-blocking server/client primitives
emu/vendor/s7/Embedded s7 Scheme 11.9 (0-BSD, MIT-compatible), compiled with -DWITH_MAIN=0 -DWITH_C_LOADER=0 -DDISABLE_DEPRECATED=1 + Win32 MinGW patch
emu/vendor/microui/Embedded rxi/microui v2.02 (MIT), immediate-mode UI rendered via SDL3 texture atlas

Build, Packaging & CI Matrix

All emulator targets live in emu/Makefile and flake.nix. Build outputs go under emu/build/ (TARGET_OS=native) or emu/build-win/ (TARGET_OS=windows).

Native Linux Builds (emu/Makefile)

# Default build: emu/build/{ivory-xl1200,libivory_core.so,ivory-fep-convert} (ISA_MODE=runtime)
nix develop --command make -C emu -j all

# Force portable C11-only core (no x86-64 AVX-512 assembly fast path)
nix develop --command make -C emu -j all ISA_MODE=portable

# Force compile-time -march=native -mavx512* core
nix develop --command make -C emu -j all ISA_MODE=native
Makefile VariableDefaultOptionsNotes
TARGET_OSnativenative, windowsAuto-switches compiler (cc/gcc vs x86_64-w64-mingw32-gcc), build/ vs build-win/, .so/.dll, Win32 libs, assembly SysV vs Win64 ABI
ISA_MODEruntimeruntime, portable, nativeruntime compiles cpu_zen4_loop.S + cpu_zen4_avx512.c (-march=znver4) and checks CPUID at runtime; portable disables ASM
SLIRP (pkg-config)autopkg-config slirpAuto-detected via $(PKG_CONFIG) --libs slirp; enables -DHAVE_LIBSLIRP=1 when libslirp + glib-2.0 are present

Core ABI and hot-reload invariants are enforced at compile and load time:

  • C11 _Static_assert checks in cpu.c, test_cpu_core.c, and test_console.c verify ABI struct sizes (sizeof(IvoryCpu) == 4096U, sizeof(IvoryMem) == 32768U, sizeof(MerlinBoard) == 278528U, sizeof(IvoryDecodedSlot) == 8U, sizeof(IvoryAsmLoopCtx) == 112U) and offsetof parity with ivory_asm_offsets.h.
  • IvoryCoreApi runtime validation in core_loader.c checks abi_version == 4U, struct_size, cpu_size, mem_size, and board_size on dlopen/LoadLibraryA reload; core objects (core/*.o) must keep zero writable .data/.bss state per emu/AGENTS.md.

Windows Cross-Compile & Wine 11 CI

The .#mingw Nix devShell (flake.nix) cross-compiles the full emulator (SDL3, libslirp, glib, s7, microui, Win64-ABI cpu_zen4_loop.S, Windows sockets/named pipes) and runs both unit tests and the Scheme E2E suite under Wine 11:

# Cross-compile ivory-xl1200.exe, libivory_core.dll, ivory-fep-convert.exe + bundled DLLs in emu/build-win/dist/
nix develop .#mingw --command make -C emu -j all dist-win TARGET_OS=windows

# Run all 14 Windows unit test executables under Wine
nix develop .#mingw --command make -C emu test-win TARGET_OS=windows

# Run the portable s7 Scheme E2E suite against build-win/ivory-xl1200.exe under Wine
nix develop .#mingw --command make -C emu test-e2e-win TARGET_OS=windows

dist-win assembles emu/build-win/dist/ containing ivory-xl1200.exe, libivory_core.dll, ivory-fep-convert.exe, xl1200.scm.example, and transitive runtime DLLs resolved via x86_64-w64-mingw32-objdump (SDL3.dll, libslirp*.dll, libglib-2.0*.dll, libwinpthread-1.dll, libgcc_s_seh-1.dll, etc.).

Nix Packages (flake.nix)

flake.nix scopes emuSrc to ./emu so documentation edits do not needlessly invalidate C builds:

  • nix build .#default — builds native Linux ivory-xl1200, libivory_core.so, and ivory-fep-convert.
  • nix build .#windows — builds the cross-compiled Windows distribution package containing bin/*.exe and DLLs.

Unit & End-to-End Test Matrix (ROM-Optional)

CommandScopeROM Behavior
make -C emu testRuns all 16 C unit/integration test binaries (test_loader, test_mem, test_cpu_core, test_isa_ops, test_disasm, test_merlin, test_eth, test_console, test_keymap, test_fep_convert, test_debug_ctl, test_bug_report, test_snapshot_reload, test_s7_config, test_serial_host, test_ui_workbench)Exit code 77 is counted as SKIP (test_rom_fixture.h)
make -C emu test-e2eRuns tests/test_e2e_puppet.sh and portable tests/e2e_suite.scm (headless + GUI --eval/--script, live AF_UNIX + TCP IPC, .snap, FEP tools)Reports [SKIP] and exits 0 when ROM dumps are absent
make -C emu test-win TARGET_OS=windowsRuns all 16 .exe unit tests under Wine (WINEDEBUG=-all)Exit code 77 counted as SKIP
make -C emu test-e2e-win TARGET_OS=windowsRuns tests/e2e_suite.scm under Wine against build-win/ivory-xl1200.exeReports SKIP and exits 0 when ROMs are absent

ROM discovery for stock-PROM regression tests checks IVORY_FEP_ROM_DIR, then ../ivory-fep-roms/fep330 and ivory-fep-roms/fep330, preferring the authentic chip pair 115988-e.bin + 115989-e.bin and falling back to combined rom.dump (never bundled in the repository). For interactive booting without proprietary ROM dumps, build the included clean-room Boot PROM via make -C prom (docs/custom-boot-prom.md).


Quick Start

# 1. Build emulator, core shared library, IFEP tool, and clean-room Boot PROM
nix develop --command make -C emu -j all
nix develop --command make -C prom

# 2. Run GUI (starts powered off: select prom/build/custom-rom.dump in Machine Setup, then click Power On)
./emu/build/ivory-xl1200 --config emu/xl1200.scm.example

# 3. Boot directly with the clean-room Boot PROM (FEPFS disk or Genera 8.3 CD-ROM)
./emu/build/ivory-xl1200 --rom prom/build/custom-rom.dump --cdrom genera-8-3.iso --autostart

# 4. Optional: boot original Symbolics split FEP 3.30 ROMs if you have them
./emu/build/ivory-xl1200 --headless --rom path/to/115988-e.bin --rom-hi path/to/115989-e.bin

4. Attach interactively to a running emulator's live debug socket

./scripts/xl1200-ctl.sh --list ./scripts/xl1200-ctl.sh

Related Chip Datasheets (10)All Component Datasheets →