Prev: 51194 Up: Map Next: 51231
51196: 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 51196 LD H,(IX+25) Read offset 25 of IX into H.
51199 LD L,(IX+26) Read offset 26 of IX into L.
51202 EX DE,HL Swap DE and HL.
51203 ADD HL,DE HL gains DE.
51204 CALL LimitHorizontalSpeed Call LimitHorizontalSpeed.
51207 LD A,(23606) The steering direction.
51210 AND A Jump to UpdateHorizontalSpeed_Store if A is not zero.
51211 JR NZ,UpdateHorizontalSpeed_Store
51213 LD A,H A=H.
51214 XOR D Flip the bits of A that are set in D.
51215 AND %10000000 Keep the bits of A that are set in 128.
51217 JR Z,UpdateHorizontalSpeed_Store Jump to UpdateHorizontalSpeed_Store if the zero flag is set.
51219 LD HL,0 HL=0.
51222 LD (51194),HL Update the horizontal scroll fraction.
UpdateHorizontalSpeed_Store 51225 LD (IX+25),H Write H to offset 25 of IX.
51228 LD (IX+26),L Write L to offset 26 of IX.
Continue on to UpdateHorizontalScrollSpeed.
Prev: 51194 Up: Map Next: 51231