.LOMOD JSR THERE \ Call THERE to see if we are in the Constrictor's \ system in mission 1 LDA #6 \ Set A to the number of the ship blueprints file \ containing the Constrictor (ship blueprints file G) BCS SHIPinA \ If the C flag is set then we are in the Constrictor's \ system, so skip to SHIPinA JSR DORND \ Set A and X to random numbers and reduce A to a AND #3 \ random number in the range 0-3 (i.e. just bits 0-1) LDX gov \ If the system's government type is 0-2 (anarchy, CPX #3 \ feudal or multi-government), shift a 0 into bit 0 of ROL A \ A, otherwise shift a 1 LDX tek \ If the system's tech level is 0-9, shift a 0 into bit CPX #10 \ 0 of A, otherwise shift a 1 ROL A \ By this point, A is: \ \ * Bit 0 = 0 for low tech level (Coriolis station) \ 1 for high tech level (Dodo station) \ * Bit 1 = 0 for more dangerous systems \ 1 for safer systems \ * Bit 2 = random \ * Bit 3 = random \ * Bits 4-7 = 0 \ \ So A is in the range 0-15, which corresponds to the \ appropriate ship blueprints file (where 0 is file \ D.MOA and 15 is file D.MOP) TAX \ Store A in X so we can retrieve it after the mission 2 \ progress check LDA TP \ If mission 2 has started and we have picked up the AND #%00001100 \ plans, then bits 2-3 of TP will be %10, so this jumps CMP #%00001000 \ to TPnot8 if this is not the case BNE TPnot8 TXA \ Retrieve the value of A we calculated above AND #%00000001 \ We have picked up the plans in mission 2 so we need to ORA #%00000010 \ load a ship blueprints file containing Thargoids, so \ set A to either %10 or %11 for file D.MOC or D.MOD, as \ they are the only files that contain Thargoid ship \ blueprints TAX \ Store the amended A in X again .TPnot8 TXA \ Retrieve the value of A we calculated above .SHIPinA CLC \ Convert A from 0-15 to 'A' to 'P' ADC #'A' STA SHIPI+6 \ Store the letter of the ship blueprints file we want \ in the seventh byte of the command string at SHIPI, so \ it overwrites the "0" in "D.MO0" with the file letter \ to load, from D.MOA to D.MOP JSR CATD \ Call CATD to reload the disc catalogue LDX #LO(SHIPI) \ Set (Y X) to point to the OS command at SHIPI, which LDY #HI(SHIPI) \ loads the relevant ship blueprints file JMP OSCLI \ Call OSCLI to execute the OS command at (Y X), which \ loads the relevant ship blueprints file, and return \ from the subroutine using a tail callName: LOMOD [Show more] Type: Subroutine Category: Loader Summary: Load a new ship blueprints file Deep dive: Ship blueprints in the disc versionContext: See this subroutine in context in the source code References: This subroutine is called as follows: * RSHIPS calls LOMOD * TT18 calls LOMOD * MJP calls via SHIPinA
Other entry points: SHIPinA Load the ship blueprints file specified in A
[X]
Configuration variable CATD = &0D7A
The address of the CATD routine that is put in place by the third loader, as set in elite-loader3.asm
[X]
Subroutine DORND (category: Maths (Arithmetic))
Generate random numbers
[X]
Configuration variable OSCLI = &FFF7
The address for the OSCLI routine
[X]
Variable SHIPI (category: Loader)
The OS command string for loading a ship blueprints file
[X]
Subroutine THERE (category: Missions)
Check whether we are in the Constrictor's system in mission 1
[X]
Label TPnot8 is local to this routine