Analysis model: gpt-5.5 xhigh

Too Complex (final) by Shock! - Technical Dissection

Scope

Too Complex (final) is a 1995 MS-DOS trackmo by Shock!. Demozoo lists it as released on 16 December 1995, as an MS-DOS demo, as part of the LiQid 1995 PC demo competition, and as 1st place at Exe Party 1995. The final scene.org file page describes the archive as the final version for Exe'95.

Release year: 1995.

Released: 16 December 1995.

This pass examines the final archive sck-clxf.zip and compares it with the older sck_2clx.zip party archives. The analysis is mostly static: archive layout, MZ header math, the first-stage DLZ-style unpacker, the bundled resource directory, and confirmed VGA helper loops. A short DOSBox-X run was used only to confirm that the final executable enters the expected VGA/GUS-era DOS path.

Sources

Old private contact listings from the original note are deliberately omitted.

Credits And Context

The public metadata and final archive text credit:

The final note says the demo needs about 450 KB of conventional memory, supports Gravis UltraSound only, and recommends a DX4/100 with VLB or PCI VGA. That matches the binary shape: it is not a DOS/4G or PMODE program. It is a real-mode MZ loader with a large appendage, direct VGA programming, an internal resource table, and a GUS-oriented music path.

The credits in the final note also give useful role hints:

Those labels line up with the resource names: FLIGHT*, CSAVAR*, object-like *.BOD chunks, palette chunks, and a large first data block associated with the 2COMPLEX.S3M label.

Archive Identity

The final archive contains:

2COMPLEX.EXE   628496 bytes
2COMPLEX.NFO    22443 bytes
FILE_ID.DIZ       454 bytes
scene.org.txt    2714 bytes

Hashes for this pass:

f4aef1cccb9f9264efecc5f7d8519eaf54481446d218000a11bbeb4f66c42bc4  sck-clxf.zip
edae0491a233149ecd7dd22b646539fc6afd6e9f6be876a532eb41c40d347a30  2COMPLEX.EXE final
babbb8ae5c106d047d4def2298632f1e58b4411d93caf1ec86ab76d83a1d5d70  2COMPLEX.NFO final
4cf343c284b5afaa6ecfc94dda0b889e9b3f4b71175f466121e834ea199a9219  FILE_ID.DIZ final
cf58c51593b1414ddb8167316fd1b721f69c6517560fcf23c4d167ba5195236f  sck_2clx.zip older LiQUiD archive
77baeb8152dd99e5a2e57d87e6d144a6bb4bb1d4532d54c4234d6e4832417953  2COMPLEX.EXE older party build

The older Exe'95 and LiQUiD'95 sck_2clx.zip archives contain the same 2COMPLEX.EXE hash. The final executable is different and 143 bytes larger. The final archive's FILE_ID.DIZ explicitly says final version and made for Exe'95; the older one says made for LiQUiD'95.

Top-Level EXE Layout

2COMPLEX.EXE is an MZ executable whose declared DOS-loaded image is much smaller than the file itself:

file size:          628496 bytes
MZ stated size:      35302 bytes (0x0089e6)
MZ header size:         32 bytes
loaded image:        35270 bytes
appendage:          593194 bytes
entry CS:IP:        0000:0000
SS:SP:              117e:0080
relocation entries:     1
relocation item:    segment 089c, offset 0004

The final appendage starts immediately at file offset 0x89e6. It begins with the string 2COMPLEX.S3M, then an internal directory. DOS itself only loads the first 0x89e6 bytes. Everything after that has to be reopened or streamed by the loader.

The older party executable has a slightly larger declared MZ image:

older executable size:      628353 bytes
older MZ stated size:        35616 bytes (0x008b20)
older appendage:            592737 bytes

So the final is not just a text-file repack. The executable's MZ/appendage split changed.

First-Stage Entry

The real entry at loaded offset 0x0000 is a mover for the packed code:

0000: fc                 cld
0001: 06                 push es
0002: 1e                 push ds
0003: 0e                 push cs
0004: 8c c8              mov ax,cs
0006: 01 06 35 01        add [0135h],ax
000a: ba a4 08           mov dx,08a4h
000d: 03 c2              add ax,dx
000f: 8b d8              mov bx,ax
0011: 05 da 08           add ax,08dah
0014: 8e db              mov ds,bx
0016: 8e c0              mov es,ax
0018: 33 f6              xor si,si
001a: 33 ff              xor di,di
001c: b9 08 00           mov cx,0008h
001f: f3 a5              rep movsw
0021: 4b                 dec bx
0022: 48                 dec ax
0023: 4a                 dec dx
0024: 79 ee              jns 0014h

The important mechanics:

After the copy loop:

0026: 8e c3              mov es,bx       ; one paragraph before the output
0028: 8e d8              mov ds,ax       ; one paragraph before the shifted copy
002a: be 52 00           mov si,0052h
002d: ad                 lodsw
002e: 8b e8              mov bp,ax       ; first bit bucket
0030: b2 10              mov dl,10h      ; 16 bits in bucket
0032: ea 01 07 fe 10     jmp 10feh:0701h

In shifted-image terms, DS:SI points at the compressed stream that begins at original file offset 0x64. The word loaded into BP comes from file offset 0x62; in the final executable it is 0xffff. ES:DI resolves to the start of the low loaded image, so the unpacker overwrites the stub with the real entry block.

The marker at file offset 0x57 is:

64 6c 7a 30  ->  "dlz0"

I treat dlz0 as the packer's stream tag, not as a demo-specific resource format.

DLZ Bit Loop

The hot bit reader is at the end of the loaded image:

88e8: d1 ed              shr bp,1
88ea: fe ca              dec dl
88ec: 75 05              jne short done
88ee: ad                 lodsw
88ef: 8b e8              mov bp,ax
88f1: b2 10              mov dl,10h
88f3: c3                 ret

It consumes bits least-significant first from BP. DL is the remaining-bit count. When DL reaches zero, the next stream word is loaded through DS:SI. The carry flag from shr bp,1 is the decision bit used by the caller.

The main decode loop starts at 0x8961:

8961: e8 84 ff           call getbit
8964: 73 03              jae 8969h
8966: a4                 movsb
8967: eb f8              jmp 8961h

So:

Short Match Token

The short path begins by reading a low-byte displacement:

8969: e8 7c ff           call getbit
896c: ac                 lodsb
896d: b7 ff              mov bh,0ffh
896f: 8a d8              mov bl,al
8971: 72 81              jb  88f4h
8973: e8 72 ff           call getbit
8976: 72 d6              jb  894eh
8978: 3a fb              cmp bh,bl
897a: 75 dd              jne 8959h

If the second bit is 0 and BL is not 0xff, it falls through to:

8959: b1 02              mov cl,02h
895b: 26 8a 01           mov al,es:[bx+di]
895e: aa                 stosb
895f: e2 fa              loop 895bh

With BH=0xff, BX is a negative 8-bit-ish displacement in the same output segment. The loop copies two bytes from ES:[DI + BX] to ES:DI. Because stosb advances DI, overlap is intentional; it is the usual LZ "copy from already written output" rule.

Three-Bit High Displacement

If the path at 0x8976 takes the carry branch, the decoder extends BH from three more bits:

894e: b1 03              mov cl,03h
8950: e8 95 ff           call getbit
8953: d0 d7              rcl bh,1
8955: e2 f9              loop 8950h
8957: fe cf              dec bh
8959: b1 02              mov cl,02h

This still copies only two bytes, but the negative displacement is no longer limited to the default 0xffxx page.

Long Match Length

The long branch at 0x88f4 builds a larger negative displacement and then a variable length:

88f4: e8 f1 ff           call getbit
88f7: d0 d7              rcl bh,1
88f9: e8 ec ff           call getbit
88fc: 72 14              jb  8912h
88fe: b6 02              mov dh,02h
8900: b1 03              mov cl,03h
8902: e8 e3 ff           call getbit
8905: 72 09              jb  8910h
8907: e8 de ff           call getbit
890a: d0 d7              rcl bh,1
890c: d0 e6              shl dh,1
890e: e2 f2              loop 8902h
8910: 2a fe              sub bh,dh

DH is a small power-of-two correction. Each zero bit asks for one more high displacement bit and doubles DH; the branch bit ends that subcode. After sub bh,dh, BH:BL is the back-reference displacement.

The length subcode starts at 0x8912:

8912: b6 02              mov dh,02h
8914: b1 04              mov cl,04h
8916: fe c6              inc dh
8918: e8 cd ff           call getbit
891b: 72 10              jb  892dh
891d: e2 f7              loop 8916h
891f: e8 c6 ff           call getbit
8922: 73 0d              jae 8931h
8924: fe c6              inc dh
8926: e8 bf ff           call getbit
8929: 73 02              jae 892dh
892b: fe c6              inc dh
892d: 8a ce              mov cl,dh
892f: eb 2a              jmp 895bh

The common case produces lengths from 3 upward. The longer forms are:

8931: e8 b4 ff           call getbit
8934: 72 10              jb  8946h
8936: b1 03              mov cl,03h
8938: b6 00              mov dh,00h
893a: e8 ab ff           call getbit
893d: d0 d6              rcl dh,1
893f: e2 f9              loop 893ah
8941: 80 c6 09           add dh,09h
8944: eb e7              jmp 892dh
8946: ac                 lodsb
8947: 8a c8              mov cl,al
8949: 83 c1 11           add cx,0011h
894c: eb 0d              jmp 895bh

So long runs either use a 3-bit extension plus 9, or a full literal length byte plus 17.

End And Stream Slide Marker

The BL == 0xff token is special:

8978: 3a fb              cmp bh,bl       ; BH is also 0xff here
897a: 75 dd              jne 8959h
897c: e8 69 ff           call getbit
897f: 73 27              jae 89a8h       ; end of stream

If the bit is zero, the unpack stream ends. If the bit is one, the decoder renormalizes ES:DI and DS:SI:

8981: b1 04              mov cl,04h
8983: 57                 push di
8984: d3 ef              shr di,cl
8986: 8c c0              mov ax,es
8988: 03 c7              add ax,di
898a: 80 ec 02           sub ah,02h
898d: 8e c0              mov es,ax
898f: 5f                 pop di
8990: 81 e7 0f 00        and di,000fh
8994: 81 c7 00 20        add di,2000h
8998: 56                 push si
8999: d3 ee              shr si,cl
899b: 8c d8              mov ax,ds
899d: 03 c6              add ax,si
899f: 8e d8              mov ds,ax
89a1: 5e                 pop si
89a2: 81 e6 0f 00        and si,000fh
89a6: eb b9              jmp 8961h

This keeps the linear output and input pointers usable while changing segment and offset parts. In the final executable's first stream, this marker appears once before the end marker.

Unpacked Entry Block

Emulating the above unpacker on the final executable replaces the first 143 bytes of the low image. The new entry begins:

0000: e8 44 00           call 0047h
0003: e8 0d 0c           call 0c13h
0006: e8 e7 32           call 32f0h
0009: e8 f2 10           call 10feh
000c: e8 c0 38           call 38cfh
000f: e8 86 6d           call 6d98h
0012: e8 82 37           call 3797h
0015: e8 ee 32           call 3306h
0018: e8 fa 37           call 3815h
001b: e8 94 e7           call e7b2h
001e: e8 27 39           call 3948h
0021: e8 f8 10           call 111ch
0024: e8 2c 38           call 3853h
0027: e8 3f 11           call 1169h
002a: e8 bd e7           call e7eah
002d: e8 39 70           call 7069h
0030: e8 5e 38           call 3891h
0033: 2e c7 06 85 f7 28 00  mov word cs:[f785h],0028h
003a: e8 88 00           call 00c5h
003d: e8 0b 0c           call 0c4bh
0040: e8 27 0c           call 0c6ah
0043: b4 4c              mov ah,4ch
0045: cd 21              int 21h

This is a part scheduler, not the whole demo body. Several targets are beyond the DOS-loaded file image and must be populated or interpreted by later loader work. That is the main reason the appendage matters.

The first called routine sets the basic video/data segment state:

0047: b8 00 a0           mov ax,0a000h
004a: 8e c0              mov es,ax
004c: 8c c8              mov ax,cs
004e: 8e d8              mov ds,ax
0050: 8c d0              mov ax,ss
0052: 05 64 10           add ax,1064h
0055: a3 11 0c           mov [0c11h],ax
0058: 05 00 10           add ax,1000h
005b: a3 e0 32           mov [32e0h],ax
005e: a3 46 ea           mov [ea46h],ax
0061: a3 9e 43           mov [439eh],ax
0064: a3 0c 26           mov [260ch],ax
0067: a3 1b 71           mov [711bh],ax

The scheduler sets ES=A000h early, then stores several derived paragraph values. That looks like a manually segmented real-mode work arena: the demo can load or render into memory above the tiny entry block while still using near calls and conventional VGA output.

VGA Helper Loops

Two small hardware loops are clearly visible even before deeper chunk recovery.

Palette upload:

00f5: 56                 push si
00f6: 52                 push dx
00f7: 50                 push ax
00f8: 51                 push cx
00f9: b9 00 03           mov cx,0300h
00fc: ba c8 03           mov dx,03c8h
00ff: 32 c0              xor al,al
0103: ee                 out dx,al
0104: 42                 inc dx          ; 03c9h
0105: f3 6e              rep outsb
0107: 59                 pop cx
0108: 58                 pop ax
0109: 5a                 pop dx
010a: 5e                 pop si

This writes all 768 DAC bytes from DS:SI: red, green, blue for 256 colors. The rep outsb is exactly the expected fast path for palette changes.

Vertical retrace wait:

015a: ba da 03           mov dx,03dah
015d: ec                 in  al,dx
015e: 24 08              and al,08h
0160: 74 fb              je  015dh

That loop waits until input status bit 3 is set. It is the coarse frame pacing primitive used before palette or page-visible changes.

Mode 13h setup also appears in the runtime image:

71c0: b8 13 00           mov ax,0013h
71c3: cd 10              int 10h

So the confirmed video baseline is 320x200, 256-color VGA, with direct writes to segment A000h and DAC updates through ports 03c8h/03c9h.

Appended Resource Directory

The appendage starts at file offset 0x89e6. The first 16 bytes are a label:

payload + 0000h: "2COMPLEX.S3M"

Usable resource records start at payload offset 0x10. Each record is 32 bytes:

struct shock_entry {
    char key[8];       /* lookup key, often the filename truncated to 8 bytes */
    uint32_t offset;   /* relative to appendage start */
    uint32_t size;
    char name[16];     /* NUL-padded display filename */
};

The final record ends at payload offset 0x390. A 16-byte sentinel follows it; that sentinel begins with ffh and points at the final 80-byte tail.

The final directory:

# Name Offset Size Notes
0 WHO.B 0x0003a0 0x03c682 large music/data block
1 WHAT.B 0x03ca22 0x0013af small effect/data block
2 SIN.DAT 0x03ddd1 0x001347 sine-like table block
3 TEXTURE.B 0x03f118 0x0001d4 texture setup block
4 BACKGND.B 0x03f2ec 0x003791 background data
5 FLIGHT.B 0x042a7d 0x0056f7 texture-flight block
6 FLIGHTX.B 0x048174 0x0075ee extended texture-flight block
7 FLIGHTX.PAL 0x04f762 0x006501 palette/data companion
8 SBOX0000.BOD 0x055c63 0x000219 small body/object chunk
9 SBOX0001.BOD 0x055e7c 0x0030fa body/object chunk
10 SBOX0002.BOD 0x058f76 0x00300b body/object chunk
11 SBOX0003.BOD 0x05bf81 0x003040 body/object chunk
12 SBOX0004.BOD 0x05efc1 0x00302e body/object chunk
13 SBOX0005.BOD 0x061fef 0x00309b body/object chunk
14 SBOX0006.BOD 0x06508a 0x002fef body/object chunk
15 JUNGLE.B 0x068079 0x003141 body/background block
16 SBOX.PAL 0x06b1ba 0x006cd7 palette/data companion
17 VALAMI2.DAT 0x071e91 0x0002bd small table/block
18 FALL.B 0x07214e 0x00029f small effect block
19 TEXTURE1.MYB 0x0723ed 0x0092d5 large texture block
20 VALAMI1.DAT 0x07b6c2 0x0041ec table/data block
21 GOREFACE.B 0x07f8ae 0x0002a3 small image/effect block
22 SQRT.DAT 0x07fb51 0x006952 lookup/data block
23 CSAVAR.B 0x0864a3 0x004392 twister block
24 CSAVAR.PAL 0x08a835 0x0050f3 palette/data companion
25 WAVE.DAT 0x08f928 0x0002d5 wave table/block
26 2CLX.B 0x08fbfd 0x0000b5 small final/logo block
27 BACKMOVE.DAT 0x08fcb2 0x001028 movement/path data

The resources are stored back-to-back; each offset plus size equals the next offset. The only gap is the final sentinel/tail after BACKMOVE.DAT.

Resource Roles

This is the most defensible map from names, sizes, repeated headers, visible strings, and the final note's credits:

The resource names are unusually descriptive for a 1995 trackmo. The code is less transparent than the directory because most part bodies are packed or custom-encoded blocks, not simple raw images.

What Each Stage Does

Based on the entry scheduler and resource table, the demo can be divided into these technical stages:

  1. MZ/DLZ bootstrap. It moves the loaded image upward, decodes the 143-byte entry block, applies packer fixups, and jumps into the real scheduler.
  2. Hardware and arena setup. It sets ES=A000h, derives several paragraph values from SS, sets VGA mode 13h, and prepares the DAC/vblank helpers.
  3. Music/player setup. The leading appendage label and the WHO.B block feed the S3M/GUS player. The NFO says GUS is the only supported device; the final binary does not expose plain ULTRASND or BLASTER strings.
  4. Early text/data parts. WHAT.B and SIN.DAT appear before the texture resources and are likely setup/intro data rather than the main flight.
  5. Texture flight. TEXTURE.B, BACKGND.B, FLIGHT.B, FLIGHTX.B, and FLIGHTX.PAL form the largest coherent named sequence. This is the part credited as texture flight.
  6. Object/body sequence. The SBOX*.BOD group and JUNGLE.B likely drive the Gouraud/object routines credited to Genesis, with SBOX.PAL as a color companion.
  7. Face/texture sequence. TEXTURE1.MYB, VALAMI1.DAT, GOREFACE.B, and SQRT.DAT form a later mapped-texture cluster.
  8. Twister. CSAVAR.B and CSAVAR.PAL are the most direct resource pair in the package: a named twister block plus palette companion.
  9. Ending movement/logo. WAVE.DAT, 2CLX.B, and BACKMOVE.DAT are small terminal blocks, suited to a wave/movement/logo finish rather than a large renderer.

The important implementation style is not "one huge EXE with all effects visible". It is a compact real-mode runner that schedules chunks from its own appendage. That is why naive disassembly of the loaded MZ body gives misleading garbage after the first setup routines.

Final Versus Older Build

The final and older party builds have the same high-level structure, but the final shifts the MZ/appendage boundary and changes both EXE and notes:

older executable: 628353 bytes, MZ stated size 0x8b20
final executable: 628496 bytes, MZ stated size 0x89e6

The final MZ image is 314 bytes smaller, while the whole executable is 143 bytes larger. That means data moved between the DOS-loaded part and appendage, and the final appended payload grew. It is not just a modified NFO.

The older Exe'95 and LiQUiD'95 archives share the same executable hash, so the final sck-clxf.zip is the right target for technical notes unless the older party behavior is being studied specifically.

Remaining Unknowns

The confirmed facts above stop short of a full source-level recovery:

What is clear is the architecture: a real-mode DLZ-packed scheduler, a compact VGA/DAC layer, and a self-contained appendage whose directory names line up closely with the credited effects.