Files and Unloading
While DEBUG.PRG is running, the X16’s SD card can be reached from your PC as well: from a view in VSCode, or with any FTP client through the command line tool. And when you’re done, the debugger can be taken off the X16 without a reset.
When files can be reached
Files go through the X16’s own DOS, using the KERNAL. While a program is part way through, the KERNAL’s state is the program’s, so files are only available when nothing is: just after DEBUG.PRG has connected, or after a program has finished. If a debug session ended with the program stopped part way, files come back once it finishes, or after a reset and running DEBUG.PRG again.
The SD card in VSCode
Open the X16 SD Card view in the Explorer and click Connect to the X16, or run X16 Remote: Open the X16’s SD Card. This starts a session that connects to the X16 and runs nothing. Once DEBUG.PRG dials in, the card’s folders and files appear.
- Open a file to see it, edit it and save it back.
- Copy files in by dragging them from the Explorer or Windows onto the view, or with the upload button. Dragging within the view moves files between folders.
- Right click a file to save it to your PC, rename it or delete it, and a folder to make a new one inside it.
- Stop the session (
Shift+F5) when you’re done.
You can also add this to launch.json:
{
"type": "x16remote",
"request": "launch",
"name": "X16 SD Card",
"sdCard": true
}
Over FTP
x16remote --ftp serves the card on ftp://127.0.0.1:2121/ while it waits for the X16, alongside its usual commands. Any user name and password work and nothing is encrypted, so it only listens on your own PC unless you say otherwise with --ftp-address. FileZilla, WinSCP, curl and Windows Explorer’s address bar all work.
Transfers are binary, so files arrive exactly as they are. Names are kept as you give them; the ones CMDR-DOS can’t hold (with :, ,, *, ?, =, ", / or \ in, or starting with @ or $) are refused.
How fast
The WiFi card talks to the X16 at 115200 baud, about 11.5KB a second. Files are streamed, with the card’s own flow control pacing the data, so they get close to that: in the emulator, around 8KB a second writing and 10KB a second reading, so a 100KB file takes about 12 seconds. Windows Explorer gives up waiting on large files (a few megabytes); a dedicated FTP client is the better choice for those.
Taking the debugger off the X16
When you stop debugging, DEBUG.PRG keeps the X16 and waits for the next session. To take it off and get the X16 back:
- In VSCode, run X16 Remote: Unload the Debugger from the X16, or use its button on the debug toolbar or the X16 SD Card view.
- From the command line tool, type
unload. - On the X16, press the NMI button while it’s waiting for the PC, ie with no session connected.
- While
DEBUG.PRGis first dialling, press any key to give up.
The KERNAL’s interrupt vectors go back as they were. If nothing was running, the X16 is back at READY.; if a program was stopped part way, it carries on without the debugger. Run DEBUG.PRG to load it again.