Skip to navigation

Elite on the BBC Micro

Maths (Geometry): SPS3, Removed [Elite-A, Docked]

Name: SPS3, Removed [Show more] Type: Subroutine Category: Maths (Geometry) Summary: Copy a space coordinate from the K% block into K3
Context: See this subroutine in context in the source code References: No direct references to this subroutine in this source file

Copy one of the space coordinates of the planet, sun or space station into the corresponding location in the temporary variable K3. The high byte and absolute value of the sign byte are copied into the first two K3 bytes, and the sign of the sign byte is copied into the highest K3 byte. The comments below are written for copying the planet's x-coordinate into K3(2 1 0). Arguments: X Determines where to copy the coordinate to: * X = 0 copies the coordinate into K3(2 1 0) * X = 3 copies the coordinate into K3(5 4 3) * X = 6 copies the coordinate into K3(8 7 6) Y Determines which coordinate to copy: * Y = 0 copies (x_sign, x_hi) of planet * Y = 3 copies (y_sign, y_hi) of planet * Y = 6 copies (z_sign, z_hi) of planet * Y = NI% + 0 copies (x_sign, x_hi) of sun/station * Y = NI% + 3 copies (y_sign, y_hi) of sun/station * Y = NI% + 6 copies (z_sign, z_hi) of sun/station Returns: X X is incremented by 3 to point to the next coordinate Y Y is incremented by 3 to point to the next coordinate
\ --- Mod: Original Acornsoft code removed: -----------> \.SPS3 \ LDA K%+1,X \ Copy x_hi into K3+X \ STA K3,X \ LDA K%+2,X \ Set A = Y = x_sign \ TAY \ AND #%01111111 \ Set K3+1 = |x_sign| \ STA K3+1,X \ TYA \ Set K3+2 = the sign of x_sign \ AND #%10000000 \ STA K3+2,X \ RTS \ Return from the subroutine \ --- End of removed code ----------------------------->