-
Notifications
You must be signed in to change notification settings - Fork 0
SDK
The SDK includes three automation scripts for compiling programs and converting assets for the emulator.
Windows: All scripts are Bash scripts. Windows users must use WSL2 (see the installation section in the README).
Compiles C or 65c02 assembly programs and generates a .bin binary ready to load into the simulator.
./scripts/compile-bin.sh <program_name>
./scripts/compile-bin.sh all # Compile all programs
./scripts/compile-bin.sh eater # Compile the WOZMON + Microsoft BASIC ROMOutput is saved to output/rom/<name>.bin.
-
cc65 (
ca65,ld65,cl65) — 6502 assembly/compilation toolchain - Python 3 (for the conversion scripts)
sdk/src/<name>.s
↓ ca65 --cpu 65C02
sdk/src/build/<name>.o
↓ ld65 -C sdk/linker/raw.cfg
output/rom/<name>.bin
sdk/src/<name>.c
↓ cl65 -O --cpu 65C02 -S (compile to assembly)
sdk/src/build/<name>.s
↓ cl65 --cpu 65C02 -C <cfg> (assemble + link + BIOS)
│ Includes: sdk/linker/bios.s + sdk/linker/C-Runtime.s
output/rom/<name>.bin
The script detects which linker configuration to use based on the headers included in the program:
| Detected header | Configuration used |
|---|---|
#include "Libs/GPUDoubleBuffer.h" |
C-Runtime-GPUDoubleBuffer.cfg |
#include "Libs/GPU.h" |
C-Runtime-GPU.cfg |
| (none) | C-Runtime.cfg |
Compiles the WozMon + Microsoft BASIC ROM using the Makefile in sdk/msbasic/.
Converts an image (PNG, JPG, or BMP) to the emulator's VRAM binary format (100×75 pixels, 1 byte per pixel in RGB 222).
./scripts/image-to-bin.sh <image_name>
./scripts/image-to-bin.sh all # Convert all images in assets/vram/
# Example: ./scripts/image-to-bin.sh assets/vram/bocchi.pngOutput is saved to output/vram/<image_name>.bin.
-
Python 3 with Pillow (
pip install Pillow)
- Load the image with Pillow
- Resize to 100×75 pixels
- Convert to RGB 222 (2 bits per color channel)
- Save the byte array as a binary file
The resulting binary can be loaded directly into VRAM through the graphical interface.
Converts a MIDI file to 65c02 assembly code for the emulator's SID chip. The result can be compiled and run directly.
./scripts/midi-to-bin.sh <midi_file>
./scripts/midi-to-bin.sh all # Convert all MIDI files in assets/midi/
# Example: ./scripts/midi-to-bin.sh assets/midi/overworld.midOutput is saved to output/midi/<song>.bin.
-
Python 3 with mido and py65 (
pip install mido py65) -
cc65 (
ca65,ld65) to compile the generated assembly
The script has 8 compression modes (time granularities from 1 ms to 100+ ms). It automatically tries from the most precise mode to the most compressed and selects the first one that fits in 32 KB of ROM:
| Mode | Granularity | Fidelity |
|---|---|---|
| 1 | ~1 ms | Maximum fidelity |
| 2 | ~2 ms | High fidelity |
| 3 | ~5 ms | Good fidelity |
| 4 | ~10 ms | Medium fidelity |
| 5 | ~20 ms | Medium compression |
| 6 | ~40 ms | High compression |
| 7 | ~80 ms | Very compressed |
| 8 | ~100+ ms | Maximum compression |
If no mode fits within 32 KB, the script reports an error.
- Parse the MIDI file with
mido - Generate 65c02 assembly code that writes to SID registers to play the song
- Compile with
ca65+ld65usingsdk/linker/raw.cfg - The final binary is loaded into ROM and the CPU executes the instructions to produce sound
sdk/src/Libs/ contains C header files that make it easy to use the hardware from C code:
| File | Description |
|---|---|
GPU.h |
Functions for writing to VRAM (single buffer) |
GPUDoubleBuffer.h |
Functions for double-buffered VRAM access |
SID.h |
Functions for controlling the SID chip |
VIA.h |
Functions for accessing the VIA 6522 |
The SDK.zip distributed in the official releases already contains the output/ folder with all programs, images, and music pre-compiled. You can find them in:
-
output/rom/: Main program binaries. -
output/vram/: Converted images for the GPU. -
output/midi/: Compiled music for the SID chip.