Prev: 31767 Up: Map Next: 31888
31769: Game Entry Point
Used by the routine at SecurityCheck.
GameInitialisation 31769 LD HL,24064 Write 0 to 16 bytes, from GameOptions to 24080.
31772 LD B,16
GameInitialisation_Loop 31774 LD (HL),0
31776 INC HL
31777 DJNZ GameInitialisation_Loop
31779 LD HL,48716 Write MainFont to FontPointer.
31782 LD (24065),HL
This entry point is used by the routine at GameOver.
Game_Restart 31785 CALL ClearScreen Call ClearScreen.
31788 CALL MenuIcons Call MenuIcons.
GameSelect_Loop 31791 CALL GameMenu Call GameMenu.
31794 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
31796 OUT (253),A
31798 IN A,(254)
31800 CPL Flip the bits.
31801 LD E,A E=A.
31802 LD A,(24064) A=GameOptions.
Handle Keyboard selection.
31805 BIT 0,E Has key "1" been pressed? ("KEYBOARD").
31807 JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
31809 AND %11111001 Keep only bits 0, 3-7.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 31811 BIT 1,E Has key "2" been pressed? ("KEMPSTON JOYSTICK").
31813 JR Z,GameSelect_CheckCursor If not jump to GameSelect_CheckCursor.
31815 AND %11111001 Keep only bits 0, 3-7.
31817 OR %00000010 Set control method = 2.
Handle Cursor Joystick selection.
GameSelect_CheckCursor 31819 BIT 2,E Has key "3" been pressed? ("CURSOR JOYSTICK").
31821 JR Z,GameSelect_CheckKnight If not jump to GameSelect_CheckKnight.
31823 AND %11111001 Keep only bits 0, 3-7.
31825 OR %00000100 Set control method = 4.
Handle "Knight" selection.
GameSelect_CheckKnight 31827 BIT 3,E Has key "4" been pressed? ("KNIGHT").
31829 JR Z,GameSelect_CheckWizard If not jump to GameSelect_CheckWizard.
31831 AND %11100111 Keep only bits 0-2, 5-7.
Handle "Wizard" selection.
GameSelect_CheckWizard 31833 BIT 4,E Has key "5" been pressed? ("WIZARD").
31835 JR Z,GameInitialisation_0 If not jump to GameInitialisation_0.
31837 AND %11100111 Keep only bits 0-2, 5-7.
31839 OR %00001000 Set player = 8.
GameInitialisation_0 31841 LD D,A
31842 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
31844 OUT (253),A
31846 IN A,(254)
31848 CPL Flip the bits.
31849 LD E,A
31850 LD A,D
Handle choosing "Serf".
GameSelect_CheckSerf 31851 BIT 4,E Has key "6" been pressed? ("SERF").
31853 JR Z,GameInitialisation_1 If not skip to GameInitialisation_1.
31855 AND %11100111 Keep only bits 0-2, 5-7.
31857 OR %00010000 Set bit 4.
GameInitialisation_1 31859 LD (24064),A
31862 LD C,A
Handle starting a new game.
GameSelect_Start 31863 BIT 0,E Has key "0" been pressed? ("START GAME").
31865 JP NZ,StartGame If so, jump to StartGame.
31868 LD HL,31978 HL=GameSelection_Attributes.
31871 LD B,3 B=3 (counter).
31873 LD A,C A=C.
31874 CALL 31888 Call 31888.
31877 LD B,3 B=3 (counter).
31879 LD A,C A=C / 4.
31880 RRCA
31881 RRCA
31882 CALL 31888 Call 31888.
31885 JP GameSelect_Loop Jump to GameSelect_Loop.
View the equivalent code in;
Prev: 31767 Up: Map Next: 31888