Prev: 43625 Up: Map Next: 43794
43689: New High Score
Used by the routines at GameEntryPoint and Handler_Fired.
NewHighScore 43689 LD IX,45123 IX=Table_HighScore.
The game stores four high scores.
43693 LD B,4 B=4.
NewHighScore_CheckLoop 43695 LD HL,(43902) HL=*ActivePlayer.
Move to the last digit of the active score (the hundreds of thousands).
43698 LD DE,4 HL+=0004.
43701 ADD HL,DE
43702 LD A,(HL) A=*HL.
43703 CP (IX+11) Jump to NewHighScore_1 if A is higher than *IX+11.
43706 JR NC,NewHighScore_1
NewHighScore_0 43708 LD DE,12 DE=0012.
43711 ADD IX,DE IX+=DE.
43713 DJNZ NewHighScore_CheckLoop Decrease counter by one and loop back to NewHighScore_CheckLoop until counter is zero.
43715 LD HL,43914 HL=Game_Flags.
43718 RES 0,(HL) Reset bit 0 of *HL.
43720 RET Return.
NewHighScore_1 43721 JR NZ,NewHighScore_2 Jump to NewHighScore_2 if {} is not zero.
43723 DEC HL Decrease HL by one.
43724 LD A,(HL) A=*HL.
43725 CP (IX+10) Jump to NewHighScore_0 if A is lower than *IX+10.
43728 JR C,NewHighScore_0
43730 JR NZ,NewHighScore_2 Jump to NewHighScore_2 if it is not zero.
43732 DEC HL Decrease HL by one.
43733 LD A,(HL) A=*HL.
43734 CP (IX+9) Jump to NewHighScore_0 if A is lower than *IX+9.
43737 JR C,NewHighScore_0
43739 JR Z,NewHighScore_0 Jump to NewHighScore_0 if it is zero.
NewHighScore_2 43741 DEC B Decrease B by one.
43742 JR Z,NewHighScore_Write Jump to NewHighScore_Write if B is zero.
43744 LD A,0 A=0.
NewHighScore_3 43746 ADD A,12 A+=12.
43748 DJNZ NewHighScore_3 Decrease counter by one and loop back to NewHighScore_3 until counter is zero.
43750 LD C,A C=A.
43751 LD HL,45158 HL=45158.
43754 LD DE,45170 DE=45170.
43757 LDDR LDDR.
NewHighScore_Write 43759 PUSH IX DE=IX.
43761 POP DE
43762 LD HL,43914 HL=Game_Flags.
43765 SET 0,(HL) Set bit 0 of *HL.
Who is in play, is it 1UP or 2UP?
43767 BIT 4,(HL) Test bit 4 of *HL.
Default to using the 1UP name.
43769 LD HL,44198 HL=Name_1UP.
43772 JR Z,NewHighScore_WriteName Jump to NewHighScore_WriteName if this is player one.
Else, use the name for 2UP.
43774 LD HL,44231 HL=Name_2UP.
NewHighScore_WriteName 43777 LD BC,8 BC=0008.
43780 LDIR Copy the exact number of bytes of the players name to the high score entry.
43782 INC DE Increment DE by one.
43783 LD HL,(43902) HL=*ActivePlayer.
43786 INC HL Increment HL by two.
43787 INC HL
Scores are held using three bytes.
43788 LD BC,3 BC=0003.
43791 LDIR Copy the three score digits for the current player into the high score entry.
43793 RET Return.
Prev: 43625 Up: Map Next: 43794