- Rust 76.7%
- Assembly 8.6%
- C 8.5%
- Makefile 6.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| debug_adapter_schemas | ||
| example | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| extension.toml | ||
| LICENSE | ||
| README.md | ||
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
- Build Emu with DAP (Linux) and put
emuon yourPATH, or point Zed at it insettings.json:{ "dap": { "x65": { "binary": "/path/to/emu" } } } - Install this extension:
zed: extensions, Install Dev Extension, and pick this directory (Zed builds it; it needs Rust with thewasm32-wasip2target). - Build your program with debug info:
-gon cc65 and ca65 (orcl65 -g), and ld65's--dbgfilewritinggame.dbgnext togame.xex. Build from the project's directory, so the source names cc65 records are relative to it. - Add a scenario to
.zed/debug.jsonand 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.