Prev: AE46 Up: Map Next: AE74
AE56: Finds the address of a word using an index.
Used by the routines at Str_Decode and Dict_Print.
Input
A Index of word.
EXIT HL holds ptr to word text.
EXIT C Word length.
Output
Words are grouped into letter length, in order starting from one.
Dict_GetWord AE56 LD HL,Dict_Groups Start with address of 1 letter word.
AE59 LD DE,$0003 Number of bytes in the group data structure.
AE5C LD C,D Index of group.
AE5D LD B,D
Dict_GetWord_0 AE5E CP (HL) See if index is within the current word group.
AE5F JR C,Dict_GetWord_1
AE61 ADD HL,DE if not move onto next group.
AE62 INC C Increase the number of letters for group.
AE63 JR Dict_GetWord_0
Dict_GetWord_1 AE65 AND A
AE66 SBC HL,DE Get difference between index and start of group index.
AE68 SUB (HL)
AE69 INC HL
AE6A LD E,(HL) Get start address of words in group.
AE6B INC HL
AE6C LD D,(HL)
AE6D EX DE,HL
AE6E RET Z If first word in list, just return as we have the correct address.
Dict_GetWord_2 AE6F ADD HL,BC Offset address by words size until correct word is found using original index.
AE70 DEC A
AE71 JR NZ,Dict_GetWord_2
AE73 RET
Prev: AE46 Up: Map Next: AE74