Prev: 40500 Up: Map Next: 40570
40512: 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 40512 BIT 7,(IY+7) Return if the object is not "visible".
40516 RET Z
40517 PUSH IY Save IY, IX and BC, and keep A in B.
40519 PUSH IX
40521 PUSH BC
40522 LD B,A
40523 LD C,(IX+16) Read the object's location.
40526 PUSH IY Call ContainerLit to test whether the container is lit.
40528 CALL ContainerLit
40531 CP B Compare it with the result.
40532 LD B,A Keep the result in B.
40533 POP IX Jump to Condition_AVisibleObject_ReturnVisible if ContainerLit's result matches the flag kept in B.
40535 JR Z,Condition_AVisibleObject_ReturnVisible
40537 CALL ContainerLit Call ContainerLit to test whether the container is lit.
40540 CP B Compare it with the result.
40541 JR NZ,Condition_AVisibleObject_ReturnNotVisible Jump to Condition_AVisibleObject_ReturnNotVisible unless it matches B.
40543 INC A Jump to Condition_AVisibleObject_ReturnVisible unless the compared byte was 255.
40544 JR NZ,Condition_AVisibleObject_ReturnVisible
40546 LD B,(IY+0) Load the copy count into B.
40549 LD A,C Use the object's location again.
Condition_AVisibleObject_Loop 40550 CP (IY+16) Jump to Condition_AVisibleObject_ReturnVisible if this copy's location matches.
40553 JR Z,Condition_AVisibleObject_ReturnVisible
40555 INC IY Step to the next byte of this object.
40557 DJNZ Condition_AVisibleObject_Loop Loop back to Condition_AVisibleObject_Loop until every copy's location has been checked.
Condition_AVisibleObject_ReturnNotVisible 40559 XOR A Set the zero flag.
40560 JR Condition_AVisibleObject_Return Jump to Condition_AVisibleObject_Return to return with the zero flag set.
Condition_AVisibleObject_ReturnVisible 40562 OR 1 Clear the zero flag.
Condition_AVisibleObject_Return 40564 POP BC Restore BC, IX and IY from the stack.
40565 POP IX
40567 POP IY
40569 RET Return.
View the equivalent code in;
Prev: 40500 Up: Map Next: 40570