The toolchain I’ve started using for development on the ZX Spectrum is as follows:
- Visual Studio Code – Editor, with the following extensions:
- Z80 Assembly 0.0.3 by Imanolea
- DeZog 2.2.3 by Maziac (this is a renamed update to Z80 Debugger 0.9.1, also by Maziac)
- ZEsarUX 9.1 – Emulator
- sjasmplus 1.18,2 – Z80 compiler
Click on the links for instructions on installing them.
Copying and building the source code
Download the latest source code here and follow the build instructions to test your build toolchain
Visual Studio Project File: launch.json
Visual Studio Code configuration file for launching the debugger.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "dezog",
"request": "launch",
"name": "Z80 Debugger",
"remoteType": "zrcp",
"zrcp": {
"hostname": "localhost",
"port": 10000,
"skipInterrupt": false
},
// "topOfStack": "Stack_Top",
"rootFolder": "${fileDirname}",
"sjasmplus": [
{
"path": "${fileDirname}/${fileBasenameNoExtension}.sld",
"useFiles": true,
"asm": "sjasmplus",
"mainFile": "${fileDirname}/${fileBasenameNoExtension}.z80"
}
],
"disassemblerArgs": {
"esxdosRst": true
},
"load": "${fileDirname}/${fileBasenameNoExtension}.sna",
"startAutomatically": false,
"preLaunchTask": "sjasmplus"
}
]
}
Note: The following changes may be required if you are upgrading your dev system from versions of DeZog prior to 2.0.0:
- Line 14: Move the property skipInterrupt from the global section to the zrcp section.
- Line 20: The path in the sjasmplus section now references a .sld file rather than a .lst file
Visual Studio Project File: tasks.json
Visual Studio Code configuration file for compiling the source code
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "sjasmplus",
"type": "shell",
"command": "sjasmplus",
"args": [
"--fullpath",
"--sld=${fileDirname}/${fileBasenameNoExtension}.sld",
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Note: The following changes may be required if you are upgrading your dev system from versions of DeZog prior to 2.0.0:
- Line 11: Added the –fullpath argument.
- Line 12: Changed the –lst argument to –sld, and modified the file extension to .sld
Z80 Source Sample
Compile a SNA file with sjasmplus
SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
DEVICE ZXSPECTRUM48
Code_Start: EQU 0x8000
ORG Code_Start
EI ; Optional, if you require interrupts to be enabled on start
include "demo_scroll.z80"
SAVESNA "Demo/demo_scroll.sna", Code_Start
Note:
- Line 1: The SLDOPT directive will need adding to just your main build files. I usually place this next to the DEVICE directive.
- Line 6: From version 1.18.2 of sjasmplus, SAVESNA will do an “IM 1; DI” automatically in the header. If you want interrupts enabled then you will need to add an EI instruction at the beginning of your source code. This is by design. See this git issue post for more details. Thanks to Robert Morrison on Twitter for alerting me to that.