Prev: E1E0 Up: Map Next: E200
E1E9: 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 00 to 63
Output
H The units digit
L The tens digit
GetDigits E1E9 AND A See whether A is zero.
E1EA JR Z,GetDigits_Skip Jump to E1F3 if the zero flag is set.
E1EC LD B,A A moves into B.
GetDigits_Convert E1ED XOR A Set A to zero.
GetDigits_Loop E1EE ADD A,$01 Add 01.
E1F0 DAA Adjust A for binary coded decimal.
E1F1 DJNZ GetDigits_Loop Repeat from E1EE while B still counts.
GetDigits_Skip E1F3 LD B,A A moves into B.
E1F4 RRA Rotate A right through the carry flag.
E1F5 RRA Rotate A right through the carry flag.
E1F6 RRA Rotate A right through the carry flag.
E1F7 RRA Rotate A right through the carry flag.
E1F8 AND %00001111 Use bits 0-3.
E1FA LD L,A A moves into L.
E1FB LD A,B B moves into A.
E1FC AND %00001111 Use bits 0-3.
E1FE LD H,A A moves into H.
E1FF RET Return.
Prev: E1E0 Up: Map Next: E200