Skip to content

Latest commit

 

History

History
145 lines (113 loc) · 5.17 KB

File metadata and controls

145 lines (113 loc) · 5.17 KB

05 - The resident loader

Lx_ReloD.cru unpacks to exactly 262,144 bytes -- 256 KB on the nose, another fixed buffer. It is the module Lx_DataL.exe loads and jumps to, and it stays resident for the rest of the session: it owns the file table, the CD driver, the RNC decompressor, the keyboard, the verb bar, and the loading screen.

Its first four instructions are what you expect from a program that has just been handed the machine:

46FC 2700        move  #$2700,sr          all interrupts off
4BF9 0001FB22    lea   $0001FB22,a5
4DF9 00DFF000    lea   $00DFF000,a6       custom chip base
4FF9 0001FB22    lea   $0001FB22,a7       its own stack

The file table

At offset 0x1662 there is a run of 84 twelve-byte filenames, NUL terminated, in load order:

Lx_TPage.cru  Lx_CompC.cru  Lx_CompE.cru  Lx_MSprM.cru  Lx_MSprF.cru
Lx_Sfx_M.bin  Lx_Sfx_F.bin
L1_LLoad.cru  L1_SprDR.cru  L1_GSBlk.cru  L1_Int_E.cru  L1_Int_F.cru
L1_Int_G.cru  L1_XMemI.cru
L2_...  L3_...  L5_...  L6_...  L7_...  L8_...  L9_...
LA_...  LB_...  LC_...

Seven shared files, then seven files for each of eleven levels: 7 + 77 = 84. That is every game file on the disc except the three that make up the boot chain (Lx_ChipI, Lx_ReloD, Lx_DataL), which the first stage loads by name itself.

Two families of names in this table do not match the names on the disc:

In the table On the disc
Lx_Sfx_M.bin, Lx_Sfx_F.bin Lx_SFX_M.bin, Lx_SFX_F.bin
LA_*, LB_*, LC_* La_*, Lb_*, Lc_*

Twenty-nine of the eighty-four entries are spelled with the wrong case. The game works because ISO 9660 filenames are matched case-insensitively by every Amiga file system that mounts them -- but it means the disc has never been read by anything that cares, and it is a trap for anyone extracting the files to a case-sensitive host.

The index table, and the hole where level 4 goes

Immediately after the names, at 0x1AA6, comes a table of 16-bit indices into them -- twelve rows of seven:

row  0:  0007 0008 0009 000A 000B 000C 000D     L1
row  1:  000E 000F 0010 0011 0012 0013 0014     L2
row  2:  0015 0016 0017 0018 0019 001A 001B     L3
row  3:  FFFF FFFF FFFF FFFF FFFF FFFF FFFF     <- L4
row  4:  001C 001D 001E 001F 0020 0021 0022     L5
row  5:  0023 0024 0025 0026 0027 0028 0029     L6
row  6:  002A 002B 002C 002D 002E 002F 0030     L7
row  7:  0031 0032 0033 0034 0035 0036 0037     L8
row  8:  0038 0039 003A 003B 003C 003D 003E     L9
row  9:  003F 0040 0041 0042 0043 0044 0045     LA
row 10:  0046 0047 0048 0049 004A 004B 004C     LB
row 11:  004D 004E 004F 0050 0051 0052 0053     LC

The table is dimensioned for twelve levels. Row 3 is seven 0xFFFF entries: seven invalid file indices, one for each of the seven files a level needs. The rows either side are contiguous, the numbering runs straight from 0x1B to 0x1C across the gap, and nothing else in the file has been renumbered.

Level 4 was cut, and the loader still has its slot (11-leftovers.md).

Right after the index table the RNC decompressor begins; the constant 0C80 524E 4301 -- cmpi.l #$524E4301,d0, that is, "RNC" 01 -- is at offset 0x1B5E.

Strings

Lx_ReloD carries the loader's own user interface, in three languages:

             Insert Disk X
         Insérez la disquette X
          Diskette X einlegen

                LOADING
          CHARGEMENT EN COURS
              LADEVORGANG

"Insert Disk X" on a CD. The floppy prompt is still compiled in, padded to a fixed 41-column field, alongside the loading message that actually gets used. See 11-leftovers.md.

Further on, at 0x16190, the in-game verb bar -- the strings are separated by 0xFE, which is the same line-break code the dialogue uses (06-text.md):

TALK  USE  EXAMINE  EXIT
PARLER  UTILISER  EXAMINER  QUITTER
ANSPRECHEN  BENUTZEN  UNTERSUCHEN  VERLASSEN

Select item to use.        Select item to examine.
Sélectionnez l'objet à utiliser.
Gegenstand zum Benutzen wählen.

And at 0x16459, a keyboard map:

`1234567890-=\  0  QWERTYUIOP[]  123ASDFGHJKL;#  456  ZXCVBNM,./  .789

That is an Amiga rawkey-code to ASCII table for a UK keyboard, numeric keypad included, laid out in rawkey order. The CD32 ships without a keyboard. The game brought one anyway (11-leftovers.md).

L?_LLoad -- the per-level loader

Each level has an LLoad file: RNC-packed 68000 code, 40 KB to 57 KB unpacked, starting with movem.l d0-d7/a0-a6,-(sp). It is the level's own load-and-setup routine, loaded and run before the level starts.

They are also very nearly the same file. Comparing the six levels that share an unpacked size of 56,680 bytes:

Pair Bytes that differ
L7_LLoad vs L8_LLoad 3
L7_LLoad vs L9_LLoad 30
L7_LLoad vs La_LLoad 30
L7_LLoad vs Lb_LLoad 38
L7_LLoad vs Lc_LLoad 39

Three bytes out of fifty-six thousand between levels 7 and 8, the first at offset 0x9F5. This is one routine assembled once per level with a handful of constants changed -- and each copy costs 13 KB of disc for the privilege. On a disc that uses 3 % of its capacity, nobody was counting.