Analysis model: gpt-5.5 xhigh
Tangle by Epical - Technical Dissection
Scope
This is a reverse-engineering pass over Tangle by Epical, an MS-DOS 100K intro released at Assembly 1993.
Public references:
- Demozoo production: https://demozoo.org/productions/6706/
- Pouet production: https://www.pouet.net/prod.php?which=4097
- Scene.org archive entry: https://files.scene.org/view/parties/1993/assembly93/100k/tangle.zip
- Direct archive URL used here: https://archive.scene.org/pub/parties/1993/assembly93/100k/tangle.zip
- Scene.org Assembly 1993 results: https://files.scene.org/view/parties/1993/assembly93/results.txt
- Demoparty.net mirror of the results: https://demoparty.net/assembly-1993/results.txt
There is a small metadata disagreement. Demozoo and Pouet list Tangle as 2nd at Assembly 1993 in the PC 100K intro competition. The plain-text Assembly 1993 results file lists Eclipse by EMF first, Debut CD Version by DarkZone second, and Tangle by Epical third. That disagreement does not affect this analysis: Tangle is still a top-three Assembly 1993 PC 100K intro either way.
Offsets below are flat offsets in the RNC-expanded image unless stated
otherwise. If the expanded image is loaded like a COM program at CS:0100, add
0x100 to a flat offset to get the loaded IP a debugger will usually show.
Examined Archive
Downloaded archive:
b62f1c2bcacdef9225dd74b7c446cc351a0e201cf239823545e84108e21686e6 tangle.zip
Files:
| File | Size | SHA-256 | Notes |
|---|---|---|---|
TANGLE.EXE |
67,428 | 6dc9fc9dd2dfdb2263eb67471c9df28dea7dda4f19435699ddbd1a806593ca0d |
Main intro, MZ executable with RNC-compressed body |
scene.org |
2,033 | 7cf81d4c83d4c54346d7f2f564f0c5b24b2f23e3b7360400c4b94515fb704121 |
Later Scene.org marker file, not part of the original intro payload |
Important strings in the expanded image include:
THIS IS EPICAL'S CONTRIBUTION TO THE ASSEMBLY '93 INTRO COMPETITION
Copyright Onko Sourcer hyv ohjelma???????
Sormet pois, Jmagic!!!
Jmagicit pois!
This program requires 386 or 486.
This program requires VGA.
Computer is in protected mode. Remove QEMM, EMM386 ...
The credits block identifies:
code: Phantom / Epical
gfx: Hega / Epical
music: Mikki / Epical
The two Jmagic strings are Finnish in-jokes/warnings. They are not part of the effect code, but they are useful fingerprints that the expanded image is the right one.
Packed Layout and RNC Expansion
TANGLE.EXE is a tiny MZ host with an RNC method 1 compressed payload starting
immediately after a 32-byte MZ header.
MZ header facts:
| Field | Value |
|---|---|
| File size | 67,428 bytes |
| Computed MZ image size | 67,428 bytes |
| Header size | 0x20 bytes |
| Relocations | 0 |
| Entry | 103a:000c |
| Entry file offset | 0x103cc |
| Stack | 379d:05a4 |
| Min alloc | 0x2782 paragraphs |
| Max alloc | 0xffff paragraphs |
The compressed block:
offset 0x00000020: RNC method 1
compressed size: 66,442 bytes
expanded size: 227,762 bytes
expanded SHA-256: 5f2dc51998a906693124b30852fe86ff67575d8cfa6a1a92315d88e6e4a628d4
The RNC bitstream has its encryption flag set. Reading the method-1 bitstream in the same order as the depacker gives:
lock bit: 0
encryption bit: 1
RNC key: 0x5765
expanded CRC16: 0xe3c0
So the packed executable is:
MZ header
RNC method-1 compressed COM-style image
small depacker/runtime tail at the MZ entry
The expanded image begins with:
00000000: e9 e1 0b 00 00 64 00 00 ...
The first instruction is a near jump. As a COM-loaded image, it jumps from
CS:0100 to loaded IP 0x0ce4, which is flat expanded offset 0x0be4.
Startup and Hardware Checks
The startup at flat 0x0be4 is direct DOS-era setup code:
resize own DOS memory block with int 21h / AH=4Ah
required_memory_kb = 300
call hardware_check
set BIOS text mode 3
call sound_config_prompt
build row-offset table
if sound enabled:
far call 2fd3:000f with startup parameters
call main_sequence
unmask PIC / restore text mode / exit
The hardware check routine at flat 0x0aaf does several checks without relying
only on DOS-reported machine state:
ax = 0013h
int 10h ; request VGA 320x200x256
ah = 0fh
int 10h ; read current video mode
if al != 13h:
print "requires VGA" and exit
probe FLAGS/EFLAGS bits ; distinguish old CPUs from 386/486 class machines
if not 386+:
print "requires 386 or 486" and exit
ask DOS for largest free block:
ah = 48h
bx = ffffh
int 21h
convert largest block to a rough free-KB value
if free < 300:
patch decimal digits in the error string
print "requires 000k ... you have only 000k"
exit
The protected/virtual-mode check is equally blunt. The code toggles flag bits that only behave as expected on suitable 386+ hardware and rejects protected or virtual-8086 environments with the QEMM/EMM386 text. This is exactly the sort of intro that wants bare DOS, not a multitasked DOS box with another memory manager already controlling the machine.
The decimal patcher at flat 0x0b37 is a tiny three-digit routine. It divides by
100 and 10 and writes ASCII digits into the two 000k fields before printing.
Sound Configuration and Sound Driver Calls
The sound prompt begins around flat 0xdbe7. It asks whether to use sound, then
stores three pieces of configuration in the low code/data area:
0x0948 no-sound flag, 1 means skip the driver
0x0945 Sound Blaster base/frequency-ish parameter
0x0947 IRQ value
The accepted IRQ values are 1, 3, 5, and 7. The frequency/base prompt
accepts digits 1 through 6 and maps them by:
al = digit - '0'
ax = al << 4
ax += 0200h
cs:[0945] = ax
After setup, the intro talks to a resident or embedded sound driver through the same far entrypoint:
2fd3:000f
The visible call patterns are:
AX=0003, BX=0001 startup/init path
AX=0004 per-frame pump or mixer update
AX=0001, BX=<position> cue/position/change command
I did not reconstruct the complete driver behind that far entrypoint. The important point for the visual analysis is that most frame loops do:
wait for vblank
if sound enabled:
far call 2fd3:000f with AX=4
The intro keeps audio progression synchronized with visible-frame pacing rather than running the whole visual timeline independently.
Common VGA Helpers
VBlank Wait at 0x0bab
The most common frame wait helper uses VGA input status register 1 at 0x3da:
push dx
push ax
dx = 03dah
while (in dx & 08h) != 0:
spin ; wait until already-active retrace ends
while (in dx & 08h) == 0:
spin ; wait until the next retrace begins
pop ax
pop dx
ret
This produces one update per vertical retrace boundary. Palette changes, CRTC display-start changes, page swaps, and audio pump calls are clustered around this wait.
Palette Upload at 0x0bc0
The palette uploader takes a segment in AX and source offset in SI, then
writes 768 DAC bytes:
es = ax
cx = 0300h
out 3c8h, 0 ; start at DAC index 0
dx = 3c9h
repeat 768:
al = es:[si]
si++
out dx, al
This is not a computed palette routine. It is a fast "copy packed DAC table to hardware" helper used for full palette states.
Bulk Screen Copy at 0x0bd6
This routine copies 64,000 bytes from offset 0x0300 in a caller-supplied
segment to the current destination segment:
ds = ax
si = 0300h
di = 0000h
cx = 7d00h ; words, 64,000 bytes
rep movsw
It is useful when a part wants a normal 64 KB Mode 13h page copy. The more interesting parts use planar writes instead.
Tweaked VGA Setup at 0x7245
The main early renderer starts from BIOS mode 13h, then retunes VGA into a planar/tweaked mode:
ax = 0013h
int 10h
out 3c8h, 0
write 0300h zero bytes to 3c9h ; black palette
out 3c4h, 0604h ; sequencer memory mode
select CRTC register 14h
clear bit 6
select CRTC register 17h
set bit 6
select CRTC register 13h
write 28h ; 40 address bytes per scanline
out 3c4h, 0f02h ; enable all four planes
es = cs:[07b1] ; normally A000h
cx = 8000h
ax = 0
rep stosw ; clear 64 KB of planar memory
The key value is CRTC offset 0x28. In planar addressing, 40 bytes per line per
plane is enough for 320 pixels because each byte address spans four horizontal
pixels across the four planes. This is the basis for the intro's Mode-X-like
page and span logic.
Row Offsets and Display Start
Before visual playback, flat 0x722e builds a table at 0x07b3:
ax = 0
for y in 0..199:
cs:[07b3 + y*2] = ax
ax += 0140h
0x0140 is 320 decimal, useful for byte-addressed 320-pixel effects.
For the tweaked planar mode, the CRTC display-start helper at 0x7292 writes
cs:[07ad] to CRTC registers 0x0c and 0x0d:
bx = cs:[07ad]
out 3d4h, 0cxxh where xx = bh
out 3d4h, 0dxxh where xx = bl
0x07ad is the visible page/start offset. 0x07af is the other page/back
offset. Many frame routines swap those two words, set the CRTC start, wait
vblank, draw into the now-hidden page, and repeat.
Planar Logo/Image Scatter at 0x5729
The image copier at flat 0x5729 is one of the clearest VGA inner loops in the
intro. Input data is stored chunky/interleaved in groups of four bytes, one byte
for each VGA plane. The routine scatters those bytes to the four VGA planes at
the same address.
Loop shape:
ds = ax
si = 0300h
bp = 0028h ; 40 rows
row_loop:
cx = 0050h ; 80 byte-addresses = 320 pixels
pixel_group_loop:
out 3c4h, 0102h ; sequencer index 2, map mask 0001b
al = ds:[si+0]
es:[di] = al
es:[di+7d00h] = al
out 3c4h, 0202h ; plane 1
al = ds:[si+1]
es:[di] = al
es:[di+7d00h] = al
out 3c4h, 0402h ; plane 2
al = ds:[si+2]
es:[di] = al
es:[di+7d00h] = al
out 3c4h, 0802h ; plane 3
al = ds:[si+3]
es:[di] = al
es:[di+7d00h] = al
di++
si += 4
loop pixel_group_loop
bp--
jnz row_loop
The duplicated write to di+0x7d00 creates a second copy in another page. The
routine is expensive because it reprograms the VGA sequencer four times for
every byte address, but for a 40-row logo/reveal it is simple and exact.
The data layout implied by the loop is:
source byte 0 -> VGA plane 0, address N
source byte 1 -> VGA plane 1, address N
source byte 2 -> VGA plane 2, address N
source byte 3 -> VGA plane 3, address N
So this is not a normal linear framebuffer copy. It is a prearranged chunky-to-planar scatter.
CRTC Wiggle, Page Swaps, and Fades
Flat 0x56c8 drives a sine-based display-start wiggle. It uses the 512-entry
32-bit sine table at 0x5ced:
phase = cs:[56c4] & 01ffh
eax = dword cs:[5ced + phase*4]
eax >>= 1
eax += 91h
ax *= 50h
cs:[07ad] = ax
cs:[07af] = ax - 7d00h
phase += 2
set CRTC display start
wait vblank
Because 0x50 is 80 decimal, the multiplication turns the sine-derived row
position into a planar byte offset. This makes the visible page slide through
video memory in row-sized steps.
Flat 0x562d is a page-swap plus palette fade:
swap cs:[07ad] and cs:[07af]
write new CRTC display start
wait vblank
for 9 DAC components beginning at DAC index 8:
current = cs:[4d2f+i]
target = cs:[4d26+i]
if current < target: current++
if current > target: current--
cs:[4d2f+i] = current
out 3c9h, current
It repeats that over 0x40 frames, so it is a controlled per-component fade,
not a single palette blast.
Flat 0x5684 fades DAC index 1 down from white and then clears a rectangular
area:
for cl = 3fh down to 0:
wait vblank
DAC[1] = (cl, cl, cl)
out 3c4h, 0f02h
di = cs:[07ad] + 0c80h
cx = 1900h
ax = 0000h
rep stosw
Flat 0x4c9d is a larger 16-colour-ish fade. It walks the first 0x30 DAC
components from an all-0x3f temporary palette toward a saved target table at
0x4c3d, one decrement per component per frame.
Main Timeline and Frame Renderer
The main visual sequence starts at flat 0x4d38. The first stage does:
call text/intro helper
call dot_init
call tweaked_vga_setup
cs:[07ad] = 3e80h
set CRTC display start
wait vblank
upload palette from segment 0f0ah
copy planar image from segment 0f0ah
start sound if enabled
mask PIC with 52h
call sine_display_wiggle
set DAC index 1 to white
After that, most of the intro is a scripted sequence of parameter blocks around
the renderer at flat 0x57a0.
The timeline code repeatedly sets:
0x064c camera/depth base, 32-bit
0x0650 projected centre x, 32-bit
0x0654 projected centre y, 32-bit
0x0646 x-rotation phase step
0x0648 y-rotation phase step
0x064a z-rotation phase step
0x063a per-frame delta added to 0x064c
0x063e per-frame delta added to 0x0650
0x0642 per-frame delta added to 0x0654
0x07a0 pointer to the current object/script table
Typical per-frame timeline loop:
for frame_count:
ax = cs:[4d24] & 01ffh
bx = ax * 4
eax = dword cs:[5ced + bx]
eax >>= 3
eax += 00a0h
cs:[0650] = eax ; oscillating projected centre x
cs:[4d24] += 2
call render_frame_57a0
if in 60h == 01h:
exit
The same structure appears with frame counts like 0x64, 0x96, and 0x190,
and with object-table pointers such as 0x0664 and 0x0704. The object data at
0x0664 begins with eight vertices and six quad records: it is a cube-like
object with coordinates around +100 and -100. The table at 0x0704 uses
six vertices and records with 0x03e7 as a fourth-vertex sentinel, meaning
"triangle, no fourth vertex".
Frame Renderer at 0x57a0
The renderer at flat 0x57a0 does the work that appears again and again:
swap visible/back-page offsets 07ad and 07af
set CRTC display start to new 07ad
wait vblank
if sound enabled:
call sound pump
select all VGA planes
compute a clear rectangle from projected centre 0650/0654
clear rows with rep stosd into the hidden page
call dot_update
copy current rotation phases into 6cd9/6cd7/6cd5
call project_current_object
iterate polygon records:
load v0, v1, v2, v3/sentinel, colour
call polygon_render
if double-object flag 579e == 1:
switch row stride/phase parameters
project and render another copy/pass
camera/depth += delta vector at 063a/063e/0642
The clear rectangle is worth noting because it is local, not a full 64 KB clear:
y0 = cs:[0654] - 100
dx = y0 * 80
dx += cs:[4d1e]
x0 = (cs:[0650] - 160) >> 2
dx += x0
dx += cs:[07af]
bp = cs:[4d22] ; number of rows
bx = cs:[4d20] ; dwords per row
for row:
di = dx
cx = bx
eax = 0
rep stosd
dx += 80
That means the renderer clears only the projected object's previous footprint. On early 386/486 hardware this matters: clearing a full planar page every frame would cost much more.
Rotation and Perspective Projection
The projection path appears as loaded IP 0x711f in a COM-origin disassembly,
which is flat offset 0x701f. It begins by converting three phase counters into
six sine/cosine values:
sin/cos phase 0x6cd5 -> 0x6cc5 / 0x6cd1
sin/cos phase 0x6cd9 -> 0x6cbd / 0x6cc9
sin/cos phase 0x6cd7 -> 0x6cc1 / 0x6ccd
The sine table has 512 entries. Adding 0x80 to a phase gives a quarter-turn
offset, so the same sine table supplies cosine values.
Each vertex is six bytes:
word x
word y
word z
The per-vertex routine performs three fixed-point rotations with a >> 9 scale
after each multiply. In simplified form:
sx0 = sin(angle0);
cx0 = sin(angle0 + 0x80);
sx1 = sin(angle1);
cx1 = sin(angle1 + 0x80);
sx2 = sin(angle2);
cx2 = sin(angle2 + 0x80);
/* first 2D rotation over x/z */
t0 = (x * cx0 + z * sx0) >> 9;
t1 = (z * cx0 - x * sx0) >> 9;
/* second rotation folds y with t1 */
t2 = (y * cx1 - t1 * sx1) >> 9;
t3 = (t1 * cx1 + y * sx1) >> 9;
/* third rotation folds t0 with t2 */
rx = (t0 * cx2 - t2 * sx2) >> 9;
rz = t3;
ry = (t2 * cx2 + t0 * sx2) >> 9;
Then it projects with a perspective divide:
scale = 0xb2;
denom = camera_depth + rz;
screen_x = (rx * scale) / denom + centre_x;
screen_y = (ry * scale) / denom + centre_y;
projected_x[index] = (int16_t)screen_x; /* table 0x6e8f */
projected_y[index] = (int16_t)screen_y; /* table 0x6cff */
That is the core of the intro's "fancy" feel. The object motion is not a hard-coded 2D twiddle. It is an actual small 3D object pipeline using 32-bit intermediate math in 16-bit real mode.
Polygon Records and Backface Test
For each projected object, the renderer reads polygon records from the current object table. The common record format is:
word vertex0
word vertex1
word vertex2
word vertex3_or_03e7
byte colour_or_plane_value
byte unused/padding
The record loader copies those fields to:
0x07a2 vertex0
0x07a4 vertex1
0x07a6 vertex2
0x07a8 vertex3 or 0x03e7 sentinel
0x72a5 fill colour
Flat 0x5baf is the signed-area/backface helper. It receives three projected
points and returns a cross-product-like value in CX:
cx =
(x2 - x0) * (y1 - y0)
- (x1 - x0) * (y2 - y0);
The surrounding code uses the sign in two ways:
if sign/reject condition fails:
skip polygon
if shading mode wants it:
colour = (cx >> 9) + base_colour
The code also has a mode where the cross-product sign selects VGA plane masks:
one side writes with map mask 0x04, the other with 0x08. That gives a cheap
two-sided fill distinction without a full lighting calculation.
For a quad, the renderer adds four edges:
v0 -> v1
v1 -> v2
v2 -> v3
v3 -> v0
For a triangle record with v3 == 0x03e7, it adds:
v0 -> v1
v1 -> v2
v2 -> v0
All edges are converted into per-scanline x intersections before the span filler runs.
Edge Table Builder at 0x5c04
Flat 0x5c04 is the scanline edge accumulator. Inputs are staged in:
0x5bf4 x0
0x5bf6 y0
0x5bf8 x1
0x5bfa y1
0x5bfc fixed-point scale, normally 0x0200
Two 200-word span tables live near the start of the code segment:
0x0008 + y*2 first x intersection for scanline y
0x02c4 + y*2 second x intersection for scanline y
The routine first sorts the endpoints by y:
if y0 > y1:
swap x0,x1
swap y0,y1
For a non-horizontal edge:
dy = y1 - y0;
dx = x1 - x0;
step = (dx * scale) / dy; /* signed 32-bit divide */
x_fp = x0 << 9;
y = y0;
while (dy--):
x = x_fp >> 9;
if (0 <= y && y <= 199) {
if (left[y] == 0)
left[y] = max(x, 1);
else if (right[y] == 0)
right[y] = max(x, 1);
}
x_fp += step;
y++;
For a horizontal edge it directly writes the two endpoints into the current scanline's two tables.
This is a standard filled-vector setup, but the implementation is compact: there is no heap structure, no sorted edge list, and no per-polygon allocation. Each polygon clears the fixed span tables, drops two x intersections per y, and immediately fills.
Four-Plane Span Filler at 0x72a5
The main tweaked-VGA filler begins at flat 0x72a5/0x72af. It reads the two x
intersections for each scanline and writes horizontal spans into the hidden
page.
The outer loop:
bp = 200
si = 0
dx = back_page_offset
for each scanline:
x0 = cs:[0008 + si]
x1 = cs:[02c4 + si]
if x0 <= 0 or x1 <= 0:
skip
if x0 > x1:
swap x0,x1
fill span x0..x1
if double-height mode 579e == 1:
si += 4
dx += 0a0h
bp -= 2
else:
si += 2
dx += 50h
bp--
The horizontal coordinate conversion is the important part:
byte_address = x >> 2
plane_bit = x & 3
Because one byte address corresponds to four horizontal pixels across the four VGA planes, the filler handles partial first and last bytes by changing the VGA sequencer map mask.
For a long span, the loop is:
left_mask = 0x0f ^ ((1 << (x0 & 3)) - 1)
out 3c4h, (left_mask << 8) | 02h
es:[dx + (x0 >> 2)] = colour
out 3c4h, 0f02h
fill middle byte-addresses with colour
right_mask = (((1 << (x1 & 3)) - 1) << 1) | 1
out 3c4h, (right_mask << 8) | 02h
es:[dx + (x1 >> 2)] = colour
The middle fill has byte and word paths:
if middle_count is odd:
stosb colour
cx = middle_count / 2
ax = colour | (colour << 8)
rep stosw
Special cases handle spans contained in the same byte-address or separated by
only one or two byte-addresses. Those cases avoid the middle rep stosw path
and combine the endpoint masks directly.
This loop is why the object renderer is reasonably quick: it pays a few VGA port writes per scanline, not per pixel.
One-Bit / Eight-Pixel Span Fillers
There is a second family of span fillers around flat 0xe0bc, 0xe1bc, and
0xeab1. These do not use the four-plane x >> 2 mapping. They treat each
byte as eight horizontal pixels:
byte_address = x >> 3
bit_mask = 0x80 >> (x & 7)
row_stride = 0x28 bytes
The overwrite variant at flat 0xe1bc:
si = 0
dx = cs:[07af]
bp = 200
for y in 0..199:
x1 = cs:[02c4 + si]
x0 = cs:[0008 + si]
if missing or invalid:
next row
if x0 > x1:
swap
byte0 = x0 >> 3
byte1 = x1 >> 3
if byte0 == byte1:
mask = left_partial_mask(x0) & right_partial_mask(x1)
es:[dx + byte0] = mask
else if byte1 - byte0 == 1:
es:[dx + byte0] = left_partial_mask(x0)
es:[dx + byte1] = right_partial_mask(x1)
else:
es:[dx + byte0] = left_partial_mask(x0)
fill bytes between with 0xff, using rep stosw where possible
es:[dx + byte1] = right_partial_mask(x1)
si += 2
dx += 28h
The OR variant at flat 0xeab1 is almost the same, but the single-byte case
uses:
or es:[di], al
instead of overwriting. That lets multiple generated spans accumulate into a bitplane mask without erasing earlier bits.
The mask formulas are:
left_partial_mask(x):
b = 0x80 >> (x & 7);
return ((b - 1) << 1) | 1;
right_partial_mask(x):
b = 0x80 >> (x & 7);
return (b - 1) ^ 0xff;
These routines are used by later 16-colour/bitplane-looking parts, especially
after the main sequence switches through BIOS mode 0x0d.
Dot / Star Plotter
Flat 0xd308 initializes 50 points. It repeatedly calls the PRNG at flat
0xd343 until each coordinate lands in range:
for i in 0..49:
do x = random(); while (x > 0x13c);
point_x[i] = x;
do y = random(); while (y < 0x2a || y > 0xc7);
point_y[i] = y;
The PRNG keeps four words and mixes them with adds, rotates, xor, and a final subtract. It is not cryptographic and does not need to be. It just needs to spread point starts cheaply:
ax += bx
rol ax, cl
ax ^= dx
xchg cl, ch
bx += cx
dx += bx
cx += ax
ror bx, 1
ax -= dx with borrow
store updated words
Flat 0xd282 updates and plots the points in the tweaked planar page:
colour_cycle = 1;
for each point:
out 3c4h, 0f02h
erase_offset = previous_byte_offset[i] + back_page_offset;
es[erase_offset] = 0;
linear = y * 0x140 + x; /* 320*y + x */
byte_offset = linear >> 2;
previous_byte_offset[i] = current_byte_offset[i];
current_byte_offset[i] = byte_offset;
plane = 1 << (linear & 3);
out 3c4h, (plane << 8) | 02h
es[back_page_offset + byte_offset] = colour_cycle + 7;
x += 1;
if x > 0x13f:
x = 0;
colour_cycle++;
if colour_cycle == 4:
colour_cycle = 1;
This is a textbook Mode-X pixel plot: calculate a linear x/y coordinate, use
x & 3 for the map mask, and use x >> 2 for the byte address. The erase uses
all planes first, then the plot selects one plane for the new pixel.
Later Mode 0x0d Section
Late in the main sequence, the intro switches to BIOS video mode 0x0d:
ax = 000dh
int 10h
It then sets the first 16 palette registers with BIOS int 10h, AX=1000h and
continues with routines around flat 0xe867, 0xf0cc, 0xf17a, and the
eight-pixel span fillers described above.
The visible hardware behaviour is clear:
mode 0dh / 320x200 16-colour planar setup
BIOS palette-register writes
row stride 0x28 byte-oriented bitplane spans
sine-derived span endpoints
OR/overwrite bitmask filling
I did not fully name every late-mode object or scene. What is clear from the inner loops is that this section is no longer using the four-plane 80-byte Mode-X span convention. It is using 40-byte rows and 8-pixel bit masks, which is the right shape for 320-pixel-wide 1-bit plane work inside a 16-colour planar mode.
Why the Intro Feels More Complex Than Its Size
The implementation gets a lot of visual mileage from a small set of compact systems:
- RNC compression turns a 67 KB executable into a 227 KB working image.
- The main renderer is data-driven by small vertex and polygon tables.
- Rotation uses a single 512-entry sine table and 9-bit fixed-point multiplies.
- Perspective projection uses 32-bit intermediates even though the program is 16-bit real-mode code.
- Filled vectors use static span tables and immediate scanline fill, avoiding a general polygon list or allocator.
- VGA page swaps are done by changing CRTC display start, not by copying a full screen every frame.
- Partial clears keep the object renderer from spending the whole frame wiping VRAM.
- Separate filler families cover both tweaked 256-colour planar mode and later 16-colour/bitplane-style effects.
The core is therefore not "a cube routine plus effects." The cube-like data at
0x0664 is just one object table fed into a small 3D/vector renderer. The
timeline changes depth, centre position, angle phases, object table pointers,
shading mode, and page offsets to make that renderer produce several distinct
visual states.
Unresolved or Lower-Confidence Areas
- The Sound Blaster driver behind far entrypoint
2fd3:000fwas not fully reconstructed. The visual code's use of it is clear, but the mixer internals are outside this pass. - The late mode
0x0droutines are identified by hardware access and span loops, but I did not assign exact scene names to each late subroutine. - Some very small helper islands are reached through code/data-adjacent areas, so the labels here are practical reverse-engineering labels, not original source symbols.