WL.EXE

Back to file listing = WASTELAND Main Executable = The main executable file for the game is "WL.EXE". It is compressed using a system known as Microsoft EXEPACK. When compressed (as it appears on the Disks), it is a little over 62Kb in size. When uncompressed it shows that its original size was 169Kb, so EXEPACK does a good job.



Segments
As you can see, the game was written in the era of Segments. This was a heady time when crazed fools in smoke-filled back rooms theorized of a day when computers would have 32-bit addressable memory, and flat memory models. In that day and age, when those mad fools were rightly shunned from polite society, bold brave code adventurers were writing code the Proper Way(tm), with 16-bit near and far pointers, and having to chop the program up into segments, so that these 16-bit near pointers could work properly. As was the norm, the segments were given different roles. In the Wasteland Executable, Segments 0 and 1 are program segments (the bytes within are interpreted as code), segments 2 and 3 are data. Segment 4 was for any temporary-working (the stack segment), and segment 5 seems to be some weird abortion doing who know what unspeakableness.
 * Segment 000 - Primary Code Segment
 * Segment 001 - Secondary Code Segment (timing and some IO it seems)
 * Segment 002 - Working store and some Initialisation data with metadata.
 * Segment 003 - Big setaside chunk for loading buffers and unpacking graphics into.
 * Segment 004 - Stack seg (empty).
 * Segment 005 - Dunno. Data probably.

Language
The Program itself seems to have been written in a mixture of high-level and low-level languages. Most of the functions are very tightly coded and smell very much of assembler, whereas some sections use complex structures, and therefore seem to have been coded in something akin to HLA or perhaps even C. Disassembler programs, such as DCC, however, do not recognise the signature of the EXE file, so it was probably not written in any major port of the C language.

The Executable uses the associated map, tile and data files to control virtually everything. There are, however, some things which are hard coded into the program. Some of these seem to be the number and sizes of the MSQ blocks in the GAMEX files, and certain strings which occur all over the game.

Finding offsets in the EXE file
The wiki sometimes refer to places in the EXE file by using an address like seg002:1fc6. If you just open the unpacked wl.exe file in your favourite hex editor then you can do nothing with such an address. Unfortunately different unpackers produces exe files with different file sizes so direct offsets in the EXE files are dependant of the used unpacker. But there seems to be safe way to find the base offset of seg002 in the EXE file: Just take the file size and subtract 116544 from it. So if your EXE file is 169824 bytes long then seg002 begins at offset 53280 (or 0xd020 in hex). So the address mentioned above can be found at 0xd020 + 0x1fc6 = 0xefe6.