![]() |
Routines |
| Prev: B5CC | Up: Map | Next: B6C5 |
|
Used by the routine at GameOver_1UP.
|
||||||||||||||||
| NewHighScore | B5FC | LD HL,$9698 | HL=1UP_Score_1. | |||||||||||||
| B5FF | LD DE,$969B | DE=2UP_Score_1. | ||||||||||||||
| B602 | CALL NewHighScore_Compare | Call NewHighScore_Compare. | ||||||||||||||
| B605 | LD A,$00 | Write 00 to 96BA. | ||||||||||||||
| B607 | LD ($96BA),A | |||||||||||||||
| B60A | JR Z,NewHighScore_Process | If there's either any carry or the zero flag is set then jump to NewHighScore_Process. | ||||||||||||||
| B60C | JR C,NewHighScore_Process | |||||||||||||||
| B60E | CPL | Flip the bits. | ||||||||||||||
| B60F | EX DE,HL | Switch the registers containing the 1UP and 2UP score. | ||||||||||||||
| NewHighScore_Process | B610 | LD ($969E),A | Write A to Flag_ActivePlayer. | |||||||||||||
| B613 | CALL NewHighScore_0 | Call NewHighScore_0. | ||||||||||||||
| B616 | EX DE,HL | Switch back the registers containing the 1UP and 2UP score. | ||||||||||||||
| B617 | LD A,($969E) | A=Flag_ActivePlayer. | ||||||||||||||
| B61A | CPL | Flip the bits. | ||||||||||||||
| B61B | LD ($969E),A | Write A to Flag_ActivePlayer. | ||||||||||||||
| NewHighScore_0 | B61E | PUSH DE | Stash DE and HL on the stack. | |||||||||||||
| B61F | PUSH HL | |||||||||||||||
|
We hold six high scores.
|
||||||||||||||||
| B620 | LD B,$06 | B=06. | ||||||||||||||
| B622 | LD DE,$B322 | DE=Pos_6_HighScore_1. | ||||||||||||||
| NewHighScore_1 | B625 | CALL NewHighScore_Compare | Call NewHighScore_Compare. | |||||||||||||
| B628 | JR NC,NewHighScore_2 | |||||||||||||||
| B62A | CALL NewHighScore_Next | Call NewHighScore_Next. | ||||||||||||||
| B62D | DJNZ NewHighScore_1 | |||||||||||||||
| NewHighScore_2 | B62F | LD A,B | ||||||||||||||
| B630 | CP $06 | |||||||||||||||
| B632 | JR Z,NewHighScore_5 | |||||||||||||||
| B634 | LD HL,$B322 | HL=Pos_6_HighScore_1. | ||||||||||||||
| B637 | LD DE,$B328 | DE=New_HighScore_1. | ||||||||||||||
| B63A | LD A,B | A=B. | ||||||||||||||
| B63B | NEG | |||||||||||||||
| B63D | ADD A,$06 | A=A+06. | ||||||||||||||
| B63F | LD ($96BB),A | Store the result at HighScorePosition. | ||||||||||||||
| NewHighScore_3 | B642 | LD BC,$0006 | BC=0006. | |||||||||||||
| B645 | PUSH HL | Stash HL on the stack. | ||||||||||||||
| B646 | LDIR | |||||||||||||||
| B648 | POP DE | Restore DE from the stack. | ||||||||||||||
| B649 | LD L,E | HL=DE. | ||||||||||||||
| B64A | LD H,D | |||||||||||||||
| B64B | CALL NewHighScore_Next | Call NewHighScore_Next. | ||||||||||||||
| B64E | EX DE,HL | |||||||||||||||
| B64F | DEC A | Decrease A by one. | ||||||||||||||
| B650 | JR NZ,NewHighScore_3 | |||||||||||||||
| B652 | POP HL | |||||||||||||||
| B653 | PUSH HL | |||||||||||||||
| B654 | LD BC,$0003 | BC=0003. | ||||||||||||||
| B657 | LDIR | |||||||||||||||
| B659 | PUSH DE | |||||||||||||||
| B65A | CALL Score_HI | Call Score_HI. | ||||||||||||||
| B65D | LD A,($96BA) | If 96BA is not zero, jump to NewHighScore_4. | ||||||||||||||
| B660 | AND A | |||||||||||||||
| B661 | JR NZ,NewHighScore_4 | |||||||||||||||
| B663 | INC A | Increment A by one. | ||||||||||||||
| B664 | LD ($96BA),A | Write A to 96BA. | ||||||||||||||
| B667 | LD HL,$61C6 | HL=Room_Special_MainMenu. | ||||||||||||||
| B66A | CALL DrawRoom | Call DrawRoom. | ||||||||||||||
| NewHighScore_4 | B66D | CALL HallOfFame_Clear | Call HallOfFame_Clear. | |||||||||||||
|
Updates the text for the appropriate player number.
|
||||||||||||||||
| B670 | LD A,($969E) | A=Flag_ActivePlayer. | ||||||||||||||
| B673 | AND A | Is this 1UP or 2UP? | ||||||||||||||
| B674 | LD A,$B1 | A=B1 (ASCII "1"+80). | ||||||||||||||
| B676 | JR Z,NewHighScore_Update_Player | Jump to NewHighScore_Update_Player if the current player is 1UP. | ||||||||||||||
| B678 | INC A | Else, A=B2 (ASCII "2"+80). | ||||||||||||||
|
Overwrite the copy:
|
||||||||||||||||
| NewHighScore_Update_Player | B679 | LD ($B783),A | Write A to B783. | |||||||||||||
|
Work out which of the HighScore_Suffixes to use.
|
||||||||||||||||
| B67C | LD A,($96BB) | B=HighScorePosition. | ||||||||||||||
| B67F | LD B,A | |||||||||||||||
| B680 | LD A,$FD | A=FD (as FD+03=00 - so the offset is then pointing at the base address). | ||||||||||||||
| NewHighScore_Suffix_Loop | B682 | ADD A,$03 | A=A+03. | |||||||||||||
| B684 | DJNZ NewHighScore_Suffix_Loop | Decrease the position counter by one and loop back to NewHighScore_Suffix_Loop until the counter is zero. | ||||||||||||||
|
Fetch the appropriate position suffix.
|
||||||||||||||||
| B686 | LD C,A | Create an offset in BC. | ||||||||||||||
| B687 | LD B,$00 | |||||||||||||||
| B689 | LD HL,$B6C5 | HL=HighScore_Suffixes + offset. | ||||||||||||||
| B68C | ADD HL,BC | |||||||||||||||
| B68D | LD DE,$B79C | DE=B79C. | ||||||||||||||
| B690 | LD BC,$0003 | BC=03 (counter). | ||||||||||||||
|
Overwrite the copy:
|
||||||||||||||||
| B693 | LDIR | Copy 03 bytes of data from HL to B79C. | ||||||||||||||
|
Print the messaging to the screen.
|
||||||||||||||||
| B695 | LD DE,$B755 | DE=NewHighScore_Attributes. | ||||||||||||||
| B698 | EXX | Switch to the shadow registers. | ||||||||||||||
| B699 | LD HL,$B75D | HL'=NewHighScore_Position. | ||||||||||||||
| B69C | LD DE,$B76D | DE'=NewHighScore_Text. | ||||||||||||||
|
There are eight lines of text.
|
||||||||||||||||
| B69F | LD B,$08 | B=08. | ||||||||||||||
| B6A1 | CALL GameMenu_Loop | Call GameMenu_Loop. | ||||||||||||||
| B6A4 | POP DE | Restore DE from the stack. | ||||||||||||||
| B6A5 | CALL $B6D7 | Call B6D7. | ||||||||||||||
| NewHighScore_5 | B6A8 | POP HL | Restore HL and DE from the stack. | |||||||||||||
| B6A9 | POP DE | |||||||||||||||
| B6AA | RET | Return. | ||||||||||||||
|
Moves the High Score pointer to the next entry (we move from 6th to 1st).
|
||||||||||||||||
| NewHighScore_Next | B6AB | DEC DE | Decrease DE by six. | |||||||||||||
| B6AC | DEC DE | |||||||||||||||
| B6AD | DEC DE | |||||||||||||||
| B6AE | DEC DE | |||||||||||||||
| B6AF | DEC DE | |||||||||||||||
| B6B0 | DEC DE | |||||||||||||||
| B6B1 | RET | Return. | ||||||||||||||
|
Compares the scores pointed to by DE and HL.
|
||||||||||||||||
| NewHighScore_Compare | B6B2 | PUSH BC | Stash BC, DE and HL on the stack. | |||||||||||||
| B6B3 | PUSH DE | |||||||||||||||
| B6B4 | PUSH HL | |||||||||||||||
|
Scores are held in three bytes.
|
||||||||||||||||
| B6B5 | LD B,$03 | B=03 (counter). | ||||||||||||||
| NewHighScore_Compare_Loop | B6B7 | LD A,(DE) | A=the score digit held at DE. | |||||||||||||
| B6B8 | CP (HL) | Compare this against the score digit held at HL. | ||||||||||||||
| B6B9 | JR C,NewHighScore_Compare_Return | If there's any carry over then jump to NewHighScore_Compare_Return to return. | ||||||||||||||
| B6BB | JR NZ,NewHighScore_Compare_Return | If the result is non-zero then jump to NewHighScore_Compare_Return to return. | ||||||||||||||
| B6BD | INC HL | Increment both HL and DE by one. | ||||||||||||||
| B6BE | INC DE | |||||||||||||||
| B6BF | DJNZ NewHighScore_Compare_Loop | Decrease the score digit counter by one and loop back to NewHighScore_Compare_Loop until the counter is zero. | ||||||||||||||
| NewHighScore_Compare_Return | B6C1 | POP HL | Restore HL, DE and BC from the stack. | |||||||||||||
| B6C2 | POP DE | |||||||||||||||
| B6C3 | POP BC | |||||||||||||||
| B6C4 | RET | Return. | ||||||||||||||
| Prev: B5CC | Up: Map | Next: B6C5 |