![]() |
Routines |
| Prev: 46974 | Up: Map | Next: 47164 |
|
Used by the routine at ProcessLocationDisplay.
Walks the text tokens while the display flag is not the end marker.
|
||||||||
| ProcessTextTokenStream | 46975 | LD A,(46974) | Jump to ProcessTextTokenStream_BitRecordFlag if the display is not 255. | |||||
| 46978 | CP 255 | |||||||
| 46980 | JR NZ,ProcessTextTokenStream_BitRecordFlag | |||||||
| ProcessTextTokenStream_Loop | 46982 | LD HL,(46806) | Return if the pointer at 46806 is zero. | |||||
| 46985 | LD A,L | |||||||
| 46986 | OR H | |||||||
| 46987 | RET Z | |||||||
| 46988 | XOR A | Clear the display. | ||||||
| 46989 | LD (46974),A | |||||||
| 46992 | PUSH HL | |||||||
| 46993 | POP IX | |||||||
| 46995 | LD L,(IX-2) | Read the low byte saved ahead of this record. | ||||||
| 46998 | LD H,(IX-1) | Record the display pointers. | ||||||
| 47001 | LD (46806),HL | |||||||
| 47004 | LD L,(IX+0) | Read the record's flag byte. | ||||||
| 47007 | LD H,(IX+1) | Call ProcessMemoryEntry to run memory entry. | ||||||
| 47010 | CALL ProcessMemoryEntry | |||||||
| 47013 | INC HL | Step on two bytes and point IX at that address. | ||||||
| 47014 | INC HL | |||||||
| 47015 | PUSH HL | |||||||
| 47016 | POP IX | |||||||
| ProcessTextTokenStream_BitRecordFlag | 47018 | LD A,(IX+0) | Jump ahead to ProcessTextTokenStream_TestCharacterClass if bit 7 of the record's flag byte is clear, and step through the text token. | |||||
| 47021 | INC IX | |||||||
| 47023 | BIT 7,A | |||||||
| 47025 | JR Z,ProcessTextTokenStream_TestCharacterClass | |||||||
| 47027 | LD D,A | Keep this token and read the next byte as its parameter. | ||||||
| 47028 | LD E,(IX+0) | |||||||
| 47031 | INC IX | |||||||
| 47033 | AND %01110000 | Keep the token type (bits 4-6) for the checks below. | ||||||
| 47035 | CP 96 | Jump ahead to ProcessTextTokenStream_Next if the record flag is 96. | ||||||
| 47037 | JR Z,ProcessTextTokenStream_Next | |||||||
| 47039 | CP 48 | Jump ahead to ProcessTextTokenStream_Next if the record flag is 48. | ||||||
| 47041 | JR Z,ProcessTextTokenStream_Next | |||||||
| 47043 | CP 32 | Return if the record flag is not 32. | ||||||
| 47045 | RET NZ | |||||||
| ProcessTextTokenStream_Next | 47046 | LD A,255 | Write 255 to the display. | |||||
| 47048 | LD (46974),A | |||||||
| 47051 | AND A | Clear the carry so a blank character ends this token. | ||||||
| 47052 | RET | Return. | ||||||
|
Treats a blank as a break and a vocabulary code as a common word.
|
||||||||
| ProcessTextTokenStream_TestCharacterClass | 47053 | CP 32 | Jump ahead to ProcessTextTokenStream_CommandTwo if the character code is below 32. | |||||
| 47055 | JR C,ProcessTextTokenStream_CommandTwo | |||||||
| 47057 | CP 96 | Jump ahead to ProcessTextTokenStream_TestKeepBitsCount if the character code is below 96. | ||||||
| 47059 | JR C,ProcessTextTokenStream_TestKeepBitsCount | |||||||
|
Get common word.
|
||||||||
| 47061 | CALL GetCommonWord | Call GetCommonWord to look up this common word. | ||||||
| 47064 | OR 1 | Set the found marker. | ||||||
| 47066 | LD A,0 | Leave A clear. The flags still show that the word was found. | ||||||
| 47068 | RET | Return. | ||||||
|
Keep the token's low five bits and add one for the letter count.
|
||||||||
| ProcessTextTokenStream_TestKeepBitsCount | 47069 | AND %00011111 | Take the letter count of this packed word from bits 0-4. | |||||
| 47071 | INC A | Set B to the token length plus one, point HL at the byte after IX, and clear C. | ||||||
| 47072 | LD B,A | |||||||
| 47073 | PUSH IX | |||||||
| 47075 | POP HL | |||||||
| 47076 | INC HL | |||||||
| 47077 | LD C,0 | |||||||
|
Rotate and extract character code.
|
||||||||
| ProcessTextTokenStream_0 | 47079 | CALL RotateAndExtractCharacterCode | Call RotateAndExtractCharacterCode to unpack the next letter. | |||||
| 47082 | DJNZ ProcessTextTokenStream_0 | Count the next character of the message and repeat from ProcessTextTokenStream_0. | ||||||
| 47084 | PUSH HL | Jump back to ProcessTextTokenStream_BitRecordFlag while the count is not zero. | ||||||
| 47085 | POP IX | |||||||
| 47087 | LD A,C | |||||||
| 47088 | AND A | |||||||
| 47089 | JR NZ,ProcessTextTokenStream_BitRecordFlag | |||||||
| 47091 | DEC IX | Step back one byte and continue at ProcessTextTokenStream_BitRecordFlag. | ||||||
| 47093 | JR ProcessTextTokenStream_BitRecordFlag | |||||||
|
Command 2 adds the following offset to the text pointer.
|
||||||||
| ProcessTextTokenStream_CommandTwo | 47095 | CP 2 | Jump ahead to ProcessTextTokenStream_CommandEleven if the command is not 2. | |||||
| 47097 | JR NZ,ProcessTextTokenStream_CommandEleven | |||||||
| 47099 | LD E,(IX+0) | Read the flag word and add it to the record pointer. | ||||||
| 47102 | LD D,(IX+1) | |||||||
| 47105 | ADD IX,DE | |||||||
| ProcessTextTokenStream_TestRecordFlagStep | 47107 | DEC IX | Step back one byte and read the next token from ProcessTextTokenStream_BitRecordFlag. | |||||
| 47109 | JR ProcessTextTokenStream_BitRecordFlag | |||||||
|
Command 11 saves the text pointer and adds the following offset.
|
||||||||
| ProcessTextTokenStream_CommandEleven | 47111 | CP 11 | Go to ProcessTextTokenStream_TestControlBelowGoes when the text command is not 11. | |||||
| 47113 | JR NZ,ProcessTextTokenStream_TestControlBelowGoes | |||||||
| 47115 | LD E,(IX+0) | Read the record's flag byte and read the moved marker. | ||||||
| 47118 | LD D,(IX+1) | |||||||
| 47121 | PUSH IX | |||||||
| 47123 | POP HL | Call AllocateMemory to allocate 2 bytes. | ||||||
| 47124 | LD A,2 | |||||||
| 47126 | CALL AllocateMemory | |||||||
| 47129 | LD (IX+0),L | Store the link word at the start of the record and keep it. | ||||||
| 47132 | LD (IX+1),H | |||||||
| 47135 | PUSH HL | |||||||
| 47136 | LD HL,(46806) | Read the display pointers. | ||||||
| 47139 | LD (46806),IX | Remember this record at 46806 and store the previous pointer's low byte just ahead of it. | ||||||
| 47143 | LD (IX-2),L | |||||||
| 47146 | LD (IX-1),H | Store the high byte of the previous pointer just ahead of this record. | ||||||
| 47149 | POP HL | Restore the pointer from the stack. | ||||||
| 47150 | ADD HL,DE | Add the offset, copy it into the record, and go to ProcessTextTokenStream_TestRecordFlagStep. | ||||||
| 47151 | PUSH HL | |||||||
| 47152 | POP IX | |||||||
| 47154 | JR ProcessTextTokenStream_TestRecordFlagStep | |||||||
|
A control below 29 goes back to the main text walk.
|
||||||||
| ProcessTextTokenStream_TestControlBelowGoes | 47156 | CP 29 | Jump back to ProcessTextTokenStream_BitRecordFlag if the character is below 29. | |||||
| 47158 | JP C,ProcessTextTokenStream_BitRecordFlag | |||||||
| 47161 | JP ProcessTextTokenStream_Loop | Jump back to ProcessTextTokenStream_Loop to read the display pointers and take the low byte of the display pointers. | ||||||
| Prev: 46974 | Up: Map | Next: 47164 |