![]() |
Routines |
| Prev: 46540 | Up: Map | Next: 46789 |
|
Used by the routine at GameOver_1UP.
|
||||||||||||||||
| NewHighScore | 46588 | LD HL,38552 | HL=1UP_Score_1. | |||||||||||||
| 46591 | LD DE,38555 | DE=2UP_Score_1. | ||||||||||||||
| 46594 | CALL NewHighScore_Compare | Call NewHighScore_Compare. | ||||||||||||||
| 46597 | LD A,0 | Write 0 to 38586. | ||||||||||||||
| 46599 | LD (38586),A | |||||||||||||||
| 46602 | JR Z,NewHighScore_Process | If there's either any carry or the zero flag is set then jump to NewHighScore_Process. | ||||||||||||||
| 46604 | JR C,NewHighScore_Process | |||||||||||||||
| 46606 | CPL | Flip the bits. | ||||||||||||||
| 46607 | EX DE,HL | Switch the registers containing the 1UP and 2UP score. | ||||||||||||||
| NewHighScore_Process | 46608 | LD (38558),A | Write A to Flag_ActivePlayer. | |||||||||||||
| 46611 | CALL NewHighScore_0 | Call NewHighScore_0. | ||||||||||||||
| 46614 | EX DE,HL | Switch back the registers containing the 1UP and 2UP score. | ||||||||||||||
| 46615 | LD A,(38558) | A=Flag_ActivePlayer. | ||||||||||||||
| 46618 | CPL | Flip the bits. | ||||||||||||||
| 46619 | LD (38558),A | Write A to Flag_ActivePlayer. | ||||||||||||||
| NewHighScore_0 | 46622 | PUSH DE | Stash DE and HL on the stack. | |||||||||||||
| 46623 | PUSH HL | |||||||||||||||
|
We hold six high scores.
|
||||||||||||||||
| 46624 | LD B,6 | B=6. | ||||||||||||||
| 46626 | LD DE,45858 | DE=Pos_6_HighScore_1. | ||||||||||||||
| NewHighScore_1 | 46629 | CALL NewHighScore_Compare | Call NewHighScore_Compare. | |||||||||||||
| 46632 | JR NC,NewHighScore_2 | |||||||||||||||
| 46634 | CALL NewHighScore_Next | Call NewHighScore_Next. | ||||||||||||||
| 46637 | DJNZ NewHighScore_1 | |||||||||||||||
| NewHighScore_2 | 46639 | LD A,B | ||||||||||||||
| 46640 | CP 6 | |||||||||||||||
| 46642 | JR Z,NewHighScore_5 | |||||||||||||||
| 46644 | LD HL,45858 | HL=Pos_6_HighScore_1. | ||||||||||||||
| 46647 | LD DE,45864 | DE=New_HighScore_1. | ||||||||||||||
| 46650 | LD A,B | A=B. | ||||||||||||||
| 46651 | NEG | |||||||||||||||
| 46653 | ADD A,6 | A=A+6. | ||||||||||||||
| 46655 | LD (38587),A | Store the result at HighScorePosition. | ||||||||||||||
| NewHighScore_3 | 46658 | LD BC,6 | BC=0006. | |||||||||||||
| 46661 | PUSH HL | Stash HL on the stack. | ||||||||||||||
| 46662 | LDIR | |||||||||||||||
| 46664 | POP DE | Restore DE from the stack. | ||||||||||||||
| 46665 | LD L,E | HL=DE. | ||||||||||||||
| 46666 | LD H,D | |||||||||||||||
| 46667 | CALL NewHighScore_Next | Call NewHighScore_Next. | ||||||||||||||
| 46670 | EX DE,HL | |||||||||||||||
| 46671 | DEC A | Decrease A by one. | ||||||||||||||
| 46672 | JR NZ,NewHighScore_3 | |||||||||||||||
| 46674 | POP HL | |||||||||||||||
| 46675 | PUSH HL | |||||||||||||||
| 46676 | LD BC,3 | BC=0003. | ||||||||||||||
| 46679 | LDIR | |||||||||||||||
| 46681 | PUSH DE | |||||||||||||||
| 46682 | CALL Score_HI | Call Score_HI. | ||||||||||||||
| 46685 | LD A,(38586) | If 38586 is not zero, jump to NewHighScore_4. | ||||||||||||||
| 46688 | AND A | |||||||||||||||
| 46689 | JR NZ,NewHighScore_4 | |||||||||||||||
| 46691 | INC A | Increment A by one. | ||||||||||||||
| 46692 | LD (38586),A | Write A to 38586. | ||||||||||||||
| 46695 | LD HL,25030 | HL=Room_Special_MainMenu. | ||||||||||||||
| 46698 | CALL DrawRoom | Call DrawRoom. | ||||||||||||||
| NewHighScore_4 | 46701 | CALL HallOfFame_Clear | Call HallOfFame_Clear. | |||||||||||||
|
Updates the text for the appropriate player number.
|
||||||||||||||||
| 46704 | LD A,(38558) | A=Flag_ActivePlayer. | ||||||||||||||
| 46707 | AND A | Is this 1UP or 2UP? | ||||||||||||||
| 46708 | LD A,177 | A=177 (ASCII "1"+128). | ||||||||||||||
| 46710 | JR Z,NewHighScore_Update_Player | Jump to NewHighScore_Update_Player if the current player is 1UP. | ||||||||||||||
| 46712 | INC A | Else, A=178 (ASCII "2"+128). | ||||||||||||||
|
Overwrite the copy:
|
||||||||||||||||
| NewHighScore_Update_Player | 46713 | LD (46979),A | Write A to 46979. | |||||||||||||
|
Work out which of the HighScore_Suffixes to use.
|
||||||||||||||||
| 46716 | LD A,(38587) | B=HighScorePosition. | ||||||||||||||
| 46719 | LD B,A | |||||||||||||||
| 46720 | LD A,253 | A=253 (as 253+3=0 - so the offset is then pointing at the base address). | ||||||||||||||
| NewHighScore_Suffix_Loop | 46722 | ADD A,3 | A=A+3. | |||||||||||||
| 46724 | 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.
|
||||||||||||||||
| 46726 | LD C,A | Create an offset in BC. | ||||||||||||||
| 46727 | LD B,0 | |||||||||||||||
| 46729 | LD HL,46789 | HL=HighScore_Suffixes + offset. | ||||||||||||||
| 46732 | ADD HL,BC | |||||||||||||||
| 46733 | LD DE,47004 | DE=47004. | ||||||||||||||
| 46736 | LD BC,3 | BC=3 (counter). | ||||||||||||||
|
Overwrite the copy:
|
||||||||||||||||
| 46739 | LDIR | Copy 3 bytes of data from HL to 47004. | ||||||||||||||
|
Print the messaging to the screen.
|
||||||||||||||||
| 46741 | LD DE,46933 | DE=NewHighScore_Attributes. | ||||||||||||||
| 46744 | EXX | Switch to the shadow registers. | ||||||||||||||
| 46745 | LD HL,46941 | HL'=NewHighScore_Position. | ||||||||||||||
| 46748 | LD DE,46957 | DE'=NewHighScore_Text. | ||||||||||||||
|
There are eight lines of text.
|
||||||||||||||||
| 46751 | LD B,8 | B=8. | ||||||||||||||
| 46753 | CALL GameMenu_Loop | Call GameMenu_Loop. | ||||||||||||||
| 46756 | POP DE | Restore DE from the stack. | ||||||||||||||
| 46757 | CALL 46807 | Call 46807. | ||||||||||||||
| NewHighScore_5 | 46760 | POP HL | Restore HL and DE from the stack. | |||||||||||||
| 46761 | POP DE | |||||||||||||||
| 46762 | RET | Return. | ||||||||||||||
|
Moves the High Score pointer to the next entry (we move from 6th to 1st).
|
||||||||||||||||
| NewHighScore_Next | 46763 | DEC DE | Decrease DE by six. | |||||||||||||
| 46764 | DEC DE | |||||||||||||||
| 46765 | DEC DE | |||||||||||||||
| 46766 | DEC DE | |||||||||||||||
| 46767 | DEC DE | |||||||||||||||
| 46768 | DEC DE | |||||||||||||||
| 46769 | RET | Return. | ||||||||||||||
|
Compares the scores pointed to by DE and HL.
|
||||||||||||||||
| NewHighScore_Compare | 46770 | PUSH BC | Stash BC, DE and HL on the stack. | |||||||||||||
| 46771 | PUSH DE | |||||||||||||||
| 46772 | PUSH HL | |||||||||||||||
|
Scores are held in three bytes.
|
||||||||||||||||
| 46773 | LD B,3 | B=3 (counter). | ||||||||||||||
| NewHighScore_Compare_Loop | 46775 | LD A,(DE) | A=the score digit held at DE. | |||||||||||||
| 46776 | CP (HL) | Compare this against the score digit held at HL. | ||||||||||||||
| 46777 | JR C,NewHighScore_Compare_Return | If there's any carry over then jump to NewHighScore_Compare_Return to return. | ||||||||||||||
| 46779 | JR NZ,NewHighScore_Compare_Return | If the result is non-zero then jump to NewHighScore_Compare_Return to return. | ||||||||||||||
| 46781 | INC HL | Increment both HL and DE by one. | ||||||||||||||
| 46782 | INC DE | |||||||||||||||
| 46783 | 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 | 46785 | POP HL | Restore HL, DE and BC from the stack. | |||||||||||||
| 46786 | POP DE | |||||||||||||||
| 46787 | POP BC | |||||||||||||||
| 46788 | RET | Return. | ||||||||||||||
| Prev: 46540 | Up: Map | Next: 46789 |