Prev: B467 Up: Map Next: B489
B472: Play Sound From Object Number
Used by the routine at HandleTransformation.
Plays the warbling sound of the player turning into a wulf or back into a human. The number of cycles depends on the sprite number of the transformation.
Input
IX Address of the object
Work the number of cycles from the sprite number.
PlaySoundFromObjectNumber B472 LD A,(IX+$00) Fetch the graphic number of the object.
B475 RLCA Rotate it left three times.
B476 RLCA
B477 RLCA
B478 AND %00011000 Keep bits 3 and 4.
B47A ADD A,$10 Add 10 to get the number of cycles.
B47C LD C,A Set C to the number of cycles.
PlaySoundFromObjectNumber_NextBeep B47D LD A,C Fetch the cycle counter.
B47E XOR %01010101 Mix it up to get a wide range of pitches.
B480 ADD A,C Add the cycle counter again.
B481 LD B,A Set B to the pitch.
B482 CALL PlaySquareWave Play a single cycle of the tone.
B485 DEC C Decrease the cycle counter and loop back to PlaySoundFromObjectNumber_NextBeep until it is zero.
B486 JR NZ,PlaySoundFromObjectNumber_NextBeep
B488 RET Return.
View the equivalent code in;
Prev: B467 Up: Map Next: B489