Prev: AB52 Up: Map Next: ABF3
AB91: Check Display Mode
Used by the routine at StartPictureModeScreenIdle.
Jumps to MatchCharacterPair when the command mode at A024 is 02. Otherwise walks the clause in E and stores the words it accepts.
CheckDisplayMode AB91 LD A,($A024) Jump to MatchCharacterPair if the command mode at A024 is 02.
AB94 CP $02
AB96 JR Z,MatchCharacterPair
AB98 LD A,E Read the low byte of the source.
AB99 OR $07 Mark bits 0-2 on the result.
AB9B LD E,A Store the result in the low byte of the source.
CheckDisplayMode_Loop AB9C CALL SaveTextPointer Go to CheckDisplayMode_Loop if it is E0.
AB9F CP $E0
ABA1 JR Z,CheckDisplayMode_Loop
ABA3 CP $30 Go to CheckDisplayMode_Next if it is not 30.
ABA5 JR NZ,CheckDisplayMode_Next
CheckDisplayMode_TestBitClear ABA7 BIT 1,E Jump ahead to CheckDisplayMode_ConditionHoldsCaller if bit 1 is clear.
ABA9 JR Z,CheckDisplayMode_ConditionHoldsCaller
CheckDisplayMode_CharacterLowByte ABAB RES 1,E Clear bit 1 of E and store BC at IY+00-01.
ABAD LD (IY+$00),C
ABB0 LD (IY+$01),B
ABB3 JR CheckDisplayMode_Loop Go back and test the next display marker.
The condition holds, so the caller continues.
CheckDisplayMode_ConditionHoldsCaller ABB5 SCF Mark the condition as met.
ABB6 RET Return.
A zero code clears the third flag bit when that bit is set.
CheckDisplayMode_Next ABB7 CP $00 Go to CheckDisplayMode_TestCodeClearsFirst if it is not 00.
ABB9 JR NZ,CheckDisplayMode_TestCodeClearsFirst
CheckDisplayMode_TestBitClearAgain ABBB BIT 2,E Jump back to CheckDisplayMode_ConditionHoldsCaller if bit 2 is clear.
ABBD JR Z,CheckDisplayMode_ConditionHoldsCaller
ABBF RES 2,E Clear bit 2 of E and store BC at IY+02-03.
ABC1 LD (IY+$02),C
ABC4 LD (IY+$03),B
ABC7 JR CheckDisplayMode_Loop Go back and test the next display marker.
A code of 40 clears the first flag bit.
CheckDisplayMode_TestCodeClearsFirst ABC9 CP $40 Go to CheckDisplayMode_TestBlankKeepsSecond unless the code is 40.
ABCB JR NZ,CheckDisplayMode_TestBlankKeepsSecond
ABCD RES 0,E Clear the mark on this character.
ABCF JR CheckDisplayMode_TestBitClear
A blank keeps the second flag bit, or the first when the second is clear.
CheckDisplayMode_TestBlankKeepsSecond ABD1 CP $20 Go to CheckDisplayMode_TestDisplayModeZero if it is not 20.
ABD3 JR NZ,CheckDisplayMode_TestDisplayModeZero
ABD5 BIT 1,E Jump back to CheckDisplayMode_TestBitClear while bit 1 is present.
ABD7 JR NZ,CheckDisplayMode_TestBitClear
ABD9 BIT 0,E Jump back to CheckDisplayMode_TestBitClearAgain while bit 0 is present.
ABDB JR NZ,CheckDisplayMode_TestBitClearAgain
ABDD RES 2,E Clear the mark on this character, then set the mark on this character.
ABDF SET 0,E
ABE1 LD A,(IY+$00)
ABE4 LD (IY+$02),A Store A at IY+02.
ABE7 LD A,(IY+$01) Copy the high byte beside the low byte and repeat the store from CheckDisplayMode_CharacterLowByte.
ABEA LD (IY+$03),A
ABED JR CheckDisplayMode_CharacterLowByte
See whether the display mode is zero, then see whether bit 1 of the low byte of the source is set.
CheckDisplayMode_TestDisplayModeZero ABEF OR A See whether the display mode is zero.
ABF0 BIT 1,E See whether bit 1 of the low byte of the source is set.
ABF2 RET Return.
Prev: AB52 Up: Map Next: ABF3