Prev: ACCC Up: Map Next: AD57
ACFB: Apply The Saved Clause
Used by the routine at StartPictureModeScreenIdle.
When the command mode at A024 is 02 and bit 6 of E is clear, copies six bytes from offset 08 of the clause record to offset 18 and returns to the scan at ReadObjectProcessingFlag. Once the game has started, any other case sets bit 3 of E and returns to that scan. Before the game has started it restores the saved word as class B0 unlinks the clause record, and falls into MatchWordAgainstEarlierClause.
ApplySavedClause ACFB LD A,($A024) Jump to ApplySavedClause_GameStarted if the command mode at A024 is not 02.
ACFE CP $02
AD00 JR NZ,ApplySavedClause_GameStarted
AD02 BIT 6,E Jump back to ReadObjectProcessingFlag while bit 6 is present.
AD04 JP NZ,ReadObjectProcessingFlag
AD07 SET 6,E Set the mark on this character
AD09 SET 3,E
AD0B PUSH IY
AD0D EXX
AD0E POP HL
AD0F LD DE,$0008 Point HL at byte 08 of the record (IY+08), save it and take 0010.
AD12 ADD HL,DE
AD13 PUSH HL
AD14 LD DE,$0010
AD17 ADD HL,DE Add 0010, so HL points at byte 18 and copy 06 bytes from byte 08.
AD18 POP DE
AD19 EX DE,HL
AD1A LD BC,$0006
AD1D LDIR
AD1F EXX Switch back to the saved registers and resume the object scan at ReadObjectProcessingFlag.
AD20 JP ReadObjectProcessingFlag
Once the game has started, sets bit 3 of E and returns to ReadObjectProcessingFlag.
ApplySavedClause_GameStarted AD23 LD A,($A01B) Jump to ApplySavedClause_RestoreWord if the initialised flag is zero.
AD26 AND A
AD27 JR Z,ApplySavedClause_RestoreWord
AD29 SET 3,E Set bit 3 of the flag in E and resume the object scan at ReadObjectProcessingFlag.
AD2B JP ReadObjectProcessingFlag
Restores the saved word as class B0 unlinks the clause record, and falls into MatchWordAgainstEarlierClause.
ApplySavedClause_RestoreWord AD2E LD HL,($AAA1) Copy the saved word to ActiveTextPointer and take class B0.
AD31 LD ($A02B),HL
AD34 LD D,$B0
AD36 LD A,($AAA3) Read the saved flag bytes at AAA3 and AAA6.
AD39 LD E,A
AD3A LD A,($AAA6)
AD3D LD ($A012),A Put the saved flag back at A012.
AD40 LD IY,($AAA4) Point IY at the saved clause record and read the low byte of its link.
AD44 LD L,(IY-$02)
AD47 LD H,(IY-$01) Read the high byte of the link.
AD4A PUSH HL Call FollowRecordPointer to follow the record pointer.
AD4B POP IX
AD4D CALL FollowRecordPointer
AD50 XOR A Clear the clause record's link.
AD51 LD (IY-$02),A
AD54 LD (IY-$01),A
Prev: ACCC Up: Map Next: AD57