Prev: C314 Up: Map Next: C34D
C332: Play Ghost Sound
Used by the routine at UpdateGhost.
Plays a sound for a ghost, if the ghost has been drawn in the view.
PlayGhostSound C332 LD BC,$C34D Point at the pitches of the ghost sound.
This entry point is used by the routine at UpdateMonster.
Plays a sound effect, using a pitch from a table, if the object at IX has been drawn in the view. The routine that draws a sprite (see DrawSprite) sets bit 1 of the flags of the object, and this routine clears it.
When it is used for a monster (see UpdateMonster), the pitches come from the ROM instead (see SoundPitchTables).
PlayFlaggedSound C335 BIT 1,(IX+$07) Check whether the object has been drawn in the view.
C339 RES 1,(IX+$07) Clear the flag, ready for the next frame.
C33D RET Z Return if the object was not drawn, because it can't be heard.
C33E LD A,($BBB2) Fetch the low byte of the frame counter.
C341 AND %00001111 Keep only the lowest four bits, to choose one of the sixteen pitches.
C343 LD L,A Add it to the address of the table.
C344 LD H,$00
C346 ADD HL,BC
C347 LD B,(HL) Fetch the pitch.
C348 LD C,$0C Set the length of the sound.
C34A JP PlayTone Jump to PlayTone to play the tone.
View the equivalent code in;
Prev: C314 Up: Map Next: C34D