Prev: 89D3 Up: Map Next: 8C3F
8C05: Accelerate Object
Adds the acceleration of an object to its speed in both directions, limiting the speed to a maximum which depends on the flags of the object. The speeds are two byte values (see LimitSpeedToRange).
Input
IX Address of the object
AccelerateObject 8C05 LD A,(IX+$10) Fetch the flags of the object.
8C08 AND %00000111 Keep the bottom three bits.
8C0A INC A Add one to get the speed limit.
8C0B LD ($8C03),A Store it in 8C03.
8C0E CPL Negate it...
8C0F LD ($8C04),A ...and store the negative limit in 8C04.
8C12 LD H,(IX+$07) Fetch the horizontal speed of the object into HL.
8C15 LD L,(IX+$08)
8C18 LD D,(IX+$0B) Fetch the horizontal acceleration into DE.
8C1B LD E,(IX+$0C)
8C1E ADD HL,DE Add it to the speed.
8C1F CALL LimitSpeedToRange Limit the speed.
8C22 LD (IX+$07),H Store the new horizontal speed.
8C25 LD (IX+$08),L
8C28 LD H,(IX+$09) Fetch the vertical speed of the object into HL.
8C2B LD L,(IX+$0A)
8C2E LD D,(IX+$0E) Fetch the vertical acceleration into DE.
8C31 LD E,(IX+$0F)
8C34 ADD HL,DE Add it to the speed.
8C35 CALL LimitSpeedToRange Limit the speed.
8C38 LD (IX+$09),H Store the new vertical speed.
8C3B LD (IX+$0A),L
8C3E RET Return.
Prev: 89D3 Up: Map Next: 8C3F