Prev: C4D1 Up: Map Next: C863
C821: Check Object Location Match
Input
A Object ID
Output
F Zero flag set if location matches
CheckObjectLocationMatch C821 PUSH IX Stash IX and BC on the stack.
C823 PUSH BC
C824 CALL FetchObjectDataPointer Call FetchObjectDataPointer.
C827 LD B,A B=A.
C828 LD A,($A036) A=*CurrentCharacter_ID.
C82B CALL GetObjectLocation Call GetObjectLocation.
C82E CP B Jump to CheckObjectLocationMatch_2 if A is equal to B.
C82F JR Z,CheckObjectLocationMatch_2
C831 BIT 7,(IX+$05) Jump to CheckObjectLocationMatch_1 if bit 7 of *IX+05 is not set.
C835 JR Z,CheckObjectLocationMatch_1
C837 LD C,A C=A.
C838 LD A,B A=B.
C839 LD B,C B=C.
C83A CALL GetObjectLocation Call GetObjectLocation.
C83D LD C,A C=A.
C83E LD A,($A036) A=*CurrentCharacter_ID.
C841 CP C Jump to CheckObjectLocationMatch_2 if A is equal to C.
C842 JR Z,CheckObjectLocationMatch_2
C844 LD A,C A=C.
C845 CP B Jump to CheckObjectLocationMatch_1 if A is not equal to B.
C846 JR NZ,CheckObjectLocationMatch_1
C848 INC A Increment A by one.
C849 JR NZ,CheckObjectLocationMatch_2 Jump to CheckObjectLocationMatch_2 if A is not equal to B.
C84B LD B,(IX+$00) B=*IX+00.
C84E LD A,($A00A) Jump to CheckObjectLocationMatch_2 if *CurrentCharacterAttribute is equal to *IX+0F.
CheckObjectLocationMatch_0 C851 CP (IX+$0F)
C854 JR Z,CheckObjectLocationMatch_2
C856 INC IX Increment IX by one.
C858 DJNZ CheckObjectLocationMatch_0 Decrease counter by one and loop back to CheckObjectLocationMatch_0 until counter is zero.
CheckObjectLocationMatch_1 C85A XOR A A=00.
C85B JR CheckObjectLocationMatch_3 Jump to CheckObjectLocationMatch_3.
CheckObjectLocationMatch_2 C85D OR %00000001 Set bit 0.
CheckObjectLocationMatch_3 C85F POP BC Restore BC and IX from the stack.
C860 POP IX
C862 RET Return.
Prev: C4D1 Up: Map Next: C863