Prev: 38845 Up: Map Next: 38911
38879: Run Object Behaviour
Used by the routines at UpdateType19 and UpdateType14.
Counts down a timer for an object and, when it has expired, runs the behaviour code for its type from the table at BehaviourTable.
Input
IX Address of the object
RunObjectBehaviour 38879 BIT 7,(IX+22) Jump to RunObjectBehaviour_Run if bit 7 of the third state byte of the object is set.
38883 JR NZ,RunObjectBehaviour_Run
38885 DEC (IX+21) Count down the lifetime of the object.
38888 RET NZ Return if it has not run out.
38889 LD A,(39884) Fetch the second byte of the random seed.
38892 AND %00011111 Keep five bits.
38894 INC A Add one.
38895 LD (IX+21),A Restart the lifetime of the object.
RunObjectBehaviour_Run 38898 LD A,(IX+0) Fetch the type of the object.
38901 SUB 19 Subtract 19.
38903 LD C,A Copy it into C.
38904 LD HL,39227 Use the table at BehaviourTable.
38907 CALL GetTableEntry Fetch the address of the code from the table.
38910 JP (HL) Run it.
Prev: 38845 Up: Map Next: 38911