Prev: 26977 Up: Map Next: 27026
26982: Pause Border Effect
Used by the routine at Game_Initialise.
Displays a rainbow-like cycling colour border while waiting for the player to press "S" to unpause the game.
Pause_BorderEffect 26982 EI Enable interrupts.
26983 LD B,20 Pause for 20 frames to give the player a moment before the effect begins.
Pause_BorderEffect_ShortLoop 26985 HALT
26986 DJNZ Pause_BorderEffect_ShortLoop
Pause_BorderEffect_ColourCycle 26988 LD B,14 Set a frame counter in B of 14 frames.
26990 HALT Halt operation (suspend CPU until the next interrupt).
Derive a border colour (0-7) from the current frame loop counter.
Pause_BorderEffect_ColourLoop 26991 LD A,B Load A with bits 0-2 of the current frame counter value. This limits the value to be between 0-7 (i.e. the colour palette).
26992 AND %00000111
26994 PUSH BC Stash the frame counter on the stack.
Pause_Border_PauseLoop_01 26995 DJNZ Pause_Border_PauseLoop_01 Decrease the frame counter by one and loop until the counter is zero.
26997 POP BC Restore the frame counter from the stack.
26998 PUSH BC But keep a copy of it back on the stack.
26999 LD B,0 Set B to 0 which increases the size of the counter.
Pause_Border_PauseLoop_02 27001 DJNZ Pause_Border_PauseLoop_02 Decrease the frame counter by one and loop again until the counter is zero.
27003 POP BC Restore the frame counter from the stack.
27004 OUT (254),A Set border to the colour held by A.
27006 DJNZ Pause_BorderEffect_ColourLoop Decrease counter by one and loop back to Pause_BorderEffect_ColourLoop until counter is zero.
27008 LD A,253 Read from the keyboard;
Port Number Bit
0 1 2 3 4
253 A S D F G
27010 IN A,(254)
27012 AND %00000010 Keep only the bit which relates to the "S" key (bit 1).
27014 JR NZ,Pause_BorderEffect_ColourCycle Jump back to Pause_BorderEffect_ColourCycle if the "S" key was not pressed.
27016 LD A,253 Read from the keyboard again;
Port Number Bit
0 1 2 3 4
253 A S D F G
StartKey_Debounce 27018 IN A,(254)
27020 AND %00000010 Keep only the bit which relates to the "S" key (bit 1).
27022 JR Z,StartKey_Debounce Jump to StartKey_Debounce until the "S" key has been released.
27024 DI Disable interrupts.
27025 RET Return.
Prev: 26977 Up: Map Next: 27026