The toolchain I’ve started using for development on the ZX Spectrum Next 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 Files

In your project, create a folder called .vscode and create the following files within it.

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}.nex",
            "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

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",
		"--zxnext",
		"--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: Added the –zxnext argument; saves having to do this in each source file
  • Line 13: Changed the –lst argument to –sld, and modified the file extension to .sld

Z80 Source Sample

Compile a NEX file with sjasmplus

		SLDOPT COMMENT WPMEM, LOGPOINT, ASSERTION
		DEVICE ZXSPECTRUMNEXT

Code_Start:	EQU 0x8000
		ORG Code_Start

		include "demo_scroll.z80"

		SAVENEX OPEN "Demo/build_scroll.nex", Code_Start
		SAVENEX CORE 3, 0, 0
		SAVENEX CFG  0
		SAVENEX BAR  1, 0xE0, 50, 25
		SAVENEX AUTO
		SAVENEX CLOSE

Note: The SLDOPT directive will need adding to just your main build files. I usually place this next to the DEVICE directive. I’ve also deleted the OPT directive for zxnext; this is now in the tasks.json file for building zxnext files.