Prev: 57824 Up: Map Next: 57856
57833: Get Digits
Used by the routines at CollectItem and UpdatePanelDigits.
Converts a number to two digits, ready to be printed as text.
Input
A The number, which is 0 to 99
Output
H The units digit
L The tens digit
GetDigits 57833 AND A See whether A is zero.
57834 JR Z,GetDigits_Skip Jump to 57843 if the zero flag is set.
57836 LD B,A A moves into B.
GetDigits_Convert 57837 XOR A Set A to zero.
GetDigits_Loop 57838 ADD A,1 Add 1.
57840 DAA Adjust A for binary coded decimal.
57841 DJNZ GetDigits_Loop Repeat from 57838 while B still counts.
GetDigits_Skip 57843 LD B,A A moves into B.
57844 RRA Rotate A right through the carry flag.
57845 RRA Rotate A right through the carry flag.
57846 RRA Rotate A right through the carry flag.
57847 RRA Rotate A right through the carry flag.
57848 AND %00001111 Use bits 0-3.
57850 LD L,A A moves into L.
57851 LD A,B B moves into A.
57852 AND %00001111 Use bits 0-3.
57854 LD H,A A moves into H.
57855 RET Return.
Prev: 57824 Up: Map Next: 57856