Prev: 49323 Up: Map Next: 49359
49334: 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 255. 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 49334 LD HL,38455 Point HL at the flag that records that a tune has been played.
49337 LD A,(HL) Fetch the flag.
49338 AND A Return if the tune has already been played.
49339 RET NZ
49340 SET 0,(HL) Set the flag.
Select every half row of the keyboard.
PlayMusic_WaitKey_Loop 49342 XOR A Read every row of the keyboard.
49343 CALL ReadKeys
49346 JR Z,PlayMusic_WaitKey_Next Jump to PlayMusic_WaitKey_Next if no key is pressed.
49348 RET Return as a key has been pressed.
Play the next note.
PlayMusic_WaitKey_Next 49349 LD A,(DE) Fetch the next note.
49350 CP 255 Jump to PlayMusic_Return if the terminator has been reached.
49352 JR Z,PlayMusic_Return
49354 CALL PlayNote Play the note using PlayNote.
49357 JR PlayMusic_WaitKey_Loop Loop back for the next note.
View the equivalent code in;
Prev: 49323 Up: Map Next: 49359