Skip to content

Feature/vscode debugger#166

Merged
highbyte merged 151 commits into
masterfrom
feature/vscode-debugger
Mar 5, 2026
Merged

Feature/vscode debugger#166
highbyte merged 151 commits into
masterfrom
feature/vscode-debugger

Conversation

@highbyte

@highbyte highbyte commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Major features and changes:

1. VSCode debugger extension
A VSCode debugger extension (TypeScript) that connects to a Debug Adapter in the emulator host for debugging 6502 code (both source and disassembly debugging).

2. Debug Adapter
A debug adapter library (.NET) to enable debugging from VSCode. It supports both source level debugging via CC65 toolchain .dbg files, and disassembly debugging when source and .dbg files are not available.

3. Debug Adapter hosts
The Avalonia Desktop app hosts the Debug Adapter (enabled via command line option) and exposes TCP endpoint for debug client connections.

Also a generic debug console app that hosts the Debug Adapter and debug clients connect via traditional STDIN/STDOUT.

Implements minimal viable debugger with:
- Debug Adapter Protocol (DAP) server in C#
- Address-based breakpoints
- Step/continue/pause execution
- Register and flag inspection
- Disassembly view at current PC
- VSCode extension integration

New projects:
- src/apps/Highbyte.DotNet6502.DebugAdapter - DAP server
- vscode-extension/ - VSCode extension files

Features:
- Launch .prg files from VSCode
- Set breakpoints at memory addresses
- View CPU state (PC, SP, A, X, Y, flags)
- Step through 6502 instructions
- Disassembly in call stack view

Limitations (MVP):
- No source-level debugging
- Address-only breakpoints
- No memory inspection
- No conditional breakpoints
- Add .vscode/launch.json for Extension Development Host
- Add .vscode/tasks.json for npm compile task
- Fix documentation to clarify F5 workflow:
  1. Open vscode-extension folder in VSCode
  2. Press F5 to launch Extension Development Host
  3. In new window, open folder with .prg file
- Update TESTING.md, DEVELOPMENT.md, README.md, MVP-COMPLETE.md
- Fix: .vscode directory now at correct path (vscode-extension/.vscode)
- Add build-test-program.ps1: PowerShell script to assemble test-program.asm using ACME
- Add launch.json.example: Sample debug configuration for test-program.prg
- Add QUICK-TEST.md: Step-by-step guide for testing the debugger
- Add test-program.prg: Pre-built binary (17 bytes) for immediate testing
- Uses ACME assembler at user's specified path
- Create vscode-extension-test/ folder for testing the debugger
- This folder has its own .vscode/launch.json for 6502 debugging
- Prevents confusion with vscode-extension/.vscode/launch.json (for extension dev)
- Add README explaining the two-folder structure
- Update QUICK-TEST.md to use the test folder

Workflow:
1. Main window: Open vscode-extension/, press F5 → Extension Dev Host
2. Dev Host window: Open vscode-extension-test/, press F5 → Debug 6502 program
- Removed test-program.asm, test-program.prg, build-test-program.ps1
- Removed launch.json.example
- These files now only exist in vscode-extension-test/ folder
- Keeps extension source folder clean and focused on extension code
- Avoids confusion about which folder to use for testing
- Use frame ID 0 (standard for top frame) instead of 1
- Add PC address to stack frame name for clarity
- Add presentationHint to frames and scopes
- Validate frameId in scopes request
- Add KNOWN-ISSUES.md explaining Variables panel behavior

The Variables panel clearing after each step is normal VSCode/DAP
behavior, not a bug. All debuggers work this way.
Current state:
- Added padding with synthetic addresses when VS Code requests instructions before 0x0000
- Added padding at end when we run out of instructions
- Behavior: Initial stop at 0x060e focuses on 0x05bf (incorrect), but highlights 0x0000 (correct)
- Subsequent stepping correctly highlights and focuses on the right addresses
- Memory addresses in disassembly still corrupted (0x0000-0x0033 then jumps to 0x0538)

This is a checkpoint - the least incorrect state seen so far.
…ble commands to work similar to ACME assembler.
…g a 6502 assembly program via the VSCode extension.
@sonarqubecloud

sonarqubecloud Bot commented Mar 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
7.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@sonarqubecloud

sonarqubecloud Bot commented Mar 5, 2026

Copy link
Copy Markdown

@highbyte highbyte marked this pull request as ready for review March 5, 2026 12:55
@highbyte highbyte merged commit 5138a8a into master Mar 5, 2026
6 checks passed
@highbyte highbyte deleted the feature/vscode-debugger branch March 5, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant