AMSpiriT — Web Server Endpoint Tests
Each section issues one real HTTP request to 127.0.0.1:8765 and shows the raw response.
Server-Sent Events — /api/events
GET Endpoints
GET
/api/ping
Connection probe + emulator status (fps, paused, cpc_model, crtc_type). Used by the UI for the connection overlay.
—
GET
/api/z80
Z80 registers snapshot (PC, SP, AF/BC/DE/HL + alternates, IX, IY, I, R, IFF1/2, IM)
—
GET
/api/ga
Gate Array state (video mode, border, HBL/VBL, ink palette)
—
GET
/api/crtc
CRTC registers snapshot (R0–R17, internal counters, VMA, HSYNC/VSYNC)
—
GET
/api/psg
PSG AY-3-8912 state (tone periods, volumes, mixer, noise, envelope)
—
GET
/api/fdc
FDC PD765 state (MSR, SR0–SR2, motor, active drive)
—
GET
/api/state
Combined snapshot: z80 + ga + crtc + psg + fdc + emu (aggregate of the sub-endpoints above)
—
GET
/api/config
Current CORE_PARAM_IN values (CPC model, CRTC type, ROM lang…)
—
GET
/api/script
Script running status + last error message
—
GET
/api/lang
Current UI language {"lang":"en"|"fr"|"es"|"de"}
—
GET
/api/keymap
Full key mapping table (keycode → CPC virtual key)
—
GET
/api/basic_state
BASIC interpreter state (current line, variables…)
—
GET
/api/basic_export?verbose=…
BASIC source detokenised from RAM (text/plain). verbose=1 adds token annotations.
—
GET/api/history
Last 20 executed Z80 instructions [{pc,hex}] (opcode bytes from CPU-visible memory)
—
GET/api/codemap
65536-bit bitmap (8192 bytes hex) of addresses where an instruction has executed (code/data zones)
—
GET/api/memmap
ROM/RAM mapping per 16 KB region + RAM banking config (rmr, ram_mode, ram_page)
—
GET/api/render
CRT monitor preset, screen type and shader parameters
—
GET/api/basic_listing
Structured listing: lines + statements with RAM address ranges + referenced variables
—
GET/api/scan_ptr
Diagnostic: RAM words pointing into the BASIC program, with the line each points into
—
POST Endpoints
POST/api/step
Execute exactly one Z80 instruction, then re-pause (no body). Pause the emulator first.
—
POST/api/render
Change monitor preset / screen type / CRT shader params. Any subset of keys.
—
POST/api/basic_step?mode=…
Step the BASIC program to the next statement (mode=stmt) or next line (mode=line). Pause first.
—
POST/api/basic_bp
Set the BASIC line-breakpoint set (comma-separated line numbers; empty = clear all)
—
POST/api/basic_runto?line=… | ?addr=…
One-shot run to a BASIC line (line=) or statement address (addr=, an 0xAE1B value from /api/basic_listing)
—
POST
/api/config
Queue a config change. Fields: cpc_model, crtc_type, rom_lang, paused, do_soft_reset, do_hard_reset
—
POST
/api/keytype
Queue a string for autotype (injected as key events on the CPC)
—
POST
/api/keypress
Press a single CPC virtual key by VK number (0x00–0xFF, see CORE_rVK_* constants)
—
POST
/api/exec
Set Z80 PC to addr and resume execution (no RAM write)
—
POST
/api/basic?reset=…&run=…
Inject BASIC source (raw text body, not JSON). reset=1 → hard reset first. run=1 → RUN after inject.
—
POST
/api/script?lang=…
Run a CSL or Lua script (raw text body). ?lang=lua for Lua, default = CSL.
—
POST
/api/disk
— action: create
Create a blank disk image in the given drive (0=A, 1=B)
—
POST
/api/disk
— action: save (triggers browser download)
Save current disk image as .dsk file (response is binary — triggers download via <a>)
—
POST
/api/lang
Change UI language {"lang":"en"|"fr"|"es"|"de"}
—
POST
/api/keymap
Remap a key: kc (keycode hex), vk (CPC VK for unshifted), vk_s (shifted), nomod (bool)
—
DELETE Endpoints
DELETE
/api/script
Abort the currently running CSL/Lua script
—
DELETE
/api/codemap
Reset the executed-instruction bitmap and the instruction history
—