Wednesday, 11 January 2023

z80 ZX Spectrum assembler

 

Download tools

  • 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 10.1 – Emulator
  • sjasmplus 1.18,2 – Z80 compiler
A comparison of the debugger compatibilities are here.

Add launch.json to your workspace's .vscode folder:
{
    // 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"
        }
    ]
}
Add tasks.json to the same folder:
  {
    // 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
            }
        }
    ]
}
  

Download zesarux for Windows (or it's Linux alternative - remember to include lib-spectrum). The source code is here.

Start zesarux 
Set up zesarux remote debugging


Select the .z80 file

Compile and Debug
Terminal > Run Task > sjasmplus
Run > Start Debugging

No comments:

Post a Comment