Routines |
Prev: 37637 | Up: Map | Next: 37966 |
Used by the routines at GameEntryPoint, Messaging_YouWin, 41586, StartMenu and Handler_OpponentWins.
|
|||||
|
|||||
MainMenu | 37695 | XOR A | Write 0 to; | ||
37696 | LD (39723),A | ||||
37699 | LD (39607),A | ||||
37702 | CALL 51998 | Call 51998. | |||
Zero the displayed score.
|
|||||
37705 | LD HL,37294 | HL=37294. | |||
37708 | LD DE,37295 | DE=37295. | |||
37711 | LD BC,5 | BC=0005. | |||
37714 | LD (HL),48 | Write "0" to the first digit in Messaging_Score. | |||
37716 | LDIR | Copy the zero to the next five digits. | |||
Print the menu options.
|
|||||
37718 | CALL PrintString_Loop | Call PrintString_Loop. | |||
37721 | DEFB 0 | CLEAR SCREEN. | |||
37722 | DEFB 16,0 | INK: BLACK. | |||
37724 | DEFB 17,0 | PAPER: BLACK. | |||
37726 | DEFB 22,5,7 | PRINT AT: 5, 7. | |||
37729 | DEFM "1 KEYBOARD" | ||||
37739 | DEFB 22,7,7 | PRINT AT: 7, 7. | |||
37742 | DEFM "2 KEMPSTON JOYSTICK" | ||||
37761 | DEFB 22,9,7 | PRINT AT: 9, 7. | |||
37764 | DEFM "3 INTERFACE TWO " | ||||
37780 | DEFB 22,11,7 | PRINT AT: 11, 7. | |||
37783 | DEFM "4 CURSOR JOYSTICK " | ||||
37801 | DEFB 22,13,7 | PRINT AT: 13, 7. | |||
37804 | DEFM "5 REDEFINE KEYS" | ||||
37819 | DEFB 22,18,7 | PRINT AT: 18, 7. | |||
37822 | DEFM "0 START GAME" | ||||
37834 | DEFB 255 | Terminator. | |||
Display the header and footer messaging.
|
|||||
37835 | CALL Messaging_HeaderFooter | Call Messaging_HeaderFooter. | |||
Set the bright white colouring.
|
|||||
37838 | CALL SetAttributeBuffer_WhiteInk | Call SetAttributeBuffer_WhiteInk. | |||
Now begin setting up the dart pointer.
|
|||||
37841 | LD HL,1281 | Set the initial position of the dart pointer to HL (1281). | |||
37844 | LD B,4 | Set a counter in B for the width of the dart pointer. | |||
Clear the attributes of all possible positions of the dart pointer.
|
|||||
ClearDartPointerAttributePositions | 37846 | PUSH BC | Stash the dart width counter and dart co-ordinates on the stack. | ||
37847 | PUSH HL | ||||
37848 | CALL ClearDartPointerAttributes | Call ClearDartPointerAttributes. | |||
37851 | POP HL | Restore the dart co-ordinates from the stack. | |||
37852 | INC H | Move down two rows (the height of the dart pointer). | |||
37853 | INC H | ||||
37854 | POP BC | Restore the dart width counter from the stack. | |||
37855 | DJNZ ClearDartPointerAttributePositions | Decrease the dart width counter by one and loop back to ClearDartPointerAttributePositions until the counter is zero. | |||
Initialise the dart pointer.
|
|||||
37857 | LD DE,1280 | Set the initial position of the dart pointer to DE (1280). | |||
37860 | LD B,4 | Set a counter in B for the width of the dart pointer. | |||
DrawDartPointer_Loop | 37862 | PUSH BC | Stash the dart width counter and dart co-ordinates on the stack. | ||
37863 | PUSH DE | ||||
37864 | CALL MainMenu_PrintDartPointer | Call MainMenu_PrintDartPointer. | |||
37867 | POP DE | Restore the dart co-ordinates and dart width counter from the stack. | |||
37868 | POP BC | ||||
37869 | INC D | Increment D by two. | |||
37870 | INC D | ||||
37871 | DJNZ DrawDartPointer_Loop | Decrease the dart width counter by one and loop back to DrawDartPointer_Loop until the counter is zero. | |||
ColourDartPointerAttributes_Loop | 37873 | CALL MainMenu_ColourDartPointer | Call MainMenu_ColourDartPointer. | ||
37876 | CALL 38495 | Call 38495. | |||
37879 | PUSH AF | Stash AF on the stack. | |||
37880 | POP AF | Restore AF from the stack. | |||
37881 | JR Z,ColourDartPointerAttributes_Loop | Jump to ColourDartPointerAttributes_Loop if D is equal to 4. | |||
Has the player hit "Start Game"?
|
|||||
37883 | CP 48 | Jump to MainMenu_Next if "0" was not pressed (ASCII 48 is "0"). | |||
37885 | JR NZ,MainMenu_Next | ||||
A game was started...
|
|||||
37887 | CALL Sound_MenuTick | Call Sound_MenuTick. | |||
Consolidate the selected configs.
|
|||||
37890 | LD A,(39414) | Write *DartPointer_Position to *ControlType. | |||
37893 | LD (39413),A | ||||
Then play an absolutely stunning reveal animation!
First calculate the co-ordinates of the selected menu item.
|
|||||
37896 | ADD A,A | The menu items are spaced two rows apart, so double the value in A and also they start five rows from the top of the screen so add that too and store the result in D. | |||
37897 | ADD A,5 | ||||
37899 | LD D,A | ||||
37900 | LD E,1 | The dart graphic is indented by one column - store this in E. | |||
Initialise the animation counter.
|
|||||
37902 | LD B,62 | Set a counter in B of the number of loops to complete the animation (62). | |||
The main animation loop. Each iteration reveals one more column of the transition.
|
|||||
RevealDartboard_AnimationLoop | 37904 | PUSH BC | Stash the reveal loop counter and dart pointer co-ordinates on the stack. | ||
37905 | PUSH DE | ||||
Synchronise with the screen refresh so the animation is smooth.
|
|||||
37906 | HALT | Halt operation (suspend CPU until the next interrupt). | |||
37907 | CALL MainMenu_PrintDartPointer | Call MainMenu_PrintDartPointer. | |||
37910 | POP HL | Restore the dart pointer co-ordinates from the stack into HL. | |||
37911 | PUSH HL | But keep a copy on the stack for later. | |||
37912 | INC L | Move the dart pointer right one position. | |||
Draw the dart pointer at the new position.
|
|||||
37913 | CALL PrintDartPointer | Call PrintDartPointer. | |||
Process one step of the reveal.
|
|||||
37916 | POP DE | Restore the dart pointer co-ordinates from the stack into DE. | |||
37917 | PUSH DE | But keep a copy on the stack for later. | |||
37918 | CALL RevealDartboard | Call RevealDartboard. | |||
37921 | POP DE | Restore the dart pointer co-ordinates from the stack. | |||
37922 | INC E | Move the dart pointer right one position. | |||
37923 | POP BC | Restore the reveal loop counter from the stack. | |||
37924 | DJNZ RevealDartboard_AnimationLoop | Decrease the reveal loop counter by one and loop back to RevealDartboard_AnimationLoop until the dartboard is fully revealed. | |||
The reveal animation is now complete!
|
|||||
37926 | JP Initialise_DartboardMenu | Jump to Initialise_DartboardMenu. | |||
MainMenu_Next | 37929 | CP 54 | Jump to ColourDartPointerAttributes_Loop if A is greater than (ASCII 54 is "6"). | ||
37931 | JP NC,ColourDartPointerAttributes_Loop | ||||
37934 | CP 48 | Jump to ColourDartPointerAttributes_Loop if A is less than (ASCII 48 is "0"). | |||
37936 | JP C,ColourDartPointerAttributes_Loop | ||||
37939 | SUB 49 | A-=49. | |||
37941 | PUSH AF | Stash AF on the stack. | |||
37942 | CALL ClearCurrentDartPointerAttributes | Call ClearCurrentDartPointerAttributes. | |||
37945 | CALL Sound_MenuTick | Call Sound_MenuTick. | |||
37948 | POP AF | Restore AF from the stack. | |||
37949 | LD (39414),A | Write A to *DartPointer_Position. | |||
37952 | CP 4 | Jump to ColourDartPointerAttributes_Loop if A is not equal to 4. | |||
37954 | JP NZ,ColourDartPointerAttributes_Loop | ||||
37957 | CALL Messaging_RedefineKeys | Call Messaging_RedefineKeys. | |||
37960 | CALL Debounce_CheckKeys | Call Debounce_CheckKeys. | |||
37963 | JP MainMenu | Jump to MainMenu. |
Prev: 37637 | Up: Map | Next: 37966 |