XL1200-EMU Symbolics XL1200 Emulator
Plans & Roadmap SpecsTODO docs/color-graphics-plan.md

Color Graphics Implementation Plan: VMEbus, Univision UDC-3400 & Symbolics FrameThrower

Status: Future / Proposed Design Plan (Tier 2) — Not yet implemented. Depends on the shared Merlin-II VMEbus & VIC068 bridge in docs/vme-bus-plan.md. See docs/ROADMAP.md for overall sequencing and docs/emulator/README.md / docs/emulator/peripherals-and-backends.md for the currently implemented C11 XL1200 emulator.

Target Emulator: C11 XL1200 Emulator (emu/)
Reference Sources (local-only developer assets): genera-original/sys.sct/{i-sys,color,ifep}/, docs/hardware-reference/04-merlin-ii-core-and-vmebus.md


1. Executive Summary & Strategy

Symbolics XL400 / XL1200 (Merlin-I / Merlin-II) workstations support two VMEbus color graphics subsystems in Genera 8.3:

  1. Univision UDC-3400 (third-party VMEbus board): Uses off-the-shelf components — three Brooktree Bt458 RAMDACs and an Intel 82786 graphics coprocessor — and has complete Lisp driver source code in Genera 8.3 (color/univision.lisp, color/univision-82786.lisp, color/vme-color.lisp).
  2. Symbolics FrameThrower (Photon + AVP) (Symbolics VMEbus boardset): Uses custom Symbolics graphics ASICs (Photon framebuffer/DP-ALU/ASQ/VDP + AVP video processor) driven by compiled Ivory binaries (color/framethrower/*.ibin) and a 1.87 MB proprietary microcode blob (microload-74.ibin), plus an IFEP boot-time sync profile (ifep/i328-framethrower.sync.~1~).
  1. Prerequisite — Shared Merlin-II VMEbus & VIC068 Bridge: Implemented once via docs/vme-bus-plan.md (emu/src/vme_bus.c, VmeDeviceOps registry, IVORY_CORE_ABI_VERSION = 5U), shared cleanly with docs/genera-pv.md using disjoint VME A32 slots.
  2. Phase 2 — Host SDL3 Secondary Display, microui UI, Snapshot & Debug Infrastructure (shared presentation/inspection layer).
  3. Phase 3 — Univision UDC-3400 (fastest path to working 8-bit/24-bit/32-bit Genera Color System + overlays, with full Lisp source truth).
  4. Phase 4 — FrameThrower (Photon + AVP) (staged: first IFEP .sync + framethrower-ccu-console direct mode, then Genera direct-framebuffer mode, then optional HLE of the *MAIN-QUEUE* / PUSH-FRAME command queue).

2. Core Emulator & ABI Invariants

All changes must preserve the invariants in emu/AGENTS.md and docs/vme-bus-plan.md:

  • Frozen hot-reload struct sizes:
    • sizeof(IvoryCpu) == 4096U
    • sizeof(MerlinBoard) == 278528U
    • sizeof(IvoryMem) == 32768U
    • Both Univision (0x9000_0000) and FrameThrower attach as VmeDeviceOps cards on the shared VmeBus *vme pointer defined in docs/vme-bus-plan.md — requiring zero additional _reserved slots in MerlinBoard.
  • Zero writable .data/.bss in emu/build/obj/core/*.o (verified via readelf -WS).
  • Zero SDL dependencies in libivory_core.so: The core renders active color scanout into a caller-provided RGBA8888 buffer through IvoryCoreApi v5 (vme_get_display_info / vme_render_rgba).
  • Strict reference provenance: Derive all register addresses, bitfields, and semantics exclusively from genera-original/sys.sct/, I_Machine/, and docs/hardware-reference/.

3. Phase 1: Merlin-II VMEbus & VIC068 Bridge (Shared Foundation)

Extracted Specification: The shared Merlin-II VMEbus & VIC068 bridge (emu/src/vme_bus.c, VmeDeviceOps registry, polled 0x88000040..0x88000140 access, direct PMA >= 0xC0000000 window with all 4 shuffle modes, VIC068 BESR.VME-BERR #x20 latching on unmapped probes, and VME IRQ1–7 / IACK routing) is specified in docs/vme-bus-plan.md. Univision (0x9000_0000) and FrameThrower register directly onto that shared bus alongside IVPV (0x1000_0000).


4. Phase 2: Host SDL3 Multi-Screen, microui UI, CLI, Snapshot & Debug Support

4.1 Display Architecture (emu/src/sdl_console.c, emu/src/ui_workbench.c, emu/src/main.c)

  • Dual-head by default when a color board is attached:
    • Window 1: Existing XL1200 monochrome B&W console (1152×896 full or 1084×812 trimmed + 28 px LED bezel + 28 px microui top menu bar).
    • Window 2: Color Monitor window (dynamically resized from VmeDisplayInfo, e.g. 1280×1024 for Univision / FrameThrower Sony CADBuffer, 640×480 / 768×576 for NTSC/PAL), rendered via an SDL_PIXELFORMAT_ARGB8888 streaming texture updated at 60 Hz when dirty_seq changes.
  • Single-head primary-console mode (for FrameThrower CCU boot without B&W monitor): Optional flag --color-primary suppresses the B&W window and routes keyboard/mouse events from the Color window to the XL1200 SLB console.
  • Workbench UI & Config Integration (ui_workbench.c, emu_script.c):
    • Machine Setup → Firmware & Memory (or View menu): Color board selector (None / Univision UDC-3400 / FrameThrower) persisted in (define-machine :color ...), plus View -> Show Color Monitor window toggle.
    • Bug Dump (bug_report.c): Automatically includes color-screen.ppm in the diagnostic .zip when a color board is active; Video Recording can optionally select the color head as capture target.
  • CLI options in main.c:
    • --color univision[:<hex_base>] (default base 0x90000000)
    • --color framethrower[:<hex_base>] (default base per probe.ibin)
    • --color-headless (attach VME board without opening an SDL3 window — for automated tests)

4.2 IvoryCoreApi Additions (IVORY_CORE_ABI_VERSION = 5U, shared with docs/vme-bus-plan.md)

Add clean, opaque VME/color hooks to emu/include/ivory_core_api.h:

  • vme_attach_univision(MerlinBoard *board, uint32_t base_addr)
  • vme_attach_framethrower(MerlinBoard *board, uint32_t base_addr)
  • vme_get_color_display_info(const MerlinBoard *board, uint32_t head_idx, VmeDisplayInfo *out)
  • vme_render_color_rgba(MerlinBoard *board, uint32_t head_idx, uint32_t *rgba_out, uint32_t max_pixels)

4.3 Debug & Snapshot Integration

  • debug_ctl.c / scripts/xl1200-ctl.sh:
    • color-status: Prints attached VME color board(s), base address, resolution, bpp, LUT/overlay mode, active dirty/write counters, and 82786/ASQ status.
    • dump-color-ppm <path>: Dumps the current composited RGB24 color screen to a PPM image for headless visual verification.
  • snapshot.c:
    • Add an optional tagged chunk (SNAP_CHUNK_VME_COLOR) storing board type, base address, register state, RAMDAC LUTs, overlay planes, and compressed/dirty-tracked color VRAM pages.

5. Phase 3: Univision UDC-3400 VMEbus Color Board

Primary Sources (local-only Genera 8.3 tree):

  • genera-original/sys.sct/color/univision.lisp.~249~
  • genera-original/sys.sct/color/univision-82786.lisp.~194~
  • genera-original/sys.sct/color/vme-color.lisp.~130~
  • genera-original/sys.sct/i-sys/console.lisp (lines 449–558)

5.1 New Module: emu/src/vme_univision.c

A. Memory Map (16 MB VME A32 Window, Default Base 0x90000000)

Byte OffsetSizeHardware Block
+0x0000004 BStatus Register: <31:16> Board ID = 0xC000, <9> VBLANK (set during vertical retrace; write 1 to clear), <8> 786_RESET, <5> VIDEO_ENB, <2> INT, <1> INT_ENB
+0x0000044 BInterrupt Vector Register
+0x0000084 BControl Register: <15:12> BUFFER_SELECT, <10> XMODE (1 = 8-bit indexed / plane-selected, 0 = 24/32-bit truecolor), <7:4> ZOOM, <3> BURST, <1> VSB_ENB
+0x00000C4 BPlane Mask Register (32-bit write-enable mask applied to CPU writes into main framebuffer)
+0x00010016 BRed Brooktree Bt458 RAMDAC (+0 Addr, +4 Color Palette, +8 Control Regs 0x04..0x07, +12 Overlay Palette)
+0x00011016 BGreen Brooktree Bt458 RAMDAC (same 4-register layout; also acts as :single RAMDAC in 8-bit mode)
+0x00012016 BBlue Brooktree Bt458 RAMDAC (same 4-register layout)
+0x00020064 BIntel 82786 Registers (+0x04 BIU Control, +0x06 Refresh, +0x08 VRAM Control, +0x0A..0x0E Priorities, +0x20 GP Opcode, +0x22/24 Link L/H, +0x26 Status, +0x28/2A PC L/H)
+0x100000256 KiBOverlay 0 Framebuffer (1 bpp, 2048 × 1024 bit-addressed)
+0x140000256 KiBOverlay 1 Framebuffer (1 bpp, 2048 × 1024 bit-addressed)
+0x180000512 KiB82786 Display List SRAM (accessed by Genera with logxor index 1 halfword permutation)
+0x8000008 MiBMain Framebuffer (2048 × 1024 pixels × 32 bpp; active visible area 1280 × 1024; supports 8-bit, 24-bit, and 32-bit modes)

B. Milestone 3a: Direct Framebuffer, Bt458 RAMDACs & Compositor

  1. Board Detection & Setup:
    • Return 0xC0000000 | status_low at +0x000000 so find-univision-controllers detects the board at 0x90000000.
    • Implement plane-mask (+0x00000C) gating on main framebuffer writes, and ensure the 0x59595959 valid-byte-mask probe (univision.lisp:390-401) reports all 4 bytes valid (useful-bits-per-pixel = 32, configurable to 24 or 8 if desired).
    • Advance a 60 Hz (16,667 µs) vertical retrace timer in tick(): latch status-vblank (<9>) so :get-vertical-sync-with-timeout succeeds immediately without spinning to timeout.
  2. Three Brooktree Bt458 RAMDACs:
    • Each Bt458 maintains: 8-bit auto-incrementing address register, 256×8 main LUT, 4×8 overlay LUT, and control registers (0x04 Read Mask, 0x05 Blink Mask, 0x06 Command Register — overlay enable bits <1:0> and RAM enable, 0x07 Test).
    • Auto-increment semantics: writing/reading palette or overlay registers cycles R→G→B or single-channel per Bt458 datasheet and univision.lisp:705-765.
  3. Scanout Compositor (render_rgba):
    • Reads visible 1280 × 1024 (with x-pan, y-pan, x-zoom, y-zoom, y-wrap from 82786/control state) from the 2048 × 1024 framebuffer:
      • Truecolor (XMODE = 0): Extract R, G, B bytes from 32-bit pixel word, map through Red/Green/Blue Bt458 main LUTs.
      • 8-bit Indexed (XMODE = 1): Extract byte selected by BUFFER_SELECT, map through RAMDAC LUTs (handling both 3-RAMDAC and :single green-RAMDAC RGB modes).
      • Overlays: Combine 1-bit pixel from Overlay 0 (bit 0) and Overlay 1 (bit 1) into 2-bit overlay index ov; if overlay is enabled in Bt458 Command Reg 0x06 and ov != 0, substitute the Bt458 overlay palette RGB entry.

C. Milestone 3b: Intel 82786 Graphics Processor (GP) Engine

Genera's 82786-mixin (univision-82786.lisp) builds command lists in +0x180000 (mapped at 82786 internal address 0x280000, with main FB at 0x000000, overlay 0 at 0x200000, overlay 1 at 0x240000) and kicks execution by writing GOTO (%82786-opcode = 0x02) + LINK_L/H.

Implement a synchronous step/drain interpreter for the Intel 82786 GP opcodes in %82786-opcodes (univision-82786.lisp:279-326):

  • Control & Registers: NOOP (0x03), GOTO (0x02), CALL (0x0F), RETURN (0x17), GENERATE_INTERRUPT (0x0E), LOAD_REGISTER (0x34), DUMP_REGISTER (0x29), ENTER_PICK/EXIT_PICK (0x44/0x45), HALT bit handling (STATUS #o200 POLL set when halted).
  • State Setup: DEFINE_BITMAP (0x1A), DEFINE_CLIP_RECTANGLE (0x46), DEFINE_COLORS (0x3D), DEFINE_MASK_AND_BOOLEAN (0x41), DEFINE_TEXTURE_OPAQUE/TRANSPARENT (0x06/0x07), DEFINE_CHAR_SET_WORD/BYTE_MODE (0x0A/0x0B), DEFINE_CHAR_ORIENTATION (0x4E), DEFINE_CHARACTER_SPACE (0x4D), MOVE (0x4F), RELATIVE_MOVE (0x52).
  • Drawing Primitives: DRAW_POINT (0x53), DRAW_INCREMENTAL_POINTS (0xB4), DRAW_LINE (0x54), DRAW_RECTANGLE (0x58), DRAW_POLYGON (0x73), DRAW_POLYLINE (0x74), DRAW_CIRCLE (0x8E), ARC_EXCLUSION/INCLUSION (0x68/0x69), SCAN_LINES (0xBA), BITBLT_WITHIN_BITMAP (0x64), BITBLT_BETWEEN_BITMAPS (0xAE), DRAW_STRING / DRAW_STRING_OPAQUE (0xA7/0xA6).
  • Symbolics Custom Halt Opcodes (univision-82786.lisp:320-325): 0xFF (set-plane-enable), 0xFE (data-block), 0xFD (stack-underflow) — must halt with POLL (#o200) + ILL_OP (#o100) cleanly so Genera's Lisp driver intercepts and services them as designed.
  • Note on set-fast-page-p timing test (univision.lisp:307-350): Genera benchmarks BITBLT via time:fixnum-microsecond-time (< 0.425 µs/pixel enables fast-page mode). Synchronous host execution completes fast enough to pass cleanly without division-by-zero (ensure fin2 > start2 or realistic microsecond accounting).

6. Phase 4: Symbolics FrameThrower (Photon + AVP)

Primary Sources (local-only Genera 8.3 tree):

  • genera-original/sys.sct/i-sys/console.lisp (lines 564–720, framethrower-ccu-console)
  • genera-original/sys.sct/color/photon.lisp.~119~ (photon-fb-mixin)
  • genera-original/sys.sct/ifep/i328-framethrower.sync.~1~
  • genera-original/sys.sct/color/framethrower/sync/*.lisp*
  • Compiled .ibin drivers in genera-original/sys.sct/color/framethrower/ (probe.ibin, hardware-definitions.ibin, photon-hardware.ibin, photon-operations.ibin, avp-hardware.ibin, video.ibin, command-queue.ibin, initialization.ibin) — to be disassembled cleanly via Genera's own disassemble or native emu/ inspection tooling before coding.

6.1 Architectural Analysis & Risk Mitigation

FrameThrower is a multi-board VMEbus graphics system (1–4 Photon framebuffer/ALU boards + 1 AVP video processor board):

  • Photon board contains: VMEbus interface & ID PROM, 32-bit VRAM (plane mode + pixel mode + component mode), 4× DP-ALU datapath ALUs, VDP video datapath, RAMDAC-CONTROL-0..3 (4-channel palette/control), MICROCODE-BANK-0/1 (dual-bank 32-bit sync microcode SRAM), and the ASQ (Address/Microcode Sequencer) that executes microload-74.ibin (1.87 MB).
  • AVP board contains: SYNC-SEQUENCER-BANK-0/1 (Am2910-based video sync microsequencer), VIDEO-PROCESSOR-ADDRESS/DATA/COMMAND, MAIN-CONTROL, AVP-CONTROL, ID-PROM.

Because microload-74.ibin is undocumented proprietary microcode for custom Symbolics ASICs, full low-level emulation (LLE) of the ASQ microengine is high-risk and unnecessary for initial color bring-up. Instead, implement FrameThrower in three incremental milestones:

6.2 Milestone 4a: Static Disassembly & Direct Console Bring-Up (framethrower-ccu-console)

  1. Reverse-engineer register map from Genera .ibins (one-time research step using Genera's disassembler or emu/ inspection tooling):
    • Extract exact VME base addresses, ID PROM layout, and PROBE-SYSTEM-SLOTS signature from probe.ibin, hardware-definitions.ibin, photon-hardware.ibin, and avp-hardware.ibin.
    • Document the resulting register map in docs/hardware-reference/07-vme-color-graphics.md.
  2. Implement emu/src/vme_framethrower.c (Base Layer):
    • Photon ID PROM + VME slot probe response.
    • Direct plane-mode framebuffer (#o41001000 word offset = mode register, #o13 | (1<<8) = 1-bit plane mode, as used by set-framethrower-parameters in i-sys/console.lisp:645-688).
    • Photon RAMDAC indirect interface (#o41001540 index, +1 map/bank select, +2 control register write, +3 24-bit palette entry write).
    • Dual-bank 32-bit sync microcode RAM (MICROCODE-BANK-0/1) so i328-kernel.fep can load i328-framethrower.sync.~1~ (Sony 1280×1024 CADBuffer, 358+60 words per bank) without error and initialize FrameThrower as the primary cold-load console.

6.3 Milestone 4b: Genera Color System Direct-Drawing Mode (remote-drawing-enabled = nil)

  • Implement Photon DISPLAY-MEMORY-CONFIGURATION, VIDEO-CONFIGURATION, VIDEO-BACKTIMING, DP-CONFIGURATION (pixel/component/plane addressing modes, plane mask, fill data 0/1), and RAMDAC-CONTROL-0..3.
  • Support 8-bit indexed and 24/32-bit direct RGB VRAM scanout at 1280×1024 (Sony CADBuffer) plus NTSC/PAL/HDTV resolutions defined in color/framethrower/sync/*.lisp.
  • Implement vertical-sync status / interrupt so console-wait-for-vertical-sync and Genera's color map updates work cleanly.
  • With remote-drawing-enabled set to nil in photon-fb-mixin (photon.lisp:162), Genera falls back to Ivory CPU drawing directly into VME VRAM — giving a complete, authentic 24/32-bit FrameThrower color display without needing ASQ microcode execution.

6.4 Milestone 4c: Command Queue Acceleration (HLE vs LLE)

  • Inspect command-queue.ibin and interface-routines.ibin (*MAIN-QUEUE*, *VERTICAL-QUEUE*, *BIT-QUEUE*, PUSH-FRAME) to catalog the command opcodes sent from Lisp to the ASQ.
  • Recommended approach — Command-Queue HLE:
    • Accept microcode downloads into MICROCODE-BANK-0/1 / ASQ RAM without faulting.
    • When Genera writes a new queued frame pointer to ASQ-COMMUNICATION / *MAIN-QUEUE*, intercept the command packet in C, execute the requested operation (BITBLT, rectangle fill, line, font glyph, sync/RAMDAC register update, return-value writeback) directly on Photon VRAM, and advance the queue consumer pointer / signal completion.
    • This unlocks full remote-drawing-enabled = t performance without needing to reverse-engineer 1.87 MB of custom ASIC microcode.
  • AVP (Optional): Stub AVP ID PROM + SYNC-SEQUENCER-BANK-0/1 + AVP-CONTROL so ft::probe-system-slots can optionally report an AVP board if needed by video/genlock diagnostics.

7. Verification & Acceptance Criteria

7.1 Automated Unit Tests (emu/tests/test_vme_color.c)

  • VMEbus: Direct window 0xC0000000..0xFFFFFFFF address calculation, all 4 shuffle modes, polled 8/16/32-bit reads & writes, unmapped address VME-BERR latching in vic-bus-error-status.
  • Univision: Board ID #xC000 probe, 0x59595959 byte-mask test, plane-mask write gating, Bt458 auto-increment LUT & overlay compositing, 82786 GP command-list execution (DEFINE_BITMAP, DRAW_RECTANGLE, DRAW_LINE, BITBLT_WITHIN_BITMAP, BITBLT_BETWEEN_BITMAPS, custom halt opcodes #xFF/#xFE).
  • FrameThrower: ID-PROM probe, RAMDAC indirect palette writes (#o41001540), plane-mode register (#o41001000), loading i328-framethrower.sync.~1~ into dual microcode banks, 1-bit & 32-bit RGBA scanout verification.

7.2 End-to-End Genera 8.3 Verification

  1. Univision E2E:
    • Boot Genera 8.3 with --color univision.
    • Evaluate (color:find-univision-controllers) → detects (:univision #x90000000 nil).
    • Create an 8-bit and 32-bit color screen (color:make-color-screen), draw primitives and windows, verify via dump-color-ppm and interactive SDL3 Color window.
    • Test both remote-drawing-enabled = nil (CPU direct) and t (82786 GP accelerated).
  2. FrameThrower E2E:
    • Install i328-framethrower.sync.~1~ on FEP disk (Install Color Startup File), cold-boot with --color framethrower, and verify IFEP initializes the Sony 1280×1024 display and renders the cold-load stream.
    • Boot Genera 8.3, verify framethrower-ccu-console and color:find-photon-controllers, draw color graphics, and verify via dump-color-ppm.

7.3 Build & ABI Hygiene Gates

After every phase:

make -C emu clean all test test-e2e
readelf -WS emu/build/obj/core/*.o | awk '$2==".data" || $2==".bss" { if ($6 != "000000") exit 1 }'
  • Confirm sizeof(IvoryCpu) == 4096, sizeof(MerlinBoard) == 278528, sizeof(IvoryMem) == 32768.
  • Confirm libivory_core.so exports only ivory_core_get_api and has zero libSDL3 linkage (ldd emu/build/libivory_core.so).

8. File Impact Summary

FileActionPurpose
emu/include/ivory_hw.hEditMerlin-II VME/VIC068 register offsets, Univision & FrameThrower hardware constants
emu/include/ivory_emu.hEditVmeBus *vme in MerlinBoard (using 1 _reserved slot), VmeDisplayInfo
emu/include/ivory_core_api.hEditBump IVORY_CORE_ABI_VERSION to 5U, add VME attach & color scanout API
emu/src/vme_bus.cNewMerlin-II VMEbus bridge (direct window, polled access, shuffle, VIC068 BERR/IRQ)
emu/src/vme_univision.cNewUnivision UDC-3400 (registers, 3× Bt458 RAMDACs, overlays, Intel 82786 GP engine)
emu/src/vme_framethrower.cNewSymbolics FrameThrower (Photon ID PROM, RAMDAC, sync banks, VRAM, HLE queue)
emu/src/merlin.c, mem.cEditRoute VIC068 polled registers and PMA >= 0xC0000000 direct VME window to vme_bus.c
emu/src/sdl_console.c, ui_workbench.c, main.cEditSecondary SDL3 color display window, microui UI toggles, --color CLI flags
emu/src/debug_ctl.c, bug_report.c, snapshot.cEditcolor-status, dump-color-ppm, color-screen.ppm in bug dumps, and SNAP_CHUNK_VME_COLOR
emu/tests/test_vme_color.cNewUnit tests for VMEbus, Univision, and FrameThrower
docs/hardware-reference/07-vme-color-graphics.mdNewRegister reference for VMEbus, UDC-3400, and disassembled FrameThrower .ibins
Related Chip Datasheets (4)All Component Datasheets →