Prev: AF66 Up: Map Next: AF8F
AF76: Play Music Once
Used by the routines at HandleMenuKeys and ShowGameOver.
Plays a tune once, and stops early if a key is pressed. After the tune has been played, nothing happens until TunePlayedFlag is cleared.
The tunes played by this routine are:
Tune Sound
Title Tune
Game Over Tune
Input
DE The address of the tune
PlayMusicOnce AF76 LD HL,$A242 Point HL at the flag which says whether the tune has been played.
AF79 LD A,(HL) Fetch the flag.
AF7A AND A Return if the tune has already been played.
AF7B RET NZ
AF7C SET 0,(HL) Set the flag.
PlayMusicOnce_Loop AF7E XOR A Read every row of the keyboard.
AF7F CALL ReadKeyboardPort
AF82 JR Z,PlayMusicOnce_NextNote Jump to PlayMusicOnce_NextNote if no key is pressed.
AF84 RET Return.
Play the next note.
PlayMusicOnce_NextNote AF85 LD A,(DE) Fetch the next note.
AF86 CP $FF Jump to PlayMusic_Finish if the terminator has been reached.
AF88 JR Z,PlayMusic_Finish
AF8A CALL PlayNote Play the note.
AF8D JR PlayMusicOnce_Loop Go back for the next note.
View the equivalent code in;
Prev: AF66 Up: Map Next: AF8F