Prev: 9FAF Up: Map Next: A050
9FC7: Message: Remember The Separator
Used by the routine at Message_ListWithASeparator.
Remembers the separator at 869F and walks the objects here, skipping any with no copies left.
Message_RememberTheSeparator 9FC7 PUSH HL Save HL and keep the id in L.
9FC8 LD L,A
9FC9 LD A,($869F) Read the space count.
9FCC LD H,A Keep the space count.
9FCD LD A,D Store D in the space count.
9FCE LD ($869F),A
9FD1 LD A,L Take the id back into A.
9FD2 EX (SP),HL Swap the id and the saved separator with HL on the stack.
9FD3 PUSH IX Point IX at the slot before the object table.
9FD5 LD IX,$C060
Message_RememberTheSeparator_Loop 9FD9 CALL Table_FindTheRecord Call Table_FindTheRecord to find the record.
9FDC JR Z,Message_RememberTheSeparator_RestoreTheSeparator Jump to Message_RememberTheSeparator_RestoreTheSeparator when the object search returns with the zero flag set.
9FDE CP (IY+$01) Jump back to Message_RememberTheSeparator_Loop unless this object is inside the one in A.
9FE1 JR NZ,Message_RememberTheSeparator_Loop
9FE3 PUSH AF Save A, then increment it (the zero flag is set if it was FF).
9FE4 INC A
9FE5 LD E,(IY+$00) Read the copy count from the object record.
9FE8 JR NZ,Message_RememberTheSeparator_TestTheLocation Jump to Message_RememberTheSeparator_TestTheLocation unless A was FF.
9FEA LD A,$01 Jump to Message_RememberTheSeparator_FindTheRecord unless this object has one copy.
9FEC CP E
9FED JR NZ,Message_RememberTheSeparator_FindTheRecord
Message_RememberTheSeparator_TestTheLocation 9FEF LD A,(IY+$10) Read the location from IY.
9FF2 CP B Jump to Message_RememberTheSeparator_TestWhoseTurn if the object is at the location in B.
9FF3 JR Z,Message_RememberTheSeparator_TestWhoseTurn
9FF5 DEC E Jump to Message_RememberTheSeparator_FindTheRecord if the copy count has run out.
9FF6 JR Z,Message_RememberTheSeparator_FindTheRecord
9FF8 LD A,(IY+$11) Read byte +11 from IY.
9FFB CP B Jump to Message_RememberTheSeparator_FindTheRecord if byte 11 of this record is not the object's location.
9FFC JR NZ,Message_RememberTheSeparator_FindTheRecord
Message_RememberTheSeparator_TestWhoseTurn 9FFE LD A,($B6EA) Read *CurrentCharacter.
A001 CP (IX+$00) Jump to Message_RememberTheSeparator_TestTheObjectHere if the character whose turn it is is not this object's id.
A004 JR NZ,Message_RememberTheSeparator_TestTheObjectHere
A006 LD A,$04 Jump to Message_RememberTheSeparator_FindTheRecord if the separator in D is 04.
A008 CP D
A009 JR Z,Message_RememberTheSeparator_FindTheRecord
Message_RememberTheSeparator_TestTheObjectHere A00B LD A,(IX+$00) Read the id from the index entry.
A00E CALL ConditionTheObjectIsHere Call ConditionTheObjectIsHere to test whether the object is here.
A011 JR Z,Message_RememberTheSeparator_FindTheRecord Jump to Message_RememberTheSeparator_FindTheRecord if ConditionTheObjectIsHere did not find the object here.
A013 INC C Count one more object.
A014 SUB A Take zero for the two flags below.
A015 LD ($B704),A Clear the capitalise-the-next-letter flag before the object's name.
A018 LD ($B703),A Update *B703.
A01B CALL MessageNameAnObject Call MessageNameAnObject to print the object's name.
A01E LD A,($B6EA) Read *CurrentCharacter.
A021 CP (IX+$00) Jump to Message_RememberTheSeparator_PrintANewline if the character whose turn it is is this object's id.
A024 JR Z,Message_RememberTheSeparator_PrintANewline
A026 LD A,$2E Use the character '.'.
A028 CALL Print_Character Call Print_Character to print one character.
A02B LD A,(IX+$00) Read the id from the index entry.
A02E CALL TableListWhatIsHere Call TableListWhatIsHere to list what is here.
A031 JR C,Message_RememberTheSeparator_FindTheRecord Jump to Message_RememberTheSeparator_FindTheRecord if TableListWhatIsHere returned with carry set.
A033 LD A,(IX+$00) Read the id from the index entry.
A036 PUSH DE Save DE and step the separator on.
A037 INC D
A038 INC D Step the separator on once more.
A039 CALL Message_RememberTheSeparator Call Message_RememberTheSeparator to remember the separator and walk the objects, then restore DE.
A03C POP DE
Message_RememberTheSeparator_FindTheRecord A03D POP AF Jump back to Message_RememberTheSeparator_Loop to find the record.
A03E JP Message_RememberTheSeparator_Loop
Message_RememberTheSeparator_PrintANewline A041 CALL Print_LineBreak Call Print_LineBreak to print a newline.
A044 JR Message_RememberTheSeparator_FindTheRecord Jump back to Message_RememberTheSeparator_FindTheRecord to find the record.
Message_RememberTheSeparator_RestoreTheSeparator A046 POP IX Restore IX from the stack and swap HL with the address on the stack.
A048 EX (SP),HL
A049 LD A,H Put the saved separator back at 869F.
A04A LD ($869F),A
A04D LD A,L Take the id back into A.
A04E POP HL Restore HL from the stack.
A04F RET Return.
Prev: 9FAF Up: Map Next: A050