K240 Alien Files

Game files are currently a mystery. Here are a few clues.

Each alien from 1 to 6 has the following files:

  • scenario/alien1.mgl - Likely the alien picture
  • scenario/planet1.mgl - Likely the alien planet animation
  • aliens/a1data1
  • aliens/a1data2
  • aliens/a1data3
  • aliens/a1data4.bin

The following data is probably stored in the four aliens files for each alien: Starting colonies and ships, ship configurations, building data, and perhaps sprites and AI settings.

Code reference

The following appears at $1e04e in the disassembly:

; d0 is the alien number
ADDI.B    #$30,D0            ; Convert alien number to ascii

MOVE.W    D0,-(A7)           ; Push alien number to stack

LEA       STR_A1DATA4BIN,A0  ; load filename "a1data4.bin" to register A0
MOVE.B    D0,15(A0)          ; Insert correct number into filename
LEA       LAB_0C7B,A5        ; Load address LAB_0C7B to register A5
JSR       LAB_0065           ; Jump to LAB_0065
BMI.S     LAB_008C           ; Branch fo LAB_008C on failure
MOVE.W    (A7),D0            ; Copy alien number back to d0

LEA       STR_A1DATA3,A0     ; load filename "a1data3" to register A0
MOVE.B    D0,15(A0)          ; Insert correct number into filename
LEA       LAB_0E28,A5        ; Load address LAB_0E28 into register A5
JSR       LAB_0065           ; Jump to LAB_0065
BMI.S     LAB_008C           ; Branch to LAB_008C on failure
MOVE.W    (A7),D0            ; Copy alien number back to A0

LEA       STR_A1DATA1,A0     ; Load filename "a1data1" to register A0
MOVE.B    D0,15(A0)          ; Insert correct number into filename
LEA       LAB_0BEE,A5        ; Load address LAB_0BEE into register A5
JSR       LAB_0065           ; Jump to LAB_0065
BMI.S     LAB_008C           ; Branch to LAB_008C on failure
MOVE.W    (A7),D0            ; Copy alien number back to A0

LEA       STR_A1DATA2,A0     ; Load filename "a1data" to register A0
MOVE.B    D0,15(A0)          ; Insert correct number into filename
MOVEA.L   LAB_0031,A5        ; Load address LAB_0031 into register A5
JSR       LAB_0065           ; Jump to LAB_0065

MOVE.W    (A7)+,D0           ; Pop D0 from the stack
MOVEQ     #0,D0              ; Set D0 to zero
RTS                          ; Return

The address loaded to register A5 is probably the location where the alien data is loaded to.

a1data1

610 bytes. A pattern emerges at a width of 10 bytes, or perhaps 5 bytes. Could this be building data?

Appears to load to $1e04e. Disassembly has a 154 word or 616 byte gap here which fits the 610 byte file.

— Added 26/05/2014 by Thiima. a1data1 is still somewhat of a mystery to me. Replacing a1data1 with a6data1 seems to adjust the colour / location of sprites used in as much as when combined with a6data2 the ships look almost normal. See example: http://imgur.com/KGNZuyG

a1data2

Variable filesize: 21,640, 22,150, 20,450, 21,160, 21,490 and 22,780 bytes. Content is a mystery.

Appears to load to $0053a, in which case it ends between $551C and $5E36 depending on filesize. This doesn't seem to make much sense as these areas include code and 20,450 bytes would end in the middle of a command. Perhaps it only overwrites code used in game initialization?

— Added 26/05/2014 by Thiima. a1data2 appears to contain the sprites, or instructions for loading the spirtes for the alien ships. Replacing a1data2 with a6data2 results in garbled ship sprites but a familiar green colouring.
See here for an example: http://imgur.com/B9BI1Zb

a1data3

Variable filesize: 7190, 4240, 8450, 6410, 6950 and 5960 bytes. Content is a mystery.

Appears to load to $33768 which has the following data structures:

LAB_0E28:
DS.L 100
LAB_0E29:
DS.L  4150

In other words, variables point to a structure of 400 bytes and one of 16,600 bytes. This suggests that the first 400 bytes is a separate data structure. It appears to be a structure of 40 records of 10 width, similar to a1data1. It may be building data.

— Added 26/05/2014 by Thiima. a1data3 does indeed appear to relate to building data, or at the very least sprites. Replacing a1data3 with a6data results in the sprites being replaced with the sprites from alien 6, although descriptions remain the same. Unknown whether or not this affects the stats of the building. See here for example: http://imgur.com/gGgQCOh

a1data4.bin

1,928 bytes. Content is a mystery.

Appears to load to $20300, in which case it fills several variables from $20300 to $20A88, several of which are used by the save game format. In particular, the thirty bytes after the first four bytes in the a1data4 file are saved as save game file PART1. Immediately after a1data4's memory location begins the area used as save game file PART2.

The label structure suggests the following data structure for a1data4.

Position Type Default value
$20300 Long $20a68 (ptr)

By default, this value is a pointer to $20a68.

The following forms PART1 of the save game file. It could change during play.

Type Default value a1 a2 a3 a4 a5 a6 Purpose
Word $0001 $0001 $0002 $0003 $0004 $0005 $0006 This value is used to determine which scenario is loaded and all related information such as starting money.
Word $003c $003c $003c $003c $0046 $003c $0032
Word $0000 $0000 $0000 $0000 $0000 $0000 $0000
Word $0046 $0046 $001e $0082 $0028 $0032 $0028
Word $00c8 $00c8 $001e $0023 $002d $0023 $0078
Word $0019 $0019 $0023 $001e $0000 $001e $001e
Word $0014 $0014 $000a $000f $000f $0019 $0019
Word $0000 $0000 $00c8 $0000 $0000 $0064 $0000
Word $0000 $0000 $0000 $0000 $0000 $0064 $0000
Word $0002 $0002 $0002 $0003 $0004 $0005 $0000
Word $0004 $0004 $0004 $0005 $0006 $0007 $0007
Word $0006 $0006 $0006 $0008 $000a $0000 $000b
Word $0010 $0010 $0010 $0050 $0000 $0028 $001e
Word $0028 $0028 $0028 $001e $0000 $001e $0014
Byte $08 $08 $06 $06 $06 $06 $05
Byte $00 $00 $00 $00 $00 $00 $04

Replacing any of the above from one aliens file into another does not appear to influence anything with the scenario (apart from the initial value which seems to be the only thing that dictates it).

There are only six scenarios (01 through to 06) entering 07 will cause a Guru Medidation error and 00 will cause a memory error.

The rest doesn't appear in the save game file, and so doesn't change during play.

Position Type Default value Purpose
$20322 400 bytes Contains either building name strings, or references to them.
$204b2 64 bytes No initially obvious effect.
$204f2 21 bytes No initially obvious effect.
$20508 12 bytes No initially obvious effect.
$20514 32 bytes No initially obvious effect.
$20534 192 bytes No initially obvious effect.
$205f4 512 bytes No initially obvious effect.
$207f4 256 bytes No initially obvious effect, however by this stage i've noticed buildings that do not belong to the race (eg have no building/sprite associated with them) begin to appear such as the tentacular defender.
$208f4 256 bytes No initially obvious effect.
$209f4 34 bytes No initially obvious effect.
$20a16 82 bytes No initially obvious effect.
$20a68 32 bytes No initially obvious effect. It may be that these are all related to buildings.
$20a88 Long $00000000

— Added 26/05/2014 by Thiima. This appears to be the 'Scenario' data that determines things like how much money you start with, which techs you start with, what sort of random events you're likely to get, how many asteroids / ships / stations the enemy start with. It also determines the names of the buildings the aliens build. See example: http://imgur.com/WFBRoPB

I now believe this file also contains the stats for the alien buildings along with their names. My reasoning behind this is that I transplanted the Rigellian aliens into the Swixaran scenario, and the two outlier colonies destroyed themselves (presumably from lack of water / air) before being complete, see the following video: https://www.youtube.com/watch?v=LGGCPG_k2Ic&feature=youtu.be

Some very wierd things start to happen when you swap aliens scenario data, especially for the Swixarans starting transports (the ones that move around like normal ships waving arms) and aliens who's space stations consist of multiple smaller entities.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License