Prev: AAC4 Up: Map Next: AB4C
AAD1: Start Picture Mode When The Screen Is Idle
Used by the routines at AAC4 and ProcessCharacterData.
When nothing is on screen, clears the picture buffer and selects picture mode.
StartPictureModeScreenIdle AAD1 PUSH DE Save DE and jump to StartPictureModeScreenIdle_CheckDisplayMode if the command mode at A024 is set.
AAD2 LD A,($A024)
AAD5 AND A
AAD6 JR NZ,StartPictureModeScreenIdle_CheckDisplayMode
AAD8 LD ($AAA7),A Clear the state byte at AAA7.
AADB LD HL,($A02B) Read the word at ActiveTextPointer, save it and call ClearCoordinateBuffer to clear the co-ordinate buffer.
AADE PUSH HL
AADF CALL ClearCoordinateBuffer
AAE2 JR NZ,StartPictureModeScreenIdle_ClearBorrow Go to StartPictureModeScreenIdle_ClearBorrow when ClearCoordinateBuffer returns non-zero.
AAE4 LD A,($AAA7) Jump to StartPictureModeScreenIdle_ClearBorrow if the state byte at AAA7 is set.
AAE7 AND A
AAE8 JR NZ,StartPictureModeScreenIdle_ClearBorrow
AAEA LD A,$02 Write 02 to the command mode at A024.
AAEC LD ($A024),A
AAEF POP HL Restore the saved pointer from the stack.
AAF0 PUSH IY Copy the character record from IY into HL.
AAF2 POP HL
AAF3 LD DE,$0018 Point HL at the co-ordinates 0018 bytes into the character record, and DE at the buffer at Buffer_CoordinateData.
AAF6 ADD HL,DE
AAF7 LD DE,$AAAC
AAFA EX DE,HL Swap the pointers, take 06 bytes and copy them.
AAFB LD BC,$0006
AAFE LDIR
AB00 LD HL,($A029) Read the word at SavedTextPointer.
AB03 LD ($A02B),HL Store it in the word at ActiveTextPointer and jump ahead to StartPictureModeScreenIdle_CheckDisplayMode to check display mode.
AB06 JR StartPictureModeScreenIdle_CheckDisplayMode
StartPictureModeScreenIdle_ClearBorrow AB08 LD A,$01 Write 01 to the command mode at A024.
AB0A LD ($A024),A
AB0D POP HL Restore the saved pointer from the stack.
AB0E LD ($A02B),HL Store the pointer in the word at ActiveTextPointer.
StartPictureModeScreenIdle_CheckDisplayMode AB11 POP DE Restore the source from the stack.
AB12 XOR A Clear the state byte at AAA7 and call CheckDisplayMode to check display mode.
AB13 LD ($AAA7),A
AB16 CALL CheckDisplayMode
AB19 JR C,CopyDisplayIfNeeded_ReportDone Jump ahead to CopyDisplayIfNeeded_ReportDone if CheckDisplayMode finds the marker bit already clear.
AB1B JR Z,StartPictureModeScreenIdle_TestBitLowByte Go to StartPictureModeScreenIdle_TestBitLowByte if bit 1 of the source is clear.
AB1D CP $90 Jump ahead to SearchCommandHandlerTable if it is 90.
AB1F JP Z,SearchCommandHandlerTable
AB22 CP $A0 Jump ahead to HandleClassAWord if it is A0.
AB24 JP Z,HandleClassAWord
AB27 BIT 3,E Jump ahead to ReadObjectProcessingFlag if bit 3 is clear.
AB29 JR Z,ReadObjectProcessingFlag
AB2B LD A,($A012) Jump to CopyDisplayIfNeeded_ReportDone if the pictures-enabled byte at A012 is set.
AB2E AND A
AB2F JR NZ,CopyDisplayIfNeeded_ReportDone
AB31 LD A,($A01B) Jump to ReadObjectProcessingFlag if the initialised flag is set.
AB34 AND A
AB35 JR NZ,ReadObjectProcessingFlag
AB37 LD A,($A02D) Jump to CopyDisplayIfNeeded_ReportDone if the byte at SavedSourceByte is not C0.
AB3A CP $C0
AB3C JR NZ,CopyDisplayIfNeeded_ReportDone
AB3E LD A,$B0 Jump ahead to CopyDisplayIfNeeded_ReportDone if D is not B0.
AB40 CP D
AB41 JR NZ,CopyDisplayIfNeeded_ReportDone
AB43 LD A,$02 Leave 02 as the result.
AB45 AND A Clear the borrow so the script reads the result as success.
AB46 RET Return.
See whether bit 3 of the low byte of the source is set, then read the pointer at the object Processing Source Flag, then record the pointer in the object Processing Source Flag.
StartPictureModeScreenIdle_TestBitLowByte AB47 BIT 3,E Go to ApplySavedClause if bit 3 of this byte is clear.
AB49 JP Z,ApplySavedClause
Prev: AAC4 Up: Map Next: AB4C