Prev: 50638 Up: Map Next: 50774
50749: Play Music Once
Used by the routine at GameMenu.
Plays a tune, but only if this routine has not played one before. Bit 0 of TunePlayedFlag is set the first time and nothing clears it. The tune stops when a key is pressed.
The tunes played by this routine are:
Tune Sound
Main Tune
Input
DE Address of the tune
Play only if TunePlayedFlag is clear.
PlayMusicOnce 50749 LD HL,48065 Point HL at TunePlayedFlag.
50752 LD A,(HL) Return if TunePlayedFlag is set.
50753 AND A
50754 RET NZ
50755 SET 0,(HL) Set bit 0 of TunePlayedFlag.
Stop if a key is pressed.
PlayMusicOnce_Loop 50757 XOR A Select all of the keyboard rows.
50758 CALL ReadKeyboardPort Call ReadKeyboardPort.
50761 JR Z,PlayMusicOnce_Note Jump to PlayMusicOnce_Note if no key is pressed.
50763 RET Return.
Play the next note.
PlayMusicOnce_Note 50764 LD A,(DE) Fetch the next note.
50765 CP 255 Jump to PlayMusic_Return if it is 255.
50767 JR Z,PlayMusic_Return
50769 CALL PlayNote Call PlayNote.
50772 JR PlayMusicOnce_Loop Jump to PlayMusicOnce_Loop.
View the equivalent code in;
Prev: 50638 Up: Map Next: 50774