Prev: D692 Up: Map Next: D6B5
D69C: Play the menu's tune at DE, once, until a key is pressed
Used by the routine at MENU.
The menu (MENU) calls this every time round its loop. TUNE_HEARD remembers that the tune has been played, so it plays only the first time; START clears it with the rest of the game's variables after every game, so it plays again then. Before each note the whole keyboard is read, and any key stops the tune at once.
Input
DE the tune
PLAY_TUNE_ONCE D69C LD HL,TUNE_HEARD played already: done
D69F LD A,(HL)
D6A0 AND A
D6A1 RET NZ
D6A2 SET 0,(HL) not again
PLAY_TUNE_ONCE_0 D6A4 XOR A A = 0 reads every half-row at once: any key stops it
D6A5 CALL READ_KEYS
D6A8 JR Z,PLAY_TUNE_ONCE_1
D6AA RET
PLAY_TUNE_ONCE_1 D6AB LD A,(DE) $FF ends the tune; play a note, and look at the keys again
D6AC CP $FF
D6AE JR Z,PLAY_TUNE_0
D6B0 CALL PLAY_NOTE
D6B3 JR PLAY_TUNE_ONCE_0
Prev: D692 Up: Map Next: D6B5