Wednesday 11 January 2023

z80 ZX Spectrum assembler and emulator tools

 

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
            }
        }
    ]
}
  
To launch zesarux automatically, see this article.

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


Or start it with the following command-line parameters:
"C:\Program Files\ZEsarUX_win-X\zesarux.exe" --disablefooter --zoomx 2 --zoomy 2 --disable-all-first-aid --quickexit --advancedmenus --enable-remoteprotocol --nosplash --nowelcomemessage

(the command-line parameters can be found here).

Select the .z80 file

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


Another way to do this is to start ZESarUX using build tasks in VSCode.

Wednesday 4 January 2023

FreeBSD find files commands

Recursively find files in folder

find .//. ! -name . -print | grep -c //

Count of directories

find . -type d | wc -l

Count of directories (depth 1)

find . -maxdepth 1 -type d | wc -l

Count of files (depth 1)

find . -maxdepth 1 -type f | wc -l

Delete files that are called Zone.Identifier

find . -name "*:Zone.Identifier" -type f -delete

https://www.freebsd.org/cgi/man.cgi?query=find&apropos=0&sektion=1&manpath=FreeBSD+7.3-RELEASE&arch=default&format=html