BitMagic The Complete Development Environment for the Commander X16.

Prog8 Settings

Pressing F5 on a Prog8 file needs no setup once Java and 64tass are installed. When you open a folder with .p8 files, the extension checks for them (and for the Prog8 compiler) and tells you what’s missing, with a button to fix it; X16 Prog8: Check Tools runs the same check whenever you like. This page is for when you want more control: a launch.json entry, the extension’s settings, or where it finds its tools.

launch.json

To keep a configuration, add one to .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "prog8",
            "request": "launch",
            "name": "Debug the game",
            "program": "${workspaceFolder}/src/game.p8",
            "compilerArgs": ["-srcdirs", "lib"],
            "stopOnEntry": true
        }
    ]
}

${file} as the program debugs whichever Prog8 file is open.

Name Type Optional Description
program string No The Prog8 file to compile and debug, or a .prg the extension built before.
compile bool Yes Compile a .p8 program first. true by default; false uses the build already in outputFolder.
compilerArgs string[] Yes More prog8c arguments, after those in the bitMagicX16Prog8.compilerArgs setting.
optimise bool Yes Let Prog8 optimise. The bitMagicX16Prog8.optimise setting (off) by default.
outputFolder string Yes Where the .prg and the rest go. A build folder next to the program by default.
project string Yes A BitMagic project.json to take everything else from: the ROM, SD card, window and so on. Its debugMode is set from this configuration.
stopOnEntry bool Yes Stop on main.start’s first line. false by default.
run bool Yes true (the default) loads the program at READY and runs it. false leaves it for something else to load and run, eg your own AUTOBOOT.X16.
onProgramEnd string Yes ready (the default) carries on at READY when the program ends. terminate ends the debug session.
stepIntoLibrary bool Yes Step into the Prog8 library rather than running through it. The bitMagicX16Prog8.stepIntoLibrary setting (off) by default.
breakpointDirectives bool Yes Stop at %breakpoint. true by default.
renderOnStop bool Yes true (the default) draws the whole screen when stopping, so output shows straight away.
romFile string Yes The ROM to use, if not BitMagic’s.
sourceFolder string Yes Where to find sources the build’s paths don’t find (a program built on another machine): by relative path, then by file name.

The extension always passes -target cx16, -dumpvars and -asmlist to prog8c (the debugger reads the variables dump and the listing), and -noopt unless optimise is on.

Extension settings

Name Type Optional Description
bitMagicX16Prog8.compilerPath string Yes A prog8c-*-all.jar, the folder it’s in, or a prog8c launcher. If empty: PROG8C, a copy the extension downloaded, a prog8c launcher or prog8c-*-all.jar in a PATH folder, or else the extension offers to download Prog8 12.3.5.
bitMagicX16Prog8.javaPath string Yes java, or a JDK folder, Java 17 or later. If empty: JAVA_HOME, the PATH, then the usual install folders (Adoptium, Oracle, Microsoft, Zulu, Corretto, Liberica, Semeru), using the first that’s new enough.
bitMagicX16Prog8.tass64Path string Yes 64tass, or the folder it’s in, 1.58 or later. If empty: TASS64, then the PATH.
bitMagicX16Prog8.compilerArgs string[] Yes prog8c arguments for every build, eg ["-srcdirs", "lib"].
bitMagicX16Prog8.optimise bool Yes Let Prog8 optimise. false by default.
bitMagicX16Prog8.stepIntoLibrary bool Yes Step into the Prog8 library. false by default.
bitMagicX16Prog8.showRunButtons bool Yes Show Debug and Run on the X16 in the editor title for Prog8 files. true by default.
bitMagicX16Prog8.openScreen bool Yes Open the X16 Screen tab when a program starts debugging. true by default.
bitMagicX16Prog8.debugModePath string Yes A debugger build to use instead of the extension’s, for working on the debugger itself.

What the build leaves

Next to game.prg in the output folder you’ll find what the debugger reads:

File From What it’s for
game.asm Prog8 The assembly, with each Prog8 line as a comment before its code.
game.list 64tass, via Prog8 Only its first lines are used: how 64tass was run.
game.vice-mon-list 64tass, via Prog8 The labels: where each subroutine and variable is.
game.p8vars the extension Prog8’s -dumpvars output, the type of every variable.
game.lines.list the debugger A listing made with 64tass’s --line-numbers, which ties each address to its line of the assembly. Made the first time you debug a build.

So a .prg you’ve built yourself can’t be debugged unless it has a .p8vars; let the extension build it.

Using it without the extension

The debugger itself is a debug mode for X16D, so a BitMagic project.json can use it directly. The extension writes one like this:

{
    "autobootRun": false,
    "debugMode": {
        "package": "BitMagic.X16Prog8.Debugger",
        "settings": {
            "program": "build/game.prg",
            "stopOnEntry": false,
            "tass64": "C:/Tools/64tass.exe"
        }
    }
}

The settings are the ones in the first table, apart from those about compiling, plus tass64 (for making the listing) and libraryFolder (a folder prog8c -libdump wrote, for stepping into the library).