Skip to navigation

Elite on the BBC Micro

Universe: SOLAR [Electron version]

Name: SOLAR [Show more] Type: Subroutine Category: Universe Summary: Set up various aspects of arriving in a new system
Context: See this subroutine in context in the source code Variations: See code variations for this subroutine in the different versions References: This subroutine is called as follows: * TT18 calls SOLAR

Halve our legal status, update the missile indicators, and set up the data block and slot for the planet.
.SOLAR LSR FIST \ Halve our legal status in FIST, making us less bad, \ and moving bit 0 into the C flag (so every time we \ arrive in a new system, our legal status improves a \ bit) JSR ZINF \ Call ZINF to reset the INWK ship workspace, which \ doesn't affect the C flag LDA QQ15+1 \ Fetch s0_hi AND #%00000111 \ Extract bits 0-2 (which also happen to determine the \ economy), which will be between 0 and 7 ADC #6 \ Add 6 + C, and divide by 2, to get a result between 3 LSR A \ and 7, at the same time shifting bit 0 of the result \ of the addition into the C flag STA INWK+8 \ Store the result in z_sign in byte #6 ROR A \ Halve A, rotating in the C flag, which was previously STA INWK+2 \ bit 0 of s0_hi + 6 + C, so when this is stored in both STA INWK+5 \ x_sign and y_sign, it moves the planet to the upper \ right or lower left JSR SOS1 \ Call SOS1 to set up the planet's data block and add it \ to FRIN, where it will get put in the first slot as \ it's the first one to be added to our local bubble of \ this new system's universe LDA #129 \ Set A = 129, the ship type for the placeholder, so \ there isn't a space station, but there is a non-zero \ ship type to indicate this JSR NWSHP \ Call NWSHP to set up the new data block and add it \ to FRIN, where it will get put in the second slot as \ we just cleared out the second slot, and the first \ slot is already taken by the planet