Prev: C0AB Up: Map Next: C0CF
C0B6: Play Music Until Key Pressed
Used by the routine at GameMenu.
Plays a tune, but only the first time that it is used, and stops if a key is pressed. The tune is a list of notes that ends with FF. See PlayNote for what the notes are. After the tune has been played, nothing happens until TunePlayedFlag is cleared.
The tunes played by this routine are:
Tune Sound
Title Tune
Input
DE The address of the tune
PlayMusic_WaitKey C0B6 LD HL,$9637 Point HL at the flag that records that a tune has been played.
C0B9 LD A,(HL) Fetch the flag.
C0BA AND A Return if the tune has already been played.
C0BB RET NZ
C0BC SET 0,(HL) Set the flag.
Select every half row of the keyboard.
PlayMusic_WaitKey_Loop C0BE XOR A Read every row of the keyboard.
C0BF CALL ReadKeys
C0C2 JR Z,PlayMusic_WaitKey_Next Jump to PlayMusic_WaitKey_Next if no key is pressed.
C0C4 RET Return as a key has been pressed.
Play the next note.
PlayMusic_WaitKey_Next C0C5 LD A,(DE) Fetch the next note.
C0C6 CP $FF Jump to PlayMusic_Return if the terminator has been reached.
C0C8 JR Z,PlayMusic_Return
C0CA CALL PlayNote Play the note using PlayNote.
C0CD JR PlayMusic_WaitKey_Loop Loop back for the next note.
View the equivalent code in;
Prev: C0AB Up: Map Next: C0CF