Prev: AA69 Up: Map Next: AB12
AAA9: New High Score
Used by the routines at GameEntryPoint and Handler_Fired.
NewHighScore AAA9 LD IX,$B043 IX=Table_HighScore.
The game stores four high scores.
AAAD LD B,$04 B=04.
NewHighScore_CheckLoop AAAF LD HL,($AB7E) HL=*ActivePlayer.
Move to the last digit of the active score (the hundreds of thousands).
AAB2 LD DE,$0004 HL+=0004.
AAB5 ADD HL,DE
AAB6 LD A,(HL) A=*HL.
AAB7 CP (IX+$0B) Jump to NewHighScore_1 if A is higher than *IX+0B.
AABA JR NC,NewHighScore_1
NewHighScore_0 AABC LD DE,$000C DE=000C.
AABF ADD IX,DE IX+=DE.
AAC1 DJNZ NewHighScore_CheckLoop Decrease counter by one and loop back to NewHighScore_CheckLoop until counter is zero.
AAC3 LD HL,$AB8A HL=Game_Flags.
AAC6 RES 0,(HL) Reset bit 0 of *HL.
AAC8 RET Return.
NewHighScore_1 AAC9 JR NZ,NewHighScore_2 Jump to NewHighScore_2 if {} is not zero.
AACB DEC HL Decrease HL by one.
AACC LD A,(HL) A=*HL.
AACD CP (IX+$0A) Jump to NewHighScore_0 if A is lower than *IX+0A.
AAD0 JR C,NewHighScore_0
AAD2 JR NZ,NewHighScore_2 Jump to NewHighScore_2 if it is not zero.
AAD4 DEC HL Decrease HL by one.
AAD5 LD A,(HL) A=*HL.
AAD6 CP (IX+$09) Jump to NewHighScore_0 if A is lower than *IX+09.
AAD9 JR C,NewHighScore_0
AADB JR Z,NewHighScore_0 Jump to NewHighScore_0 if it is zero.
NewHighScore_2 AADD DEC B Decrease B by one.
AADE JR Z,NewHighScore_Write Jump to NewHighScore_Write if B is zero.
AAE0 LD A,$00 A=00.
NewHighScore_3 AAE2 ADD A,$0C A+=0C.
AAE4 DJNZ NewHighScore_3 Decrease counter by one and loop back to NewHighScore_3 until counter is zero.
AAE6 LD C,A C=A.
AAE7 LD HL,$B066 HL=B066.
AAEA LD DE,$B072 DE=B072.
AAED LDDR LDDR.
NewHighScore_Write AAEF PUSH IX DE=IX.
AAF1 POP DE
AAF2 LD HL,$AB8A HL=Game_Flags.
AAF5 SET 0,(HL) Set bit 0 of *HL.
Who is in play, is it 1UP or 2UP?
AAF7 BIT 4,(HL) Test bit 4 of *HL.
Default to using the 1UP name.
AAF9 LD HL,$ACA6 HL=Name_1UP.
AAFC JR Z,NewHighScore_WriteName Jump to NewHighScore_WriteName if this is player one.
Else, use the name for 2UP.
AAFE LD HL,$ACC7 HL=Name_2UP.
NewHighScore_WriteName AB01 LD BC,$0008 BC=0008.
AB04 LDIR Copy the exact number of bytes of the players name to the high score entry.
AB06 INC DE Increment DE by one.
AB07 LD HL,($AB7E) HL=*ActivePlayer.
AB0A INC HL Increment HL by two.
AB0B INC HL
Scores are held using three bytes.
AB0C LD BC,$0003 BC=0003.
AB0F LDIR Copy the three score digits for the current player into the high score entry.
AB11 RET Return.
Prev: AA69 Up: Map Next: AB12