Analysis model: gpt-5.5 xhigh

Innuendo by Halcyon - Technical Dissection

Innuendo is Halcyon's first-prize MS-DOS demo from Juhla 1996. Blitz's executable is a 32-bit protected-mode program built around six separately compiled copies of the same fixed-point object pipeline. Each copy owns its scene state, matrix builder, face list, stable radix sorter and compact affine texture span. The release adds four deliberately different RIX3 resources and Croaker's karva S3M, then uses the module order and row as the show clock.

Release year: 1996

Innuendo's large textured object

Evidence Boundary

Demozoo dates the release to 13 January 1996 and credits Blitz for code, Croaker for music, and Placidity and Shrine for graphics. Pouet records the first place in the Juhla 1996 PC demo competition.

The local run establishes the hardware prompts, GUS path, resource loading and switch into the graphics engine. DOSBox-X's ZMBV recorder in this build aborts when capture crosses the text-to-mode-13 transition, so the published GIFs are cut from the video-only stream of the capture linked by Pouet. No audio was downloaded, captured or published. The GIFs are visual cross-checks; claims about implementation below come from the restored executable and data files.

Archive And Restored Executable Identity

The release archive and its three runtime inputs hash as follows:

de49420415630e875adc089e30abd70a914180a5bb93254d936e07c9c565bbdc  h_innu.zip
fb34580cac7fab2e692ac0fc1bb3c78d84f7605dfa8d15d8a9d4cad1e19395ce   69852  KARVA.EXE
c4d3893cd626c555494b783355e0a3cd1195208b86b9e8bfbbd119472f88d2ea  417978  KARVA.S3M
dffa30b1afbf0d1c9fc0eea255f2d44cd47ccda3a7a8ed6745fa015500a87252  263720  KARVAA.ÖÖÖ

The distributed executable carries a W. Collis packer. Restoring it with UNP produces this stable image:

4d973ebe06a5d4a457cb031cd94dd7f941939875768b1822a3421e16e39f6823  175616  KARVA.EXE

Its MZ declaration covers the restored file exactly:

struct innuendo_mz {
    uint16_t magic;             // 5A4D
    uint16_t bytes_last_page;   // 0000
    uint16_t pages;             // 0157 = 343
    uint16_t relocations;       // 001E = 30
    uint16_t header_paragraphs; // 000A = 160 bytes
    uint16_t min_alloc;         // 0080 paragraphs
    uint16_t max_alloc;         // FFFF paragraphs
    uint16_t ss;                // 2916
    uint16_t sp;                // 1C00
    uint16_t checksum;          // 0345
    uint16_t ip;                // 03E0
    uint16_t cs;                // 0000
};

declared_size = 343 * 512;      // 175616 bytes
entry_file    = 160 + 0x03e0;   // 0x480
load_module   = 175616 - 160;   // 175456 bytes

The 30 relocation entries target twelve segments. The largest clusters are six references to 0F1Fh, four to 00BFh, four to 04E2h, and three each to 003Fh and 0089h. The entry at file offset 0480h is not the demo loop; it is the PMODE/W bootstrap that creates the flat 32-bit environment in which the later code executes.

Startup Makes A 64 KiB-Banked Arena

The show asks its allocator for 0D0000h bytes, rounds the returned address up to the next 64 KiB boundary, and walks forward in whole banks:

10510  mov eax,0D0000h
10515  call allocator
1051A  or  eax,0FFFFh
1051F  inc eax
10520  mov [B50Dh],eax
10525  add eax,10000h
1052A  mov [A7EAh],eax
1052F  add eax,10000h
10534  mov [A7EEh],eax
10539  add eax,10000h
1053E  mov [A7F2h],eax
10543  add eax,10000h
10548  mov [B511h],eax

That is an explicit bank layout, not incidental alignment:

B50D  initial 320x200 page and fourth RIX payload
A7EA  first  65536-byte texture/image bank
A7EE  second 65536-byte texture/image bank
A7F2  third  65536-byte texture/image bank
B511  base for further work pages

The scene engines repeatedly align their own allocations in the same way. Consequently a page copy is just 16,000 dwords, and the inner renderer can form a texture address without a multiply or row-stride lookup.

mov edi,[work_page]
mov esi,[render_page]
mov ecx,3E80h            ; 16000 dwords = 64000 bytes
rep movsd

KARVAA.ÖÖÖ Is Four RIX3 Records, But Not Four Screens

The custom data file is exactly four records of 1030Ah bytes:

record 1  00000h  256 x 256  65536 indexed pixels
record 2  1030Ah  1024 x 64  65536 indexed pixels
record 3  20614h  256 x 256  65536 indexed pixels
record 4  3091Eh  320 x 200  64000 indexed pixels + 1536 trailing bytes

Each starts with the same header and palette:

struct Rix3Header {
    char     magic[4];       // "RIX3"
    uint16_t width;
    uint16_t height;
    uint16_t flags;          // 00AFh in all four records
};

struct InnuendoRixRecord {
    Rix3Header header;       // 10 bytes
    uint8_t    palette[768]; // VGA RGB, components in range 0..63
    uint8_t    payload[65536];
};

All four decoded RIX3 records at their actual aspect ratios

The second resource is a long sequence of radial light profiles, useful as a one-dimensional lighting or falloff source. The fourth is a 320x200 glyph sheet. Calling all four “pictures” would hide their actual jobs.

The executable opens the bank once and performs four consecutive operations. For the first three it skips ten bytes, reads a 0300h palette, then consumes a complete 64 KiB payload:

mov bl,1
mov eax,0Ah
call seek_relative
mov edx,palette_1
mov ecx,300h
call read
mov edx,[A7EAh]
mov ecx,10000h
call read

The fourth record differs only in its pixel count:

mov edx,palette_4
mov ecx,300h
call read
mov edx,[B50Dh]
mov ecx,0FA00h            ; 320 * 200
call read

So the executable deliberately ignores the final 1,536 bytes of the fourth fixed-size record. It then programs the full VGA palette from that record and uses its 320x200 page as the initial text surface.

The S3M Is Also The Timeline

KARVA.S3M identifies itself as karva. Its header is compact but ordinary:

orders       22
instruments  20 (17 sample instruments, 3 metadata slots)
patterns     14
speed        6
tempo        172
global vol   64
master vol   48
ultraclick   16
pan flag     FCh

The exact order list is:

uint8_t orders[22] = {
    13, 0, 1, 2, 6, 3, 5, 4, 4, 4, 10,
     8, 9, 7, 4, 4, 4, 4, 4, 11, 12, 255
};

The active channel slots are interleaved:

0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5

Pattern packing is not uniform, which matters when checking that a parser has not mistaken empty rows for end markers:

uint16_t packed_pattern_bytes[14] = {
    284, 295, 296, 433, 811, 431, 337,
    715, 703, 152, 831, 941, 1683, 72
};

The player exposes the current order and row as two words. Intro text and every large effect poll those fields rather than an independent millisecond timer. The top-level sequence can be reconstructed as:

show_intro_text_until_order_3();
scene_13cdb();  // leaves at order 5
scene_17517();  // leaves at order 6, row 49
text_and_crtc_transition();
scene_1ae6d();  // leaves after order 10, row 56
scene_1fb2d();  // leaves at order 14
scene_24b11();  // leaves at order 18
scene_2843b();  // leaves at order 19, row 32
show_final_text();

The third and last tests are range-safe rather than equality-only:

done3 = order > 10 || (order == 10 && row >= 56);
done6 = order > 19 || (order == 19 && row >= 32);

That avoids trapping the demo if a slow frame crosses the exact target row. It also explains why a valid GUS clock is essential even when host playback is muted: without advancing song position, scene-local animation can continue while the show controller never calls the next effect.

Six Copies Of One Geometry Engine

The six major effect entries are at original restored-file offsets:

13CDBh  17517h  1AE6Dh  1FB2Dh  24B11h  2843Bh

They are not six thin parameter blocks over one common renderer. Each contains a near-copy of the object reader, transform, face assembly, radix sorter, triangle setup and four orientation variants of the span routine. Their global addresses differ, and several scenes also copy a separate 20,000-byte embedded object stream into a work bank.

The practical 1996 trade is clear:

for each scene {
    own globals;
    own patched constants;
    own renderer copy;
    no per-frame scene dispatch inside the inner loops;
}

This spends executable bytes to make scene-specific code and data references direct. The restored binary has room for it, and the hot loops avoid an extra layer of pointers or branches.

The Object Stream Is Parsed Into Render-Friendly Arrays

The first parser begins at 131C3h; corresponding copies appear in the later scene engines. Its source format is compact:

struct PackedObject {
    uint8_t  tag_or_version;  // parser advances past it
    uint32_t vertex_count;
    uint32_t face_count;
    int16_t  xyz[vertex_count][3];
    int16_t  faces[face_count][3];
    int16_t  vertex_aux[vertex_count];
};

The loader allocates separate original and transformed vertex arrays, each with a six-byte stride. It also allocates a six-byte face-index array and an expanded auxiliary area:

original_xyz   = alloc(vertex_count * 6);
transformed_xyz = alloc(vertex_count * 6);
face_offsets   = alloc(face_count * 6);
vertex_work    = alloc(vertex_count * 4);

Each face's vertex ordinal is multiplied by six during loading:

for (i = 0; i < face_count * 3; ++i)
    face_offsets[i] = packed_face_index[i] * 6;

That moves the stride multiplication out of every frame. Face assembly can add each pre-scaled word straight to the projected-vertex base.

Q10 Trigonometry Builds A 3x3 Matrix

The first copy's matrix builder starts at 135F4h. Three angles index 1,024-entry sine/cosine tables. The products are normalized with shifts by ten or twenty bits, establishing a Q10 basis:

sx = sin1024[ax & 1023];  cx = cos1024[ax & 1023];
sy = sin1024[ay & 1023];  cy = cos1024[ay & 1023];
sz = sin1024[az & 1023];  cz = cos1024[az & 1023];

m00 = (cy * cz) >> 10;
m01 = ((sx * sy * cz) >> 20) - ((cx * sz) >> 10);
m02 = ((cx * sy * cz) >> 20) + ((sx * sz) >> 10);
/* six corresponding terms complete the 3x3 matrix */

The exact algebra is less important than where its divisions occur: once per matrix, not once per vertex. A transformed coordinate is three signed multiply-accumulates followed by one ten-bit shift:

tx = (x*m00 + y*m01 + z*m02) >> 10;
ty = (x*m10 + y*m11 + z*m12) >> 10;
tz = (x*m20 + y*m21 + z*m22) >> 10;

The perspective path at 13778h then performs two integer divides:

screen_x = ((tx << 8) / tz) + center_x;
screen_y = ((ty << 8) / tz) + center_y;
depth    = tz + 0x8000;

A second path at 138E4h omits the divide for affine or already projected phases. Both retain the same six-byte destination stride, so the later face code does not care which transform produced the coordinates.

The red folded scene driven by the same fixed-point pipeline

Face Assembly Performs View Tests And Back-Face Culling

The first face builder at 139FFh consumes three pre-scaled offsets, fetches projected coordinates and rejects obviously off-screen triangles before adding work to the sorter.

Its signed area is the standard 2D cross product:

area = (x1 - x0) * (y2 - y0)
     - (x2 - x0) * (y1 - y0);

if (area has desired sign)
    emit_face();

The emitted key packs two different meanings into one dword:

uint32_t render_key = ((uint32_t)depth << 16)
                    | (uint16_t)face_stream_offset;

That encoding is why the following sorter only processes 15 depth bits. The low word remains attached as payload throughout the stable partition passes.

The “Sort” Is Fifteen Stable Bit Partitions

At 12372h, the first renderer initializes a mask to one and performs one stable partition per bit until 8000h:

for (mask = 1; mask < 0x8000; mask <<= 1) {
    zero_count = one_count = 0;

    for (i = 0; i < face_count; ++i) {
        if (keys[i] & (mask << 16))
            ones[one_count++] = keys[i];
        else
            zeroes[zero_count++] = keys[i];
    }

    keys = concatenate(zeroes, ones);
}

This is a least-significant-bit radix sort over the biased 15-bit depth. It is stable, data-independent, and uses only sequential reads and writes. There is no recursive quicksort and no comparator repeatedly unpacking face records.

Triangle Setup Uses 16.16 Edge Slopes

The setup beginning at 12402h orders the three vertices by Y and computes edge increments with signed division:

dxdy = ((x_bottom - x_top) << 16) / (y_bottom - y_top);
dudy = ((u_bottom - u_top) << 16) / (y_bottom - y_top);
dvdy = ((v_bottom - v_top) << 16) / (y_bottom - y_top);

Values are rotated and packed before the scanline loop so that byte selection in the pixel loop can use register halves directly. Four copies cover the possible left/right edge orientations without testing orientation for each pixel.

The Texture Span Is The Real Inner Loop

The first orientation copy starts at 127F0h:

127F0  mov  ebx,eax
127F2  mov  bl,ch
127F4  shld ebx,ecx,8
127F8  mov  al,[ebx]
127FA  add  ecx,esi
127FC  mov  [edi+ebp],al
127FF  inc  ebp
12800  jnz  127F0h

ECX carries packed fixed-point texture coordinates; CH and the high bits shifted in by SHLD form the 16-bit address inside an aligned 64 KiB texture. ESI is the per-pixel affine increment. The loop therefore performs one address construction, one texture byte load, one coordinate add and one framebuffer byte store.

The binary contains the author's technical claim that this loop takes eight clocks per pixel. Treat that as an embedded 486-era target, not a benchmark of the whole triangle path. Clipping, edge division, sorting, palette work and page copies are outside it.

The first engine has four orientation copies at:

127F0h  12B08h  12EC0h  1314Ch

The same structure reappears in the later engines, including the copy at 199C4h:

199C4  mov  ebx,eax
199C6  mov  bl,ch
199C8  shld ebx,ecx,8
199CC  mov  al,[ebx]
199CE  add  ecx,esi
199D0  mov  [edi+ebp],al
199D3  inc  ebp
199D4  jnz  199C4h

That byte-for-byte recurrence is strong evidence for compile-time duplication of one renderer source, rather than six unrelated visual tricks.

Palette Work Sits Beside Geometry, Not Inside It

Each frame engine maintains a 768-byte current palette and interpolates toward a scene target. The final hardware upload is a linear port stream:

mov dx,03C8h
xor al,al
out dx,al
inc dx
mov ecx,300h
palette_loop:
    outsb
    loop palette_loop

The large black fields and restricted red or grey ramps are thus cheap to change. The texture mapper still writes one 8-bit index per pixel; lighting, fades and much of the color identity happen when those indices are mapped by the DAC.

Palette-restricted text and moving texture particles

The Visual Sequence Follows The Code Boundaries

The reference capture's section changes agree with the six calls and their music gates:

intro        monochrome text from the 320x200 glyph page
13CDB/17517  words, small textured forms, then the red folded object
1AE6D        large grey texture-mapped radial geometry
1FB2D        colored vortex and bright capsule-like object
24B11        red clustered forms with long camera/plane motion
2843B        final cluster variation and exit text

The vortex and bright object section

Late red cluster and moving textured planes

The odd forms are not video frames pasted over the screen. They are projected triangle meshes sent through the same face culling, radix sorting and affine span loop, with different embedded objects, transform constants, textures and palette ramps. That shared machinery is the core of Innuendo: one compact, very specific software 3D renderer, copied and bent into six scene programs, with the S3M player deciding exactly when each copy yields to the next.