jsbeeb-mcp

v4.5.0
jsbeeb-mcp Checked 13 hours ago Published 23 days ago

MCP server for jsbeeb — lets AI assistants control a headless BBC Micro emulator

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

create_machine

Boot one of the machines jsbeeb emulates and return a session ID for use with all other tools. The machine runs until the BASIC prompt before this call returns.

ParameterTypeDescription
bank_romsarraySideways ROMs to fit in the banks they name, before extra_roms fill the rest. Fails for a bank the model has no socket for (B-stock and B-MOS0.10 have only 12 to 15), one its own ROMs or fittings fill…
boot_timeout_secsnumberMax seconds of emulated time to wait for the boot prompt
econetbooleanFit Econet, with a file server on the network. A Master gets the ANFS ROM too: *NET, then *I AM SYST logs on (MasterANFS boots into it, so *NET is not needed). A BBC B gets the network hardware but no…
extra_romsarraySideways ROMs to fit in the banks the model leaves free, highest first, passing over its sideways RAM. Fails if there are not enough free banks. Not on the Atom
modelstringMachine to emulate: B-DFS1.2 (BBC B with 8271 (DFS 1.2)), B-DFS0.9 (BBC B with 8271 (DFS 0.9)), B1770 (BBC B with 1770 (DFS)), B1770A (BBC B with 1770 (ADFS)), B-stock (BBC B (stock)), B-US (BBC B (US…
station_idintegerThis machine's Econet station number, with econet (default 101)
tubebooleanAttach the second processor this model was sold with: a 3MHz 65C02 for a BBC B, or the 4MHz 65C102 Turbo board for a Master
video_nulabooleanFit a VideoNuLA in place of the video ULA, for programs that use its extended palette and modes (written at &FE22 and &FE23). Not on the Atom

destroy_machine

Destroy a BBC Micro session and free its resources.

ParameterTypeDescription
session_id *stringSession ID from create_machine

load_disc

Put a disc image in a drive, from a file on this machine (image_path) or from the archives or a URL (image_ref). Zips are opened and the disc inside used. After loading, use type_input to issue DFS commands (e.g. '*RUN hello', '*DIR', 'CHAIN""'); a disc in drive 1 is reached as ':1.name'.

ParameterTypeDescription
session_id *stringSession ID from create_machine
driveintegerDrive to put the disc in
image_pathstringAbsolute path to a disc image on this machine: .ssd, .dsd, .adf, or a zip holding one
image_refstringA disc as jsbeeb's own URL names it: 'sth:Acornsoft/Elite.zip' for a Stairway to Hell disc, 'hfe:<path>' for one from the BBC disc archive, 'bitshifters:<path>' for one of the Bitshifters' demos, 'git…

load_tape

Put a tape (.uef, or a zip holding one) in the cassette recorder and press PLAY. The Atom's tape runs at once; on a BBC or Master it runs when the OS starts the motor, so follow with type_input '*TAPE' and then 'CHAIN""' (or '*RUN', 'LOAD""').

ParameterTypeDescription
session_id *stringSession ID from create_machine
image_pathstringAbsolute path to a tape image on this machine
image_refstringA tape by URL: http(s), file:, or 'github:owner/repo[@ref]/path' as for discs

load_basic

Tokenise BBC BASIC source code and load it into the emulator's PAGE memory, exactly as if you had typed it in and saved it. Does NOT run the program.

ParameterTypeDescription
session_id *stringSession ID from create_machine
source *stringBBC BASIC source code (plain text, BBC dialect)

type_input

Type text at the current keyboard prompt (simulates key presses). RETURN is pressed once after the text, unless the text already ends in a newline. Use run_until_prompt after this to collect output. A breakpoint stops the typing part way: completed is false, the breakpoint and registers are reported, and the rest is typed as the machine runs on; until then key_down and key_up refuse, and release_all_keys drops it.

ParameterTypeDescription
session_id *stringSession ID from create_machine
text *stringText to type (e.g. 'RUN' or '10 PRINT"HELLO"')

run_until_prompt

Run the emulator until it returns to a keyboard input prompt (e.g. the BASIC prompt after RUN completes). Returns all text output that was written to the screen since the last call.

ParameterTypeDescription
session_id *stringSession ID from create_machine
clearbooleanIf true (default), clear the output buffer after returning it. Pass false to peek at accumulated output without consuming it.
timeout_secsnumberMax emulated seconds to run before giving up

screenshot

Capture the last fully-painted BBC Micro frame as a PNG image. Returns a base64-encoded PNG of the full 1024×625 emulated display, plus the frame counter so you can tell a genuinely new frame from the same one captured twice. Tip: call run_until_prompt first to let the screen settle, or run_frames to step to the next frame.

ParameterTypeDescription
session_id *stringSession ID from create_machine
active_onlybooleanIf true, crop to the active display area and apply 2× pixel scaling for clarity

read_memory

Read bytes from the BBC Micro's memory map. Returns an array of decimal byte values plus a hex dump, and paging: romsel as last written, bank (the sideways bank it pages in at &8000–&BFFF) and on a Master acccon, so a read of paged memory says which bank it came from. Pass bank or shadow to read a particular one instead.

ParameterTypeDescription
address *integerStart address (0–65535)
session_id *stringSession ID from create_machine
bankintegerSideways ROM/RAM bank to page at &8000–&BFFF for this access, instead of the one ROMSEL selects (12 to 15 on B-stock and B-MOS0.10, which have four sockets)
lengthintegerNumber of bytes to read (max 256)
shadowbooleanOn a Master, use shadow RAM (true) or main RAM (false) at &3000–&7FFF, whatever ACCCON says

write_memory

Write bytes into the BBC Micro's memory. Useful for poking machine code, modifying variables, or patching running programs. Pass bank or shadow to write into a particular bank, as for read_memory.

ParameterTypeDescription
address *integerStart address (0–65535)
bytes *arrayArray of byte values to write
session_id *stringSession ID from create_machine
bankintegerSideways ROM/RAM bank to page at &8000–&BFFF for this access, instead of the one ROMSEL selects (12 to 15 on B-stock and B-MOS0.10, which have four sockets)
shadowbooleanOn a Master, use shadow RAM (true) or main RAM (false) at &3000–&7FFF, whatever ACCCON says

read_registers

Read the current 6502 CPU register state (PC, A, X, Y, stack pointer, processor status), along with the frame and cycle counters.

ParameterTypeDescription
session_id *stringSession ID from create_machine

run_for_cycles

Run the emulator for a number of CPU cycles (2MHz on a BBC, 1MHz on an Atom): that many to within the instruction that finishes it, unless a breakpoint stops it first. Useful for precise timing, or just to advance the clock a bit between interactions. Do not use this to step frames: a frame is 40000 cycles with interlace on (the default) but 39936 with it off, so a fixed step drifts against the display. Use run_frames instead. Reports cycles_run, the cycles actually executed, and accumulated text output. A breakpoint stops the run early: completed is false, stopped_reason is 'breakpoint', and…

ParameterTypeDescription
cycles *integerNumber of CPU cycles to execute
session_id *stringSession ID from create_machine
clearbooleanIf true (default), clear the output buffer after returning it. Pass false to peek.

run_frames

Run the emulator until it has painted another `count` frames, stopping on the paint itself. Use this rather than run_for_cycles for anything frame-oriented: capturing consecutive screenshots to see flicker or tearing, or stepping an animation. One frame is exactly one new screenshot. Reports frames_run, cycles_run, and frame_count (which only ever climbs, so compare it across calls to confirm the screen really did move on). completed is false if the machine stopped painting or a breakpoint fired first; a breakpoint stop reports stopped_reason 'breakpoint' and the registers, or 'pending_breakpo…

ParameterTypeDescription
session_id *stringSession ID from create_machine
clearbooleanIf true (default), clear the output buffer after returning it. Pass false to peek.
countintegerNumber of frames to advance

run_until_address

Run until the PC reaches an address, stopping before the instruction there runs, or until timeout_secs of emulated time pass. Like a one-off execute breakpoint: give bank to stop only while that sideways bank is paged in. reached says whether it got there; stopped_reason is 'address', 'timeout', or 'breakpoint' if a set breakpoint fired first ('pending_breakpoint', with cycles_run 0 and reached false as nothing ran, for a hit an earlier call left unreported, as run_for_cycles does). An execute breakpoint on the address itself still reports reached true and 'address', with that breakpoint attac…

ParameterTypeDescription
address *integerAddress to run to (0–65535)
session_id *stringSession ID from create_machine
bankintegerOnly stop while this sideways bank is paged in at &8000–&BFFF, to stop in one ROM (12 to 15 on B-stock and B-MOS0.10)
clearbooleanIf true (default), clear the output buffer after returning it. Pass false to peek.
timeout_secsnumberMax emulated seconds to run before giving up

key_down

Press and hold a key on the keyboard; use key_up to release it later. Name the key one way: by the machine's own name for it, or by BBC internal key number, INKEY number, or col and row, which is how to press exactly the key a game's own keyboard scan reads. Every way presses the matrix key itself, so what goes down is what keyboard_state reports. Reports the key that went down, with name and numbers.

ParameterTypeDescription
session_id *stringSession ID from create_machine
colintegerKeyboard matrix column, given with row
inkeyintegerNegative INKEY number, -1 to -128 (X is -67, SPACE is -99); the internal number is -inkey - 1
internalintegerBBC internal key number, as OSBYTE 121 and a game's keyboard scan use (X is 66, SPACE is 98)
keystringThe key as the machine's own keyboard names it, which is how keyboard_state reports it. On a BBC or Master: SHIFT, CTRL, RETURN, SPACE, DELETE, ESCAPE, TAB, CAPSLOCK, SHIFTLOCK, COPY, UP, DOWN, LEFT,…
rowintegerKeyboard matrix row, given with col

key_up

Release a held key, named any of the ways key_down takes. Reports the matrix keys that came up.

ParameterTypeDescription
session_id *stringSession ID from create_machine
colintegerKeyboard matrix column, given with row
inkeyintegerNegative INKEY number, -1 to -128 (X is -67, SPACE is -99); the internal number is -inkey - 1
internalintegerBBC internal key number, as OSBYTE 121 and a game's keyboard scan use (X is 66, SPACE is 98)
keystringThe key as the machine's own keyboard names it, which is how keyboard_state reports it. On a BBC or Master: SHIFT, CTRL, RETURN, SPACE, DELETE, ESCAPE, TAB, CAPSLOCK, SHIFTLOCK, COPY, UP, DOWN, LEFT,…
rowintegerKeyboard matrix row, given with col

keyboard_state

Report the keyboard as the machine sees it: every key held, with its matrix column and row, its name, and on a BBC its internal key number (as OSBYTE 121 and a keyboard scan use) and negative INKEY number; and whether typing from an interrupted type_input is still pending. Check this before a test that assumes nothing is held.

ParameterTypeDescription
session_id *stringSession ID from create_machine

release_all_keys

Release every held key and drop any typing still pending from an interrupted type_input, so the keyboard is in a known state. Reports what was released.

ParameterTypeDescription
session_id *stringSession ID from create_machine

flush_keyboard_buffer

Empty the OS's keyboard buffer, throwing away keys pressed but not yet read, so a program that is busy when they go down does not read them later. Unlike OSBYTE 21 it leaves a function key's expansion still to come. Not on the Atom, whose OS has no buffer.

ParameterTypeDescription
session_id *stringSession ID from create_machine

reset

Reset the BBC Micro. With autoboot=true, holds SHIFT during reset to trigger a disc autoboot (SHIFT+BREAK) and reports shift_held_at_reset. The boot sequence is initiated but not run to completion — use run_for_cycles or run_until_prompt afterwards as needed. Typing left pending by an interrupted type_input is dropped first (cancelled_typing).

ParameterTypeDescription
session_id *stringSession ID from create_machine
autobootbooleanHold SHIFT during reset to autoboot the disc in drive 0
hardbooleanHard reset (power-on) if true, soft reset if false

boot_disc

Load a disc image, from a file here or from the archives or a URL as load_disc takes them, and autoboot it (SHIFT+BREAK). Equivalent to: load_disc → key_down SHIFT → reset → key_up SHIFT. The boot sequence is initiated but not run to completion — use run_for_cycles or run_until_prompt afterwards as needed. Reports shift_held_at_reset, and cancelled_typing if an interrupted type_input had to be dropped first.

ParameterTypeDescription
session_id *stringSession ID from create_machine
image_pathstringAbsolute path to a disc image on this machine: .ssd, .dsd, .adf, or a zip holding one
image_refstringA disc as jsbeeb's own URL names it: 'sth:Acornsoft/Elite.zip' for a Stairway to Hell disc, 'hfe:<path>' for one from the BBC disc archive, 'bitshifters:<path>' for one of the Bitshifters' demos, 'git…

run_disc

One-shot convenience tool: boot a BBC Micro, load a disc image, autoboot it (SHIFT+BREAK), return all text output and optionally a screenshot, then destroy the session. Like run_basic but for disc images.

ParameterTypeDescription
image_pathstringAbsolute path to a disc image on this machine: .ssd, .dsd, .adf, or a zip holding one
image_refstringA disc as jsbeeb's own URL names it: 'sth:Acornsoft/Elite.zip' for a Stairway to Hell disc, 'hfe:<path>' for one from the BBC disc archive, 'bitshifters:<path>' for one of the Bitshifters' demos, 'git…
modelstringMachine to emulate: B-DFS1.2 (BBC B with 8271 (DFS 1.2)), B-DFS0.9 (BBC B with 8271 (DFS 0.9)), B1770 (BBC B with 1770 (DFS)), B1770A (BBC B with 1770 (ADFS)), B-stock (BBC B (stock)), B-US (BBC B (US…
screenshotbooleanInclude a screenshot of the final screen state
timeout_secsnumberMax emulated seconds to allow the disc to boot and run

run_basic

One-shot convenience tool: boot a BBC Micro, load a BASIC program, run it, return all text output and a screenshot, then destroy the session. Perfect for quickly trying out ideas without managing sessions.

ParameterTypeDescription
source *stringBBC BASIC source code to run
modelstringMachine to emulate: B-DFS1.2 (BBC B with 8271 (DFS 1.2)), B-DFS0.9 (BBC B with 8271 (DFS 0.9)), B1770 (BBC B with 1770 (DFS)), B1770A (BBC B with 1770 (ADFS)), B-stock (BBC B (stock)), B-US (BBC B (US…
screenshotbooleanInclude a screenshot of the final screen state
timeout_secsnumberMax emulated seconds to allow the program to run

read_sound_state

Read the SN76489 sound chip's current register state: tone periods for channels 0–2, noise register, volume/attenuation for all 4 channels, LFSR state, and which register is latched. Useful for verifying what the program has written to the sound chip.

ParameterTypeDescription
session_id *stringSession ID from create_machine

start_sound_capture

Start capturing all SN76489 sound chip writes. Every byte written to the chip is logged with its cycle timestamp. Use stop_sound_capture to retrieve the log. Clears any previous capture.

ParameterTypeDescription
session_id *stringSession ID from create_machine

stop_sound_capture

Stop capturing SN76489 writes and return the log. Each entry has a cycle timestamp and the byte value written. The values are decoded into human-readable form (channel, tone/volume, value).

ParameterTypeDescription
session_id *stringSession ID from create_machine
max_entriesnumberMaximum number of entries to return (most recent if exceeded)

set_breakpoint

Set a persistent breakpoint. The breakpoint stays active across multiple run_for_cycles calls until removed with clear_breakpoint. When a breakpoint fires, run_for_cycles returns early and reports which breakpoint was hit. Types: 'execute' (PC reaches address), 'read' (memory read), 'write' (memory write). An address in &8000–&BFFF is in whichever sideways ROM is paged in; give bank to stop in one ROM only.

ParameterTypeDescription
address *numberAddress to break on (0–65535)
session_id *stringSession ID from create_machine
bankintegerOnly break while this sideways bank is paged in at &8000–&BFFF, to stop in one ROM (12 to 15 on B-stock and B-MOS0.10)
typestringBreakpoint type: execute (PC), read (memory read), write (memory write)

clear_breakpoint

Remove a previously set breakpoint by its ID, or pass id=0 to clear all breakpoints.

ParameterTypeDescription
id *numberBreakpoint ID to remove (0 = clear all)
session_id *stringSession ID from create_machine

step_back

Step the machine back one instruction, or with over back over the call the last instruction returned from, or with to_cycle back to that cycle (an instruction's start, as who_wrote reports one). Replays the history the session keeps (see the history tool) from a snapshot before where it lands. It replays text from type_input, but cannot go back past something no replay can repeat: a load_basic, a disc or tape change, a write to a disc, a write_memory with bank or shadow, a read_memory of a device register, or the cassette motor running, and an Econet machine keeps no history; reset (hard) and…

ParameterTypeDescription
session_id *stringSession ID from create_machine
overbooleanStep back over the call the last instruction returned from
to_cycleintegerStep back to this elapsed cycle instead, as who_wrote gives a write's cycle

step_back_out

Step the machine back to the JSR, BRK or interrupt that entered the routine it is in, the reverse of running to its RTS or RTI. Replays the history the session keeps (see the history tool) from a snapshot before where it lands. It replays text from type_input, but cannot go back past something no replay can repeat: a load_basic, a disc or tape change, a write to a disc, a write_memory with bank or shadow, a read_memory of a device register, or the cassette motor running, and an Econet machine keeps no history; reset (hard) and restore_state start the history afresh. While type_input is still t…

ParameterTypeDescription
session_id *stringSession ID from create_machine

reverse_continue

Run the machine backwards to where it would have stopped at the newest hit of any breakpoint set with set_breakpoint before now: before the instruction for an execute breakpoint, after the instruction for a read or write. Running on from there does not stop at the same breakpoint again. Replays the history the session keeps (see the history tool) from a snapshot before where it lands. It replays text from type_input, but cannot go back past something no replay can repeat: a load_basic, a disc or tape change, a write to a disc, a write_memory with bank or shadow, a read_memory of a device regis…

ParameterTypeDescription
session_id *stringSession ID from create_machine

who_wrote

Find the last write to a byte, as the machine pages it now, by replaying the history the session keeps, newest first, and leaving the machine as it was. found says whether a write was found. A write reports pc and pcHex, the instruction that wrote it (null when an input such as write_memory did), value, the cycle it started at (step_back with to_cycle goes there), and cycles_ago and seconds_ago. With nothing found, searched_cycles and why say how far back it looked and why it went no further; refusal says why it could not search at all (no history, ROM, or something it cannot replay since the…

ParameterTypeDescription
address *integerAddress of the byte (0–65535)
session_id *stringSession ID from create_machine

history

See, or set, how much history the session keeps for step_back, step_back_out, reverse_continue and who_wrote. Each machine starts keeping what the jsbeeb page keeps: 3 recent snapshots, at most one a frame, and 30 more, at most one a second, each about 130KB on a Master to 200KB on a B (65KB more with a tube); keeping them slows a run somewhat. An Econet machine keeps none, and refuses to start. Give recent or seconds to change it (both 0 turns history off; a lone ring of 1 holds only the newest snapshot, which leaves a step back nothing to start from), which forgets the history kept so far. R…

ParameterTypeDescription
session_id *stringSession ID from create_machine
recentintegerRecent snapshots to keep, at most one a frame
secondsintegerSnapshots to keep further back, at most one a second

start_coverage

Start recording which instructions the host CPU executes, and how often, as the machine runs under any tool. Addresses in &8000–&BFFF are kept apart by the sideways bank paged in (and on a Master, ANDY over &8000–&8FFF); HAZEL and shadow RAM count as the plain address. Recording never stops the machine, and carries on across reset, boot_disc and restore_state. An instruction the machine is stopped at has already been counted, even if stop_coverage comes before it runs. Use stop_coverage to stop and get the summary. Starting again discards what was recorded so far.

ParameterTypeDescription
session_id *stringSession ID from create_machine

stop_coverage

Stop recording coverage and summarise it: instructions_executed, unique_addresses, the stretches of code executed (ranges, each from the first to the last instruction address run in it, with bank (0–15, or 'andy') for &8000–&BFFF, the count of addresses and executions in it), and hot_spots, the addresses run most often. Over max_ranges stretches, the busiest are kept; ranges_total says how many there were.

ParameterTypeDescription
session_id *stringSession ID from create_machine
max_hot_spotsintegerMost hot spot addresses to list
max_rangesintegerMost stretches of code to list

save_state

Snapshot the whole machine (CPU, RAM, sideways RAM, video, sound chip, discs, tube) and keep it server-side under a state ID. Econet's file server is not in it, so a machine restored from it may need to log on again. Booting is the slow part of a session, so snapshotting once and restoring between attempts is much cheaper than creating a machine for each one. The snapshot itself never crosses this connection, only its ID.

ParameterTypeDescription
session_id *stringSession ID from create_machine
labelstringOptional note to identify this state in list_states

restore_state

Put a session back to a state saved by save_state. Memory, registers and the cycle count rewind; breakpoints and the frame counter carry on. A state saved where an execute breakpoint or run_until_address stopped the machine runs on past that instruction when next run; otherwise an execute breakpoint at the restored PC fires (read and write breakpoints stop after their instruction has run). The target session need not be the one the state was saved from, so a state can be restored into several machines to run from the same start point, but it must be the same model with the same tube, Econet, s…

ParameterTypeDescription
session_id *stringSession ID to restore into
state_id *stringState ID from save_state

list_states

List the states held by save_state, newest first.

ParameterTypeDescription
session_idstringOnly list states saved from this session (default: all)

delete_state

Discard a saved state and free the memory it holds. States outlive the session they came from, so they are only freed when deleted.

ParameterTypeDescription
state_id *stringState ID from save_state

save_memory

Save a range of the BBC Micro's memory to a file on the host filesystem. Much faster than multiple read_memory calls for large dumps. Reports paging as read_memory does, and takes bank or shadow the same way.

ParameterTypeDescription
address *integerStart address (0–65535)
length *integerNumber of bytes to save
path *stringAbsolute path to write the file to
session_id *stringSession ID from create_machine
bankintegerSideways ROM/RAM bank to page at &8000–&BFFF for this access, instead of the one ROMSEL selects (12 to 15 on B-stock and B-MOS0.10, which have four sockets)
shadowbooleanOn a Master, use shadow RAM (true) or main RAM (false) at &3000–&7FFF, whatever ACCCON says

disassemble

Disassemble 6502 machine code from the BBC Micro's memory. Returns assembly listing with addresses, hex bytes, and mnemonics.

ParameterTypeDescription
address *numberStart address (0–65535)
session_id *stringSession ID from create_machine
countnumberNumber of instructions to disassemble