Prev: 45894 Up: Map Next: 46195
46037: Handler: Game Menu
Used by the routine at GameInitialisation.
HandlerGameMenu 46037 LD A,255 Write 255 to FlagHallOfFame.
46039 LD (38583),A
46042 CALL ClearPlayArea_Attributes Call ClearPlayArea_Attributes.
46045 CALL ClearPlayArea Call ClearPlayArea.
46048 LD HL,25030 HL=Room_Special_MainMenu.
46051 CALL DrawRoom Call DrawRoom.
46054 CALL GameMenu Call GameMenu.
46057 CALL HallOfFameCheck Call HallOfFameCheck.
46060 LD DE,48231 HL=MusicData_GameComplete.
46063 CALL PlayAudio_WaitKey Call PlayAudio_WaitKey.
HandlerGameMenu_0 46066 CALL GameMenu Call GameMenu.
46069 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
46071 OUT (253),A
46073 IN A,(254)
46075 CPL Flip the bits.
46076 LD E,A Store the result in E.
46077 LD A,(38546) A=GameOptions.
Handle 1UP game selection.
GameSelect_Check1UP 46080 BIT 0,E Has key "1" been pressed? ("1 PLAYER GAME").
46082 JR Z,GameSelect_Check2UP If not jump to GameSelect_Check2UP.
46084 RES 0,A Reset bit 0.
Handle 2UP game selection.
GameSelect_Check2UP 46086 BIT 1,E Has key "2" been pressed? ("2 PLAYER GAME").
46088 JR Z,GameSelect_CheckKeyboard If not jump to GameSelect_CheckKeyboard.
46090 SET 0,A Set bit 0.
Handle Keyboard selection.
GameSelect_CheckKeyboard 46092 BIT 2,E Has key "3" been pressed? ("KEYBOARD").
46094 JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
46096 AND %11111001 Keep only bits 0, 3-7.
Handle Kempston Joystick selection.
GameSelect_CheckKempston 46098 BIT 3,E Has key "4" been pressed? ("KEMPSTON JOYSTICK").
46100 JR Z,GameSelect_CheckCursor If not jump to GameSelect_CheckCursor.
46102 AND %11111001 Keep only bits 0, 3-7.
46104 OR %00000010 Set control method = 2.
Handle Cursor Joystick selection.
GameSelect_CheckCursor 46106 BIT 4,E Has key "3" been pressed? ("CURSOR JOYSTICK").
46108 JR Z,HandlerGameMenu_1 If not jump to HandlerGameMenu_1.
46110 AND %11111001 Keep only bits 0, 3-7.
46112 OR %00000100 Set control method = 4.
This entry point is used by the routine at PlayAudio_WaitKey.
HandlerGameMenu_1 46114 LD C,A Temporarily store A (GameOptions) in C.
46115 LD A,239 Read from the keyboard;
Port Number Bit
0 1 2 3 4
239 0 9 8 7 6
46117 OUT (253),A
46119 IN A,(254)
46121 CPL Flip the bits.
46122 LD E,A Store the result in E.
46123 LD A,C Restore the previous game options value to A.
Handle Interface II Joystick selection.
GameSelect_CheckInterface2 46124 BIT 4,E Has key "6" been pressed? ("INTERFACE II").
46126 JR Z,HandlerGameMenu_2 If not jump to HandlerGameMenu_2.
46128 OR %00000110 Set control method = 6.
HandlerGameMenu_2 46130 LD (38546),A Write A to GameOptions.
Handle starting a new game.
GameSelect_Start 46133 BIT 0,E Has key "0" been pressed? ("START GAME").
46135 RET NZ If so, return.
46136 CALL HallOfFameCheck Call HallOfFameCheck.
46139 JP HandlerGameMenu_0 Jump to HandlerGameMenu_0.
HallOfFameCheck 46142 LD HL,38583 HL=FlagHallOfFame.
46145 LD A,(38546) A=GameOptions.
46148 CP (HL)
46149 LD (38583),A Write A to FlagHallOfFame.
46152 CALL HandlerHallOfFame Call HandlerHallOfFame.
Handle flashing each selection.
46155 LD HL,46232 HL=GameSelection_Attributes.
46158 LD A,(38546) A=GameOptions.
46161 LD C,A Temporarily store A (GameOptions) in C.
There are two player options to choose from (1UP or 2UP game).
46162 LD B,2 B=2.
46164 AND %00000001 Keep only bit 0 (the player options).
46166 CALL HandlerMenuAttributeFlash Call HandlerMenuAttributeFlash.
46169 LD A,C Restore the previous game options value to A.
46170 RRCA Shift off the 1UP/ 2UP player options.
46171 AND %00000011 Keep only bits 0-1 (the control options).
There are four control methods to choose from.
46173 LD B,4 B=4 (counter).
46175 CALL HandlerMenuAttributeFlash Call HandlerMenuAttributeFlash.
46178 RET Return.
Selection flashing routine.
HandlerMenuAttributeFlash 46179 AND A Jump to MenuAttributeUnset if A is zero.
46180 JR NZ,MenuAttributeUnset
MenuAttributeSet 46182 SET 7,(HL) Set the FLASH attribute for the current selection.
46184 JR MenuAttributeNext Jump to MenuAttributeNext, we're done here.
HandlerMenuAttributeFlash_Loop 46186 DEC A Decrease A by one.
46187 JR Z,MenuAttributeSet Jump to MenuAttributeSet if A is zero.
MenuAttributeUnset 46189 RES 7,(HL) Unset the FLASH attribute for the current selection.
MenuAttributeNext 46191 INC HL Move onto the next selection attribute.
46192 DJNZ HandlerMenuAttributeFlash_Loop Decrease counter by one and loop back to HandlerMenuAttributeFlash_Loop until counter is zero.
46194 RET Return.
Prev: 45894 Up: Map Next: 46195