Prev: 51032 Up: Map Next: 51098
51043: Pause game routine - play tune and check user input
Used by the routines at 50870 and 51141.
(This is where the ERRSP stack pointer error is pointed at in routine at 48992)
When 'P' is pressed (check made in previous routine at 51032), 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 51053 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
51043 LD A,0 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 50870.
51045 LD (48921),A
51048 LD A,2 This tells the music player to play tune number 2 (the 'pause game' music) - a short tune stored at 60530.
51050 CALL 58806 Play the tune
This routine checks if the player is pressing 'S', which saves the current game.
51053 LD BC,65022 Keyboard port address for keys A, S, D, F, G
51056 IN A,(C) Check this half-row of the keyboard
51058 OR %11111101 For the 'S' key we're interested in the second lowest bit (bit 1), so set all the other bits to 1
51060 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.
51062 JR Z,51141 If this is the case and 'S' isn't being pressed, jump to 51141 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.
51064 CALL 57081 Clear the scroll status panel at the bottom of the screen
51067 LD A,37 "Start tape then press enter" is message number 37
51069 CALL 58789 Get the address pointer for this message text (29523)
51072 LD (60065),HL ...and store it.
51075 LD HL,20615 Set and store address position to print text (centre-left of scroll)
51078 LD (60068),HL
51081 CALL 58064 Print the text string on the scroll
This routine checks the keyboard until the player presses ENTER
51084 LD BC,49150 Keyboard port address for keys H, J, K, L, ENTER
51087 IN A,(C) Check this half-row of the keyboard
51089 OR %11111110 For the ENTER key we're interested in the lowest bit (bit 0), so set all the other bits to 1
51091 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.
51093 JR Z,51084 If this is the case, keep checking this keyboard half-row until ENTER is pressed
Player has (started the tape and) pressed ENTER
51095 CALL 57081 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: 51032 Up: Map Next: 51098