We just reached 30,000 articles on this wiki! 🥳
If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Imperium Galactum (Apple II)

From The Cutting Room Floor
Jump to navigation Jump to search

Title Screen

Imperium Galactum

Developer: Strategic Simulations
Publisher: Strategic Simulations
Platform: Apple II
Released in US: 1984


SourceIcon.png This game has uncompiled source code.


Source Code

Side B of the disk contains a slew of source code, starting at Track 20, Sector 4. This continues until Track 23, Sector 10.

 BNE S305B
S305A1 LDX PLN1
 INX
 CPX #4
 BCC S305A
 RTS
S305B LDX #0
S305B1 STX PLN2
 CPX PLN1
 BNE S305C
S305B2 LDX PLN2
 INX
 CPX #4
 BCC S305B1
 BCS S305A1
S305C LDA EX,X
 BEQ S305B2
 STX PL
 LDA PLN1
 STA APL
 JSR GTDIPL
 CMP #2
 BCS S305C1
 JSR REVPL
 JSR GTDIPL
 CMP #2
 BCC S305B2
S305C1 LDA PLN1
 STA AP
 LDA PLN2
 STA DP
 LDA #1
 STA PASS
 LDX #0
S305D STX X
 LDA EX,X
 BNE S305D2
S305D1 LDX X
 INX
 CPX #4
 BCC S305D
 BCS S305E
S305D2 CPX PLN2
 BEQ S305D1
 CPX PLN1
 BEQ S305D1
 STX APL
 LDA PLN2
 STA PL
 JSR GTDIPL
 BNE S305D1
 JSR REVPL
 JSR GTDIPL
 BNE S305D1
 LDX PASS
 LDA X
 STA DP,X
 INC PASS
 LDX X
 STX PL
 LDX PLN1
 STX APL
 JSR GTDIPL
 CMP #2
 BCS S305D1
 JSR REVPL
 JSR GTDIPL
 CMP #2
 BCS S305D1
 JSR SUB300
 JMP S305B2
S305E LDX #1
 STX PASS
 LDX #0
S305F STX Y
 LDA EX,X
 BNE S305F2
S305F1 LDX Y
 INX
 CPX #4
 BCC S305F
 RTS
S305F2 CPX PLN1
 BEQ S305F1
 STX PL
 LDA PLN1
 STA APL
 JSR GTDIPL
 BNE S305F1
 JSR REVPL
 JSR GTDIPL
 BNE S305F1
 LDX #0
S305G STX X
 LDA DP,X
 STA PL
 CMP #4
 BEQ S305H
 JSR GTDIPL
 CMP #2
 BCC S305F1
 LDX X
 INX
 CPX #3
 BCC S305G
S305H LDX PASS
 LDA Y
 STA AP,X
 JMP S305F1
SUB405 LDX #0
 LDA MISSON
 BPL S405A
 LDA #32
 LDX #128
S4050 STA PLAYMS-1,X
 DEX
 BNE S4050
S405A STX ATDEF
 LDA #0
 STA TA,X
 CPX #0
 BEQ S405A1
 LDX #3
S405A1 STX PASS
 LDA AP,X
S405A2 STA PL
 CMP #4
 BNE S405B
 JMP S405M1
S405B LDA MISSON
 BMI S405C
 JMP S405K
S405C JSR STPLMS
 STX APL
 LDX #0
S405D STX TF
 LDY #5
 JSR GETTF
 CMP SYST
 BNE S405J
 LDY #7
 LDA (ZWORK),Y
 STA ANS
 CMP #9
 BCS S405J
 CMP #4
 BEQ S405E
 CMP #5
 BNE S405F
S405E STA WRK3
 LDX TURN
 CPX #10
 BEQ S405J
 BNE S405F1
S405F LDA #0
 STA WRK3
S405F1 LDA MISSON
 AND #127
 LDX ATDEF
 BNE S405G
 CMP #2
 BNE S405F2
 CMP ANS
 BEQ S405J
S405F2 LDX TURN
 CPX #10
 BNE S405F3
 LDX ANS
 CPX #2
 BEQ S405J
 BNE S405I
S405F3 CMP ANS
 BEQ S405I
 CMP #2
 BNE S405J
 LDA WRK3
 BNE S405J
 BEQ S405I
S405G CMP #3
 BEQ S405H
 LDA WRK3
 BNE S405J
 BEQ S405I
S405H LDA WRK3
 BEQ S405J
 JSR RAND
 CMP #28
 BCS S405J
S405I LDX APL
 LDA TF
 STA PLAYMS,X
 INC APL
S405J LDX TF
 INX
 CPX #32
 BCS S405J1
 JMP S405D
S405J1 LDA APL
 AND #31
 BEQ S405K
 LDX APL
 LDA #32
 STA PLAYMS,X
S405K JSR SUB34
 BNE S405L1
 LDX PASS
S405K1 LDA #4
 INX
 CPX #3
 BEQ S405L
 CPX #6
 BEQ S405L
 LDA AP,X
S405L DEX
 STA AP,X
 INX
 CMP #4
 BNE S405K1
 DEX
 CPX PASS
 BNE S405M
S405L1 LDX PASS
 INX
 CPX #3
 BEQ S405M1
 CPX #6
 BEQ S405M1
 STX PASS
S405M LDX PASS
 JMP S405A1
S405M1 LDX ATDEF
 BNE S405M2
 INX
 JMP S405A
S405M2 RTS
REVPL LDA APL
 PHA
 LDA PL
 STA APL
 PLA
 STA PL
 RTS
GTDIPL JSR GETDV
 LDY #5
 LDA (SCREEN),Y
 RTS
STPLMS LDA PL
 ASL
 ASL
 ASL
 ASL
 ASL
 TAX
 RTS
SUB34 LDA #0
 STA AVGEFF
 JSR STPLMS
SUB34A LDA PLAYMS,X
 CMP #32
 BEQ SUB34C
 INX
 TXA
 AND #31
 BNE SUB34A
SUB34C STX AVGEFF+1
 DEC AVGEFF+1
SUB34B DEX
 STX APL
 TXA
 AND #31
 CMP #31
 BEQ SUB34F
 LDA PLAYMS,X
 CMP #32
 BCS SUB34D
 TAX
 LDY #6
 JSR GETTF
 CLC
 ADC AVGEFF
 STA AVGEFF
 JMP SUB34E
SUB34D LDY AVGEFF+1
 LDA PLAYMS,Y
 LDX APL
 STA PLAYMS,X
 LDA #32
 STA PLAYMS,Y
 DEC AVGEFF+1
SUB34E LDX APL
 JMP SUB34B
SUB34F LDX PL
 LDA AVGEFF
 STA NP,X
 LDX ATDEF
 CLC
 ADC TA,X
 BCC SUB34G
 LDA #255
SUB34G STA TA,X
 LDA AVGEFF
 BNE SUB34H
 JSR STPLMS
 LDA PLAYMS,X
 CMP #32
 BEQ SUB34H
 INC AVGEFF
SUB34H LDA AVGEFF
 RTS

 GTPOS2
 INC ANS+1
GTPOS2 STA SCREEN
 LDA ANS+1
 STA SCREEN+1
  LDA #0
 RTS
MULT0 LDA #0
 STA NUM1+1
 STX NUM1
 STY NUM2
 LDA #0
 STA WRK3
 STA ANS
 STA ANS+1
 LDY #8
MULT1 LSR NUM1+1
 ROR NUM1
 BCC MULT2
 CLC 
 ADC NUM2
MULT2 ROR
 ROR ANS+1
 ROR ANS
 DEY 
 BNE MULT1
 LDY NUM1
 BEQ MULT3
 LDY #8
 INC WRK3
 JMP MULT1
MULT3 LDY WRK3
 BNE MULT4
 LDY ANS+1
 STY ANS
 STA ANS+1
MULT4 LDX ANS+1
 LDA ANS
 RTS 
GETTF LDA #TSKFRC/256
 CLC 
 ADC PL
 STA ZWORK+1
 TXA 
 ASL
 ASL
 ASL
 ADC #TSKFRC&255
 STA ZWORK
 BCC GTTFE
 INC ZWORK+1
GTTFE LDA (ZWORK),Y
 RTS 
DRWTSK LDA PL
 TAY
 ASL
 ASL
 ASL
 STA PASS
 CPY #2
 BCC DRTSK0
 LDY #2
 LDA MAP
 BEQ DRTSK1
 INY
 BNE DRTSK1
DRTSK0 LDY #0
DRTSK1 JSR GETPOS
 LDY #0
 STY NUM2
 LDA PL
 AND #1
 BEQ DRTSK2
 INC SCREEN
 INC SCREEN
 LDA MAP
 BEQ DRTSK2
 INC SCREEN
DRTSK2 JMP PRCHAR
GETPLN LDY #20
 JSR MULT0
 CLC 
 ADC #PLANET&255
 STA ZWORK2
 TXA 
 ADC #PLANET/256
 STA ZWORK2+1
 RTS 
DRMPTC LDA #15
 STA MAP
 LDA X
 SEC 
 SBC #10
 BPL DMPTC1
 LDA #0
DMPTC1 CMP #20
 BCC DMPTC2
 LDA #20
DMPTC2 STA CX
 CLC 
 ADC #19
 STA EX
 LDA Y
 SEC 
 SBC #5
 BPL DMPTC3
 LDA #0
DMPTC3 CMP #10
 BCC DMPTC4
 LDA #10
DMPTC4 STA CY
 CLC 
 ADC #9
 STA EY
 BNE DRWMAP
DRMPST LDA #0
 STA CX
 STA CY
 STA MAP
 LDA #39
 STA EX
 STA EY
DRWMAP JSR HGR
 LDX #0
DRWMP0 STX SYST
 JSR GETSYS
 LDY #0
 LDA (ZWORK),Y
 BNE DRWMP2
DRWSKP JMP DRWMPH
DRWMP1 LDA (ZWORK),Y
 AND #127
DRWMP2 STA TYPE,Y
 INY
 CPY #5
 BCC DRWMP1
 LDY #1
 JSR GETPOS
 BNE DRWSKP
 LDA TYPE
 LDY MAP
 BNE DRMP2A
 ASL
 ASL
 ASL
 ADC #24
 STA PASS
 LDA ODEVEN
 STA NUM2
 JMP DRMP2B
ADD127 LDA SCREEN
 CLC
 ADC #127
 STA SCREEN
 RTS
DRMP2A JSR MULT32
 CLC
 ADC #40
 STA PASS
 LDY #0
 STY NUM2
 INC SCREEN
 JSR PRCHAR
 INC SCREEN
 JSR PRCHAR
 JSR ADD127
 JSR PRCHAR
DRMP2B INC SCREEN
 JSR PRCHAR
 LDX #0
 STX AVGEFF
 LDA APL
 STA PL
 JSR FINDTF
DRWMP4 BMI DRWMP7
 INC AVGEFF
 LDY #7
 LDA MISSON
 CMP #10
 BEQ DRWMP6
 CMP (ZWORK),Y
 BEQ DRWMP6
 JSR FNDTF1
 JMP DRWMP4
DRWMP6 JSR DRWTSK
DRWMP7 LDA AVGEFF
 BNE DRWMPC
 LDY #0
DRWMPB STY TYPE
 LDX PLN1,Y
 CPX #75
 BCS DWMPBA
 JSR GETPLN
 LDY #9
 LDA (ZWORK2),Y
 JSR DIV32
 TAY 
 DEY 
 CPY
 APL
 BEQ DRWMPC
DWMPBA LDY TYPE
 INY 
 CPY #2
 BCC DRWMPB
 BCS DRWMPH
DRWMPC LDX #0
DRMPCA STX PL
 CPX APL
 BEQ DRWMPG
 JSR FINDTF
 BMI DRWMPG
 JSR DRWTSK
DRWMPG LDX PL
 INX 
 CPX #4
 BCC DRMPCA
DRWMPH LDX SYST
 INX 
 CPX #50
 BCS DRWMPI
 JMP DRWMP0
DRWMPI RTS
PRCHAR LDX PASS
 LDA SHAPES,X
 LDY NUM2
 BEQ PRCHR1
 LDX TYPE
 CPX #4
 BNE PRCHR0
 AND #127
 LSR A
 BNE PRCHR3
PRCHR0 ASL
 AND #127
 BCC PRCHR1
PRCHR3 ORA #128
PRCHR1 LDY #0
 STA (SCREEN),Y
 INC PASS
 LDA PASS
 AND #7
 BEQ PRCHR2
 LDA SCREEN+1
 CLC
 ADC #4
 STA SCREEN+1
 BNE PRCHAR
PRCHR2 LDA SCREEN+1
 AND #$23
 STA SCREEN+1
 RTS
FNDSYS LDA #50
 STA TYPE
 LDX #0
FNDSY1 STX SYST
 JSR GETSYS
 LDY #0
 LDA (ZWORK),Y
 BEQ FNDSY2
 LDY #3
 LDA (ZWORK),Y
 AND #127
 CMP X
 BNE FNDSY3
 INY 
 LDA (ZWORK),Y
 AND #127
 CMP Y
 BNE FNDSY3
 RTS 
FNDSY2 LDX SYST
 STX TYPE
FNDSY3 INC SYST
 LDX SYST
 CPX #50
 BCC FNDSY1
 RTS 
DIV STA NUM1
 TXA 
 STY NUM2
 LDY #0
 STY ANS
 LDY #8
 SEC 
 SBC NUM2
LOOP PHP 
 ROL ANS
 ASL NUM1
 ROL
 PLP 
 BCC ADD
 SBC NUM2
 JMP NEXT
ADD ADC NUM2
NEXT DEY 
 BNE LOOP
 BCS LAST
 ADC NUM2
 CLC 
LAST ROL ANS
 LDY ANS
 RTS 
RANDOM STA NUM2
 BEQ RAND5
 LDX #0
RAND2 LDA NUM2
 ASL
 BCS RAND3
 ASL NUM2
 INX 
 BNE RAND2
RAND3 JSR RAND
 CMP NUM2
 BCS RAND3
 CPX #0
 BEQ RAND5
RAND4 LSR
 DEX 
 BNE RAND4
RAND5 TAX 
 INX 
 RTS
RAND TXA
 PHA
 LDA #0
 STA VARAND+1
 STA VARAND
 LDA #6
 STA VWRK3
RNDNUM LDA VARWRK
 SEC
 ADC VARWRK+4
 ADC VARWRK+5
 STA VARWRK
 LDX #4
NXTDGT LDA VARWRK,X
 STA VARWRK+1,X
 DEX
 BPL NXTDGT
 CLC
 LDA VARWRK+1
 ADC VARAND
 STA VARAND
 LDA VARAND+1
 ADC #0
 STA VARAND+1
 DEC VWRK3
 BNE RNDNUM
 PLA
 TAX
 LDA VARAND
 RTS
DIV32 LSR
 LSR
 LSR
 LSR
 LSR
 RTS 
FNDSHP TYA 
 LDY #0
 LDX #0
 JSR GTSHIP
FNDSH1 STX SHIP2
 STY SHIP4
 LDA (ZWORK),Y
 BNE FNDSHE
FNDSH3 INY 
 INY 
 BNE FNDSH2
 INC ZWORK+1
FNDSH2 INX 
 BNE FNDSH1
FNDSHE RTS 
FNDWSH STX TURN
 LDA SHIP1
 SEC 
 LDY AP,X
 SBC NP,Y
 BCC FNDW1
 STA SHIP1
 INX 
 BNE FNDWSH
FNDW1 STY PL
 INC SHIP1
 JSR FNDSHP
FNDW2 BEQ FNDW5A
 INY 
 LDA (ZWORK),Y
 AND #31
 STA VALUE
 JSR CMPTSK
 BEQ FNDW5
 DEC SHIP1
 BEQ FNDW6
FNDW5 LDX SHIP2
 DEY 
 JSR FNDSH3
 JMP FNDW2
FNDW5A LDA #4
 STA PL
FNDW6 RTS 
CMPTSK JSR STPLMS
CMPTS1 LDA PLAYMS,X
 AND #63
 CMP #32
 BEQ CMPTS3
 CMP VALUE
 BEQ CMPTS2
 INX 
 TXA 
 AND #31
 BEQ CMPTS3
 BNE CMPTS1
CMPTS2 LDA #1
CMPTS3 RTS 
MOVSHP INY
 LDA (ZWORK),Y
 JSR DIV32
 STA CLASS,X
 DEY 
 LDA (ZWORK),Y
 JSR DIV32
 STA TECH,X
 LDA (ZWORK),Y
 AND #31
 STA EFF,X
 RTS 
LODSHP CMP PL
 BEQ LDSP02
 PHA 
 LDA PDS
 BPL LDSP0
 LDX #0
 STX NRG
 STX PB
 LDY #32
 STY MS
 AND #127
 CMP SHIP
 BEQ LDSP00
 BCS LDSP01
LDSP00 STX MS
 STY NRG
LDSP01 LDA PDA
 BMI LDSP03
 LSR MS
 LSR NRG
LDSP03 PLA 
 JMP LDSP3
LDSP0 PLA 
LDSP02 ASL
 ASL
 ASL
 ORA CLASS,X
 ASL
 ASL
 ASL
 ADC #DESIGN&255
 STA ZWORK2
 LDA #0
 ADC #DESIGN/256
 STA ZWORK2+1
 LDA EFF,X
 STA WEFF
 
STY WRK1
 LDY #7
 LDA (ZWORK2),Y
 STA SIZ
 CMP #2
 BCS LDSP1
 ASL WTECH
 CMP #1
 BCS LDSP1
 ASL WTECH
LDSP1 LDY #3
 LDA (ZWORK2),Y
 STA EV
 LDY WRK1
LDSP2 STY WRK1
 LDA (ZWORK2),Y
 CLC 
 ADC WTECH
 STA PB,Y
 TAX 
 LDA #25
 SEC 
 SBC WEFF
 TAY 
 JSR MULT0
 LDY #25
 JSR DIV
 ASL
 CMP NUM2
 BCC LDSP20
 INC ANS
LDSP20 LDY WRK1
 LDA PB,Y
 SEC 
 SBC ANS
 STA PB,Y
 INY 
 CPY #3
 BEQ LDSP3
 CPY #6
 BCC LDSP2
LDSP3 RTS 
SETTEC LDA PDS
 BMI STEC2
 LDA TECH,X
 SEC 
 SBC TECH,Y
 BCS STEC1
STEC2 LDA #0
STEC1 STA WTECH
 RTS 
EXPLOD LDA #5
 STA SOUND
 LDA #255
 STA SOUND+1
 LDA #2
 STA SOUND+2
 JSR H94A2
 LDA #$82
 STA SOUND+2
 LDA #$1E
 STA SOUND
H94A2 SEC
 INC SOUND
 LDX SOUND+1
H94A7 ROL $00
 ROL $01
 TXA
 BEQ H94AF
 DEX
H94AF BNE H94B8
 BCC H94B8
 LDA $C030
 LDX SOUND+1
H94B8 ROR
 ROR
 ROR
 EOR $01
 ASL
 ASL
 ASL
 PHP
 LDA SOUND+2
 BEQ H94D9
 DEY
 BNE H94D9
 TAY
 BMI H94D4
 LDA SOUND+1
 BEQ H94D9
 DEC SOUND+1
 TYA
 BNE H94D9
H94D4 INC SOUND+1
 AND #$7F
 TAY
H94D9 PLP
 DEC VARAND+1
 BNE H94A7
 DEC SOUND
 BNE H94A7
 RTS
DAMAGE LDX SIZ
 BEQ DAMAG1
 ASL
 DEX
 BEQ DAMAG1
 ASL
DAMAG1 STA WRK1
 LDX TF
 LDA EFF,X
 SEC
 SBC WRK1
 BCS DAMAG2
 LDA #0
DAMAG2 STA WEFF
 STA EFF,X
 LDY SHIP4
 LDA (ZWORK),Y
 AND #$E0
 ORA WEFF
 STA (ZWORK),Y
 LDA WEFF
 BEQ DAMAG3
 RTS 
DAMAG3 STA (ZWORK),Y
 JSR EXPLOD
 JSR ADJDV
 LDX TF
 DEC TA,X
 LDX PL
 DEC NP,X
 LDY SHIP4
 INY 
 LDA (ZWORK),Y
 AND #31
 STA VALUE
 AND #0
 STA (ZWORK),Y
 LDX VALUE
 LDY #6
 JSR GETTF
 BEQ DAMAG7
 SEC 
 SBC #1
 STA (ZWORK),Y
 BNE DAMAG7
 JMP CONDNS
DAMAG7 LDA #0
 RTS 
COMBAT JSR RAND
 AND #1
 STA ATDEF
 LDX #0
CMBT0 STX PASS
 LDY ATDEF
 LDA MANEUV,Y
 BEQ COMBT
 JSR RAND
 AND #3
 BEQ CMBT00
COMBT LDA TA,Y
 BNE CMBT01
CMBT03 LDY ATDEF
 BEQ CMBT00
 LDA PDS
 BMI CMBT00
 LDA PDA
 AND #127
 CLC 
 ADC PDS
 BNE CMBT04
CMBT00 JMP CMBT6A
CMBT04 PHA
 LDA PDS
 ORA #128
 STA PDS
 PLA 
CMBT01 STA MXSHIP
 LDX #0
CMBT02 STX SHIP
 JSR RAND
 AND #15
 BEQ CMBT1
CMBT05 JMP CMBT5
CMBT1 JSR GETATK
 BMI CMBT03
 BNE CMBT05
 CMP #0
 BNE CMBT21
 JMP ATKTRN
CMBT21 JSR RANDOM
 STA SHIP1
 STA SHIP3
 LDX TF
 BEQ CMBT3
 LDX #3
CMBT3 JSR FNDWSH
 LDA PL
 CMP #4
 BNE CMBT31
 JMP CMBT44
CMBT31 JSR SURPRS
 BPL CMBT32
 JMP CMBT5
CMBT32 LDY SHIP4
 LDX TF
 JSR MOVSHP
 LDX ATDEF
 LDY TF
 JSR SETTEC
 LDY #0
 LDA APL
 JSR LODSHP
 LDX TF
 LDY ATDEF
 JSR SETTEC
 LDY #4
 LDA PL
 JSR LODSHP
 LDA PB
 BEQ CMBT41
 JSR RAND
 AND #15
 BNE CMBT41
 JSR RAND
 AND #15
 CMP EV
 BCC CMBT41
 LDA PB
 JSR DAMAGE
 BMI CMBT44
 BEQ CMBT42
CMBT41 LDA NRG
 BEQ CMBT43
 JSR RAND
 AND #3
 BEQ CMBT43
 JSR RAND
 AND #15
 CMP EV
 BCC CMBT43
 LDA NRG
 JSR RANDOM
 STX ANS
 LDA AR
 LSR
 STA ANS+1
 JSR RANDOM
 TXA 
 CLC 
 ADC ANS+1
 STA ANS+1
 LDA ANS
 SEC 
 SBC ANS+1
 BCC CMBT43
 BEQ CMBT43
 JSR DAMAGE
 BMI CMBT44
 BNE CMBT43
CMBT42 JMP CMBT5
CMBT44 LDA ATDEF
 BNE CMBT45
 LDA PDS
 BNE CMBT42
 LDA PDA
 AND #127
 BNE CMBT42
CMBT45 JMP CMBT9
CMBT43 LDA MS
 BEQ CMBT5
 JSR RANDOM
 STX ANS
 LDA AM
 ASL
 ASL
 ADC AM
 JSR RANDOM
 CPX ANS
 BEQ CMBT46
 BCS CMBT5
CMBT46 JSR RAND
 AND #7
 BEQ CMBT5
 JSR DAMAGE
 BMI CMBT44
CMBT5 LDX SHIP
 INX 
 CPX MXSHIP
 BCS CMBT6
 JMP CMBT02
CMBT6 JMP CMBT03
CMBT6A LDA #1
 SEC 
 SBC ATDEF
 STA ATDEF
 LDA PDS
 AND #127
 STA PDS
 LDX PASS
 INX 
 CPX #64
 BCS CMBT7
 JMP CMBT0
ATKTRN JSR DESTRN
 BMI CMBT9
 BPL CMBT5
CMBT7 LDX #0
CMBT8 STX ATDEF
 LDA MANEUV,X
 BNE CMBTA
CMBT8A LDX
(Source: Original TCRF research)