EAUDIO · REFERENCEALPHA · USE AT YOUR OWN RISK
Command reference
EAudio 0.3 uses OSWORD &C0 with a fixed 64-byte request block and a 16-byte reply.
| Byte | Value | Meaning |
|---|---|---|
| 0 | 64 | bytes sent |
| 1 | 16 | bytes returned |
| 2–5 | EAUD | signature |
| 6 | 0–7 | command on entry; 0 success / 1 invalid request on return |
| 7 | &A5 | acknowledgement - clear before each call |
| 8–15 | payload | command data or reply |
Commands
| # | Command | Payload | Effect |
|---|---|---|---|
| 0 | INIT | - | Reset state and define envelopes 1–4. Must come first. |
| 1 | MUSIC_START | bank, score page, score offset | Start a three-voice score held in a sideways ROM. |
| 2 | MUSIC_STOP | - | Stop music. |
| 3 | SFX | effect ID 0–49 | Play an effect, subject to channel priority. |
| 4 | TICK | - | Top up each music voice’s MOS queue. Call regularly, including from menu loops. |
| 5 | STATUS | - | Reply: active music at byte 8, active effect at byte 9. |
| 6 | SILENCE | - | Music off; all four channels flushed. |
| 7 | VOLUME | 0 mute … 3 full | Rescale envelopes and fixed amplitudes. |
Built-in effects
| ID | Priority | Intended use | Sound |
|---|---|---|---|
| 0 | 3 | death | dirge E4–C4–A3, held |
| 2 | 2 | player hurt | short low tone |
| 3 | 2 | level up | fanfare C5–E5–G5–C6, ringing |
| 4 | 0 | pickup | bell: F6 and C7 together |
| 6 | 1 | kill | white-noise snap then a low crunch; noise channel only |
| 8 | 0 | menu key | high white-noise tick |
| 9 | 2 | chest opens | sparkle G5–B5–D6–G6 |
| 10 | 3 | boss arrives | drum boom then a two-voice fanfare in D minor |
| 11 | 0 | purchase | noise “ch-ing” |
| 12 | 1 | low health | heartbeat lub-dub |
| others | 0 | generic | one-semitone tone scale |
Envelopes: 1 bell, 2 sting, 3 thud, 4 music. Tone notes take the next free tone channel, or one playing a strictly lower-priority effect; otherwise they are dropped. Menu effects stay on the noise channel so they never interrupt menu music.
Score format
A score starts with three 16-bit voice offsets. Each voice is a list of (pitch, duration) pairs; pitch 0 is a rest and duration 0 loops the voice. Bit 7 of a duration marks the first note of a bar, which EAudio starts with MOS sync so the three voices wait for each other.