Getting started
Install
Use Python 3.13, 3.14 or 3.15 and install the .NET 10 runtime. NumPy and pythonnet are installed as package dependencies.
Add the package to a uv project:
sh
uv add mrkwatkins-oakemuOr install it with pip:
sh
python -m pip install mrkwatkins-oakemuCreate a machine
python
from mrkwatkins.oakemu.zxspectrum import ZXSpectrum
spectrum = ZXSpectrum()
spectrum.execute_frame()
print(spectrum.cpu.registers.pc)
print(spectrum.memory[16384])The default machine uses the fast CPU and screen implementations. It is ready to run without downloading any .NET assemblies separately.
Load a snapshot
python
spectrum.load("game.z80")
spectrum.execute_frames(50)
image = spectrum.screen.get_rgb_screenshot()The path must refer to a supported ZX Spectrum file. Compressed files, such as game.z80.zst, are decompressed automatically.
The returned image is a NumPy array. See screenshots for its shape and how to save it.