Prev: 24320 Up: Map Next: 24428
24327: Game Initialisation
Blank the game configs.
GameInitialisation 24327 LD HL,24064 Write 0 to 163 bytes starting from 24064.
24330 LD DE,24065
24333 LD BC,163
24336 LD (HL),0
24338 LDIR
24340 LD HL,65535 Write 65535 to BestTime - this isn't used anywhere until Flag_BestTime is set.
24343 LD (24064),HL
This entry point is used by the routine at GameOver.
Game_Restart 24346 LD HL,65535 Write 65535 to PlayerWorldPosition.
24349 LD (24116),HL
24352 LD SP,24064 Set the stack pointer to 24064.
24355 CALL SetDayAttributes Call SetDayAttributes.
24358 CALL CreateWindow Call CreateWindow.
GameSelect_Loop 24361 CALL GameMenu Call GameMenu.
The "Best Time Today" banner only shows when one is set. The flag at Flag_BestTime toggles it on/ off.
24364 LD A,(24067) If Flag_BestTime is not zero, call DisplayBestTime.
24367 AND A
24368 CALL NZ,DisplayBestTime
24371 LD A,(24126) D=GameOptions.
24374 LD D,A
24375 LD A,247 Read from the keyboard;
Port Number Bit
0 1 2 3 4
247 1 2 3 4 5
24377 OUT (253),A
24379 IN A,(254)
24381 CPL Flip the bits.
Handle keyboard selection.
GameSelect_CheckKeyboard 24382 BIT 0,A Has key "1" been pressed? ("1 KEYBOARD").
24384 JR Z,GameSelect_CheckJoystick If not jump to GameSelect_CheckJoystick.
24386 RES 1,D Set control method = keyboard.
Handle joystick selection.
GameSelect_CheckJoystick 24388 BIT 1,A Has key "2" been pressed? ("2 JOYSTICK").
24390 JR Z,GameSelect_CheckStart If not jump to GameSelect_CheckStart.
24392 SET 1,D Set control method = joystick.
Handle starting a new game.
GameSelect_CheckStart 24394 BIT 2,A Has key "3" been pressed? ("3 START GAME").
24396 JP NZ,StartGame If it has then jump to StartGame.
Handle flashing each selection.
24399 LD A,D Write D to GameOptions.
24400 LD (24126),A
24403 LD HL,24488 HL=GameSelection_Attributes + 1 (i.e. ignoring "Game Selection" as it doesn't flash).
24406 LD A,(24126) C=GameOptions.
24409 LD C,A
24410 BIT 1,C If the joystick option is selected, jump to MenuAttributeSetSecond.
24412 JR NZ,MenuAttributeSetSecond
Set the first menu item, unset the second.
MenuAttributeSetFirst 24414 SET 7,(HL) Set the FLASH attribute for the first selection.
24416 INC HL Move onto the next menu attribute.
24417 RES 7,(HL) Unset the FLASH attribute for the second selection.
24419 JR GameSelect_Loop Jump to GameSelect_Loop.
Unset the first menu item, set the second.
MenuAttributeSetSecond 24421 RES 7,(HL) Unset the FLASH attribute for the first selection.
24423 INC HL Move onto the next menu attribute.
24424 SET 7,(HL) Set the FLASH attribute for the second selection.
24426 JR GameSelect_Loop Jump to GameSelect_Loop.
View the equivalent code in;
Prev: 24320 Up: Map Next: 24428