Prev: 81A7 Up: Map Next: 81E6
81AD: Print the score
Prints 'you have mastered xx.x% of this adventure.' The score is kept at $B5E8 in tenths of a percent. The hundreds and tens are printed with 81E6 (a leading zero in the hundreds is suppressed), then a decimal point and the tenths digit.
The hundreds-digit routine only ever prints a single character ('0' plus the digit), so a score of 1000 or more would print a stray ':' rather than '10' - I checked this in the emulator by poking the score directly. It cannot happen in an ordinary game, though: the highest score obtainable is 750, or 75.0% (8CEA), safely below the point where this would show.
81AD PUSH HL Save HL and DE
81AE PUSH DE
81AF XOR A Print in the lower window
81B0 LD ($B5F2),A
81B3 LD HL,$B345 "you have mastered "
81B6 CALL $72D4
81B9 LD HL,($B5E8) HL = the score, in tenths of a percent
81BC LD DE,$0064 Print the hundreds digit, dividing by 100...
81BF CALL $81E6
81C2 CALL NZ,$7580 ...but only if it is not zero (no leading zero)
81C5 LD DE,$000A Print the tens digit, dividing what is left by 10
81C8 CALL $81E6
81CB CALL $7580
81CE LD A,$2E "."
81D0 CALL $7580
81D3 LD A,L Whatever is left (0-9) is the tenths digit
81D4 ADD A,$30
81D6 CALL $7580
81D9 XOR A No forced capital for the word that follows
81DA LD ($B5F5),A
81DD LD HL,$B353 "% of this adventure."
81E0 CALL $72D4
81E3 POP DE Restore DE and HL
81E4 POP HL
81E5 RET
Prev: 81A7 Up: Map Next: 81E6