Prev: B346 Up: Map Next: B473
B3D5: Handler: Game Menu
Used by the routine at GameInitialisation.
HandlerGameMenu B3D5 LD A,$FF Write FF to FlagHallOfFame.
B3D7 LD ($96B7),A
B3DA CALL ClearPlayArea_Attributes Call ClearPlayArea_Attributes.
B3DD CALL ClearPlayArea Call ClearPlayArea.
B3E0 LD HL,$61C6 HL=Room_Special_MainMenu.
B3E3 CALL DrawRoom Call DrawRoom.
B3E6 CALL GameMenu Call GameMenu.
B3E9 CALL HallOfFameCheck Call HallOfFameCheck.
B3EC LD DE,$BC67 HL=MusicData_GameComplete.
B3EF CALL PlayAudio_WaitKey Call PlayAudio_WaitKey.
HandlerGameMenu_0 B3F2 CALL GameMenu Call GameMenu.
B3F5 LD A,$F7 Read from the keyboard;
Port Number Bit
0 1 2 3 4
F7 1 2 3 4 5
B3F7 OUT ($FD),A
B3F9 IN A,($FE)
B3FB CPL Flip the bits.
B3FC LD E,A Store the result in E.
B3FD LD A,($9692) A=GameOptions.
Handle 1UP game selection.
GameSelect_Check1UP B400 BIT 0,E Has key "1" been pressed? ("1 PLAYER GAME").
B402 JR Z,GameSelect_Check2UP If not jump to GameSelect_Check2UP.
B404 RES 0,A Reset bit 0.
Handle 2UP game selection.
GameSelect_Check2UP B406 BIT 1,E Has key "2" been pressed? ("2 PLAYER GAME").
B408 JR Z,GameSelect_CheckKeyboard If not jump to GameSelect_CheckKeyboard.
B40A SET 0,A Set bit 0.
Handle Keyboard selection.
GameSelect_CheckKeyboard B40C BIT 2,E Has key "3" been pressed? ("KEYBOARD").
B40E JR Z,GameSelect_CheckKempston If not jump to GameSelect_CheckKempston.
B410 AND %11111001 Keep only bits 0, 3-7.
Handle Kempston Joystick selection.
GameSelect_CheckKempston B412 BIT 3,E Has key "4" been pressed? ("KEMPSTON JOYSTICK").
B414 JR Z,GameSelect_CheckCursor If not jump to GameSelect_CheckCursor.
B416 AND %11111001 Keep only bits 0, 3-7.
B418 OR %00000010 Set control method = 02.
Handle Cursor Joystick selection.
GameSelect_CheckCursor B41A BIT 4,E Has key "3" been pressed? ("CURSOR JOYSTICK").
B41C JR Z,HandlerGameMenu_1 If not jump to HandlerGameMenu_1.
B41E AND %11111001 Keep only bits 0, 3-7.
B420 OR %00000100 Set control method = 04.
This entry point is used by the routine at PlayAudio_WaitKey.
HandlerGameMenu_1 B422 LD C,A Temporarily store A (GameOptions) in C.
B423 LD A,$EF Read from the keyboard;
Port Number Bit
0 1 2 3 4
EF 0 9 8 7 6
B425 OUT ($FD),A
B427 IN A,($FE)
B429 CPL Flip the bits.
B42A LD E,A Store the result in E.
B42B LD A,C Restore the previous game options value to A.
Handle Interface II Joystick selection.
GameSelect_CheckInterface2 B42C BIT 4,E Has key "6" been pressed? ("INTERFACE II").
B42E JR Z,HandlerGameMenu_2 If not jump to HandlerGameMenu_2.
B430 OR %00000110 Set control method = 06.
HandlerGameMenu_2 B432 LD ($9692),A Write A to GameOptions.
Handle starting a new game.
GameSelect_Start B435 BIT 0,E Has key "0" been pressed? ("START GAME").
B437 RET NZ If so, return.
B438 CALL HallOfFameCheck Call HallOfFameCheck.
B43B JP HandlerGameMenu_0 Jump to HandlerGameMenu_0.
HallOfFameCheck B43E LD HL,$96B7 HL=FlagHallOfFame.
B441 LD A,($9692) A=GameOptions.
B444 CP (HL)
B445 LD ($96B7),A Write A to FlagHallOfFame.
B448 CALL HandlerHallOfFame Call HandlerHallOfFame.
Handle flashing each selection.
B44B LD HL,$B498 HL=GameSelection_Attributes.
B44E LD A,($9692) A=GameOptions.
B451 LD C,A Temporarily store A (GameOptions) in C.
There are two player options to choose from (1UP or 2UP game).
B452 LD B,$02 B=02.
B454 AND %00000001 Keep only bit 0 (the player options).
B456 CALL HandlerMenuAttributeFlash Call HandlerMenuAttributeFlash.
B459 LD A,C Restore the previous game options value to A.
B45A RRCA Shift off the 1UP/ 2UP player options.
B45B AND %00000011 Keep only bits 0-1 (the control options).
There are four control methods to choose from.
B45D LD B,$04 B=04 (counter).
B45F CALL HandlerMenuAttributeFlash Call HandlerMenuAttributeFlash.
B462 RET Return.
Selection flashing routine.
HandlerMenuAttributeFlash B463 AND A Jump to MenuAttributeUnset if A is zero.
B464 JR NZ,MenuAttributeUnset
MenuAttributeSet B466 SET 7,(HL) Set the FLASH attribute for the current selection.
B468 JR MenuAttributeNext Jump to MenuAttributeNext, we're done here.
HandlerMenuAttributeFlash_Loop B46A DEC A Decrease A by one.
B46B JR Z,MenuAttributeSet Jump to MenuAttributeSet if A is zero.
MenuAttributeUnset B46D RES 7,(HL) Unset the FLASH attribute for the current selection.
MenuAttributeNext B46F INC HL Move onto the next selection attribute.
B470 DJNZ HandlerMenuAttributeFlash_Loop Decrease counter by one and loop back to HandlerMenuAttributeFlash_Loop until counter is zero.
B472 RET Return.
Prev: B346 Up: Map Next: B473