Samples at addresses the game chooses: a resident set and a swap area. More...
Macros | |
| #define | ADDR_BELOW 0x1FB8 |
| #define | ADDR_BULK 0x4000 |
| #define | ADDR_LEAD 0x2000 |
| The places of the swap area. | |
| #define | ADDR_SWAP 0x3000 |
| #define | CASE_LATE1 5 |
| #define | CASE_ON 1 |
| Silence cases (q3_case): the voice left on, stopped at once, stopped 1 or 2 frames before, stopped late in a frame then 1 frame. | |
| #define | CASE_STOP 2 |
| #define | CASE_WAIT1 3 |
| #define | CASE_WAIT2 4 |
| #define | PH_DONE 6 |
| #define | PH_PLACE 1 |
| Phases, written to phase so a manifest knows where the run is. | |
| #define | PH_REFUSE 2 |
| #define | PH_REPLACE 3 |
| #define | PH_SILENCE 4 |
| #define | PH_TIMING 5 |
| #define | SIZE(name) |
| Size of a data.asm sample. | |
| #define | SMP_ABOVE 3 |
| #define | SMP_BELOW 4 |
| #define | SMP_BULK 5 |
| #define | SMP_LEAD 1 |
| Sample slots. | |
| #define | SMP_PROBE 6 |
| #define | SMP_SWAP 2 |
| #define | VOICE_LEAD 0 |
| Voices: the one that plays on, the one whose sample is replaced, the witness. | |
| #define | VOICE_SWAP 1 |
| #define | VOICE_WITNESS 2 |
Functions | |
| static void | enter (u8 p, u16 c) |
| Start a phase. | |
| int | main (void) |
| static void | silence_case (u8 c) |
| One silence case: pad plays on the swap voice, then bell replaces it in its place after the action the case names. | |
| static u8 | steps_to_end (u16 n) |
| Run a load in steps of n bytes to its end, one step a frame. | |
| static void | tick (void) |
| Wait one frame. | |
| static void | ticks (u8 n) |
| Wait n frames. | |
| static void | tint (u16 c) |
| Backdrop colour per phase. | |
| static u16 | vline (void) |
| The scanline the PPU is drawing (latched by reading SLHV). | |
| static u16 | vpos (void) |
| Scanlines since the last VBlank began (line 225 of 262, NTSC): with frame, which tick() bumps then, a clock that runs across frames. | |
| static void | witness_note (u8 i) |
| Time one witness note: the frame and the scanline its key-on goes. | |
Variables | |
| u16 | addr_above |
| u16 | begin_lines |
| u8 | bell_brr [] |
| u8 | bell_brr_end [] |
| u8 | bulk_brr [] |
| u8 | bulk_brr_end [] |
| u8 | bulk_steps |
| u16 | errors_refused |
| u16 | frame |
| u16 | free_above |
| u16 | free_below |
| u16 | free_lead |
| u16 | free_refused |
| u16 | free_start |
| u16 | free_swap |
| u16 | free_unload_above |
| u16 | free_unload_below |
| u16 | kon_frame [12] |
| u16 | kon_line [12] |
| u8 | kon_steady |
| u8 | lead_active |
| u8 | lead_brr [] |
| The hand-written BRR samples of data.asm. | |
| u8 | lead_brr_end [] |
| u8 | pad_brr [] |
| u8 | pad_brr_end [] |
| u8 | phase |
| Oracles (WRAM): read by testing/manifests/audio_sample_swap*.toml. | |
| u8 | place_errs |
| u8 | q3_case |
| u16 | q3_gap_frames [6] |
| u16 | q3_gap_lines [6] |
| u8 | refusals [10] |
| u16 | release_lines |
| u16 | release_polls |
| u8 | replace_play_during |
| u8 | replace_steps |
| u8 | swap_brr [] |
| u8 | swap_brr_end [] |
| u8 | swap_play_after |
Samples at addresses the game chooses: a resident set and a swap area.
audioLoadSample() puts each sample where the last one ended. A game whose samples do not all fit in the sound CPU's memory keeps some resident and replaces others during play, in places of its own. This ROM does it with audioLoadSampleAt() and audioLoadSampleBeginAt(), and measures what a game needs to know:
Nothing to press: the phases run on their own, the backdrop colour names the phase, and the results are globals the manifests read.
| #define ADDR_BELOW 0x1FB8 |
ends where lead starts: touching is not overlapping
| #define ADDR_BULK 0x4000 |
| #define ADDR_LEAD 0x2000 |
The places of the swap area.
| #define ADDR_SWAP 0x3000 |
| #define CASE_LATE1 5 |
| #define CASE_ON 1 |
Silence cases (q3_case): the voice left on, stopped at once, stopped 1 or 2 frames before, stopped late in a frame then 1 frame.
| #define CASE_STOP 2 |
| #define CASE_WAIT1 3 |
| #define CASE_WAIT2 4 |
| #define PH_DONE 6 |
| #define PH_PLACE 1 |
Phases, written to phase so a manifest knows where the run is.
| #define PH_REFUSE 2 |
| #define PH_REPLACE 3 |
| #define PH_SILENCE 4 |
| #define PH_TIMING 5 |
| #define SIZE | ( | name | ) |
| #define SMP_ABOVE 3 |
an ordinary load after the placed ones
| #define SMP_BELOW 4 |
placed below the allocator's pointer
| #define SMP_BULK 5 |
the 1728-byte load timed against a note
| #define SMP_LEAD 1 |
Sample slots.
resident, at ADDR_LEAD
| #define SMP_PROBE 6 |
the slot the refusals ask for
| #define SMP_SWAP 2 |
the swap place: pad, then bell
| #define VOICE_LEAD 0 |
Voices: the one that plays on, the one whose sample is replaced, the witness.
| #define VOICE_SWAP 1 |
| #define VOICE_WITNESS 2 |
| int main | ( | void | ) |
< resident, at ADDR_LEAD
< the swap place: pad, then bell
< an ordinary load after the placed ones
< an ordinary load after the placed ones
< placed below the allocator's pointer
< ends where lead starts: touching is not overlapping
< placed below the allocator's pointer
< an ordinary load after the placed ones
< the slot the refusals ask for
< the slot the refusals ask for
< the slot the refusals ask for
< the slot the refusals ask for
< the slot the refusals ask for
< the slot the refusals ask for
< resident, at ADDR_LEAD
< the swap place: pad, then bell
< the swap place: pad, then bell
< the swap place: pad, then bell
< the slot the refusals ask for
< the swap place: pad, then bell
< the slot the refusals ask for
< the swap place: pad, then bell
< resident, at ADDR_LEAD
< the 1728-byte load timed against a note
|
static |
One silence case: pad plays on the swap voice, then bell replaces it in its place after the action the case names.
pad is first put back where bell will go (a blocking replacement), so each case starts from the same bytes. A control build whose swap_brr holds pad's bytes (data.asm) runs the same code at the same cycles: its sound differs from this one's only where the voice read a byte that changed.
< the swap place: pad, then bell
< the swap place: pad, then bell
< the swap place: pad, then bell
|
static |
Wait one frame.
|
static |
Wait n frames.
|
static |
Backdrop colour per phase.
|
static |
The scanline the PPU is drawing (latched by reading SLHV).
|
static |
|
static |
Time one witness note: the frame and the scanline its key-on goes.
< resident, at ADDR_LEAD
| u16 addr_above |
where the ordinary load went
| u16 begin_lines |
scanlines of one audioLoadSampleBeginAt() (it checks the 64 slots)
|
extern |
| u8 bell_brr_end[] |
|
extern |
| u8 bulk_brr_end[] |
| u8 bulk_steps |
steps the bulk load took
| u16 errors_refused |
audio_error_count after them
| u16 frame |
frames since the screen came on
| u16 free_above |
...after the ordinary load (it goes above)
| u16 free_below |
...after the sample placed just below lead (unchanged)
| u16 free_lead |
...after the sample at $2000
| u16 free_refused |
audioGetFreeMemory() after them: unchanged
| u16 free_start |
| u16 free_swap |
...after the sample at $3000
| u16 free_unload_above |
...after unloading the ordinary one (back)
| u16 free_unload_below |
...after unloading it (unchanged: not on top)
| u16 kon_frame[12] |
frame of each witness note: 4 alone, 4 after a step, 4 before one
| u16 kon_line[12] |
scanline at which its key-on command was sent
| u8 kon_steady |
1: the twelve notes went in twelve frames running
| u8 lead_active |
voice 0 still sounding after the replacement
|
extern |
The hand-written BRR samples of data.asm.
| u8 lead_brr_end[] |
|
extern |
| u8 pad_brr_end[] |
| u8 phase |
Oracles (WRAM): read by testing/manifests/audio_sample_swap*.toml.
| u8 place_errs |
the codes of the five placing calls, OR-ed: 0
| u8 q3_case |
the silence case whose first step is running, 0 between: a hook for a luna checkpoint (until_if) at that step
| u16 q3_gap_frames[6] |
per case: frames from the key-off to the first step
| u16 q3_gap_lines[6] |
per case: scanlines from the key-off (or the same point, voice left on) to the first step
| u8 refusals[10] |
the code of each refused call, in order
| u16 release_lines |
scanlines from audioStopVoice() to a silent envelope
| u16 release_polls |
envelope reads it took
| u8 replace_play_during |
audioPlaySampleOn() on the slot mid-load: AUDIO_VOICE_NONE
| u8 replace_steps |
steps of 24 bytes for the 72-byte bell
|
extern |
| u8 swap_brr_end[] |
| u8 swap_play_after |
audioPlaySampleOn() on the slot once whole