WinASM65 for VS Code
6502 assembly for WinASM65 projects.
- Debug in any emulator. Press F5 in a folder that has a project configuration. The project is built, the emulator the configuration names starts with its WinASM65 bridge, and you debug in your
.nas / .asm sources. Mesen2 and MesenCE are built in; any other emulator (VICE for the C64, say) works through a custom adapter and a bridge script:
- breakpoints in the gutter
- continue, step over (steps over
JSR calls), step into, step out and pause
- registers, flags and the zero page in the Variables view
- the 64 KiB address space in the hex memory view
- Debug console. Type a symbol, a register or
$0010 to see its value. Monitor commands (CPU, READ $0200 16, BREAK LIST, …) are passed straight to the monitor.
- Listing column. Right-click a source (in the Explorer, the editor or the line-number margin) and choose WinASM65 → Show Listing, or use the button in the editor title bar. Each line then shows the address and bytes it assembled to, in a column to its left, as in a
.lst. The column follows your edits before you save. A file read through .include is listed as its project's last build placed it, so its addresses follow the .org of the unit that includes it.
- Project configuration. A source belongs to the nearest configuration that declares it as an input, searched from its own folder upwards:
config.json, the file a launch.json names as its config, or any other .json with an Input section (a game.json, say). A file no configuration declares, an include, belongs to the nearest configuration.
- RAM panel. All 2 KiB of RAM ($0000-$07FF) in hex and ASCII. It opens at the first stop and refreshes at every stop:
- bytes changed since the last stop are highlighted;
- the zero page and the stack are shaded, and the byte at SP is marked;
- hovering a byte shows its address, value and any names the build gives it;
- double-click a byte to change it;
- tick Live to keep it updating while the game runs.
- Build task. "WinASM65: build" is offered for each configuration in the workspace. Errors go to the Problems panel.
- Highlighting. Mnemonics, directives, labels and numbers are coloured, using the same mnemonic and directive tables as the assembler.
Requirements
An emulator with a WinASM65 bridge. Set its path in one of these places:
Emulator.Path in config.json
"emulatorPath" in launch.json
- the
winasm65.emulatorPath setting
Emulator.Name chooses the adapter: mesen2 and mesence are built in; any other name is a custom emulator, started with Emulator.Arguments ({rom}, {script} and {port} are replaced) and its own Emulator.Bridge script:
"Emulator": {
"Name": "vice",
"Path": "C:\\Emulators\\VICE\\bin\\x64sc.exe",
"Bridge": "bridges/my_vice_bridge.lua",
"Arguments": "-autostart {rom}"
}
A bridge answers the WinASM65 line protocol on a TCP port and reports what the emulator can do; the debugger adapts to it. See the documentation's Emulator bridges page.
With Mesen2
- Mesen2 2.1.1 is the emulator the NES examples are tested with.
- Single instance. Mesen2 runs as a single instance, so close any open Mesen2 window before you debug.
- Mesen2 settings. The first launch writes the
settings.json entries the bridge needs to open a socket.
launch.json
{
"type": "winasm65",
"request": "launch",
"name": "Debug WinASM65 project",
"config": "${workspaceFolder}/config.json",
"stopOnEntry": false
}
To use an emulator that is already running its bridge, use "request": "attach" with its "port".
Banks
Two banks assembled at the same CPU address are told apart by their offset in PRG-ROM. A breakpoint stops only in the bank of the line it was set on.
| |