Skip to navigation


Flight: hyp

[NES version, Bank 0]

Name: hyp [Show more] Type: Subroutine Category: Flight Summary: Start the hyperspace process
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TT102 calls hyp

Called when the hyperspace icon is chosen during flight. Checks the following: * We are in space * We are not already in a hyperspace countdown and if all the pre-jump checks are passed, we print the destination on-screen and start the countdown.
.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 selectedSystemFlag ; If bit 6 of selectedSystemFlag is set, then we can ASL A ; hyperspace to the currently selected system, so jump BMI hyps1 ; to hyps1 to skip the following instruction and keep ; going RTS ; Bit 6 of selectedSystemFlag is clear, so we can't ; hyperspace to the currently selected system (we may ; not have enough fuel, or it might be the same as the ; current system), so return from the subroutine .hyps1 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