Prev: D4D7 Up: Map Next: D4FD
D4EA: Convert Character
Converts a character into the number of its tile in Font. The space is 00, the digits are from 01 to 0A and the letters begin at 0B. A character which is not one of these gives a number which has other bits set.
Input
A The character
Output
A The number of the tile
Make a space into zero.
ConvertCharacter D4EA SUB $20 Take away 20, and keep it in C.
D4EC LD C,A
D4ED AND %00111111 Keep only bits 0-5.
D4EF RET Z Return if it is a space.
Make the digits begin at one.
D4F0 LD A,C Take away 0F, and keep it in C.
D4F1 SUB $0F
D4F3 LD C,A
D4F4 AND %00111111 Keep only bits 0-5.
D4F6 CP $0B Return if it is a digit.
D4F8 RET C
Make the letters begin at eleven.
D4F9 LD A,C Take away 07.
D4FA SUB $07
D4FC RET Return.
Prev: D4D7 Up: Map Next: D4FD