Prev: 26537 Up: Map Next: 26614
26550: Handler: Score
Used by the routines at 29184, 29385 and 31154.
Handler_Score 26550 LD A,(26355) Jump to AddToScore if *Flag_ActiveDemoMode is not active.
26553 OR A
26554 JR Z,AddToScore
Demo mode is active, so just reset the score.
26556 LD DE,25896 DE=ScoreBuffer.
26559 LD B,0 B=0.
26561 JR Reset_ScoreBuffer Jump to Reset_ScoreBuffer.
AddToScore 26563 LD HL,25881 Point HL at 25881 (the current score).
26566 LD DE,25902 Point DE at 25902 (the points to add).
26569 LD B,6 Set a counter in B for 6 score digits.
AddToScore_Loop 26571 LD A,(DE) Fetch the points digit and add it to the corresponding score digit.
26572 ADD A,(HL)
26573 SUB 48 Convert the value from ASCII by subtracing 48.
26575 CP 58 Jump to AddToScore_Store if A is less than 58.
26577 JR C,AddToScore_Store
26579 SUB 10 A-=10.
26581 DEC HL Decrease HL by one.
26582 INC (HL) Increment *HL by one.
26583 INC HL Increment HL by one.
AddToScore_Store 26584 LD (HL),A Write A to *HL.
26585 DEC DE Decrease DE by one.
26586 DEC HL Decrease HL by one.
26587 DJNZ AddToScore_Loop Decrease counter by one and loop back to AddToScore_Loop until counter is zero.
Reset_ScoreBuffer 26589 PUSH DE Copy the score buffer pointer to HL (using the stack).
26590 POP HL
26591 INC DE Increment the score buffer destination pointer by one.
26592 LD C,6 Set a counter in C for 6 score digits.
26594 LD (HL),48 Write 48 ("0") to the score buffer.
26596 LDIR Copy 48 ("0") across the remaining five score buffer digits.
Check if the score is at least "10,000".
26598 LD A,(25877) Return if *25877 is not equal to 49 ("1").
26601 CP 49
26603 RET NZ
26604 LD HL,26351 Return if Flag_ExtraLife says that no extra life should be awarded.
26607 LD A,(HL)
26608 OR A
26609 RET Z
Award an extra life to the player.
26610 DEC (HL) Reset Flag_ExtraLife as an extra life has been "awarded".
26611 INC HL Move to the lives counter at Player_Lives.
26612 INC (HL) Award one extra life.
26613 RET Return.
Prev: 26537 Up: Map Next: 26614