Skip to navigation

Keyboard: ProcessPauseKeys

Name: ProcessPauseKeys [Show more] Type: Subroutine Category: Keyboard Summary: Pause or unpause the game when COPY or DELETE are pressed
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ProcessGameplay calls ProcessPauseKeys
.ProcessPauseKeys LDA keyLogger+3 \ Set A to the key logger entry for "7", "8", COPY and \ DELETE (volume down, volume up, pause, unpause) BMI paws2 \ If there is no key press in the key logger entry, jump \ to paws2 to return from the subroutine CMP #2 \ If A <> 2 then COPY is not being pressed, so jump to BNE paws2 \ paws2 to check for DELETE \ If we get here then COPY is being pressed, so we need \ to pause the game ROR gamePaused \ Set bit 7 of gamePaused to indicate that the game is \ paused (this works because the CMP above returned an \ equality, so the C flag is set and ready to be rotated \ into bit 7 of gamePaused) LDA #8 \ Update the scanner so it's filled with green, to show JSR UpdateScannerNow \ that the game is paused (calling UpdateScannerNow \ ensures the scanner is updated irrespective of whether \ the scanner is currently enabled in-game) JSR FlushSoundBuffers \ Flush all four sound channel buffers .paws1 LDA keyLogger+3 \ Set A to the key logger entry for "7", "8", COPY and \ DELETE (volume down, volume up, pause, unpause) CMP #3 \ If A <> 3 then DELETE is not being pressed, so jump BNE paws1 \ paws1 to check for key presses (or wait until no key \ is being pressed) LDA #0 \ Update the scanner so it's filled with black, so the JSR UpdateScannerNow \ game can resume with a blank scanner (calling \ UpdateScannerNow ensures the scanner is updated \ irrespective of whether the scanner is currently \ enabled in-game) LSR gamePaused \ Clear bit 7 of gamePaused to indicate that the game is \ unpaused .paws2 RTS \ Return from the subroutine