Skip to navigation

Elite on the BBC Micro and NES

Universe: hyp1

[NES version, Bank 0]

Name: hyp1 [Show more] Type: Subroutine Category: Universe Summary: Process a jump to the system closest to (QQ9, QQ10)
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TT18 calls hyp1

Do a hyperspace jump to the system closest to galactic coordinates (QQ9, QQ10), and set up the current system's state to those of the new system.
Returns: (QQ0, QQ1) The galactic coordinates of the new system QQ2 to QQ2+6 The seeds of the new system EV Set to 0 QQ28 The new system's economy tek The new system's tech level gov The new system's government
Other entry points: hyp1+3 Jump straight to the system at (QQ9, QQ10) without first calculating which system is closest. We do this if we already know that (QQ9, QQ10) points to a system
.hyp1 JSR jmp ; Set the current system to the selected system LDX #5 ; We now want to copy the seeds for the selected system ; in QQ15 into QQ2, where we store the seeds for the ; current system, so set up a counter in X for copying ; 6 bytes (for three 16-bit seeds) .TT112 LDA safehouse,X ; Copy the X-th byte in safehouse to the X-th byte in STA QQ2,X ; QQ2 STA QQ15,X ; Copy the X-th byte in safehouse to the X-th byte in ; QQ15 as well, to set the selected system DEX ; Decrement the counter BPL TT112 ; Loop back to TT112 if we still have more bytes to ; copy INX ; Set X = 0 (as we ended the above loop with X = $FF) STX EV ; Set EV, the extra vessels spawning counter, to 0, as ; we are entering a new system with no extra vessels ; spawned LDA #%10000000 ; Set bit 7 and clear bit 6 of selectedSystemFlag, to STA selectedSystemFlag ; indicate that there is a currently selected system ; but we can't hyperspace to it (because it is the same ; as the currently selected system) JSR UpdateIconBar_b3 ; Update the icon bar to remove the Hyperspace button ; if present JSR TT24_b6 ; Call TT24 to calculate system data from the seeds in ; QQ15 and store them in the relevant locations, so our ; new selected system is fully set up LDA QQ3 ; Set the current system's economy in QQ28 to the STA QQ28 ; selected system's economy from QQ3 LDA QQ5 ; Set the current system's tech level in tek to the STA tek ; selected system's economy from QQ5 LDA QQ4 ; Set the current system's government in gov to the STA gov ; selected system's government from QQ4 ; Fall through into GVL to calculate the availability of ; market items in the new system