X65 Emu DAP debugger for Zed
  • Rust 76.7%
  • Assembly 8.6%
  • C 8.5%
  • Makefile 6.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-21 20:33:56 +02:00
debug_adapter_schemas Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
example Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
src Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
.gitignore Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
Cargo.lock Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
Cargo.toml Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
extension.toml Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
LICENSE Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00
README.md Initial version of X65 Emu DAP debugger for Zed 2026-10-21 20:33:56 +02:00

X65 debugger for Zed

Debug X65 programs from Zed, at source level: set breakpoints in your C and assembly sources, step, and look at the registers, memory and disassembly of the running machine.

The debugger is Emu, the X65 emulator, which speaks the Debug Adapter Protocol itself and reads cc65 debug info. This extension only tells Zed how to start it: as the x65 debug adapter. Emu's side of the contract, every launch field included, is doc/dap.md in Emu.

Setup

  1. Build Emu with DAP (Linux) and put emu on your PATH, or point Zed at it in settings.json:
    { "dap": { "x65": { "binary": "/path/to/emu" } } }
    
  2. Install this extension: zed: extensions, Install Dev Extension, and pick this directory (Zed builds it; it needs Rust with the wasm32-wasip2 target).
  3. Build your program with debug info: -g on cc65 and ca65 (or cl65 -g), and ld65's --dbgfile writing game.dbg next to game.xex. Build from the project's directory, so the source names cc65 records are relative to it.
  4. Add a scenario to .zed/debug.json and start it from the debug panel:
    [
      { "label": "X65: game", "adapter": "x65", "request": "launch",
        "program": "$ZED_WORKTREE_ROOT/game.xex", "cwd": "$ZED_WORKTREE_ROOT",
        "stopOnEntry": true, "build": { "command": "make" } }
    ]
    

launch starts Emu over stdio with the program; with a tcp_connection it starts Emu listening on that port instead. attach with a tcp_connection joins an Emu you started yourself with --dap-port, taking the machine as it is.

Field
request launch or attach
program the .xex to run (launch)
debugFile cc65 debug info, if not the .dbg next to the program
bankBase the bank for the debug info's 16-bit addresses (default 0)
cwd where relative paths and source names are looked up first
stopOnEntry stop at the program's first instruction

Example

example/ is a C program built with cc65's none target into an X65 .xex (x65.cfg and xex.s lay out the file). Open the directory in Zed, start X65: hello, and set a breakpoint in fib().

Variables

The variables view has the registers and Globals: your program's variables by their C names (results, frames), cc65's runtime left out. cc65 records no C types, so a variable shows by its size -- a byte, a word, or an array of bytes to expand -- and you can set it. Watch expressions and hovers take a variable's name, or one of its bytes (results[3]).

Not there: local variables, and a call stack deeper than the current frame.