Crusader_Decomp/docs/spice86/spice86.md
2026-10-12 00:41:16 +02:00

4.8 KiB

Setup

  • Spice86 executable: I:\Apps\Spice86\win-x64\Spice86.exe
  • Test installation: G:\games\Crusader No Remorse
  • MCP endpoint: http://localhost:8281/mcp
  • Spice86 HTTP API: http://127.0.0.1:20000 (started by the tested launch)
  • GDB server: localhost:10000 (started by the tested launch)
  • Recorded-data root: K:\ghidra\Crusader_Decomp\spice86

Use the installed GOG game directory as the emulated C: drive. The standalone repository executable is not a substitute for this installation when testing game startup.

Launch

Run from PowerShell:

& 'I:\Apps\Spice86\win-x64\Spice86.exe' `
  -c 'G:\games\Crusader No Remorse' `
  -e 'G:\games\Crusader No Remorse\CRUSADER.EXE' `
  -a '-warp 0 23807 25343 0 -mapoff 13' `
  -r 'K:\ghidra\Crusader_Decomp\spice86' `
  --McpHttpPort 8281

The arguments match dosboxCRUSADER_single.conf. Spice86 creates a program-SHA-256 subdirectory beneath the -r root. Dumps are written on a completed emulator run; a directory by itself is not evidence that a dump was produced.

First Debug

  1. Start the command above and confirm the log says the MCP HTTP server is listening on port 8281.
  2. Check http://localhost:8281/health; the tested response was {"status":"ok"}.
  3. Send MCP JSON-RPC requests to /mcp with both Content-Type: application/json and Accept: application/json, text/event-stream. Without the Accept header, the initialize request returned HTTP 406. Use the documented sequence: initialize, then tools/list.
  4. For the first guest stop, call read_cpu_state and read_disassembly at the reported CS:IP. Check get_pause_status before trying execution controls. Use read_video_state or capture_screenshot only if the guest reaches a useful screen.
  5. Save the terminal error and MCP state with the run notes. Do not interpret a healthy MCP endpoint as proof that the game started.

Test Log

  • Spice86 and its HTTP API, MCP endpoint, and GDB server all started with the installed game. MCP health, initialization, tool discovery, CPU-state reads, and disassembly reads worked on port 8281.
  • Both the default CPU model and --CpuModel INTEL_80386 halted before the game screen at 0257:23D4 with Invalid opcode 0xF01. The startup log also reports an unsuccessful open of 386MAX$$ at 0257:C6F0; its relationship to the opcode fault is not confirmed.
  • The Spice86 README says 80286 protected mode is not implemented and 80386 support is partial, with protected mode not implemented. This is a likely compatibility barrier for the game's Phar Lap DOS extender, not yet a proven explanation for this exact fault.
  • A diagnostic retry with --FailOnInvalidOpcode false moved the fault to an uninitialized interrupt vector at 0:0. Adding --AllowIvtAddress0 did not recover: execution repeatedly reported CALL STACK DEPTH EXCEEDED 1000 at 0000:002F. That run was stopped. Do not use these flags as a startup workaround.
  • --CpuModel INTEL_80386 --Ems false --Xms false also halted at 0257:23D4 with the same invalid opcode. It additionally logged an unhandled INT 2Fh subfunction 1687 (DPMI host detection) and missing EMMXXXX0, EMMQXXX0, and $MMXXXX0 names. The memory toggles do not resolve the CPU/DPMI startup barrier.
  • --CpuModel INTEL_80286 --Ems false --Xms false produced the same DPMI probe and opcode halt. Together with the default-memory runs, both CPU models have now been tested with EMS/XMS on and off; none booted the game.
  • A read-only hash check found the installed CRUSADER.EXE.BAK has the same SHA-256 as the standalone executable tried earlier, so it is not a new binary variant to test.
  • The DOSBox profile mounts GAME.GOG as D:, while the tested Spice86 command provides only C:. CD-drive parity remains untested, but it is separate from the current early CPU/DPMI halt.
  • The recorded-data directory spice86\97317993EFFE2FAB37C4C10105B3388E5948ECB8001E3340DF87FA0E743214C9 was created, but was empty when checked. No generated CFG, memory dump, or C# project has been verified yet.

Next Run

  1. Keep the default invalid-opcode behavior; the ignored-fault path loops at 0000:002F rather than booting the game.
  2. Further progress with Spice86 likely requires DPMI/protected-mode support; both CPU models, with EMS/XMS enabled and disabled, stop at the same instruction. Do not attribute the exact opcode fault to protected mode without confirming the instruction semantics in a compatible emulator.
  3. If the CPU/DPMI barrier is resolved, next test the profile's GAME.GOG as D: because the current Spice86 launch maps only the installed C: directory.
  4. Only record generated output as successful after verifying files appear in the hash subdirectory. The current confirmed success is MCP-based runtime inspection, not Crusader gameplay or dump generation.