Prev: ABF3 Up: Map Next: AC8F
AC24: 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 AC24 LD HL,$AAA8 Call ClearBuffer to clear buffer.
AC27 LD B,$0A
AC29 CALL ClearBuffer
AC2C LD A,E Read the low byte of the source.
AC2D OR $34 Mark bits 2, 4, 5 on the result.
AC2F 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 AC30 CALL SaveTextPointer Go to ClearCoordinateBuffer_TestLowAndHighToken if it is not 80.
AC33 CP $80
AC35 JR NZ,ClearCoordinateBuffer_TestLowAndHighToken
AC37 BIT 4,E Jump ahead to ClearCoordinateBuffer_Next if bit 4 is clear.
AC39 JR Z,ClearCoordinateBuffer_Next
AC3B RES 4,E Clear the mark on this character.
AC3D JR ClearCoordinateBuffer_Loop
The condition holds, so the caller continues.
ClearCoordinateBuffer_Next AC3F SCF Mark the condition as met.
AC40 RET Return.
Accepts token types 10 and 70 when their flag bits are set.
ClearCoordinateBuffer_TestLowAndHighToken AC41 CP $10 Jump to ClearCoordinateBuffer_AcceptFlaggedToken when the token type is 10.
AC43 JR Z,ClearCoordinateBuffer_AcceptFlaggedToken
AC45 CP $70 Jump to ClearCoordinateBuffer_TestVocabularyCode when the token type is not 70.
AC47 JR NZ,ClearCoordinateBuffer_TestVocabularyCode
ClearCoordinateBuffer_AcceptFlaggedToken AC49 BIT 4,E Jump back to ClearCoordinateBuffer_Next if bit 4 is clear.
AC4B JR Z,ClearCoordinateBuffer_Next
AC4D BIT 2,E Jump back to ClearCoordinateBuffer_Next if bit 2 is clear.
AC4F JR Z,ClearCoordinateBuffer_Next
AC51 LD A,($AAA7) Jump to ClearCoordinateBuffer_Next if the state byte at AAA7 is at least 03.
AC54 CP $03
AC56 JR NC,ClearCoordinateBuffer_Next
AC58 INC A Count one more at AAA7, then call PointPictureOrigin.
AC59 LD ($AAA7),A
AC5C CALL PointPictureOrigin
AC5F JR NZ,ClearCoordinateBuffer_Next Jump back to ClearCoordinateBuffer_Next to return if PointPictureOrigin does not return 00.
AC61 RES 5,E Jump back to ClearCoordinateBuffer_Loop to check token 10 or 70.
AC63 JR ClearCoordinateBuffer_Loop
A vocabulary code clears the upper flag bits when the second flag bit is set.
ClearCoordinateBuffer_TestVocabularyCode AC65 CP $60 Jump to ClearCoordinateBuffer_TestCodeKeepsOrdinate when the token type is not 60.
AC67 JR NZ,ClearCoordinateBuffer_TestCodeKeepsOrdinate
AC69 BIT 2,E Jump back to ClearCoordinateBuffer_Next if bit 2 is clear.
AC6B JR Z,ClearCoordinateBuffer_Next
AC6D RES 4,E Clear the marker for check token 10 or 70.
AC6F RES 5,E Clear bit 5 and call ReadBytePointer to read the next co-ordinate pair.
AC71 CALL ReadBytePointer
AC74 JR NZ,ClearCoordinateBuffer_Next Jump back to ClearCoordinateBuffer_Next to return if ReadBytePointer does not return 00.
AC76 JR ClearCoordinateBuffer_Loop Jump back to ClearCoordinateBuffer_Loop to check token 10 or 70.
A code of F0 or 50 keeps the co-ordinate bits that this token uses.
ClearCoordinateBuffer_TestCodeKeepsOrdinate AC78 CP $F0 Jump to ClearCoordinateBuffer_RecordBufferOrdinate when the token type is F0.
AC7A JR Z,ClearCoordinateBuffer_RecordBufferOrdinate
AC7C CP $50 Jump to ClearCoordinateBuffer_0 when the token type is not 50.
AC7E JR NZ,ClearCoordinateBuffer_0
ClearCoordinateBuffer_RecordBufferOrdinate AC80 LD A,E Record the buffer: co-ordinate data.
AC81 AND $CB
AC83 LD E,A
AC84 LD ($AAAC),BC
AC88 CALL SaveTextPointer Call SaveTextPointer to remember the text pointer.
ClearCoordinateBuffer_0 AC8B AND A Clear the carry before testing bit 5 of the source.
AC8C BIT 5,E See whether bit 5 of the low byte of the source is set.
AC8E RET Return.
Prev: ABF3 Up: Map Next: AC8F