Prev: 46083 Up: Map Next: 46126
46105: 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 46105 LD A,(IX+0) Fetch the graphic number of the sparkle.
46108 RLCA Rotate it left twice.
46109 RLCA
46110 AND %00011111 Keep the lowest five bits.
46112 OR %00000011 Make sure that there are at least three cycles.
46114 LD C,A Set C to the number of cycles.
PlayAppearingSound_NextBeep 46115 LD A,C Fetch the cycle counter.
46116 RLCA Multiply it by four to get the pitch.
46117 RLCA
46118 LD B,A Set B to the pitch.
46119 CALL PlaySquareWave Play a single cycle of the tone.
46122 DEC C Decrease the cycle counter and loop back to PlayAppearingSound_NextBeep until it is zero.
46123 JR NZ,PlayAppearingSound_NextBeep
46125 RET Return.
View the equivalent code in;
Prev: 46083 Up: Map Next: 46126