Prev: C758 Up: Map Next: C79A
C763: Pause game routine - play tune and check user input
Used by the routines at C6B6 and C7C5.
(This is where the ERRSP stack pointer error is pointed at in routine at BF60)
When 'P' is pressed (check made in previous routine at C758), the game is paused and some music is played:
  • while the game is paused, the player can press 'S' to save the game, or 'O' to resume the game
  • the keyboard checks for 'S' and 'O' are done at C76D after a full cycle of the tune has played
  • this means the player needs to keep the relevant key (to save/resume the game) held down until the tune has finished its current loop
C763 LD A,$00 Set game flag to 0 (new/current game), in preparation for the player leaving the pause menu returning to the game. Checked at the start of the game cycle keyboard checks at C6B6.
C765 LD ($BF19),A
C768 LD A,$02 This tells the music player to play tune number 2 (the 'pause game' music) - a short tune stored at EC72.
C76A CALL $E5B6 Play the tune
This routine checks if the player is pressing 'S', which saves the current game.
C76D LD BC,$FDFE Keyboard port address for keys A, S, D, F, G
C770 IN A,(C) Check this half-row of the keyboard
C772 OR %11111101 For the 'S' key we're interested in the second lowest bit (bit 1), so set all the other bits to 1
C774 CP %11111111 If bit 1 is set to 1, all the bits will be set to 1, indicating the 'S' key isn't being pressed.
C776 JR Z,$C7C5 If this is the case and 'S' isn't being pressed, jump to C7C5 to check if the 'O' key (resume) is being pressed.
The player has pressed the 'S' key to save the current game. This code prints "Start tape then press enter" on the scroll.
C778 CALL $DEF9 Clear the scroll status panel at the bottom of the screen
C77B LD A,$25 "Start tape then press enter" is message number 37
C77D CALL $E5A5 Get the address pointer for this message text (7353)
C780 LD ($EAA1),HL ...and store it.
C783 LD HL,$5087 Set and store address position to print text (centre-left of scroll)
C786 LD ($EAA4),HL
C789 CALL $E2D0 Print the text string on the scroll
This routine checks the keyboard until the player presses ENTER
C78C LD BC,$BFFE Keyboard port address for keys H, J, K, L, ENTER
C78F IN A,(C) Check this half-row of the keyboard
C791 OR %11111110 For the ENTER key we're interested in the lowest bit (bit 0), so set all the other bits to 1
C793 CP %11111111 If bit 0 is set to 1, all the bits will be set to 1, indicating the ENTER key isn't being pressed.
C795 JR Z,$C78C If this is the case, keep checking this keyboard half-row until ENTER is pressed
Player has (started the tape and) pressed ENTER
C797 CALL $DEF9 Clear the scroll status panel at the bottom of the screen, ready to save.
Then continue to the next routine to save the game.
Prev: C758 Up: Map Next: C79A