![]() |
Routines |
| Prev: 800A | Up: Map | Next: 80D1 |
|
Rebuilds the menu window, shows the hall of fame, then loops on the game selection keys until "6" starts a game.
|
||||||||||||||||||||
| Game_Restart | 802C | CALL CreateWindow | Call CreateWindow. | |||||||||||||||||
| 802F | CALL HallOfFame | Call HallOfFame. | ||||||||||||||||||
| 8032 | CALL CreateWindow | Call CreateWindow. | ||||||||||||||||||
|
Draw the menu, then read keys "1"-"5".
|
||||||||||||||||||||
| GameSelect_Loop | 8035 | CALL GameMenu | Call GameMenu. | |||||||||||||||||
| 8038 | LD A,$F7 | Read from the keyboard;
|
||||||||||||||||||
| 803A | OUT ($FD),A | |||||||||||||||||||
| 803C | IN A,($FE) | |||||||||||||||||||
| 803E | CPL | Flip the bits. | ||||||||||||||||||
| 803F | LD E,A | Store the key bits for the tests below. | ||||||||||||||||||
| 8040 | LD A,($5E00) | Copy GameOptions to PreviousGameOptions. | ||||||||||||||||||
| 8043 | LD ($5E7C),A | |||||||||||||||||||
|
Handle 1UP selection.
|
||||||||||||||||||||
| GameSelect_CheckP1 | 8046 | BIT 0,E | Jump to GameSelect_CheckP2 if "1" was not pressed. | |||||||||||||||||
| 8048 | JR Z,GameSelect_CheckP2 | |||||||||||||||||||
| 804A | RES 0,A | Set a 1UP game. | ||||||||||||||||||
|
Handle 2UP selection.
|
||||||||||||||||||||
| GameSelect_CheckP2 | 804C | BIT 1,E | Jump to GameSelect_CheckKeyboard if "2" was not pressed. | |||||||||||||||||
| 804E | JR Z,GameSelect_CheckKeyboard | |||||||||||||||||||
| 8050 | SET 0,A | Set a 2UP game. | ||||||||||||||||||
|
Handle Keyboard selection.
|
||||||||||||||||||||
| GameSelect_CheckKeyboard | 8052 | BIT 2,E | Jump to GameSelect_CheckKempston if "3" was not pressed. | |||||||||||||||||
| 8054 | JR Z,GameSelect_CheckKempston | |||||||||||||||||||
| 8056 | AND %11111001 | Set the control method to keyboard. | ||||||||||||||||||
|
Handle Kempston Joystick selection.
|
||||||||||||||||||||
| GameSelect_CheckKempston | 8058 | BIT 3,E | Jump to GameSelect_CheckCursor if "4" was not pressed. | |||||||||||||||||
| 805A | JR Z,GameSelect_CheckCursor | |||||||||||||||||||
| 805C | AND %11111001 | Clear the control method bits. | ||||||||||||||||||
| 805E | OR %00000010 | Set the control method to Kempston. | ||||||||||||||||||
|
Handle Cursor Joystick selection.
|
||||||||||||||||||||
| GameSelect_CheckCursor | 8060 | BIT 4,E | Jump to GameSelect_StartGame if "5" was not pressed. | |||||||||||||||||
| 8062 | JR Z,GameSelect_StartGame | |||||||||||||||||||
| 8064 | AND %11111001 | Clear the control method bits. | ||||||||||||||||||
| 8066 | OR %00000100 | Set the control method to cursor. | ||||||||||||||||||
|
Write the options back, then test "6" to start.
|
||||||||||||||||||||
| GameSelect_StartGame | 8068 | LD ($5E00),A | Write the updated options to GameOptions. | |||||||||||||||||
| 806B | LD A,$EF | Read from the keyboard;
|
||||||||||||||||||
| 806D | OUT ($FD),A | |||||||||||||||||||
| 806F | IN A,($FE) | |||||||||||||||||||
| 8071 | CPL | Flip the bits. | ||||||||||||||||||
| 8072 | BIT 4,A | Jump to StartGame if "6" was pressed. | ||||||||||||||||||
| 8074 | JP NZ,StartGame | |||||||||||||||||||
|
Queue a jingle if the player count or control method changed since the last pass.
|
||||||||||||||||||||
| 8077 | LD A,($5E00) | Copy the current game options into C. | ||||||||||||||||||
| 807A | LD C,A | |||||||||||||||||||
| 807B | LD A,($5E7C) | Compare them with PreviousGameOptions. | ||||||||||||||||||
| 807E | XOR C | |||||||||||||||||||
| 807F | PUSH AF | Stash the changed-option flags on the stack. | ||||||||||||||||||
| 8080 | BIT 0,A | Call QueueMenuTune if the player count has changed. | ||||||||||||||||||
| 8082 | CALL NZ,QueueMenuTune | |||||||||||||||||||
| 8085 | POP AF | Restore the changed-option flags from the stack. | ||||||||||||||||||
| 8086 | AND %00000110 | Keep only the control method bits. | ||||||||||||||||||
| 8088 | JR Z,Game_Restart_FlashSelection | Jump to Game_Restart_FlashSelection if the control method is unchanged. | ||||||||||||||||||
|
Queue the jingle for the newly selected control method.
|
||||||||||||||||||||
| 808A | LD DE,$BA9E | Set the tune table pointer to Menu_Tune_Table. | ||||||||||||||||||
| 808D | LD A,C | Fetch the current game options. | ||||||||||||||||||
| 808E | AND %00000110 | Keep only the control method bits. | ||||||||||||||||||
| 8090 | LD L,A | Create an offset in HL. | ||||||||||||||||||
| 8091 | LD H,$00 | |||||||||||||||||||
| 8093 | ADD HL,DE | Point HL at the matching entry in Menu_Tune_Table. | ||||||||||||||||||
| 8094 | LD E,(HL) | Fetch the control-method jingle address. | ||||||||||||||||||
| 8095 | INC HL | |||||||||||||||||||
| 8096 | LD D,(HL) | |||||||||||||||||||
| 8097 | CALL QueueTune | Queue the control-method jingle. | ||||||||||||||||||
|
Flash the selected 1UP/ 2UP and control-method lines.
|
||||||||||||||||||||
| Game_Restart_FlashSelection | 809A | LD HL,$810F | HL=GameSelection_Attributes_Options (the first selectable line, skipping the title). | |||||||||||||||||
| 809D | LD A,($5E00) | Copy the current game options into C. | ||||||||||||||||||
| 80A0 | LD C,A | |||||||||||||||||||
| 80A1 | BIT 0,C | Jump to Game_Restart_Flash2UP if this is a 2UP game. | ||||||||||||||||||
| 80A3 | JR NZ,Game_Restart_Flash2UP | |||||||||||||||||||
| 80A5 | CALL MenuAttributeSetUnset | Call MenuAttributeSetUnset. | ||||||||||||||||||
|
Flash the line for the selected control method and clear the other two.
|
||||||||||||||||||||
| MenuAttributeHandler | 80A8 | LD B,$03 | Set a control method counter in B for 03 loops. | |||||||||||||||||
| 80AA | LD A,C | Fetch the options and move the control bits into bits 0-1. | ||||||||||||||||||
| 80AB | RRCA | |||||||||||||||||||
| MenuAttributeHandler_Loop | 80AC | AND %00000011 | Keep only bits 0-1. | |||||||||||||||||
| 80AE | JR Z,Game_Restart_FlashControlMethod | Jump to Game_Restart_FlashControlMethod if this control method is selected. | ||||||||||||||||||
| 80B0 | CALL MenuAttributeUnSetFirst | Call MenuAttributeUnSetFirst. | ||||||||||||||||||
| GameSelect_ReadOptions | 80B3 | DEC A | Decrease the method bits and loop back to MenuAttributeHandler_Loop until all three lines are updated. | |||||||||||||||||
| 80B4 | DJNZ MenuAttributeHandler_Loop | |||||||||||||||||||
| 80B6 | JP GameSelect_Loop | Jump to GameSelect_Loop. | ||||||||||||||||||
|
Flash the selected control-method line.
|
||||||||||||||||||||
| Game_Restart_FlashControlMethod | 80B9 | CALL MenuAttributeSetFirst | Call MenuAttributeSetFirst. | |||||||||||||||||
| 80BC | JR GameSelect_ReadOptions | Jump to GameSelect_ReadOptions. | ||||||||||||||||||
|
Flash the 2UP line, then handle the control methods.
|
||||||||||||||||||||
| Game_Restart_Flash2UP | 80BE | CALL MenuAttributeUnsetSet | Call MenuAttributeUnsetSet. | |||||||||||||||||
| 80C1 | JR MenuAttributeHandler | Jump to MenuAttributeHandler. | ||||||||||||||||||
|
Flash this menu line and clear FLASH on the next.
|
||||||||||||||||||||
| MenuAttributeSetUnset | 80C3 | SET 7,(HL) | Set the FLASH attribute for this menu line. | |||||||||||||||||
| 80C5 | INC HL | Move onto the next menu attribute. | ||||||||||||||||||
| MenuAttributeUnSetFirst | 80C6 | RES 7,(HL) | Clear the FLASH attribute for this menu line. | |||||||||||||||||
| 80C8 | INC HL | Move onto the next menu attribute. | ||||||||||||||||||
| 80C9 | RET | Return. | ||||||||||||||||||
|
Clear FLASH on this menu line and set it on the next.
|
||||||||||||||||||||
| MenuAttributeUnsetSet | 80CA | RES 7,(HL) | Clear the FLASH attribute for this menu line. | |||||||||||||||||
| 80CC | INC HL | Move onto the next menu attribute. | ||||||||||||||||||
| MenuAttributeSetFirst | 80CD | SET 7,(HL) | Set the FLASH attribute for this menu line. | |||||||||||||||||
| 80CF | INC HL | Move onto the next menu attribute. | ||||||||||||||||||
| 80D0 | RET | Return. | ||||||||||||||||||
| Prev: 800A | Up: Map | Next: 80D1 |