Minimal VS Code debug adapter for Z80 programs. It loads Intel HEX + .lst listings, runs asm80 by default before each debug session (when an asm root is provided), supports source-level stepping/breakpoints, and exposes registers. “Debug80” is the debugger name used in the examples below.
Machine-specific setups now live in separate repos. For TEC-1, see debug80-tec1:
https://github.com/jhlagado/debug80-tec1
|
|
- Node 18+ (Node 20+ recommended)
- Yarn
- asm80 installed locally:
yarn add -D asm80
yarn install --ignore-engines
yarn build
yarn test- Open
examples/HelloWorldfor the Simple platform terminal demo. - Open
examples/Tec1for the TEC-1 monitor + serial demo. - Press F5 to start debugging.
These example folders already include .vscode configs, so you can run them immediately.
Add .vscode/debug80.json so F5 doesn’t depend on the active editor (debug80.json at the repo root also works). Example:
{
"defaultTarget": "app",
"targets": {
"app": {
"sourceFile": "examples/echo.asm",
"outputDir": "build",
"artifactBase": "echo",
"platform": "simple",
"simple": {
"regions": [
{ "start": 0, "end": 2047, "kind": "rom" },
{ "start": 2048, "end": 65535, "kind": "ram" }
],
"appStart": 2304,
"entry": 0,
"binFrom": 2304,
"binTo": 65535
}
}
}
}Fields per target:
sourceFile: root asm file to assembleoutputDir: where artifacts goartifactBase: basename for artifactsplatform: currentlysimplesimple: platform config (memoryregionswithkind+readOnly; CPU starts at 0x0000 / 0, app at 0x0900 / 2304)simple.binFrom/simple.binTo: optional, emits a.binvia an extra asm80 passassemble: defaults totrue. Set tofalseto skip running asm80 (use existing HEX/LST).hex,listing: optional explicit paths (override defaults)entry: optional entry point override (non-simple platforms)sourceRoots: optional list of directories to resolve.asmfiles referenced by the LSTstepOverMaxInstructions: optional max instructions for Step Over (0disables the cap)stepOutMaxInstructions: optional max instructions for Step Out (0disables the cap)terminal: optional terminal port map for thesimpleplatform- You can define multiple targets (e.g.,
app,unit,integration) and setdefaultTarget.
Launch config (.vscode/launch.json) option:
openRomSourcesOnLaunch: opens ROM listing/source files automatically when a session starts (default true).openMainSourceOnLaunch: opens the primary source file automatically when a session starts.sourceColumn: editor column (1-9) for source files opened on launch (default 1).panelColumn: editor column (1-9) for Debug80 platform panels (default 2).
To make a folder debuggable quickly in VS Code:
- Press
Cmd-Shift-P(macOS) orCtrl-Shift-P(Windows/Linux) to open the Command Palette. - Type “Debug80: Create Project (config + launch)” and press Enter.
This command scaffolds a Simple-platform config:
- Creates
.vscode/debug80.jsonwith a default target (triessrc/main.asm, or the first.asmit finds). - Creates
.vscode/launch.jsonwith a Debug80 launch configuration.
After scaffolding, adjust the sourceFile, outputDir, and artifactBase as needed, then press F5.
To target a different platform (e.g., tec1):
- Set
platform: "tec1"in.vscode/debug80.json. - Copy relevant fields from
examples/Tec1/.vscode/debug80.json(e.g., memory regions, ROM,ramInitHex). - Update
sourceFileto your program and build outputs.
- Run “Debug80: Create Project (config + launch)” to scaffold
.vscode/debug80.json(defaults totargets.appwithsrc/main.asm) and.vscode/launch.json. - Start debugging with the generated debug80 launch; the adapter reads
.vscode/debug80.json, runsasm80automatically using the target’ssourceFile/asm, and writes HEX/LST intooutputDir(installasm80locally first). Setassemble: falseto use pre-built artifacts instead. - Set breakpoints in
.asmfiles (preferred). Listing breakpoints in.lststill work as a fallback. - Start debugging (F5).
stopOnEntryhalts on entry; Step/Continue as usual. Registers show in the Variables view.
Notes:
- HALT stops execution; Continue again to terminate.
- Listing/HEX are required; ensure asm80 completes successfully or provide existing artifacts.
- Step Over/Step Out can run for a long time in tight loops; use Pause to interrupt if needed.
For external repos:
- Open the external project as your workspace (e.g.,
caverns80). - Run “Debug80: Create Project (config + launch)” to scaffold
.vscode. - Update
platformandsourceFileto match the project and platform (Simple/TEC-1). - Press F5.
This keeps example configs inside Debug80 while letting external projects own their debug setup.
docs/technical.md— detailed developer guide to the extension, adapter, mapping, and steppingdocs/platforms.md— platform architecture and config referencesdocs/d8-debug-map.md— debug map format and generator notesdocs/timing-model.md— timing and cycle model detailsdocs/platform-development-guide.md— how to add a new platform runtime/UI