Prev: 44019 Up: Map Next: 44175
44068: Clear Co-ordinate Buffer
Used by the routines at StartPictureModeScreenIdle and CopyDisplayIfNeeded.
Clears the co-ordinate buffer and marks bits 2, 4 and 5 of E.
ClearCoordinateBuffer 44068 LD HL,43688 Call ClearBuffer to clear buffer.
44071 LD B,10
44073 CALL ClearBuffer
44076 LD A,E Read the low byte of the source.
44077 OR 52 Mark bits 2, 4, 5 on the result.
44079 LD E,A Store the result in the low byte of the source.
Saves the text pointer, and a code of 128 clears the fourth flag bit.
ClearCoordinateBuffer_Loop 44080 CALL SaveTextPointer Go to ClearCoordinateBuffer_TestLowAndHighToken if it is not 128.
44083 CP 128
44085 JR NZ,ClearCoordinateBuffer_TestLowAndHighToken
44087 BIT 4,E Jump ahead to ClearCoordinateBuffer_Next if bit 4 is clear.
44089 JR Z,ClearCoordinateBuffer_Next
44091 RES 4,E Clear the mark on this character.
44093 JR ClearCoordinateBuffer_Loop
The condition holds, so the caller continues.
ClearCoordinateBuffer_Next 44095 SCF Mark the condition as met.
44096 RET Return.
Accepts token types 16 and 112 when their flag bits are set.
ClearCoordinateBuffer_TestLowAndHighToken 44097 CP 16 Jump to ClearCoordinateBuffer_AcceptFlaggedToken when the token type is 16.
44099 JR Z,ClearCoordinateBuffer_AcceptFlaggedToken
44101 CP 112 Jump to ClearCoordinateBuffer_TestVocabularyCode when the token type is not 112.
44103 JR NZ,ClearCoordinateBuffer_TestVocabularyCode
ClearCoordinateBuffer_AcceptFlaggedToken 44105 BIT 4,E Jump back to ClearCoordinateBuffer_Next if bit 4 is clear.
44107 JR Z,ClearCoordinateBuffer_Next
44109 BIT 2,E Jump back to ClearCoordinateBuffer_Next if bit 2 is clear.
44111 JR Z,ClearCoordinateBuffer_Next
44113 LD A,(43687) Jump to ClearCoordinateBuffer_Next if the state byte at 43687 is at least 3.
44116 CP 3
44118 JR NC,ClearCoordinateBuffer_Next
44120 INC A Count one more at 43687, then call PointPictureOrigin.
44121 LD (43687),A
44124 CALL PointPictureOrigin
44127 JR NZ,ClearCoordinateBuffer_Next Jump back to ClearCoordinateBuffer_Next to return if PointPictureOrigin does not return 0.
44129 RES 5,E Jump back to ClearCoordinateBuffer_Loop to check token 16 or 112.
44131 JR ClearCoordinateBuffer_Loop
A vocabulary code clears the upper flag bits when the second flag bit is set.
ClearCoordinateBuffer_TestVocabularyCode 44133 CP 96 Jump to ClearCoordinateBuffer_TestCodeKeepsOrdinate when the token type is not 96.
44135 JR NZ,ClearCoordinateBuffer_TestCodeKeepsOrdinate
44137 BIT 2,E Jump back to ClearCoordinateBuffer_Next if bit 2 is clear.
44139 JR Z,ClearCoordinateBuffer_Next
44141 RES 4,E Clear the marker for check token 16 or 112.
44143 RES 5,E Clear bit 5 and call ReadBytePointer to read the next co-ordinate pair.
44145 CALL ReadBytePointer
44148 JR NZ,ClearCoordinateBuffer_Next Jump back to ClearCoordinateBuffer_Next to return if ReadBytePointer does not return 0.
44150 JR ClearCoordinateBuffer_Loop Jump back to ClearCoordinateBuffer_Loop to check token 16 or 112.
A code of 240 or 80 keeps the co-ordinate bits that this token uses.
ClearCoordinateBuffer_TestCodeKeepsOrdinate 44152 CP 240 Jump to ClearCoordinateBuffer_RecordBufferOrdinate when the token type is 240.
44154 JR Z,ClearCoordinateBuffer_RecordBufferOrdinate
44156 CP 80 Jump to ClearCoordinateBuffer_0 when the token type is not 80.
44158 JR NZ,ClearCoordinateBuffer_0
ClearCoordinateBuffer_RecordBufferOrdinate 44160 LD A,E Record the buffer: co-ordinate data.
44161 AND 203
44163 LD E,A
44164 LD (43692),BC
44168 CALL SaveTextPointer Call SaveTextPointer to remember the text pointer.
ClearCoordinateBuffer_0 44171 AND A Clear the carry before testing bit 5 of the source.
44172 BIT 5,E See whether bit 5 of the low byte of the source is set.
44174 RET Return.
Prev: 44019 Up: Map Next: 44175