.SPS1 \ --- Mod: Original Acornsoft code removed: -----------> \ LDX #0 \ Copy the two high bytes of the planet's x-coordinate \ JSR SPS3 \ into K3(2 1 0), separating out the sign bit into K3+2 \ LDX #3 \ Copy the two high bytes of the planet's y-coordinate \ JSR SPS3 \ into K3(5 4 3), separating out the sign bit into K3+5 \ LDX #6 \ Copy the two high bytes of the planet's z-coordinate \ JSR SPS3 \ into K3(8 7 6), separating out the sign bit into K3+8 \ --- And replaced by: --------------------------------> LDX #0 \ Copy the two high bytes of the planet/sun/station's JSR SPS3 \ x-coordinate into K3(2 1 0), separating out the sign \ bit into K3+2 JSR SPS3 \ Copy the two high bytes of the planet/sun/station's \ y-coordinate into K3(5 4 3), separating out the sign \ bit into K3+5 JSR SPS3 \ Copy the two high bytes of the planet/sun/station's \ z-coordinate into K3(8 7 6), separating out the sign \ bit into K3+8 \ --- End of replacement ------------------------------> \ Fall through into TAS2 to build XX15 from K3Name: SPS1 [Show more] Type: Subroutine Category: Maths (Geometry) Summary: Calculate the vector to the planet, sun or station and store it in XX15Context: See this subroutine in context in the source code References: This subroutine is called as follows: * COMPAS calls SPS1 * Main flight loop (Part 9 of 16) calls SPS1 * TACTICS (Part 3 of 7) calls SPS1

Arguments: Y Determines the object whose vector we are calculating: * 0 = calculate the vector to the planet * NI% = calculate the vector to the sun/space station Other entry points: SPS1+1 A BRK instruction

[X]

Subroutine SPS3 (category: Maths (Geometry))

Copy a space coordinate from the K% block into K3