Prev: 44902 Up: Map Next: 44943
44918: 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 44918 LD HL,41538 Point HL at the flag which says whether the tune has been played.
44921 LD A,(HL) Fetch the flag.
44922 AND A Return if the tune has already been played.
44923 RET NZ
44924 SET 0,(HL) Set the flag.
PlayMusicOnce_Loop 44926 XOR A Read every row of the keyboard.
44927 CALL ReadKeyboardPort
44930 JR Z,PlayMusicOnce_NextNote Jump to PlayMusicOnce_NextNote if no key is pressed.
44932 RET Return.
Play the next note.
PlayMusicOnce_NextNote 44933 LD A,(DE) Fetch the next note.
44934 CP 255 Jump to PlayMusic_Finish if the terminator has been reached.
44936 JR Z,PlayMusic_Finish
44938 CALL PlayNote Play the note.
44941 JR PlayMusicOnce_Loop Go back for the next note.
View the equivalent code in;
Prev: 44902 Up: Map Next: 44943