Prev: 44428 Up: Map Next: 44509
44452: PrintRating
Print "Competence Rating: nnn": clamp RatingScore to 100, reset the ASCII digits inside the label string to "00", bump them A times with decimal carries (RatingHundred patches in the leading "1" for a perfect 100), then print the patched 22-character string.
Used by the routine at 44125.
44452 LD A,(40503) A = RatingScore,
44455 CP 100 clamped to 100
44457 JR C,44461
44459 LD A,100
44461 CALL 45207 digits = " 00"
44464 LD (42065),HL
44467 AND A zero: print as-is
44468 JR Z,44494
44470 LD B,A else count the score out
44471 LD HL,42066 in ASCII: units +1,
44474 LD A,58
44476 INC (HL)
44477 CP (HL) past '9'?
44478 JR NZ,44492
44480 LD (HL),48 wrap to '0',
44482 DEC HL carry into the tens,
44483 INC (HL)
44484 CP (HL)
44485 JR NZ,44491
44487 CALL 45216 and past 99 write the "10"
44490 INC HL of a perfect 100
44491 INC HL
44492 DJNZ 44476
44494 LD HL,20612 print "Competence Rating: nnn"
44497 LD (31257),HL on screen row 19
44500 LD DE,42046
44503 LD B,22
44505 CALL 44509
44508 RET
Prev: 44428 Up: Map Next: 44509