LDA INWK+27 ; Set A = the ship's speed in byte #24 + the ship's CLC ; acceleration in byte #28 ADC INWK+28 BPL P%+4 ; If the result is positive, skip the following ; instruction LDA #0 ; Set A to 0 to stop the speed from going negative STA INWK+27 ; Store the updated speed in byte #27 LDY #15 ; Set A to byte #15 from the current ship blueprint, JSR GetShipBlueprint ; which contains the ship's maximum speed CMP INWK+27 ; If A >= the ship's current speed, skip the following BCS P%+4 ; instruction as the speed is already in the correct ; range STA INWK+27 ; Otherwise store the maximum speed in byte #27 LDA #0 ; We have added the ship's acceleration, so we now set STA INWK+28 ; it back to 0 in byte #28, as it's a one-off changeName: MVEIT (Part 4 of 9) [Show more] Type: Subroutine Category: Moving Summary: Move current ship: Apply acceleration to ship's speed as a one-offContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
This routine has multiple stages. This stage does the following: * Apply acceleration to the ship's speed (if acceleration is non-zero), and then zero the acceleration as it's a one-off change
[X]
Subroutine GetShipBlueprint (category: Drawing ships)
Fetch a specified byte from the current ship blueprint