Prev: C2E7 Up: Map Next: C314
C2ED: Add BC to the score, and print it
In BCD: B goes to the middle byte of SCORE and C to SCORE_LOW, carrying up. The score printed is seven digits: the lower digit of SCORE's first byte, the four of the next two, and the two zeros of SCORE_ZEROS, which nothing writes -- so what is shown is a hundred times what is added: C = $25 shows as 2500. Measured: from nothing, BC = $0025 printed 0002500 and BC = $2500 printed 0250000.
What scores (from the callers): a villain destroyed, 250000 (OBJECT_FLIGHT); a monster of 112-127 destroyed by an antibody 2500, changed 2000, split 1500, turned into one of 64-79 1000 (MONSTER_HIT_TABLE); the creature struck or run into a wall, 1000 (CREATURE_UPDATE); a monster of 64-79 struck, 500 (WANDERING_MONSTER). And a monster that touches the knight scores too, as it takes his hit: 2500 for one of 112-127, 500 for one of 64-79.
PRINT_SCORE prints it where it stays on the panel, in yellow; GAME_OVER uses PRINT_SCORE_AT to print it after a game in its own place and colour.
Input
BC the points, BCD: B in tens of thousands, C in hundreds
ADD_SCORE C2ED LD HL,SCORE_LOW add, in BCD, carrying up
C2F0 LD A,(HL)
C2F1 ADD A,C
C2F2 DAA
C2F3 LD (HL),A
C2F4 DEC HL
C2F5 LD A,(HL)
C2F6 ADC A,B
C2F7 DAA
C2F8 LD (HL),A
C2F9 DEC HL
C2FA LD A,(HL)
C2FB ADC A,$00
C2FD DAA
C2FE LD (HL),A
This entry point is used by the routine at NEW_GAME.
PRINT_SCORE C2FF LD A,$46 PRINT_SCORE: yellow, at the bottom of the panel
C301 EX AF,AF'
C302 LD HL,$50E6
This entry point is used by the routine at GAME_OVER.
PRINT_SCORE_AT C305 LD DE,SCORE PRINT_SCORE_AT: four bytes from SCORE, in the digits' font, from the first byte's lower digit
C308 LD B,$04
C30A PUSH HL
C30B LD HL,FONT
C30E LD (FONT_BASE),HL
C311 POP HL
C312 JR PRINT_BCD_LOW
Prev: C2E7 Up: Map Next: C314