.hyp LDA QQ12 ; If we are docked (QQ12 = $FF) then jump to dockEd to BNE dockEd ; print an error message and return from the subroutine ; using a tail call (as we can't hyperspace when docked) LDA QQ22+1 ; Fetch QQ22+1, which contains the number that's shown ; on-screen during hyperspace countdown BEQ P%+3 ; If it is zero, skip the next instruction RTS ; The count is non-zero, so return from the subroutine ;LDA #CYAN ; These instructions are commented out in the original ;JSR DOCOL ; source JSR CTRL ; Scan the keyboard to see if CTRL is currently pressed BMI Ghy ; If it is, then the galactic hyperdrive has been ; activated, so jump to Ghy to process it LDA QQ11 ; If the current view is 0 (i.e. the space view) then BEQ TTX110 ; jump to TTX110, which calls TT111 to set the current ; system to the nearest system to (QQ9, QQ10), and jumps ; back into this routine at TTX111 below AND #%11000000 ; If either bit 6 or 7 of the view type is set - so BNE P%+3 ; this is either the Short-range or Long-range Chart - ; then skip the following instruction RTS ; This is not a chart view, so return from the ; subroutine JSR hm ; This is a chart view, so call hm to redraw the chart ; crosshairs .TTX111 ; If we get here then the current view is either the ; space view or a chart LDA QQ8 ; If either byte of the distance to the selected system ORA QQ8+1 ; in QQ8 are zero, skip the next instruction to make a BNE P%+3 ; copy of the destination seeds in safehouse RTS ; The selected system is the same as the current system, ; so return from the subroutine LDX #5 ; We now want to copy those seeds into safehouse, so we ; so set a counter in X to copy 6 bytes .sob LDA QQ15,X ; Copy the X-th byte of QQ15 into the X-th byte of STA safehouse,X ; safehouse DEX ; Decrement the loop counter BPL sob ; Loop back to copy the next byte until we have copied ; all six seed bytes LDA #7 ; Move the text cursor to column 7 JSR DOXC LDA #23 ; Set A = 23 to use as the text row for views other ; than the space view LDY QQ11 ; If QQ11 = 0 then this is the space view, so set A = 17 BNE P%+4 ; to use as the text row LDA #17 JSR DOYC ; Move the text cursor to row 17 (in the space view) or ; 23 (otherwise), which is in the middle of the bottom ; text row) LDA #0 ; Set QQ17 = 0 to switch to ALL CAPS STA QQ17 LDA #189 ; Print recursive token 29 ("HYPERSPACE ") JSR TT27 LDA QQ8+1 ; If the high byte of the distance to the selected BNE goTT147 ; system in QQ8 is > 0, then it is definitely too far to ; jump (as our maximum range is 7.0 light years, or a ; value of 70 in QQ8(1 0)), so jump to TT147 via goTT147 ; to print "RANGE?" and return from the subroutine using ; a tail call LDA QQ14 ; Fetch our current fuel level from Q114 into A CMP QQ8 ; If our fuel reserves are greater than or equal to the BCS P%+5 ; distance to the selected system, then we have enough ; fuel for this jump, so skip the following instruction ; to start the hyperspace countdown .goTT147 JMP TT147 ; We don't have enough fuel to reach the destination, so ; jump to TT147 to print "RANGE?" and return from the ; subroutine using a tail call LDA #'-' ; Print a hyphen JSR TT27 JSR cpl ; Call cpl to print the name of the selected system ; Fall through into wW to start the hyperspace countdownName: hyp [Show more] Type: Subroutine Category: Flight Summary: Start the hyperspace processContext: See this subroutine in context in the source code References: This subroutine is called as follows: * TT102 calls hyp * TTX110 calls via TTX111
Called when "H" or CTRL-H is pressed during flight. Checks the following: * We are in space * We are not already in a hyperspace countdown If CTRL is being held down, we jump to Ghy to engage the galactic hyperdrive, otherwise we check that: * The selected system is not the current system * We have enough fuel to make the jump and if all the pre-jump checks are passed, we print the destination on-screen and start the countdown.
Other entry points: TTX111 Used to rejoin this routine from the call to TTX110
[X]
Subroutine CTRL (category: Keyboard)
Scan the keyboard to see if CTRL is currently pressed
[X]
Subroutine DOXC (category: Text)
Move the text cursor to a specific column
[X]
Subroutine DOYC (category: Text)
Move the text cursor to a specific row
[X]
Subroutine Ghy (category: Flight)
Perform a galactic hyperspace jump
[X]
Subroutine TT147 (category: Flight)
Print an error when a system is out of hyperspace range
[X]
Subroutine TT27 (category: Text)
Print a text token
[X]
Subroutine TTX110 (category: Flight)
Set the current system to the nearest system and return to hyp
[X]
Subroutine cpl (category: Universe)
Print the selected system name
[X]
Subroutine dockEd (category: Flight)
Print a message to say there is no hyperspacing allowed inside the station
[X]
Label goTT147 is local to this routine
[X]
Subroutine hm (category: Charts)
Select the closest system and redraw the chart crosshairs
[X]
Label sob is local to this routine