Prev: C7FA Up: Map Next: C81F
C7FC: Update Horizontal Speed
Used by the routine at UpdateShipSpeeds.
Adds the acceleration in DE to the horizontal speed of the ship, limits it, and sets it to zero if the ship has turned round. Carries on at UpdateHorizontalScrollSpeed to work out the horizontal scroll speed.
Input
DE Acceleration
IX Address of the ship
UpdateHorizontalSpeed C7FC LD H,(IX+$19) Read offset 19 of IX into H.
C7FF LD L,(IX+$1A) Read offset 1A of IX into L.
C802 EX DE,HL Swap DE and HL.
C803 ADD HL,DE HL gains DE.
C804 CALL LimitHorizontalSpeed Call LimitHorizontalSpeed.
C807 LD A,($5C36) The steering direction.
C80A AND A Jump to UpdateHorizontalSpeed_Store if A is not zero.
C80B JR NZ,UpdateHorizontalSpeed_Store
C80D LD A,H A=H.
C80E XOR D Flip the bits of A that are set in D.
C80F AND %10000000 Keep the bits of A that are set in 80.
C811 JR Z,UpdateHorizontalSpeed_Store Jump to UpdateHorizontalSpeed_Store if the zero flag is set.
C813 LD HL,$0000 HL=00.
C816 LD ($C7FA),HL Update the horizontal scroll fraction.
UpdateHorizontalSpeed_Store C819 LD (IX+$19),H Write H to offset 19 of IX.
C81C LD (IX+$1A),L Write L to offset 1A of IX.
Continue on to UpdateHorizontalScrollSpeed.
Prev: C7FA Up: Map Next: C81F