Prev: 50090 Up: Map Next: 50136
50109: Play Sound Effect
Used by the routine at StartGame.
Plays the next note of the current sound effect. The note counter is held at NoteCounter and the number of the sound effect at SoundNumber. A sound effect is started by setting the note counter to the number of notes.
The sound effects are:
Effect Sound
0, a new cell
1, a speed bonus
2, a health bonus
3, an item
Count down the notes of the current sound effect.
PlaySoundEffect 50109 LD HL,48121 Point at the counter of notes still to play.
50112 LD A,(HL) Return if there are no more notes to play.
50113 AND A
50114 RET Z
50115 DEC (HL) Count down a note.
50116 EX AF,AF' Keep the note counter in AF'.
50117 INC HL Point at the number of the sound effect.
Find the pitch of this note.
50118 LD A,(HL) Fetch the number of the sound effect.
50119 LD BC,50136 Point at the table of sound effects.
50122 CALL GetTableEntry Fetch the address of the notes of the sound effect.
50125 EX AF,AF' Get the number of the note back from AF'.
50126 LD C,A Use it as the distance along the notes.
50127 LD B,0 Make the distance a whole number of bytes.
50129 ADD HL,BC Find the address of the note.
50130 LD B,(HL) Fetch the pitch of the note.
50131 LD C,12 Set the length of the note.
50133 JP PlayTone Jump to PlayTone to play the note.
View the equivalent code in;
Prev: 50090 Up: Map Next: 50136