Prev: 60969 Up: Map Next: 61012
60994: Move Object Horizontally
Used by the routines at Handle_Flying_Creature and Handle_Carrying_Eagle.
Adds a velocity to the x position of an object. The velocity is multiplied by sixteen and added to the x position and its fraction (byte 10 of the record), so that the position changes by a sixteenth of the velocity in each call. The new x position is returned, but it is not stored in the record: that is up to the caller.
Input
HL The x velocity, with the sign extended to sixteen bits
IX Object record
Output
A The new x position
F The zero flag is set if the new x position is less than 128
Move_Object_Horizontally 60994 ADD HL,HL Multiply the velocity by sixteen.
60995 ADD HL,HL
60996 ADD HL,HL
60997 ADD HL,HL
60998 LD C,(IX+10) Fetch the fraction of the x position.
61001 LD B,(IX+1) Fetch the x position.
61004 ADD HL,BC Add the velocity to the position.
61005 LD (IX+10),L Store the new fraction.
61008 LD A,H Fetch the new x position.
61009 BIT 7,A Test bit 7 of the new x position.
61011 RET Return.
Prev: 60969 Up: Map Next: 61012