Prev: F8BE Up: Map Next: F916
F8CF: Controls: Pause/ Quit Game
Used by the routine at GameEntryPoint.
In-game Holding down "SHIFT" and pressing 1, 2 or 3 has the following effect:
Key 1 Key 2 Action
"SHIFT" "1" Pause
"SHIFT" "2" Resume
"SHIFT" "3" Quite
Controls_PauseQuit F8CF LD A,$FE
Port Number Bit
0 1 2 3 4
FE SHIFT Z X C V
F8D1 CALL ReadKeyboard Call ReadKeyboard.
F8D4 CP $01 Return if "SHIFT" is not being pressed.
F8D6 RET NZ
"SHIFT" is being held down here. Test for the number keys.
F8D7 CALL ReadKeyboard_1234 Call ReadKeyboard_1234.
F8DA CP $04 Jump to QuitGame if "3" is being pressed.
F8DC JR Z,QuitGame
F8DE CP $01 Return if "1" is not being pressed.
F8E0 RET NZ
If "1" is being pressed - this is where the "in-game pause" loop begins.
PauseGame_Loop F8E1 LD A,$FE
Port Number Bit
0 1 2 3 4
FE SHIFT Z X C V
F8E3 CALL ReadKeyboard Call ReadKeyboard.
F8E6 CP $01 Test for "SHIFT"...
F8E8 LD B,$06 B=06.
F8EA JR NZ,GamePaused Jump to GamePaused if "SHIFT" is not being pressed.
F8EC CALL ReadKeyboard_1234 Call ReadKeyboard_1234.
F8EF CP $04 Jump to TestFor_ResumeGame if "3" (quit) is not being pressed.
F8F1 JR NZ,TestFor_ResumeGame
Action quitting the game.
QuitGame F8F3 LD A,$01 Write 01 to *Game_State.
F8F5 LD ($D3FD),A
To resume the game we just reset the border colour and RETurn from the pause loop.
ResumeGame F8F8 XOR A Set the border to BLACK.
F8F9 OUT ($FE),A
F8FB RET Return.
The game is in the pause loop so test if we want to resume.
TestFor_ResumeGame F8FC CP $02 Jump to ResumeGame if "2" is being pressed.
F8FE JR Z,ResumeGame
F900 LD B,$06 B=06.
Creates a nice border pattern.
GamePaused F902 LD A,B A=B.
F903 OUT ($FE),A Change border very quickly to create a rainbow effect.
F905 OUT ($FE),A
F907 DJNZ GamePaused Decrease counter by one and loop back to GamePaused until counter is zero.
F909 CALL ReadKeyboard_1234 Call ReadKeyboard_1234.
F90C JR PauseGame_Loop Loop back to PauseGame_Loop.
Testing for the number keys.
ReadKeyboard_1234 F90E LD A,$F7
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
ReadKeyboard F910 IN A,($FE) Read from the keyboard.
F912 CPL Invert the bits in A.
F913 AND %00001111 Keep only bits 0-3.
F915 RET Return.
Prev: F8BE Up: Map Next: F916