Prev: B436 Up: Map Next: B4BA
B4A1: Play the menu's tune, once, until a key is pressed
Used by the routine at MENU.
The menu (MENU) calls this every time round its loop with the tune at DE. TUNE_HEARD remembers that it has been played, so it plays only the first time; AFTER_GAME clears the variable with the rest after every game, so it plays again then. Before each note the whole keyboard is read, and any key stops the tune at once.
GAME_ENDED comes in at PLAY_TUNE_TILL_KEY for the game-over tune, which plays after every game, until a key. The same routine as Pentagram's PLAY_TUNE_ONCE.
Input
DE the tune
PLAY_TUNE_ONCE B4A1 LD HL,TUNE_HEARD played already: done
B4A4 LD A,(HL)
B4A5 AND A
B4A6 RET NZ
B4A7 SET 0,(HL) not again
This entry point is used by the routine at GAME_ENDED.
PLAY_TUNE_TILL_KEY B4A9 XOR A A = 0 reads every half-row at once: any key stops it
B4AA CALL READ_KEYS
B4AD JR Z,PLAY_TUNE_ONCE_0
B4AF RET
PLAY_TUNE_ONCE_0 B4B0 LD A,(DE) $FF ends the tune; play a note, and look at the keys again
B4B1 CP $FF
B4B3 JR Z,PLAY_TUNE_0
B4B5 CALL PLAY_NOTE
B4B8 JR PLAY_TUNE_TILL_KEY
Prev: B436 Up: Map Next: B4BA