Prev: EB20 Up: Map Next: EB67
EB41: 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 EB41 AND A Is A zero?.
EB42 LD B,$FF Load B with FF.
Count how many times DE fits into HL (digit quotient).
Print_Digit_DivideLoop EB44 INC B Step the outer print loop counter on by one.
EB45 SBC HL,DE Subtract DE from HL, including the previous success marker.
EB47 JR NC,Print_Digit_DivideLoop Jump to Print_Digit_DivideLoop if the result did not underflow.
EB49 ADD HL,DE HL+=DE.
EB4A 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 EB4B OR A Is A zero? If not, jump to Print_DigitLoopB.
EB4C JR NZ,Print_DigitLoopB
EB4E LD A,($EB1F) Load A from Flag_ScoreLeadingZeroSuppress.
EB51 OR A Is A zero? If not, jump to Print_Digit_LeadingZero.
EB52 JR NZ,Print_Digit_LeadingZero
EB54 LD A,$20 Load A with 20.
EB56 JR Print_DigitLoopB2 Jump to Print_DigitLoopB2 to continue the loop.
Print a leading zero (0) while suppression is still armed.
Print_Digit_LeadingZero EB58 LD A,$30 Load A with 30.
EB5A 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 EB5C ADD A,$30 A+=30.
EB5E LD ($EB1F),A Set Flag_ScoreLeadingZeroSuppress.
Write the chosen character through IX and advance one column.
Print_DigitLoopB2 EB61 LD (IX+$00),A Write the character code through IX.
EB64 INC IX Advance IX to the next character column.
EB66 RET Return.
Prev: EB20 Up: Map Next: EB67