Prev: F7C7 Up: Map Next: F82F
F7D6: Starts tune A and sets up its sound-effect trigger table
Plays tune A (via start_tune), looks up a pointer in the table at $FA75 (indexed by A*2) into a per-tune SFX script, and clears the 3 SFX "busy" flags at $F837/$F895/$F8A2. Falls into the script reader below, whose byte-code and interaction with titlescr_music's SFX dispatch is documented at titlescr_drum_advance.
titlescr_start_tune F7D6 PUSH AF
F7D7 CALL start_tune
F7DA POP AF
This entry point is used by the routine at run_title_screen.
load_drum_script F7DB RLCA
F7DC LD C,A
F7DD LD B,$00
F7DF LD HL,$FA75
F7E2 ADD HL,BC
F7E3 XOR A
F7E4 LD ($F8A2),A
F7E7 LD ($F895),A
F7EA LD ($F837),A
F7ED LD A,(HL)
F7EE INC HL
F7EF LD H,(HL)
F7F0 LD L,A
F7F1 JP load_drum_op
SFX script byte-code reader: reads opcode bytes from the script pointer at $F7FC, with $FE meaning "jump to a new script pointer read from the following 2 bytes" ($F823) and $FF meaning "end of script, disable interrupts and stop the tune" (stop_music_and_silence via $F829). Any other byte is a delay/repeat value (stored to $F7F5 and used to throttle titlescr_drum_advance's own re-entry -- it decrements $F7F5 and returns early via RET NZ until it counts down to 0). The *following* script byte is a raw byte offset (not a scaled index) into the table at $FAA4: each entry there is 3 bytes -- a selector byte (copied to both $F84E and $F842, read back by titlescr_music) followed by a 2-byte pointer (stored to $F85E, the reload source for titlescr_music's sample-selector-stream pointer at $F853). This entry point is used by the routine at titlescr_music.
titlescr_drum_advance F7F4 LD A,$00
F7F6 DEC A
F7F7 LD ($F7F5),A
F7FA RET NZ
F7FB LD HL,$0000
load_drum_op F7FE LD A,(HL)
F7FF INC HL
F800 CP $FE
F802 JP Z,titlescr_start_tune_1
F805 CP $FF
F807 JR Z,titlescr_start_tune_0
F809 LD ($F7F5),A
F80C LD C,(HL)
F80D INC HL
F80E LD ($F7FC),HL
F811 LD B,$00
F813 LD HL,$FAA4
F816 ADD HL,BC
F817 LD A,(HL)
F818 INC HL
F819 LD ($F84E),A
F81C LD ($F842),A
F81F LD ($F85E),HL
F822 RET
titlescr_start_tune_0 F823 LD A,(HL)
F824 INC HL
F825 LD H,(HL)
F826 LD L,A
F827 JR load_drum_op
titlescr_start_tune_1 F829 POP HL
F82A POP HL
F82B DI
F82C JP stop_music_and_silence
Prev: F7C7 Up: Map Next: F82F