.TT146 LDA QQ8 \ Take the two bytes of the 16-bit value in QQ8 and ORA QQ8+1 \ OR them together to check whether there are any BNE TT63 \ non-zero bits, and if so, jump to TT63 to print the \ distanceName: TT146 Type: Subroutine Category: Text Summary: Print the distance to the selected system in light years
If it is non-zero, print the distance to the selected system in light years. If it is zero, just move the text cursor down a line. Specifically, if the distance in QQ8 is non-zero, print token 31 ("DISTANCE"), then a colon, then the distance to one decimal place, then token 35 ("LIGHT YEARS"). If the distance is zero, move the cursor down one line.
Cassette, Flight, Docked, Master, Electron
6502SPINC YC \ The distance is zero, so we just move the text cursor RTS \ in YC down by one line and return from the subroutineJMP INCYC \ Move the text cursor down by one line and return from \ the subroutine using a tail call
.TT63 LDA #191 \ Print recursive token 31 ("DISTANCE") followed by JSR TT68 \ a colon LDX QQ8 \ Load (Y X) from QQ8, which contains the 16-bit LDY QQ8+1 \ distance we want to show SEC \ Set the C flag so that the call to pr5 will include a \ decimal point, and display the value as (Y X) / 10 JSR pr5 \ Print (Y X) to 5 digits, including a decimal point LDA #195 \ Set A to the recursive token 35 (" LIGHT YEARS") and \ fall through into TT60 to print the token followed \ by a paragraph break