Prev: 33695 Up: Map Next: 33913
33706: Game Selection Menu
Used by the routine at GameInitialise.
main-menu
Prints "Select controls".
GameMenu 33706 LD HL,35633 HL=Messaging_SelectControls.
33709 LD DE,20555 DE=20555 (screen buffer location).
33712 CALL Print_String Call Print_String.
33715 LD HL,20587 HL=20587 (screen buffer location).
33718 LD B,15 Underline the header with 15 character blocks of 255.
33720 CALL Underline
Prints "1 User defined keys".
33723 LD HL,35648 HL=Messaging_UserDefinedKeys.
33726 LD DE,20617 DE=20617 (screen buffer location).
33729 CALL Print_String Call Print_String.
Prints "2 Kempston joystick".
33732 LD HL,35667 HL=Messaging_KempstonJoystick.
33735 LD DE,20649 DE=20649 (screen buffer location).
33738 CALL Print_String Call Print_String.
Prints "3 Interface 2".
33741 LD HL,35686 HL=Messaging_Interface2.
33744 LD DE,20681 DE=20681 (screen buffer location).
33747 CALL Print_String Call Print_String.
Prints "4 Cursor key type J/S".
33750 LD HL,35699 HL=Messaging_CursorKeys.
33753 LD DE,20713 DE=20713 (screen buffer location).
33756 CALL Print_String Call Print_String.
Handle retrieving the players input.
GameMenu_InputLoop 33759 LD BC,63486 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
33762 IN A,(C)
33764 OR %11100000 Set bits 5-7 (to fill in the extra bits).
33766 CP 255 Jump to GameMenu_HandleInput if any of the keys have been pressed.
33768 JR NZ,GameMenu_HandleInput
33770 LD B,5 Call 32853 with a count of 5.
33772 CALL 32853
33775 JR GameMenu_InputLoop Jump to GameMenu_InputLoop.
Process the players input.
GameMenu_HandleInput 33777 CP 254 Jump to SetUserDefinedKeys if A is equal to 254.
33779 JR Z,SetUserDefinedKeys
Was Kempston joystick selected?
33781 LD HL,36437 HL=KeyMap_Kempston.
33784 CP 253 Jump to SetKempstonJoystick if A is equal to 253.
33786 JR Z,SetKempstonJoystick
Was Interface 2 joystick selected?
33788 LD HL,36452 HL=KeyMap_Interface2.
33791 CP 251 Jump to SetNoOperation if A is equal to 251.
33793 JR Z,SetNoOperation
Was the Cursor joystick selected?
33795 LD HL,36467 HL=KeyMap_CursorKeys.
33798 CP 247 Jump back to GameMenu_InputLoop if the cursor joystick was not selected.
33800 JR NZ,GameMenu_InputLoop
Self-modifying code. See; HandleControlBits.
SetNoOperation 33802 LD A,0 Write 0 (NOP) to *HandleControlBits.
SetActiveKeyMap 33804 LD (34292),A Write A to *HandleControlBits.
33807 LD DE,61408 Copy 0015 bytes from *HL to *ActiveKeyMap.
33810 LD BC,15
33813 LDIR
33815 RET Return.
Self-modifying code. See; HandleControlBits.
Invert the bits in the controls routine.
SetKempstonJoystick 33816 LD A,47 A=47 (CPL) to *HandleControlBits.
33818 JR SetActiveKeyMap Jump to SetActiveKeyMap.
Self-modifying code. See; HandleControlBits.
SetUserDefinedKeys 33820 LD A,0 Write 0 (NOP) to *HandleControlBits.
33822 LD (34292),A
33825 CALL ClearBottomScreenArea Call ClearBottomScreenArea.
Prints "Please select ".
33828 LD HL,35720 HL=Messaging_PleaseSelectKeys.
33831 LD DE,20647 DE=20647 (screen buffer location).
33834 CALL Print_String Call Print_String.
Cycle through each key/ key messaging to collect the user input:
Using "right key", "down key", "left key", "up key" and "fire key" strings.
33837 LD HL,35734 HL=Messaging_RedefineKeys_Right.
33840 LD B,5 Store a counter in B of 5 for how many strings to print.
33842 LD IX,61408 IX=ActiveKeyMap.
SetKeys_Loop 33846 PUSH BC Stash the string counter and active keymap position on the stack.
33847 PUSH IX
33849 LD DE,20661 DE=20661 (screen buffer location).
33852 CALL Print_String Call Print_String.
33855 PUSH HL Stash the messaging pointer on the stack.
GameMenu_0 33856 CALL PauseCheck Call PauseCheck.
GameMenu_1 33859 LD B,5 Call 32853 with a count of 5.
33861 CALL 32853
33864 LD BC,65278 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 SHIFT Z X C V
GameMenu_2 33867 IN A,(C)
33869 OR %11100000 Set bits 5-7 (to fill in the extra bits).
33871 CP 255 Jump to GameMenu_3 if any of the keys have been pressed.
33873 JR NZ,GameMenu_3
33875 RLC B Rotate B left (with carry).
33877 JR C,GameMenu_2 Jump to GameMenu_2 if A is lower.
33879 JR GameMenu_1 Jump to GameMenu_1.
GameMenu_3 33881 CPL Invert the bits in A.
33882 AND %00011111 Keep only bits 0-4.
33884 LD E,A E=A.
GameMenu_4 33885 RRA RRA.
33886 JR NC,GameMenu_4 Jump to GameMenu_4 if A is higher.
33888 CP 0 Jump to GameMenu_0 if A is not equal to 0.
33890 JR NZ,GameMenu_0
33892 POP HL Restore the messaging pointer and active keymap position from the stack.
33893 POP IX
33895 LD (IX+0),C Write the keymap data to the current active key.
33898 LD (IX+1),B
33901 LD (IX+2),E
33904 LD BC,3 Add 0003 to IX to move to the next key.
33907 ADD IX,BC
33909 POP BC Restore the string counter from the stack.
33910 DJNZ SetKeys_Loop Decrease the string counter by one and loop back to SetKeys_Loop until all keys have been collected.
33912 RET Return.
Prev: 33695 Up: Map Next: 33913