BitMagic The Complete Development Environment for the Commander X16.

Command Line

x16remote does the remote debugger’s jobs without VSCode: it writes the debugger to an SD card, builds BitMagic projects, and has a small debugger of its own for a terminal. It’s handy for scripts, CI, or a machine without VSCode.

How to install it

It’s a .NET tool on NuGet, and needs .NET 10:

dotnet tool install -g BitMagic.X16Remote.Tool

Commands

Argument Description
deploy [<from>] <to> [--host <address>] [--port 6464] [--bank 63] Writes DEBUG.PRG, DBGSTUB.BIN, DBGTRAMP.BIN and DEBUGHOST.TXT to <to>, the SD card or a folder. <from> defaults to the copy that comes with the tool. Without --host, the X16 dials this PC’s name if your network’s DNS knows it, with its address as the fallback, else just the address.
hostfile <to> [--host <address>] [--port 6464] Writes only DEBUGHOST.TXT, to point a card that already has the debugger at this PC (worked out the same way) or at --host.
build <project.json or .bmasm> [<to>] Builds a BitMagic project and writes every file it makes to <to>, or the project’s outputFolder.
[--port 6464] [--script <file>] [--io <range>]... Waits for the X16 to dial in, then takes debugger commands, typed or from a file. Each --io (eg --io $9f60-$9f6f) lets m and w read and write that part of the I/O area, never the WiFi card.
--ftp [--ftp-port 2121] [--ftp-address 127.0.0.1] Also serves the X16’s SD card over FTP, on ftp://127.0.0.1:2121/ by default. Any user name and password work and nothing is encrypted, so keep it on localhost. Files can only be reached while no program is part way through on the X16.
help Lists the above.

For example, to write an SD card that dials this PC, then to point it at mypc.lan instead:

x16remote deploy E:\
x16remote hostfile E:\ --host mypc.lan

How to debug from a terminal

Run x16remote, then RUN DEBUG.PRG on the X16. Once it’s connected, it takes these commands:

Command Description
r Registers.
m addr [len] / w addr bytes... Read or write memory.
vm addr [len] / vw addr bytes... Read or write VRAM.
d [addr] [count] Disassemble.
set reg value Set A, X, Y, P, PC, RAMBANK or ROMBANK.
b addr [bank] / bc addr [bank] / bl Set, clear and list breakpoints.
s / n / o Step into, over and out.
c / go Continue and wait for the stop, or continue in the background.
p / wait Pause, or wait for the stop.
run file.prg [&] Load a PRG and start it.
drop Close the connection; the X16 dials back in.
ls [folder] / get file [local] / put local [file] List the SD card, and copy files from and to it.
dos command Send a CMDR-DOS command, eg dos MD//:GAMES.
unload Take the debugger off the X16: back to BASIC, or a stopped program carries on without it.
time command Run a command and say how long it took.
q Quit.

A script is the same commands, one per line, which makes it easy to check something on the machine over and over:

run app/SAMPLE.PRG
b $081e
c
r
m $0826 1