Prev: ADF3 Up: Map Next: AE17
AE03: Find Object
Used by the routine at HandleValve.
Searches the objects of the room for one whose sprite number is in a range.
Input
H Number of sprite numbers in the range
L First sprite number in the range
Output
IY The address of the object, if one was found
F Carry flag set if an object was found
Test each room object.
FindObject AE03 LD IY,$5C08 Point IY at RoomObjects.
AE07 LD DE,$0020 Set DE to 0020.
AE0A LD B,$34 Set a counter of 34.
FindObject_TestObject AE0C LD A,(IY+$00) Fetch the sprite number.
AE0F SUB L Subtract the first sprite number in the range.
AE10 CP H Compare it with the number of sprite numbers.
AE11 RET C Return if the object is in the range.
AE12 ADD IY,DE Move on to the next object.
AE14 DJNZ FindObject_TestObject Jump to FindObject_TestObject until all of the objects have been tested.
AE16 RET Return.
Prev: ADF3 Up: Map Next: AE17