Automation
Run the ZX Spectrum with device windows for an interactive session or use headless automation for a configured tape or assembly program. Provide the ROM and any tape images before starting.
Interactive automation can show the ZX Spectrum display and tape player windows. During regular emulation, start configured tape events from the tape player’s Events tab.
With --no-gui, set device:zxspectrum-ula.screenFileName to save a .scr screen. Set device:zxspectrum-ula.audioFileName or device:audio-ay3_8910-chip.audioFileName to capture beeper or AY PCM, respectively. Headless audio capture works without host audio playback.
Configuration file
The ZX Spectrum 48K configuration file is config/ZxSpectrum48K.toml. The key settings are:
Memory (byte-mem) settings
The most important setting is loading the 16 KB ROM image at startup. This is configured in the [MEMORY.settings] section:
| Setting | Description |
|---|---|
imageName0 | Path to the 16 KB ROM file (e.g. examples/zxspectrum-48k/48.rom) |
imageAddress0 | Load address for the ROM (must be 0) |
CPU (z80-cpu) settings
| Setting | Default | Description |
|---|---|---|
frequency_khz | 4000 | CPU plugin default in kHz; the bundled Spectrum configuration sets 3500 (3.5 MHz) |
Tape automation
Set device:audiotape-player.inputFileName with --set to play one TAP or TZX file at startup. Use automationEvents for a sequence.
The Audio Tape Player loads and plays tapes using configured events. The auto command starts the sequence in both windowed and headless runs. During regular emulation, choose Play in the tape player’s Events tab to start the sequence.
Configuring tape automation events
Automation events are stored in the audiotape-player plugin settings under the automationEvents key. Each event is serialized as TYPE:parameter:
| Event | Serialized format | Description |
|---|---|---|
| Load tape | LOAD_TAPE:/path/to/file.tap | Load a tape file into the deck |
| Play tape | PLAY: | Start playback and wait until the tape finishes |
| Stop tape | STOP: | Stop the currently playing tape |
| Reset tape | RESET: | Stop and unload the current tape |
| Unload tape | UNLOAD: | Stop playback and unload the tape |
| Delay | DELAY:5 | Wait for the specified number of seconds |
Example tape automation configuration
To configure tape automation events in the configuration file, add the automationEvents array to the audiotape-player settings:
# Add to the existing audiotape-player [DEVICE.settings] table.
automationEvents = [
"LOAD_TAPE:/path/to/game.tap",
"DELAY:3",
"PLAY:"
]
The PLAY event waits until tape playback finishes before the next event runs. The CPU must be running for tape pulses to advance; loading a tape does not type LOAD "" into BASIC.
Example
The following command runs the ZX Spectrum 48K emulator in interactive automation mode with a beeper example:
./emuStudio -cf config/ZxSpectrum48K.toml --input-file examples/zx-spectrum/twinkle_beeper.asm auto
- computer configuration “ZX Spectrum 48K + AY” (file
config/ZxSpectrum48K.toml) will be loaded - input file for compiler is the beeper example
- (
auto) automatic emulation will be executed (interactive mode — display and devices will be shown)
For a bounded non-interactive run:
./emuStudio -cf config/ZxSpectrum48K.toml --input-file examples/zx-spectrum/twinkle_beeper.asm auto --no-gui --waitmax 5000
The deadline bounds execution if the program keeps running. With interrupts disabled, the example’s HALT stops the CPU; with interrupts enabled, interrupts can resume its loop.