← B7D2 Sound effect: inhabitant spawns Map B85A → Sound effect: name-entry cursor move
B803: Sound effect: orb chews the ball
The sound while the orb chews the ball, a 49-step sequence.
chew_counter B803 DEFB $00 Step counter: 0 when the effect is disarmed, otherwise the step it has reached, 1 to 50
chew_periods B804 DEFB $64,$C8 Never read
B806 DEFB $6E,$D2,$78,$C8,$96,$C8,$FA,$5A Pitch period for each step
B80E DEFB $E6,$C8,$96,$32,$0C,$78,$46,$5A
B816 DEFB $F0,$64,$A0,$64,$50,$78,$A0,$BE
B81E DEFB $D2,$64,$C8,$96,$28,$0A,$6E,$96
B826 DEFB $C8,$82,$5A,$96,$C8,$82,$64,$FA
B82E DEFB $64,$8C,$28,$50,$1E,$78,$82,$32
The 49 played steps start when the orb's chew reaches animation frame 20 and end before the spit.
sfx_chew B836 LD A,(chew_counter) Read the step counter; a disarmed effect has nothing to play.
B839 OR A
B83A RET Z
B83B CP $32 The sweep over: clear the counter and stay silent this frame.
B83D JR NZ,chew_step
B83F XOR A
B840 LD (chew_counter),A
B843 RET
chew_step B844 INC A Advance to the next step and store the counter back.
B845 LD (chew_counter),A
Each step's pitch comes from the chew table.
B848 LD E,A Take this step's period byte into D. QUIRK: the table ends one byte below this routine. The last step reaches past its end and takes the routine's own first opcode as the period.
B849 LD D,$00
B84B LD HL,chew_periods
B84E ADD HL,DE
B84F LD D,(HL)
B850 LD C,$02 Two square-wave cycles this frame
chew_emit B852 CALL sound_blip Emit one cycle at the current period.
B855 DEC D Step the period between the two cycles, then loop.
B856 DEC C
B857 JR NZ,chew_emit
B859 RET
← B7D2 Sound effect: inhabitant spawns Map B85A → Sound effect: name-entry cursor move
Fork me on GitHub