Prev: B403 Up: Map Next: B42E
B419: Play Appearing Sound
Used by the routine at HandlePlayerAppearing.
Plays the rising sound of the sparkles that show the player appearing. The number of cycles depends on the sprite number of the sparkle.
Input
IX Address of the sparkle object
Make a beep for each remaining frame.
PlayAppearingSound B419 LD A,(IX+$00) Fetch the graphic number of the sparkle.
B41C RLCA Rotate it left twice.
B41D RLCA
B41E AND %00011111 Keep the lowest five bits.
B420 OR %00000011 Make sure that there are at least three cycles.
B422 LD C,A Set C to the number of cycles.
PlayAppearingSound_NextBeep B423 LD A,C Fetch the cycle counter.
B424 RLCA Multiply it by four to get the pitch.
B425 RLCA
B426 LD B,A Set B to the pitch.
B427 CALL PlaySquareWave Play a single cycle of the tone.
B42A DEC C Decrease the cycle counter and loop back to PlayAppearingSound_NextBeep until it is zero.
B42B JR NZ,PlayAppearingSound_NextBeep
B42D RET Return.
View the equivalent code in;
Prev: B403 Up: Map Next: B42E