Prev: 9305 Up: Map Next: 944E
933F: Main Menu
main-menu
MainMenu 933F XOR A Write 00 to;
9340 LD ($9B2B),A
9343 LD ($9AB7),A
9346 CALL $CB1E Call CB1E.
Zero the displayed score.
9349 LD HL,$91AE HL=91AE.
934C LD DE,$91AF DE=91AF.
934F LD BC,$0005 BC=0005.
9352 LD (HL),$30 Write "0" to the first digit in Messaging_Score.
9354 LDIR Copy the zero to the next five digits.
Print the menu options.
main-menu-1
Note; the bright white doesn't happen until later.
9356 CALL PrintString_Loop Call PrintString_Loop.
9359 DEFB $00 CLEAR SCREEN.
935A DEFB $10,$00 INK: BLACK.
935C DEFB $11,$00 PAPER: BLACK.
935E DEFB $16,$05,$07 PRINT AT: 05, 07.
9361 DEFM "1 KEYBOARD" 1-keyboard
936B DEFB $16,$07,$07 PRINT AT: 07, 07.
936E DEFM "2 KEMPSTON JOYSTICK" 2-kempston-joystick
9381 DEFB $16,$09,$07 PRINT AT: 09, 07.
9384 DEFM "3 INTERFACE TWO " 3-interface-two
9394 DEFB $16,$0B,$07 PRINT AT: 0B, 07.
9397 DEFM "4 CURSOR JOYSTICK " 4-cursor-joystick
93A9 DEFB $16,$0D,$07 PRINT AT: 0D, 07.
93AC DEFM "5 REDEFINE KEYS" 5-redefine-keys
93BB DEFB $16,$12,$07 PRINT AT: 12, 07.
93BE DEFM "0 START GAME" 0-start-game
93CA DEFB $FF Terminator.
Display the header and footer messaging.
main-menu-2
93CB CALL Messaging_HeaderFooter Call Messaging_HeaderFooter.
Set the bright white colouring.
main-menu-3
93CE CALL SetAttributeBuffer_WhiteInk Call SetAttributeBuffer_WhiteInk.
Now begin setting up the dart pointer.
93D1 LD HL,$0501 Set the initial position of the dart pointer to HL (0501).
93D4 LD B,$04 Set a counter in B for the width of the dart pointer.
Clear the attributes of all possible positions of the dart pointer.
ClearDartPointerAttributePositions 93D6 PUSH BC Stash the dart width counter and dart co-ordinates on the stack.
93D7 PUSH HL
93D8 CALL ClearDartPointerAttributes Call ClearDartPointerAttributes.
93DB POP HL Restore the dart co-ordinates from the stack.
93DC INC H Move down two rows (the height of the dart pointer).
93DD INC H
93DE POP BC Restore the dart width counter from the stack.
93DF DJNZ ClearDartPointerAttributePositions Decrease the dart width counter by one and loop back to ClearDartPointerAttributePositions until the counter is zero.
Initialise the dart pointer.
93E1 LD DE,$0500 Set the initial position of the dart pointer to DE (0500).
93E4 LD B,$04 Set a counter in B for the width of the dart pointer.
DrawDartPointer_Loop 93E6 PUSH BC Stash the dart width counter and dart co-ordinates on the stack.
93E7 PUSH DE
93E8 CALL MainMenu_PrintDartPointer Call MainMenu_PrintDartPointer.
93EB POP DE Restore the dart co-ordinates and dart width counter from the stack.
93EC POP BC
93ED INC D Increment D by two.
93EE INC D
93EF DJNZ DrawDartPointer_Loop Decrease the dart width counter by one and loop back to DrawDartPointer_Loop until the counter is zero.
ColourDartPointerAttributes_Loop 93F1 CALL MainMenu_ColourDartPointer Call MainMenu_ColourDartPointer.
93F4 CALL $965F Call 965F.
93F7 PUSH AF Stash AF on the stack.
93F8 POP AF Restore AF from the stack.
93F9 JR Z,ColourDartPointerAttributes_Loop Jump to ColourDartPointerAttributes_Loop if D is equal to 04.
Has the player hit "Start Game"?
93FB CP $30 Jump to MainMenu_Next if "0" was not pressed (ASCII 30 is "0").
93FD JR NZ,MainMenu_Next
A game was started...
93FF CALL Sound_MenuTick Call Sound_MenuTick.
Consolidate the selected configs.
9402 LD A,($99F6) Write *DartPointer_Position to *ControlType.
9405 LD ($99F5),A
Then play an absolutely stunning reveal animation!
reveal-dartboard-animation
First calculate the co-ordinates of the selected menu item.
9408 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.
9409 ADD A,$05
940B LD D,A
940C LD E,$01 The dart graphic is indented by one column - store this in E.
Initialise the animation counter.
940E LD B,$3E Set a counter in B of the number of loops to complete the animation (3E).
The main animation loop. Each iteration reveals one more column of the transition.
RevealDartboard_AnimationLoop 9410 PUSH BC Stash the reveal loop counter and dart pointer co-ordinates on the stack.
9411 PUSH DE
Synchronise with the screen refresh so the animation is smooth.
9412 HALT Halt operation (suspend CPU until the next interrupt).
9413 CALL MainMenu_PrintDartPointer Call MainMenu_PrintDartPointer.
9416 POP HL Restore the dart pointer co-ordinates from the stack into HL.
9417 PUSH HL But keep a copy on the stack for later.
9418 INC L Move the dart pointer right one position.
Draw the dart pointer at the new position.
9419 CALL PrintDartPointer Call PrintDartPointer.
Process one step of the reveal.
941C POP DE Restore the dart pointer co-ordinates from the stack into DE.
941D PUSH DE But keep a copy on the stack for later.
941E CALL RevealDartboard Call RevealDartboard.
9421 POP DE Restore the dart pointer co-ordinates from the stack.
9422 INC E Move the dart pointer right one position.
9423 POP BC Restore the reveal loop counter from the stack.
9424 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!
9426 JP Initialise_DartboardMenu Jump to Initialise_DartboardMenu.
MainMenu_Next 9429 CP $36 Jump to ColourDartPointerAttributes_Loop if A is greater than (ASCII 36 is "6").
942B JP NC,ColourDartPointerAttributes_Loop
942E CP $30 Jump to ColourDartPointerAttributes_Loop if A is less than (ASCII 30 is "0").
9430 JP C,ColourDartPointerAttributes_Loop
9433 SUB $31 A-=31.
9435 PUSH AF Stash AF on the stack.
9436 CALL ClearCurrentDartPointerAttributes Call ClearCurrentDartPointerAttributes.
9439 CALL Sound_MenuTick Call Sound_MenuTick.
943C POP AF Restore AF from the stack.
943D LD ($99F6),A Write A to *DartPointer_Position.
9440 CP $04 Jump to ColourDartPointerAttributes_Loop if A is not equal to 04.
9442 JP NZ,ColourDartPointerAttributes_Loop
9445 CALL Messaging_RedefineKeys Call Messaging_RedefineKeys.
9448 CALL Debounce_CheckKeys Call Debounce_CheckKeys.
944B JP MainMenu Jump to MainMenu.
Prev: 9305 Up: Map Next: 944E