Prev: 1AF8 Up: Map Next: 1B3A
1B21: hex_to_int: Convert hex digit in A to integer in B or $FF if invalid.
Used by the routines at OELRoutine19, 1DC4, 1E42, 1F28, 1F40 and 1F67.
hex_to_int 1B21 CP $47 if character is greater than or equal to 'G' or less than '0' then jump to hex_to_int_0
1B23 JR NC,hex_to_int_0
1B25 CP $30
1B27 JR C,hex_to_int_0
1B29 CP $41 if character is greater than or equal to 'A' then jump to hex_to_int_1
1B2B JR NC,hex_to_int_1
1B2D CP $39 if character is less than or equal to '9' then jump to hex_to_int_2
1B2F JR C,hex_to_int_2
hex_to_int_0 1B31 LD B,$FF return $FF in B
1B33 RET
hex_to_int_1 1B34 ADD A,$09 add 9 to character
hex_to_int_2 1B36 AND $0F return low nibble in B
1B38 LD B,A
1B39 RET
Prev: 1AF8 Up: Map Next: 1B3A