Prev: 54930 Up: Map Next: 54965
54940: Play Music Once
Used by the routine at GameMenu.
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
Main Tune
Input
DE The address of the tune
Play only if TunePlayedFlag is clear.
PlayMusicOnce 54940 LD HL,42823 Point HL at the flag which says whether the tune has been played.
54943 LD A,(HL) Fetch the flag.
54944 AND A Return if the tune has already been played.
54945 RET NZ
54946 SET 0,(HL) Set the flag.
Stop if a key is pressed.
PlayMusicOnce_Loop 54948 XOR A Read every row of the keyboard.
54949 CALL ReadKeyboardPort
54952 JR Z,PlayMusicOnce_Note Jump to PlayMusicOnce_Note if no key is pressed.
54954 RET Return.
Play the next note.
PlayMusicOnce_Note 54955 LD A,(DE) Fetch the next note.
54956 CP 255 Jump to PlayMusic_Done if the terminator has been reached.
54958 JR Z,PlayMusic_Done
54960 CALL PlayNote Play the note.
54963 JR PlayMusicOnce_Loop Jump to PlayMusicOnce_Loop.
View the equivalent code in;
Prev: 54930 Up: Map Next: 54965