Prev: C7FA Up: Map Next: C81F
C7FC: Accelerate the ship across, and work out this pass's horizontal scroll
Used by the routine at move_ship.
Called by move_ship with the thrust (or the drag) for this pass. The ship's speed across is a word at +$19/+$1A of its record, whole pixels in the high byte (stored high byte first). The thrust is added and the speed clamped to the top speed (clamp_speed_across). With the controls off the drag must not turn the ship round, so a speed that changes sign is made zero instead.
Then speed_to_scroll turns the speed into this pass's horizontal scroll.
Input
IX The ship record
DE The thrust or drag this pass (8.8 fixed point)
accelerate_across C7FC LD H,(IX+$19) Add the thrust and clamp.
C7FF LD L,(IX+$1A)
C802 EX DE,HL
C803 ADD HL,DE
C804 CALL clamp_speed_across
C807 LD A,(steer_push) Not steering, and the speed changed sign: stop dead, the position word too.
C80A AND A
C80B JR NZ,accelerate_across_0
C80D LD A,H
C80E XOR D
C80F AND $80
C811 JR Z,accelerate_across_0
C813 LD HL,$0000
C816 LD (ship_position_across),HL
accelerate_across_0 C819 LD (IX+$19),H The new speed.
C81C LD (IX+$1A),L
Prev: C7FA Up: Map Next: C81F