Prev: 60192 Up: Map Next: 60263
60225: Print Digit
Used by the routine at Print_ScoreDigits.
Divide HL by DE, print the quotient digit through IX, and leave the remainder in HL. Uses Flag_ScoreLeadingZeroSuppress to suppress leading zeros.
Print_Digit 60225 AND A Is A zero?.
60226 LD B,255 Load B with 255.
Count how many times DE fits into HL (digit quotient).
Print_Digit_DivideLoop 60228 INC B Step the outer print loop counter on by one.
60229 SBC HL,DE Subtract DE from HL, including the previous success marker.
60231 JR NC,Print_Digit_DivideLoop Jump to Print_Digit_DivideLoop if the result did not underflow.
60233 ADD HL,DE HL+=DE.
60234 LD A,B Copy the loop counter from B into A.
This entry point is used by the routine at Print_ScoreDigits.
Choose a digit glyph, a leading space, or a leading zero using Flag_ScoreLeadingZeroSuppress.
Print_Digit_SelectGlyph 60235 OR A Is A zero? If not, jump to Print_DigitLoopB.
60236 JR NZ,Print_DigitLoopB
60238 LD A,(60191) Load A from Flag_ScoreLeadingZeroSuppress.
60241 OR A Is A zero? If not, jump to Print_Digit_LeadingZero.
60242 JR NZ,Print_Digit_LeadingZero
60244 LD A,32 Load A with 32.
60246 JR Print_DigitLoopB2 Jump to Print_DigitLoopB2 to continue the loop.
Print a leading zero (0) while suppression is still armed.
Print_Digit_LeadingZero 60248 LD A,48 Load A with 48.
60250 JR Print_DigitLoopB2 Jump to Print_DigitLoopB2 to continue the loop.
Convert a non-zero quotient to ASCII and clear the leading-zero suppress flag.
Print_DigitLoopB 60252 ADD A,48 A+=48.
60254 LD (60191),A Set Flag_ScoreLeadingZeroSuppress.
Write the chosen character through IX and advance one column.
Print_DigitLoopB2 60257 LD (IX+0),A Write the character code through IX.
60260 INC IX Advance IX to the next character column.
60262 RET Return.
Prev: 60192 Up: Map Next: 60263