Prev: 9E34 Up: Map Next: 9E7A
9E40: Condition: A Visible Object
Used by the routines at Condition_SwapAndRetest and ConditionTheObjectIsHere.
Returns whether the object is visible and in the location just tested.
Condition_AVisibleObject 9E40 BIT 7,(IY+$07) Return if the object is not "visible".
9E44 RET Z
9E45 PUSH IY Save IY, IX and BC, and keep A in B.
9E47 PUSH IX
9E49 PUSH BC
9E4A LD B,A
9E4B LD C,(IX+$10) Read the object's location.
9E4E PUSH IY Call ContainerLit to test whether the container is lit.
9E50 CALL ContainerLit
9E53 CP B Compare it with the result.
9E54 LD B,A Keep the result in B.
9E55 POP IX Jump to Condition_AVisibleObject_ReturnVisible if ContainerLit's result matches the flag kept in B.
9E57 JR Z,Condition_AVisibleObject_ReturnVisible
9E59 CALL ContainerLit Call ContainerLit to test whether the container is lit.
9E5C CP B Compare it with the result.
9E5D JR NZ,Condition_AVisibleObject_ReturnNotVisible Jump to Condition_AVisibleObject_ReturnNotVisible unless it matches B.
9E5F INC A Jump to Condition_AVisibleObject_ReturnVisible unless the compared byte was FF.
9E60 JR NZ,Condition_AVisibleObject_ReturnVisible
9E62 LD B,(IY+$00) Load the copy count into B.
9E65 LD A,C Use the object's location again.
Condition_AVisibleObject_Loop 9E66 CP (IY+$10) Jump to Condition_AVisibleObject_ReturnVisible if this copy's location matches.
9E69 JR Z,Condition_AVisibleObject_ReturnVisible
9E6B INC IY Step to the next byte of this object.
9E6D DJNZ Condition_AVisibleObject_Loop Loop back to Condition_AVisibleObject_Loop until every copy's location has been checked.
Condition_AVisibleObject_ReturnNotVisible 9E6F XOR A Set the zero flag.
9E70 JR Condition_AVisibleObject_Return Jump to Condition_AVisibleObject_Return to return with the zero flag set.
Condition_AVisibleObject_ReturnVisible 9E72 OR $01 Clear the zero flag.
Condition_AVisibleObject_Return 9E74 POP BC Restore BC, IX and IY from the stack.
9E75 POP IX
9E77 POP IY
9E79 RET Return.
View the equivalent code in;
Prev: 9E34 Up: Map Next: 9E7A