Analysis model: gpt-5.5 xhigh

Superunknown by Five, And Then Some - Technical Dissection

Scope

Superunknown is a large MS-DOS/GUS demo by Five, And Then Some. It won the PC demo competition at The Gathering 1994, and the public metadata lists it as released on 2 April 1994.

Release year: 1994.

Public references:

The complete credited production team is Andrez (code/graphics), BlackAce (music), Bladerunner (sound code), Captain Napalm (code), and SanasolGutten (graphics). The group and credited contributors are Norwegian.

The final archive is unusually valuable because it includes the source tree. This analysis therefore uses the shipped Borland C++ / TASM source as primary evidence, backed by the executable and asset layout. Old contact details from the period text are intentionally omitted.

Visual Evidence

The runtime images below come from the public 5:26 video linked by Demozoo, Five And Then Some - Superunknown (PC demo, 1994), uploaded by xprojected. I downloaded YouTube format 134, a 480x360 H.264 video-only stream, on 2026-08-15. Its SHA-256 is fc070faedc7158cbd3040fe02fa818e6ee673db1385687501bf6d539bee7a304. No audio stream was downloaded, decoded, or played. GIF timestamps use the start of that public video as zero; they are visual-reference evidence rather than a claim of cycle-exact local emulation.

Demozoo's single 640x480 reference screenshot is retained separately. It shows the eye/title scene and is not a frame extracted from my downloaded stream.

Superunknown Demozoo reference screenshot

Examined Files

The archive is sunknown.zip.

44cd2608cf5e883d8a1085df47ef06520be464979aafec44f4bd958410d51b98  sunknown.zip
acd720756562e9489a109d63a9084b751d27c572ac48f85487302c3aecf46191  SUNKNOWN.EXE
9c1be9cdfdb627558a071bd3eb515d46aa30ea300c7a1e0afecded5bcd0ba0a8  SUNKNOWN.NFO
58fed76e5897c62513b7a89abded1d73fb74f2bfb2edb4c5ebcf16fae9317647  SUNKNOWN.200
74e1df3ce5511c5a18d468c47f6522159bdc2607c1ee4e46b9aea50bddd43f94  SUNKNOWN.201

The major archive pieces:

SUNKNOWN.EXE       212,531 bytes  main DOS executable
ULTRAMID.EXE        34,212 bytes  UltraMID TSR used for GUS MIDI
SUNKNOWN.200        40,629 bytes  standard MIDI file
SUNKNOWN.201         6,908 bytes  UltraMID patch map
SU*.PAT            845,780 bytes  22 GUS patch files total
SUNKNOWN.000 etc.  visual assets, palettes, maps, masks, and streams
SOURCE/             C/C++ and assembly source for the final build

The MIDI file is Standard MIDI format 1:

format       1
tracks       13
division     96 ticks per quarter note
track bytes  19, 5979, 9233, 3176, 9737, 2943, 1307,
             802, 1234, 431, 1488, 4097, 65

The visual data files include:

SUNKNOWN.000  768      palette
SUNKNOWN.001  13,212   scroller/title data
SUNKNOWN.002  65,536   surface map
SUNKNOWN.003  768      surface palette
SUNKNOWN.004  14,720   fractal twist table
SUNKNOWN.005  258,495  compressed fractal animation data
SUNKNOWN.006  36,864   first fractal page
SUNKNOWN.007  88       fractal length table header area
SUNKNOWN.008  768      voxel palette
SUNKNOWN.009  65,536   cloud texture
SUNKNOWN.010  64,000   marble / IFS background
SUNKNOWN.013  65,536   eye texture
SUNKNOWN.015  51,200   dune plasma map
SUNKNOWN.016  51,200   second dune plasma map
SUNKNOWN.017  271,758  morph point data
SUNKNOWN.020  5,757    title logo data
SUNKNOWN.021  61,440   voxel precomputed data
SUNKNOWN.103  8,041    flame mask data

Executable Shape

SUNKNOWN.EXE is a normal MZ executable, not a tiny intro packer.

e_magic        5a4dh
e_cblp         0060h
e_cp           00fbh
e_crlc         0259h
e_cparhdr      00e0h
e_minalloc     0000h
e_maxalloc     ffffh
e_ss:e_sp      1e55h:0080h
e_cs:e_ip      0000h:0000h
e_lfarlc       003eh
declared size  1f460h bytes
physical size  33e33h bytes
header size    0e00h bytes
entry offset   0e00h
relocations    601

The physical file is larger than the declared MZ image by about 84 KB. With the source tree present, the important finding is not a hidden decompressor; it is that the demo is a conventional large-model DOS build with many external data files and a few hand-written assembly kernels.

The source project says it was built with Borland C++ 3.1 and TASM, with 386 code enabled. That matches the assembly files: the hot paths use 386 registers, FS/GS, rep movsd, and 32-bit temporaries inside real-mode code.

Source Map

Top-level source files:

MAIN.CPP       show order, music setup, global state
GLOBAL.H       time marks and asset filenames
SEG.CPP        far heap allocator for large data pages
XGRAF.CPP      Mode-X setup, palette, pixel, page switch helpers
TIMER.CPP      PIT timing wrapper
KEYSCAN.CPP    INT 09h keyboard state
MIDI*.C        Standard MIDI parser and UltraMID bridge
ASMTOTSR.ASM   timer / MIDI tick layer from the UltraMID path
MORPH.CPP      morph part driver
ASMORPH.ASM    morph point update and copy kernel
EYE.CPP        eye/title scene using voxel-style texture sampling
FLAMSCRL.CPP   flame scroller
ZOOM.CPP       fractal zoom stream decoder and scheduler
ASMZOOM.ASM    zoom, twist, full-copy, and scroller copy kernels
VOXEL.CPP      voxel terrain generator and setup
ASMVOXEL.ASM   voxel renderer, sky filler, interpolation
IFS.CPP        recursive tendril scene
ASMIFS.ASM     IFS line and page-copy kernels
DUNE.CPP       dune/plasma relief driver
ASMDUNE.ASM    plasma combine and relief light kernel
SURFACE.CPP    final surface flyover driver
MODEL.CPP      ray setup and surface page renderer
ASMDRAW.ASM    80-column strip and map-swap kernels

The allocator in SEG.CPP explains the structure of the rendering code. It allocates len + 16 bytes, then nudges the returned far pointer up near a 64K boundary:

allocated pointer -> plus 10000h -> minus 4

That lets the parts treat their buffers as segment-sized grids with cheap 16-bit offsets. Many loops index textures as BH:BL, or jump to another 64K page by adding a segment delta.

Main Show Script

MAIN.CPP has the whole show order:

start MIDI or timer
find relative machine speed
remember music start tick
enable periodic MIDI calls if GUS is active

morph()
modex(1)
eye()
flamscrl()
zoom()
voxel()
ifs()
dune()
modex(1)
surface()

reset MIDI/timer
black out palette
repeat if -LOOP was supplied

The source time marks in GLOBAL.H are millisecond-like values derived from the demo's custom timer:

END_MORPH  25,500
END_EYE    47,500
END_FRACT 121,000
END_VOXEL 201,000
END_IFS   246,500
END_DUNE  290,000
END_SURFA 325,200

Those markers are the real sequencing mechanism. The visual parts are mostly self-contained, but each one reads the shared timer and exits when the music position reaches its allocated span.

The command-line parser recognizes:

-GUS        use the MIDI / UltraMID path
-LOOP       repeat the whole show
-SPEED      measure and print relative speed

The batch file first tries to load UltraMID high with the SUNKNOWN.201 patch map. If that works, it runs SUNKNOWN -GUS. If not, it offers a no-sound run.

Timer and MIDI Loop

The custom timer has two layers.

TIMER.CPP programs the PIT with divisor 9944:

out 43h, 36h
out 40h, d8h
out 40h, 26h

9944 is roughly a 120 Hz interrupt rate. The elapsed-time conversion constant is:

TIMERFAC = 8.35708687636071

The UltraMID timer code in ASMTOTSR.ASM installs INT 08h. Its interrupt path does three jobs:

push 32-bit registers and segment state
ticks++
us_timer += clock_interval
if us_timer > tempo:
    timer += us_timer / tempo
    us_timer %= tempo
if callmidi:
    smidigo()
call old INT 08h
iret

The comment in that assembly file says the original Forte code only saved 16-bit registers in the interrupt handler, while the demo uses 32-bit code throughout. The source fixes this by saving EAX, EBX, ECX, and EDX. That is a practical real-mode 386 bug fix: a C compiler may emit 32-bit work inside code that an old TSR did not expect.

The MIDI parser reads the whole MIDI file into per-track far blocks. Playback uses the standard MIDI time model:

track.playp        current byte pointer
track.position     byte position
track.status       running status byte
track.play_time    absolute event tick
Mp_next_event_time earliest pending event among tracks

smidigo() checks whether the next event time has arrived. If so, midi_do_something() walks every live track:

if (now_time < next_event_time)
    return;

next_event_time = infinity;

for each track:
    while track.play_time <= now_time:
        if next byte has bit 7 set:
            status = read byte;
        else:
            reuse running status;

        if status is channel message:
            read one or two data bytes;
            call note_on / note_off / pitch_bend / program / control hook;
        else if status is meta event:
            read variable length;
            if tempo event:
                update tempo;
            else:
                skip payload;
        else if status is sysex:
            skip variable payload;

        track.play_time += next variable delta;

    update global next_event_time;

The output hook sends MIDI bytes into UltraMID. The archive's patch map remaps program and drum numbers across 256K, 512K, 768K, and 1024K GUS memory tiers. That is why contemporary comments call the soundtrack unusual: it is not a MOD or S3M replay, but a MIDI file backed by a demo-specific GUS patch set.

The flame scroller briefly clears callmidi, calls smidigo() manually, waits for retrace, then restores callmidi. That avoids the timer interrupt stepping the MIDI parser while a particularly tight VGA copy is in flight.

Mode-X Base

XGRAF.CPP sets a 320x240 planar Mode-X-like screen:

BIOS mode 13h if requested
blank DAC
Sequencer memory mode register changes
MISC_OUTPUT = e3h
CRTC vertical timings for 240 rows
map mask = 0fh
clear A000h with 32768 word stores

A pixel write computes:

byte offset = y * 80 + (x >> 2)
plane mask  = 1 << (x & 3)

putpixel() writes the plane mask to port 03C4h index 02h, then writes the color byte into A000:offset. getpixel() uses 03CEh index 04h to select the read plane before loading from the same offset.

Page display is done by changing the CRTC start address. yoffset(y) converts a row offset into the high and low CRTC bytes, waits for retrace, then writes index 0Dh and 0Ch. This is why many parts use page increments of 1200 paragraphs: 1200 * 16 = 19200 bytes, one 320x240 Mode-X page per plane.

switchpage() enables all planes and calls one of two block-slide transitions. Each transition repeatedly copies 80-byte rows with rep movsb, split into ten 12-row blocks, with retrace waits between steps. It is an effect built from VRAM-to-VRAM copies, not a full rerender.

Morph Part

The morph data file stores sets of point triples. The driver in MORPH.CPP loads an initial raw point set, then each target point set, and prepares a fixed step delta for each coordinate.

The point storage uses three separate 64K pages:

t1 = x state page
t2 = y state page
t3 = color/depth page

Each logical point consumes four bytes per page:

word current_8_8
word delta_8_8

finddiff() computes:

target = raw_byte << 8;
target += 128;
delta = (target - current) / steps;
store delta;

ASMORPH.ASM has the hot update:

clear 200*64 dwords in the chunky work buffer

for each point:
    eax = x_current_delta_pair
    dx  = low word current
    dx += high word delta
    store new x current
    bl = high byte of x current

    repeat for y page
    bh = high byte of y current

    repeat for color/depth page
    color = high byte of third current

    buffer[bx] = color

BX becomes the 8-bit x/y address: BL is x and BH is y. The inner loop is therefore only three fixed-point adds, three stores back to the state pages, and one byte plot. The frame copy routine then copies a centered 256x200-ish area:

for 200 rows:
    copy 64 dwords
    skip 64 dwords in the A000 destination

That copies 256 bytes per row into the middle of the planar page while leaving the left/right padding alone.

Eye and Title Scene

The eye part uses the voxel texture sampler from VOXEL.CPP, but with an eye bitmap as the source page. It loads:

SUNKNOWN.013  65,536-byte eye texture
SUNKNOWN.014  palette
SUNKNOWN.020  logo/title bitmap

The title data is transposed while loading:

tittel[y + LOGOY * x] = file_byte;

That makes the later drawtitle() loop walk each screen column contiguously. drawtitle() reveals a centered span whose length grows after pro > 0.3. For each VGA plane:

select plane
for each title column assigned to this plane:
    for LOGOY rows:
        al = title byte
        if al != 0:
            al |= row tint byte
            screen[di] = al
        si += 1
        di += 80
    si += 3 * LOGOY     ; skip columns owned by other planes
    di += 1 - 80*LOGOY

The eye texture itself is rendered by visvox(). For each VGA plane, it samples 80 columns by 240 rows. Four vertical samples are unrolled per iteration:

for plane in 0..3:
    set map mask
    di = 0
    cx,dx = starting texture coordinate
    for 80 screen columns:
        save cx,dx
        repeat 60 times:
            write texture[ch:dh] to es:di
            di += 80
            cx -= ply
            dx += plx
            write texture[ch:dh] to es:di
            di += 80
            cx -= ply
            dx += plx
            write texture[ch:dh] to es:di
            di += 80
            cx -= ply
            dx += plx
            write texture[ch:dh] to es:di
            di += 80
            cx -= ply
            dx += plx
        restore column start
        advance by the horizontal vector

So a frame is a planar texture rotation: the C++ code computes plx, ply, x0, and y0 from sine/cosine; the assembly-like inline loop spends almost all its time in table loads and A000 writes.

The public-video interval at 00:35-00:40 makes both layers visible: the iris rotates as sampled texture data while the orange title remains a separately drawn foreground element. That matches the split between visvox() and drawtitle() instead of suggesting one pre-rendered animation.

Superunknown rotating eye and title

The near-static title frame at 00:49 preserves the scene's final composition without asking the animation to stand in for typography detail.

Superunknown eye/title composition

Flame Scroller

FLAMSCRL.CPP is a compact fire simulation plus a masked planar writer.

The fire field is 40 columns wide and roughly 100 rows tall. Every other frame, the hot loop updates two fire bytes at a time through AX:

cx = (HEIGHT + 2) * WIDTH
di = flame + WIDTH
bh = decay_toggle

loop:
    ax = [di]

    ah = ah + al
    al = ah
    ah = ah + [di-1] + [di+WIDTH]
    if ah != 0:
        ah = (ah - bh) >> 2

    bh ^= 1

    al = al + [di+2] + [di+WIDTH+1]
    if al != 0:
        al = (al - bh) >> 2

    clamp al,ah to 63
    swap al,ah
    [di-WIDTH] = ax
    di += 2
    cx -= 2

The bottom row is reseeded from a 256-byte random table. The character mask is advanced in 15-scanline steps. compilemask() turns a narrow glyph stripe into a small run stream, and the render path applies that stream into two VGA planes.

The draw kernel is structured as:

for selected planes:
    select map mask
    for each 20-byte flame column group:
        ch = number of mask runs
        if ch == 0:
            skip one output column
        else:
            for each mask run:
                di += run_dest_skip
                si += run_source_skip / 2
                cl = run_length
                al = run_or_mask
                repeat cl:
                    ah = [si]
                    si += WIDTH
                    ah |= al
                    [es:di] = ah
                    di += SCREEN
                    [es:di] = ah
                    di += SCREEN

That routine both scales vertically by two and applies a mask/tint byte, while avoiding writes for empty glyph regions. The temporary movef32() helper copies an 80x31 dword block inside the flame data with rep movsd; it is used to shift the precompiled mask area.

Fractal Zoom

The zoom part is built from a 192x192 fractal image sequence, a bitstream of delta frames, and a 14,720-byte twist table.

The source constants:

FRAMES       34
EXT          192
ROUGHSPLITS 12
MAXFRAMES    1564
HITIT       69,050

The setup reads:

SUNKNOWN.004  twist table
SUNKNOWN.006  first 192x192 frame
SUNKNOWN.007  per-frame compressed lengths
SUNKNOWN.005  compressed frame bitstreams

The first 12 substeps of each frame use roughsplit(), which doubles an already-available coarse source block into the destination:

for each selected half-resolution line:
    for EXT/2 source pixels:
        al = *src++
        ah = al
        dst[0]   = ax     ; two horizontal copies
        dst[256] = ax     ; next row copy
        dst += 2
    dst += EXT + 128
    src += EXT/2 + 64

After that, finemask() drives a recursive 2x2 subdivision decoder. The small popbit() routine reads a bit from the compressed stream, shifts the mask, and advances the byte pointer when the mask wraps. At leaf size two, ctest() either applies a signed small delta, emits zero, or reads a full replacement byte. The decoded value is added into globalbmp[x + y*256].

The actual screen draw happens in ASMZOOM.ASM. drawzoom() computes two sample vectors:

sdx,sdy  full-size source vector
kdx,kdy  half-size incoming-frame vector
shx,shy  starting coordinate for current image
khx,khy  starting coordinate for incoming image

Then _asmzoom draws four pieces into two map-mask pairs:

farfrac1 center, plane masks 03h and 0Ch
farfrac2 top edge, plane masks 03h and 0Ch
farfrac2 bottom edge, plane masks 03h and 0Ch

The vertical span kernels all share this inner loop:

for 80 output columns:
    set topx,topy for this column
    length = twist_table[column,tune]
    if length:
        dx,cx = topx,topy
        repeat length:
            bx = (high_y << 8) | high_x
            al = source[bx]
            es:[di] = al
            cx += y_step
            dx += x_step
            di += 80
    topx += 2*y_step
    topy -= 2*x_step
    di = next column byte

The twist table controls which vertical spans are drawn in the center/top/bottom regions. The expensive trig and zoom math is outside the hot loop; each pixel is a two-byte fixed-point address and one store.

At 01:34-01:39 the captured zoom continuously changes both scale and colour distribution. A still could show the fractal image, but not the repeated delta-frame reconstruction and twist-driven resampling described above.

Superunknown fractal zoom

Voxel Terrain

The voxel section generates a 256-wide height strip field with midpoint subdivision and sine mixing, then uses ASMVOXEL.ASM to project it.

The C++ setup builds four random 257-entry height arrays. makestrip() combines those arrays into one 256-byte height strip:

v1 = ra1[(x + pl1) & 255];
v2 = ra2[(x + pl2) & 255];
v3 = ra3[(x + pl3) & 255];
v4 = ra4[(x + pl4) & 255];
height = ((v1 + v2 + v3 + v4) >> 9) - fade_minus;
if height < 0:
    height = random(2);
strip[x] = 128 + height;

colorstrip() shades from neighboring heights:

diff = 3*height[x+2] - 2*height[x] - height[x-2] + 64;
clamp diff to 2..127;
color[x] = diff;

precalc() reads SUNKNOWN.021 into two tables:

3 * 96 * 128 bytes  camera / map-step script
96 * 256 bytes      lookup table

The _interpolate helper smooths a 512-stride page with 32-bit parallel byte averages:

edx = fefefefeh
for 64 columns:
    eax = current dword
    for 128 rows:
        ebx = next-row dword
        eax = ((eax + ebx) & edx) >> 1
        dest = eax
        eax = ebx

Masking with FEh in every byte avoids cross-byte carry before the shift.

The main _asmvox loop is a front-to-back horizon renderer. It uses:

DS  height page
ES  map/height source
FS  color source
GS  lookup table
BP  precomputed camera script
DI  output column buffer

The inner path does this for each x column and y depth:

read scripted map coordinate and fraction
sample height at x and x+1
height0 -= altitude
height1 -= altitude
look up projected screen height for both
blend heights by fraction
if blended height <= current top:
    continue

span = blended_height - top
top = blended_height

sample color at x and x+1
blend colors by fraction

if span == 1:
    write one color byte
elif span == 2:
    write two bytes, averaging with previous color if available
else:
    if previous color exists:
        linearly step from previous color to new color across the span
    else:
        fill the span with new color

The renderer stops scanning a column once the y counter reaches the near field, then writes a terminator and the top value. This is a classic voxel skyline loop: it only draws newly visible vertical spans, so covered terrain costs a few comparisons but no pixels.

The 02:38-02:43 interval shows the practical result of that horizon algorithm. Near ridges replace the sky from the bottom upward while already-covered depth samples remain hidden; the camera motion exposes why front-to-back span drawing is cheaper than painting every projected terrain sample.

Superunknown voxel terrain flyover

ASMSKY fills sky bands by copying from the cloud texture. It examines a height byte from the previous row, computes a run length, and uses rep movsd twice to copy two rows. The sky path is therefore a wide memory mover, while terrain is span-based.

IFS Tendrils

The IFS part renders recursive branching lines over a scaled marble background.

First it loads a 320x200 background and suppresses the top and bottom scanlines:

SUNKNOWN.010  64,000 bytes
SUNKNOWN.022  palette

scale() converts the 320-wide source to a 256-wide centered buffer. It blanks top/bottom bands with blanker(), then copies each selected line with onestrip():

onestrip:
    cx = 64
    rep movsd       ; 256 bytes

The recursive driver:

drawifs(x, y, angle, length, level):
    set ifsx, ifsy, ifsdx, ifsdy, ifslen, ifslev
    asmifs()
    if level == MAXLEV:
        return
    left_length  = length * lfac[level] >> 16
    right_length = length * rfac[level] >> 16
    drawifs(end_x, end_y, angle + lbend[level], left_length, level+1)
    drawifs(saved_end_x, saved_end_y, angle + rbend[level], right_length, level+1)

setparameters() animates the branch bends and length factors with sine functions. number decides how many root tendrils are emitted around the center.

ASMIFS.ASM has two line kernels. The thin kernel:

while length_high != 0:
    bx = (high_y << 8) | high_x
    [bx] = color
    [bx + skheight] |= 64
    x += dx
    y += dy

The thick kernel writes two bytes on two adjacent rows:

while length_high != 0:
    bx = (high_y << 8) | high_x
    [bx]       = color_pair
    [bx+256]   = color_pair
    [bx+skheight]       |= highlight_pair
    [bx+skheight+256]   |= highlight_pair
    x += dx
    y += dy

So the C++ side owns recursion and animation, while assembly owns line stepping and the small highlight offset that gives the tendrils thickness.

At 03:44-03:49 the roots rotate, lengthen, and subdivide over the marble field. This is the visible signature of setparameters() changing bends and length factors while drawifs() recursively emits the same two line kernels.

Superunknown recursive IFS tendrils

Dune Relief

The dune part loads two 256x200 plasma maps and builds a 64K lighting table.

fixlight() fills the lighting table as:

res = x - y;
res += (x + y) >> 3;
res += 128;
res = clamp(res, 0, 255);
light[x,y] = res >> 2;

loadplasma() stores each loaded row into a far-spaced map:

next row address += 65536 * 32

It also writes mirrored or duplicated copies, depending on the sym flag. The result is intentionally expensive in memory and cheap in rendering: the assembly can move between rows by changing the segment rather than calculating a large offset.

drawall() chooses three animated phase positions:

dunepl1 = row_a * 512 + col_a
dunepl2 = row_b * 512 + col_b
dunepl3 = row_c * 512 + col_c

makeplasma() combines three maps by maxing their bytes:

for 202 rows:
    for 162 words:
        ax = map1 word
        dx = map2 word
        ax.low  = max(ax.low,  dx.low)
        ax.high = max(ax.high, dx.high)
        dx = map3 word
        ax.low  = max(ax.low,  dx.low)
        ax.high = max(ax.high, dx.high)
        store ax to dune_buffer
    move DS to the next far-spaced row

drawrelieff() then turns the height buffer into lit mode-13h pixels:

previous = first height word
for each screen row:
    for 160 words:
        current = next height word

        first byte:
            index = (previous.high << 8) | current.low
            out.low = light[index]

        second byte:
            index = (current.low << 8) | current.high
            out.high = light[index]

        out += duneplus
        A000[di] = out
        previous = current

The relief is therefore a slope-lighting trick: adjacent height bytes form a two-dimensional index into the prebuilt light table, and two output pixels are written at a time.

The 04:28-04:33 sample is deliberately animated because its shading reads as a moving relief only when adjacent samples change together. The coherent folds are consistent with the three height maps being max-combined before the lookup table converts local slopes to colour.

Superunknown animated dune relief

Surface Flyover

The final surface section is the largest structural renderer. SURFACE.CPP loads SUNKNOWN.002, sets SUNKNOWN.003 as the palette, and drives a camera over a 256x256 map with a slowly curving path.

model_C::swapmap() keeps a 256x256 camera-local area fresh. When the camera moves, it only swaps in the newly exposed rows or columns:

for y from oldy+256 to newy+256:
    hswap(new row)
for y from newy to oldy:
    hswap(new row)
for x from oldx+256 to newx+256:
    vswap(new column)
for x from newx to oldx:
    vswap(new column)

hswap() and vswap() use a 256-entry table that expands one map byte into an 8-byte texture strip. The horizontal swap computes:

source offset = ((y & ~7) << 5) + (x >> 3)
sub-byte shift = x & 7
swap table row = source byte, shifted by sub-byte offset

Then it writes partial leading bits, 32 full 8-byte chunks, and partial trailing bits into the camera-local area. vswap() is the same idea down a column, with 256-byte jumps.

Before drawing, drawover() precomputes 240 ray rows:

for pre = 0..239:
    wfac = camera_length_for_row[pre]
    lx[pre] = xpos + projected_forward_x
    ly[pre] = ypos + projected_forward_y
    wx80[pre] = projected_normal_x
    wy80[pre] = projected_normal_y
    qinx[pre] = wx80[pre] / 80
    qiny[pre] = wy80[pre] / 80

The VGA draw then runs the same 80-byte strip kernel once per row, per plane. For plane 0:

select plane mask 01h
for rows 239 downto 0:
    bx = qiny[row]
    dx = ly[row]
    cx = lx[row]
    si = qinx[row]
    draw80()

Plane 1, 2, and 3 add a fraction of the normal vector before calling the same strip function:

plane 1: add normal / 320
plane 2: add normal / 160
plane 3: add normal / 107

On slow machines it collapses to two plane writes by using wider map masks:

plane pair 0/1 via mask 03h
plane pair 2/3 via mask 0Ch

The strip kernel in ASMDRAW.ASM is fully unrolled around an 80-pixel row. It draws 40 pixels backward from the center, then 40 pixels forward:

save bx,cx,dx

repeat 39:
    bx = (high_y << 8) | high_x
    ah = [bx]
    es:[di] = ah
    di--
    cx -= step_x
    dx -= step_y

write center pixel
di += 40
restore cx,dx
cx += step_x
dx += step_y

repeat 39:
    bx = (high_y << 8) | high_x
    ah = [bx]
    es:[di] = ah
    di++
    cx += step_x
    dx += step_y

write final pixel
di += 40

That design is a strong fit for Mode-X: a row is 80 bytes wide per plane, so the renderer emits one byte per four screen pixels for each selected plane. All perspective setup is paid once per scanline, then the inner loop is just fixed-point stepping and texture loads.

The final 05:08-05:13 interval shows the camera travelling across the blue surface and its large orange glyphs. Perspective changes from row to row while the texture remains stable, which is exactly what the precomputed ray rows and the unrolled 80-sample strip kernel are meant to produce.

Superunknown final surface flyover

Why It Feels Different

Superunknown is not a tiny math trick. It is closer to a DOS-era multimedia engine:

The core pattern repeats across the codebase:

C++ prepares tables, timing, and high-level state.
Assembly owns the frame-sized loop.
Hot loops avoid per-pixel trig and divide.
VGA plane selection is moved outside inner loops whenever possible.
Far data pages are arranged so 16-bit offsets can do most addressing.

That is the technical reason this demo can be so large and varied while still running as a 1994 real-mode DOS production.

Caveats

Because the archive includes source, this article is source-assisted rather than a pure black-box reverse-engineering pass. I did not reproduce the old contact details or the full patch map text. I also did not attempt to rebuild the demo with Borland C++ 3.1; the analysis is based on the shipped executable, assets, and source files.

The runtime concordance is bounded to the public-video intervals stated above. It verifies that the source-described renderers correspond to the visible sections, but it does not establish exact frame timing, original capture hardware, or perfect colour calibration.