.SOLAR \ --- Mod: Original Acornsoft code removed: -----------> \ 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) \ --- And replaced by: --------------------------------> \ We now want to extract bits 3-10 of QQ8(1 0) into A, \ so we can subtract this value from our legal status in \ FIST (so the further we travel, the quicker our legal \ status drops back down to clean, as we put more \ distance between us and our crimes - specifically, we \ drop 1.2 FIST points for each light year, as we \ subtract (QQ8 / 8) from FIST, and QQ8 contains the \ distance in light years * 10) LDA QQ8 \ Set A to the low byte of the distance to the selected \ system in QQ8(1 0), so (QQ8+1 A) contains the distance LDY #3 \ We're going to extract bits 3-10 by shifting QQ8(1 0) \ right by 3 places, so we start by setting a loop \ counter in Y .legal_div LSR QQ8+1 \ Shift (QQ8+1 A) to the right by one place ROR A DEY \ Decrement the loop counter BNE legal_div \ Loop back until we have shifted right by 3 places, by \ which point A will contain bits 3-10 of QQ8(1 0) \ We now subtract A from FIST, and subtract 1 more, \ making sure we don't reduce FIST beyond 0, which we do \ by doing the subtraction in reverse and then negating \ the result with one's complement SEC \ Set A = A - FIST (which we will negate later) SBC FIST BCC legal_over \ If the subtraction underflowed, i.e. A < FIST, skip \ the following instruction LDA #&FF \ A > FIST, so we set A = &FF so the EOR flips this to \ 0, so FIST gets set to 0 when we travel far enough to \ clear our name .legal_over EOR #&FF \ Flip all the bits in A to negate the result, so if the \ subtraction underflowed, i.e. A < FIST, we now have \ A = FIST - A - 1 STA FIST \ Update the value of FIST to the new value in A \ --- End of replacement ------------------------------> JSR ZINF \ Call ZINF to reset the INWK ship workspace, which \ doesn't affect the C flag LDA QQ15+1 \ Fetch s0_hi AND #%00000011 \ Extract bits 0-1 (which also help to determine the \ economy), which will be between 0 and 3 ADC #3 \ Add 3 + C, to get a result between 3 and 7, clearing \ the C flag in the process STA INWK+8 \ Store the result in z_sign in byte #6 ROR A \ Halve A, rotating in the C flag (which is clear) and STA INWK+2 \ store in both x_sign and y_sign, moving the planet to STA INWK+5 \ the upper right 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 QQ15+3 \ Fetch s1_hi, extract bits 0-2, set bits 0 and 7 and AND #%00000111 \ store in z_sign, so the sun is behind us at a distance ORA #%10000001 \ of 1 to 7 STA INWK+8 LDA QQ15+5 \ Fetch s2_hi, extract bits 0-1 and store in x_sign and AND #%00000011 \ y_sign, so the sun is either dead in our rear laser STA INWK+2 \ crosshairs, or off to the top left by a distance of 1 STA INWK+1 \ or 2 when we look out the back LDA #0 \ Set the pitch and roll counters to 0 (no rotation) STA INWK+29 STA INWK+30 LDA #129 \ Set A = 129, the ship type for the sun JSR NWSHP \ Call NWSHP to set up the sun's data block and add it \ to FRIN, where it will get put in the second slot as \ it's the second one to be added to our local bubble \ of this new system's universeName: SOLAR [Show more] Type: Subroutine Category: Universe Summary: Set up various aspects of arriving in a new systemContext: See this subroutine in context in the source code References: This subroutine is called as follows: * TT18 calls SOLAR

Halve our legal status, update the missile indicators, and set up data blocks and slots for the planet and sun.

[X]

Subroutine NWSHP (category: Universe)

Add a new ship to our local bubble of universe

[X]

Subroutine SOS1 (category: Universe)

Update the missile indicators, set up the planet data block

[X]

Subroutine ZINF (category: Utility routines)

Reset the INWK workspace and orientation vectors

[X]

Label legal_div is local to this routine

[X]

Label legal_over is local to this routine