Prev: 9A7E Up: Map Next: 9B21
9AEE: Decode a word index string into a readable string.
Used by the routine at Draw_StringIntoOther.
Input
HL Address of word index string.
B Number of bytes in string.
Output
EXIT: ScratchPad Holds string.
A word index string holds a string of indices, each representing a string from the dictionary.
Resulting string [Len, "string"]
0x7B is used as a space.
Str_Decode 9AEE LD DE,ScratchPad Temp memory for storing expanded string.
9AF1 XOR A First byte holds the length, so clear.
Str_Decode_0 9AF2 LD (DE),A
9AF3 INC DE Start of string content.
9AF4 PUSH BC
9AF5 PUSH HL Get next word index.
9AF6 LD A,(HL)
9AF7 BIT 7,A Bit 7 set means we use the index as an ascii code
9AF9 JR Z,Str_Decode_1
9AFB AND $7F which is stored directly into the string.
9AFD LD (DE),A
9AFE INC DE
9AFF LD HL,ScratchPad Increase string length by one.
9B02 INC (HL)
9B03 LD A,(HL)
9B04 JR Str_Decode_2
Str_Decode_1 9B06 PUSH DE Get address and length of word using the index.
9B07 CALL Dict_GetWord
9B0A LD A,(ScratchPad) Increase overall string count by the length of the current word.
9B0D ADD A,C
9B0E LD (ScratchPad),A
9B11 POP DE
9B12 LDIR Append word to string.
Str_Decode_2 9B14 POP HL
9B15 INC HL
9B16 POP BC
9B17 DEC B Next word.
9B18 RET Z
9B19 INC A Insert a gap betweens words using 0x7b char.
9B1A LD (ScratchPad),A
9B1D LD A,$7B
9B1F JR Str_Decode_0
Prev: 9A7E Up: Map Next: 9B21