![]() |
Routines |
| Prev: 48231 | Up: Map | Next: 48494 |
|
Used by the routine at HandlerGameMenu.
Plays a tune in the same way as PlayMusic, but stops as soon as any key is pressed. The key press is then handled by the game selection menu (see HandlerGameMenu), as if it had been read there.
|
||||||||
| PlayMusic_WaitKey | 48465 | DI | Disable interrupts. | |||||
|
Check for any key being pressed.
|
||||||||
| PlayMusic_WaitKey_Loop | 48466 | XOR A | Select every row of the keyboard. | |||||
| 48467 | OUT (253),A | Write A to port 253 (this has no effect). | ||||||
| 48469 | IN A,(254) | Read every half-row of the keyboard at once (the high byte of the port number is zero). | ||||||
| 48471 | CPL | Flip the bits. | ||||||
| 48472 | AND %00011111 | Keep only bits 0-4. | ||||||
| 48474 | JR Z,PlayMusic_WaitKey_Process | Jump to PlayMusic_WaitKey_Process if no keys were pressed. | ||||||
|
A key was pressed, so stop playing and hand over to the game menu.
|
||||||||
| 48476 | LD A,(38546) | Fetch the game options from GameOptions. | ||||||
| 48479 | INC SP | Discard the return address. | ||||||
| 48480 | INC SP | |||||||
| 48481 | JP GameSelect_ReadSecondKeyRow | Jump to GameSelect_ReadSecondKeyRow to handle the key press in the game selection menu. | ||||||
|
This is identical to PlayMusic except it also handles exiting on a keypress.
|
||||||||
| PlayMusic_WaitKey_Process | 48484 | LD A,(DE) | Fetch the next note. | |||||
| 48485 | CP 255 | Jump to PlayMusic_Return if the end of the tune has been reached (255). | ||||||
| 48487 | JR Z,PlayMusic_Return | |||||||
| 48489 | CALL PlayNote | Play the note. | ||||||
| 48492 | JR PlayMusic_WaitKey_Loop | Jump to PlayMusic_WaitKey_Loop to check for a key press. | ||||||
| Prev: 48231 | Up: Map | Next: 48494 |