SDK for developing applications for the Spectranext cartridge (and for original Spectranet).
Run the installation script to set up z88dk and Python dependencies:
git clone https://github.com/spectranext/spectranext-sdk
cd spectranext-sdk
./install.shOption 1: Double-click installation (easiest)
Simply double-click install.bat after cloning the repository:
git clone https://github.com/spectranext/spectranext-sdk
cd spectranext-sdk
# Double-click install.bat or run it from command prompt
install.batOption 2: PowerShell script
Run the PowerShell installation script directly:
git clone https://github.com/spectranext/spectranext-sdk
cd spectranext-sdk
.\install.ps1It would prompt you to add SDK to PATH, so you can use the tools from anywhere.
Prerequisites for Windows:
- Python 3.7 or later (download from https://www.python.org/downloads/)
- Make sure to check "Add Python to PATH" during installation
- Git for Windows (download from https://git-scm.com/download/win)
- PowerShell 5.1 or later (included with Windows 10/11)
The installation script will:
- Download and install z88dk toolchain
- Create a Python virtual environment
- Install required Python dependencies
Option 1: Source in your shell
Source the SDK environment in your shell:
source spectranext-sdk/source.shOr add it to your shell configuration file (~/.zshrc or ~/.bashrc):
source /path/to/spectranext-sdk/source.shOption 2: Use as environment file in IDE
You can also use source.sh as an environment file in your IDE. For example, in CLion:
- Go to File > Settings (or CLion > Preferences on macOS)
- Navigate to Build, Execution, Deployment > Toolchains
- Select your toolchain (e.g., "Default")
- Click the Environment field
- Click the folder icon and select
source.shfrom your SDK directory - CLion will automatically load the environment variables from
source.sh
This ensures that CMake builds use the correct SDK environment without needing to source the file manually.
Use as environment file in IDE
You can also use source.ps1 as an environment file in your IDE. For example, in CLion:
- Go to File > Settings
- Navigate to Build, Execution, Deployment > Toolchains
- Select your toolchain (e.g., "Default")
- Click the Environment field
- Click the folder icon and select
source.ps1from your SDK directory - CLion will automatically load the environment variables from
source.ps1
This ensures that CMake builds use the correct SDK environment without needing to source the file manually.
Create a CMakeLists.txt file in your project directory:
cmake_minimum_required(VERSION 3.16)
# Import Spectranext SDK - MUST be before project()
include($ENV{SPECTRANEXT_SDK_PATH}/cmake/spectranext_sdk_import.cmake)
spectranext_sdk_init()
project(idetest C)
add_executable(idetest main.c)
target_compile_options(idetest PUBLIC -debug)
target_link_libraries(idetest PUBLIC -lndos -llibspectranet.lib -llibsocket.lib)
target_link_options(idetest PUBLIC -debug -create-app)
# Set boot basic program (optional)
# This creates a boot.zx file that will be uploaded before your program
spectranext_set_boot("
10 %tapein \"idetest.tap\"
20 LOAD \"\"
")
# Add convenience targets (upload_bin, upload_tap, etc.)
spectranext_add_extra_outputs(idetest)If source.sh is not sourced then SPECTRANEXT_SDK_PATH must be explicitly provided.
spectranext_sdk_init()must be called beforeproject()- This is required because the SDK sets up the CMake toolchain, which must be configured before the project is defined.
The spectranext_set_boot() function allows you to create a boot BASIC program that will be automatically uploaded before your main program. This is useful for creating loader programs or initialization code.
Usage:
spectranext_set_boot("
10 PRINT \"Booting...\"
20 CLEAR 32767
30 %aload \"myprogram.bin\" CODE 32768
40 RANDOMIZE USR 32768
")The function:
- Creates
boot.basin the CMake binary directory - Compiles it to
boot.zxusingzmakebas(starting at line 10) - Creates an
upload_boottarget that builds and uploadsboot.zx - When
spectranext_add_extra_outputs()is called,upload_binandupload_taptargets will automatically depend onupload_bootif it exists
Example boot program:
spectranext_set_boot("
10 REM Boot loader
20 %tapein \"myprogram.tap\"
30 LOAD \"\"
40 REM Program will auto-run after loading
")The boot program is compiled with zmakebas -o boot.zx -a 10 boot.bas, which means it starts at line 10. Make sure your BASIC code includes line numbers or uses labels if you're using zmakebas label mode.
If spectranext_set_boot() was called, the following additional target is available:
upload_boot- Build and uploadboot.zxfile for your BASIC loader program.
After calling spectranext_add_extra_outputs(project_name), the following targets are available:
project_name_upload_bin- Build and upload.binfileproject_name_upload_tap- Build and upload.tapfileproject_name_bin_autoboot- Build, upload.bin, and configure autobootproject_name_tap_autoboot- Build, upload.tap, and configure autoboot
# Configure CMake (if not already done)
cmake -B build
# Build and upload .bin file
cmake --build build --target idetest_upload_bin
# Build and upload .tap file
cmake --build build --target idetest_upload_tap
# Build, upload, and configure autoboot
cmake --build build --target idetest_bin_autoboot- z88dk - Z80 cross-compiler toolchain
- SPX Tools - Command-line tools for interacting with Spectranext (
spx-ls,spx-get,spx-put, etc.) - CMake Integration - Automatic toolchain setup and convenience targets
- Headers - Spectranext API headers in
include/ - Libraries - Pre-built libraries in
clibs/
The SDK sets the following environment variables:
SPECTRANEXT_SDK_PATH- Path to the SDK root directorySPECTRANEXT_TOOLCHAIN- Path to the CMake toolchain fileSPECTRANEXT_INCLUDE_DIR- Path to SDK include directoryZCCTARGET- z88dk target (default:zx)ZCCCFG- z88dk configuration pathPATH- Includesz88dk/bin
The SDK provides command-line tools for interacting with Spectranext:
You can read on xfs tools a little bit more here: https://docs.spectranext.net/development/syncing-with-computer
spx-ls [path]- List contents of RAMFS on Spectranext cartridgespx-get <remote> <local>- Download file from devicespx-put <local> <remote>- Upload file to devicespx-mv <old> <new>- Move/rename filespx-rm <path>- Delete filespx-mkdir <path>- Create directoryspx-rmdir <path>- Remove directoryspx-reboot- Trigger ZX Spectrum rebootspx-autoboot- Configure autoboot from xfs://ram/ and rebootspx-terminal- Show terminal connection info (macOS/Linux: launches minicom; Windows: shows connection settings)
Note: On Windows, use spx.bat ls, spx.bat get, etc. instead of spx-ls, spx-get, etc.
Run spx-help for a list of available commands (or spx.bat help on Windows).