Prev: C7A6 Up: Map Next: C863
C821: Check Object Location Match
Looks the object up and clears the zero flag when its location matches the current character.
Input
A Object ID
Output
F Zero flag clear when the location matches
CheckObjectLocationMatch C821 PUSH IX Call FetchObjectDataPointer to look up that object.
C823 PUSH BC
C824 CALL FetchObjectDataPointer
C827 LD B,A Keep A in B and call GetObjectLocation to read the current character's room.
C828 LD A,($A036)
C82B CALL GetObjectLocation
C82E CP B Go to CheckObjectLocationMatch_TestStepSucceedsScript if the character's room is this object.
C82F JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
C831 BIT 7,(IX+$05) Jump ahead to CheckObjectLocationMatch_Next if the object-attribute flag is clear.
C835 JR Z,CheckObjectLocationMatch_Next
C837 LD C,A Exchange A with B and call GetObjectLocation to read that object's room.
C838 LD A,B
C839 LD B,C
C83A CALL GetObjectLocation
C83D LD C,A Go to CheckObjectLocationMatch_TestStepSucceedsScript if this object's room is the character being processed.
C83E LD A,($A036)
C841 CP C
C842 JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
C844 LD A,C Go to CheckObjectLocationMatch_Next if the two locations differ.
C845 CP B
C846 JR NZ,CheckObjectLocationMatch_Next
C848 INC A Report a match at CheckObjectLocationMatch_TestStepSucceedsScript unless both locations are FF.
C849 JR NZ,CheckObjectLocationMatch_TestStepSucceedsScript
C84B LD B,(IX+$00) Read the record's flag byte.
C84E LD A,($A00A) Read the character attribute.
CheckObjectLocationMatch_0 C851 CP (IX+$0F) Jump ahead to CheckObjectLocationMatch_TestStepSucceedsScript if it matches the character attribute.
C854 JR Z,CheckObjectLocationMatch_TestStepSucceedsScript
C856 INC IX Step to the next byte of the object.
C858 DJNZ CheckObjectLocationMatch_0 Count the next object and repeat from CheckObjectLocationMatch_0.
CheckObjectLocationMatch_Next C85A XOR A Set the zero flag and jump ahead to CheckObjectLocationMatch_BringSavedCount.
C85B JR CheckObjectLocationMatch_BringSavedCount
CheckObjectLocationMatch_TestStepSucceedsScript C85D OR $01 Clear the zero flag to report that the character attribute was found.
CheckObjectLocationMatch_BringSavedCount C85F POP BC Restore the saved count and the saved character record from the stack.
C860 POP IX
C862 RET Return.
View the equivalent code in;
Prev: C7A6 Up: Map Next: C863