Analysis model: gpt-5.5 xhigh
Untitled by Dust - Technical Dissection
Scope
This is a static technical dissection of Untitled by Dust, released for
MS-DOS at The Party 1993. Demozoo lists it as released on 29 December 1993 and
as the 1st-place entry in the The Party 1993 PC demo competition. Pouet lists
the same production as an MS-DOS demo released at The Party 1993, ranked 1st in
the PC demo compo.
Public references:
- Demozoo production: https://demozoo.org/productions/6123/
- Pouet production: https://www.pouet.net/prod.php?which=64
- Scene.org final archive: https://files.scene.org/view/parties/1993/theparty93/demo/dust_unt.zip
- Scene.org alternate final archive: https://files.scene.org/view/parties/1993/theparty93/demo/untitled.zip
- Scene.org party version: https://files.scene.org/view/parties/1993/theparty93/demo/dust_unt-partyver.zip
The main target here is the final dust_unt.zip / UNTITLED.EXE. The party
version was downloaded for comparison, but the final is the better analysis
target because the final UNTITLED.NFO says the party pre-release required a
Gravis UltraSound, while the final also supports Sound Blaster and Sound
Blaster Pro.
Offsets below are explicit about their base. EXE+0xa0 means a file offset in
the final UNTITLED.EXE; stage2+0x1805 means an offset inside the unpacked
second-stage loader image; 3D+0x963c means an offset inside extracted
3D.COM.
Credits And Requirements
The final NFO credits the demo as follows:
- Stone: sound system, loader and XMS management, 3D system, transitions, halfpipe animation, landscape, texts.
- Tyrone: setup graphics, halfpipe graphics, zoom-rotate-scroll graphics, airbag graphics, credits graphics, texts and ANSI art.
- Vioon: dungeon, dungeon maps, dungeon animation.
- Den: tube graphics.
- B-Man: composition and arrangement of music, halfpipe animation.
The same NFO recommends a 486, requires at least a 386, and lists about 544 KB
of base memory plus about 2360 KB of XMS. It also documents the /NS command
line option, which skips the setup screen and starts directly with the dungeon.
That matches the binary architecture: this is not a monolithic .COM demo. It
is a self-extracting MZ file with a private archive, XMS-aware loader services,
several separately loaded .COM effect modules, one shared polygon filler
module, map/texture/palette files, music data, and sample instruments.
Examined Files
Final archive:
dust_unt.zip 858,590 bytes
UNTITLED.EXE 1,364,453 bytes
UNTITLED.NFO 14,655 bytes
FILE_ID.DIZ 629 bytes
CRUSADER.COM 9,296 bytes
Alternate final archive:
untitled.zip 853,236 bytes
UNTITLED.EXE 1,364,453 bytes same executable
UNTITLED.NFO 14,974 bytes
FILE_ID.DIZ 629 bytes
ULTRA.LBM 14,854 bytes
Party archive:
dust_unt-partyver.zip 1,044,806 bytes
UNTITLED.EXE 1,414,888 bytes
READ.COM 22,083 bytes
INFO.TXT 1,624 bytes
NE2READ.TXT 879 bytes
TDTSWEDE.EXE 1,535 bytes
FILE_ID.DIZ 65 bytes
Important hashes:
3bc2c3de94ac34303c4a10743367caa71434fcc02d22c39612eed39ba95dfaf6 dust_unt.zip
8b7831daba33059ece689b34e41016f1be1445e9269cfcf1ad0e2db036146bb2 untitled.zip
882f966045e9f18b0c93c2a12fc4bbf1af2a2b408cc0e058645f30d02a77979a dust_unt-partyver.zip
65e72cdafbe1198bd727227ffaef970031447b63c3b5b1e366884c2207f57784 final UNTITLED.EXE
df6b7ec461422886325dadcdfcabece0f7266e1ab8e9261828acfa8934e41a82 final UNTITLED.NFO
3baf5aea5c60862e1f58e9c4c4a4cac1b421d93a7fd014e56079a52c70ce2cf9 CRUSADER.COM
d69c3bc4264df5e1b95e25197847f2b07742c9c3c75f963ece3367b62e515acd party UNTITLED.EXE
The final and alternate archives contain the same UNTITLED.EXE. The alternate
adds ULTRA.LBM; the final adds CRUSADER.COM.
Top-Level Shape
The final UNTITLED.EXE is an MZ executable whose header describes only a tiny
load image. The real demo payload is a large appended overlay.
file size: 1,364,453 bytes
MZ image size field: 4,188 bytes
MZ header size: 160 bytes
relocation count: 1
initial CS:IP: fff0:0100
initial SS:SP: 0106:0200
entry file offset: 0xa0
The odd-looking CS=fff0, IP=0100 is intentional. In an MZ executable the
runtime CS is relative to the load segment, and fff0h effectively points back
to the PSP paragraph. The entry code executes at PSP:0100, which corresponds to
the start of the loaded image at EXE+0xa0.
There is exactly one relocation record:
relocation table offset: 0x52
relocation: segment 0000, offset 0007
patched file word: EXE+0xa7
The relocated word is the immediate operand in add ax,0000. DOS changes that
word to the program load segment, so startup can compute absolute segment
addresses without calling DOS.
The first bytes at EXE+0xa0 are:
b8 06 03 ba fc 00 05 00 00 3b 06 02 00 72 1b ...
Decoded:
mov ax,0306h
mov dx,00fch
add ax,load_segment
cmp ax,[0002h] ; PSP top-of-memory paragraph
jb enough_memory
...
If the top-of-memory check fails, the stub prints Check this out !!$.
First-Stage Depacker
The initial visible MZ program is only a staging stub. After the memory check it copies a depacker to high conventional memory and far-returns into it.
The relevant startup copy is:
sub ax,20h
mov ss,ax
sub ax,25h
mov es,ax
mov cx,0123h
mov si,0144h
xor di,di
rep movsw
lret
With the usual DOS layout, this lands the depacker around PSP+02d1h. The
depacker then runs downward-copy setup with std, copies about 0xfc0 bytes
from the file-backed load image into high memory, and expands the second-stage
program into the low loaded image.
The compressed input window starts effectively at EXE+0x330, and the
decompressed output is written to PSP:0100.
The bitstream is LSB-first. BP is used as the bit bucket and DX/DL tracks
available bits. Its high-level shape is LZ:
while unpacking:
if get_bit() == 0:
*out++ = *in++ ; literal
else:
length = decode_length()
distance = decode_distance()
copy from out - distance to out for length bytes
The literal path is exactly the expected one-byte copy path:
movsb
The match path computes a previous output pointer and performs:
si = di - distance
rep movsb
There is also a special escape path through byte values feh and ffh. That
path is not visual code; it normalizes DS, ES, SI, and DI across 64 KB
boundaries and then reads a relocation/entry trailer from the packed stream. At
the end the depacker has set the final stack and entry CS:IP, then returns into
the next loader.
Emulating this stage up to the final far return produced:
unpacked second-stage image: 11,280 bytes
SHA-256: 1af15e395496fc2770d7b4ce087192d25bf16c9f1336762800d86201154c6be8
write range in emulated memory: 10100h..22f5eh
final return target: 1010:0100
The second-stage image begins with a PSP-like zero area. Its real entry is at
offset 0x100, and the first instruction there is jmp 0407h.
Second-Stage Loader
The unpacked loader is the heart of the demo runtime. It resizes the DOS memory block, checks for a 386, installs a private interrupt vector, initializes its archive access, and then loads effect modules on demand.
At stage2+0x0407 it computes how many paragraphs the loader needs and calls
DOS function int 21h, ah=4ah to release the rest of conventional memory.
Then it copies the PSP command tail and calls the CPU check at stage2+0x1cfe.
The CPU check is a standard 386 test. It toggles high FLAGS bits and verifies that the machine preserves them. This matches the NFO's "386 or higher" requirement.
Private int 80h Service Table
The loader installs interrupt 80h as a private service entry:
; stage2+1d3e, simplified
save old IVT[80h] into [1d3a:1d3c]
IVT[80h].offset = 1805h
IVT[80h].segment = CS
The handler is compact:
; stage2+1805
shl bp,1
call word ptr cs:[bp+17f3h]
iret
So loaded modules call the loader through:
mov bp,service_number
int 80h
The service number is doubled and used as an offset into the dispatch table at
stage2+0x17f3. This is why many effect modules do not contain their own DOS
file code; they ask the resident loader to allocate memory, fetch members from
the embedded archive, and return segment pointers.
The loader also uses int 81h as a sound/timer interface. In the modules,
int 81h calls with BP values such as 11h, 13h, and 14h set music/player
callbacks and timing hooks.
Boot Sequence
The early loader sequence is:
stage2+0407 resize memory block
stage2+0418 copy command tail
stage2+0434 call CPU check
stage2+0437 install int 80h vector
stage2+0441 initialize archive source as "untitled.exe"
stage2+044b int80 service 8
stage2+045e int80 service 1 for "untitled.nfo"
...
The stage2 string table already exposes the module order and asset family:
untitled.exe
sgi.com
so.sng
tsin4096.com
tube01.col
chr01.col
zclean.col
air.col
int1.col
colorfx.col
colorfx2.col
plasma6.col
plasma3.col
credbck1.col
tu.com
rz.com
ab.com
chr01.map ... chr08.map
zper2048.com
sqrt_16w.dat
polyfill.256
abag.com
air.map
int1.map
int2.map
int.com
ls.com
lso.com
plasma3.map
credbck1.map
credbck2.map
mo.com
air2.map
ab2.com
setup.com
3d.com
tx1pic.map ... tx4pic.map
tube01.map ... tube04.map
That table is more than a cosmetic list. The effect modules request these names
through int 80h, and the loader returns allocated segments for the unpacked
members.
Embedded Archive Format
UNTITLED.EXE contains its own encrypted member archive. The directory is at
the end of the file, just before a six-byte footer.
The final footer is:
c0 05 c3 bb 14 00
Interpreted by the loader:
table_size: 0x05c0 = 1472 bytes
footer_base: 0x14bbc3
table_start: eof - table_size - 6 = 0x14cc1f
member_base: table_start - footer_base = 0x105c
records: 92
record size: 16 bytes
Each 16-byte directory record is:
00..0b uppercase-ish 12-byte member name field
0c..0f member offset relative to member_base
The directory itself is byte-encrypted with an additive rolling XOR key:
key = 0
for byte in directory:
decrypted = byte ^ key
key = (key + 0x61) & 0xff
Member loading uses a second layer:
seek(member_base + directory_offset)
read 4-byte member header
header ^= 0xa5a5a5a5
packed_size = header & 0xffff
unpacked_size = header >> 16
read packed_size bytes
for i in 0..packed_size-1:
body[i] ^= (0x44 + i*0x20) & 0xff
The decrypted body is a simple signed-count RLE stream:
while output < unpacked_size:
n = signed little-endian word
if n >= 0:
copy n+1 literal bytes
else:
b = next byte
output b repeated (-n)+1 times
The unpacked output is then truncated to the member header's unpacked_size.
Some bitmap-style streams naturally end right at the boundary, and a robust
extractor should clamp the final copy or repeat to that declared size.
This is the loader's member load service in prose:
uppercase requested filename
scan 16-byte directory records
if name matches:
seek to member
decrypt packed-size/unpacked-size header
allocate enough paragraphs for unpacked data plus loader slack
read packed bytes at the high end of the allocation
XOR-decrypt body using key 44h, +20h per byte
RLE-expand downward source to low output
return segment pointer to caller
Extracted Members
The archive contains 92 records. The interesting code and data members include:
| Member | Packed | Unpacked | Role |
|---|---|---|---|
SGI.COM |
11431 | 14530 | Sound/graphics interface loader piece. |
UNTITLED.NFO |
9913 | 14655 | Final info text. |
SETUP.COM |
3014 | 5658 | Setup program module. |
SETUP1.MAP, SETUP2.MAP, PANELS.MAP |
25836..29167 | 64000 each | Setup screen maps. |
3D.COM |
5835 | 43323 | Main dungeon/3D module. |
3DO.COM |
27015 | 28000 | 3D object/data support. |
3DL.COM |
6290 | 6912 | 3D/light or lookup support. |
TSIN4096.COM |
20484 | 20480 | Trigonometric table data, not normal code. |
ZPER2048.COM |
40968 | 40960 | Depth/perspective table data. |
SQRT_16W.DAT |
32776 | 32768 | 16-bit square-root lookup table. |
POLYFILL.256 |
55508 | 56866 | Shared polygon filler and texture span code. |
TU.COM |
4932 | 6583 | Tube part module. |
RZ.COM |
4666 | 7060 | Zoom/rotate/scroll style module. |
AB.COM |
5339 | 8520 | Airbag/object module. |
AB2.COM |
5538 | 8719 | Second airbag/object module. |
INT.COM |
5338 | 8514 | Interlude/object transition module. |
LS.COM |
4686 | 16306 | Landscape-ish module. |
LSO.COM |
5980 | 6266 | Landscape/object support module. |
MO.COM |
3338 | 5796 | Motion/final transition style module. |
SO.SNG |
12243 | 14216 | Song data. |
*.INS |
varied | varied | Instrument/sample data. |
*.COL |
mostly 7..774 | 768 | VGA palettes. |
*.MAP |
varied | 10240..64000 | 8-bit image/maps/textures. |
Some role names above are inferred from filenames, NFO credits, and code shape.
3D.COM and POLYFILL.256 are reconstructed much more deeply than INT.COM,
LS.COM, and MO.COM.
Visual And Runtime Sequencing
The demo is built around a resident loader and separately loaded parts:
- Setup and sound initialization.
SETUP.COMand setup maps/palettes form the configuration front end./NSskips this path. - Main 3D/dungeon part.
3D.COMloads texture/palette maps, object helpers, sine/perspective/sqrt tables, andPOLYFILL.256. - Picture/logo and palette transitions.
DUSTLOGO.*,DUSTMOVE.COL,TX?PIC.*, and the color-effect palettes are used for palette and image transitions around the main sections. - Tube part.
TU.COMconsumesTUBE01.MAPthroughTUBE04.MAPandTUBE01.COL. - Zoom/rotate/scroll.
RZ.COMis the rotozoom-style sampler, matching the NFO credit for zoom-rotate-scroll graphics. - Airbag/object parts.
AB.COM,AB2.COM,ABAG.COM,AIR*.MAP, andAIR.COLform the airbag/airplane/object family. - Interlude, landscape, plasma, credits, and final transitions are handled by
modules such as
INT.COM,LS.COM,LSO.COM,MO.COM, plus thePLASMA*,CREDBCK*, andCHR*assets.
The exact frame-by-frame timeline was not reconstructed from the music script. The useful technical point is that the binary is modular: each part receives segments and callback services from the loader instead of carrying all resource and sound code inline.
Complete Direct Silent Run
The hashed final dust_unt.zip release was run from its extracted archive in
DOSBox-X 2026.01.02. The /NS option skips only the setup screen and enters
the normal dungeon-first authored sequence. The guest used a 486-class dynamic
core at 50,000 cycles, 16 MB RAM, S3 VGA, XMS with EMS disabled, and Gravis
UltraSound at the release's recommended base 240, DMA 3, IRQ 11. SDL's
host audio driver was explicitly dummy, so no sound or music was played.
The demo completed every part and returned normally. External X11 capture recorded about 358 seconds from DOS startup through the final return as lossless FFV1 at 10 fps, with no audio stream and the mouse cursor disabled. The eight GIFs below are six-second direct 640x400 guest-display crops scaled to 400x300. No H.264, MP4, contact sheet, public video, or browser capture is used as runtime evidence.
The dungeon clip is now continuous evidence rather than one isolated frame:

The next section moves a turquoise ball through the pale tube geometry:

The Dust logo becomes a moving 3D object instead of a static title card:

The organic airbag/object passage exposes the stranger mapped geometry of the
later AB family:

The mapped text sphere is a separate effect family, not another crop of the same object scene:

The yellow-white distortion is the clearest moving view of the rotozoom path:

The late landscape part turns the colour-mapped height field in depth:

The authored ending reaches the final Dust credit sequence:

Runtime-To-Code Concordance
The complete direct run removes the old one-frame boundary. The dungeon remains the strongest instruction-level anchor, while the later GIFs now prove the authored roles of the tube, rotozoom, airbag/object, landscape, and credits families:
direct runtime scene strongest examined module/resource anchor
textured dungeon 3D.COM + POLYFILL.256 + perspective tables
tube and turquoise ball TU.COM + TUBE01..04.MAP + TUBE01.COL
moving Dust logo DUSTLOGO.MAP/COL + object/presentation path
organic mapped object AB.COM / AB2.COM / ABAG.COM + AIR resources
mapped text sphere later object/map family; exact child remains unclaimed
yellow-white rotozoom RZ.COM sampling loop
colour-mapped landscape LS.COM / LSO.COM + landscape resources
final credits CREDBCK/CHR assets and late module sequence
The /NS capture path matters. It skips the setup front end and goes through
the resident loader's normal module service path: the second-stage loader
installs int 80h at stage2+0x1805, exposes archive/resource services
through the table at stage2+0x17f3, and lets 3D.COM request members such
as 3DO.COM, 3DL.COM, TSIN4096.COM, ZPER2048.COM, SQRT_16W.DAT,
POLYFILL.256, DUSTLOGO.MAP, and the texture/palette maps. The dungeon clip
is therefore downstream of the MZ overlay, custom encrypted archive, and
loader-service machinery, not a directly embedded bitmap.
The perspective corridor visible in the direct clip maps to the 3D.COM traversal
around 3D+0x963c. Object records are read from FS, translated, rotated
through the sine/cosine table segment, and written into temporary vertex lists.
The rotation blocks at 3D+0x971d, 3D+0x9782, and 3D+0x97ea use signed
32-bit multiplies and complementary trig streams to rotate x/z, y/z, and x/y
pairs before projection.
The convergence of the walls and floor is the projection path at
3D+0x988e. Z is converted into an index into ZPER2048.COM, then screen
coordinates are computed as table-scaled x and y terms centered around
(160,100). The separate shade/material calculation carries distance and
surface state forward to the face list, which is why the scene reads as a lit
textured corridor rather than only wire geometry.
The visible faces are filtered and ordered by the code at 3D+0x9937 through
3D+0x9d24. The module rejects faces outside the active 3D window, applies the
2D projected cross-product test at 3D+0x99f7, computes lighting around
3D+0x9a58 using the SQRT_16W.DAT lookup, and insertion-sorts visible faces
by average depth. This is the bridge between the high-level dungeon object data
and the ordered polygons in the runtime clip.
The texture and filled spans come from POLYFILL.256, not from
bespoke drawing code inside 3D.COM. At 3D+0xa8db, the module copies the
polyfill far-call entry table, then initializes the output segment and the
active clip rectangle x=16..303, y=16..183. Later, 3D+0x9d84 dispatches
each visible face through one of those far pointers, with 3D.COM supplying
the parameter block and POLYFILL.256 doing scan conversion.
The corridor edges correspond to the edge-table builders:
flat entries POLYFILL+0x190a/0x1900/0x18f6 share the edge builder at
POLYFILL+0x1912, while textured entries
POLYFILL+0x2b88/0x2b7b/0x2b6e build companion interpolant tables. The
left/right scanline tables at [0e16+y*4] and [1136+y*4] are what let the
span writers fill each row of a wall/floor polygon without testing every pixel
against polygon edges.
The textured surface pixels map to the hot textured span path
around POLYFILL+0x60f2, especially the unrolled loop at POLYFILL+0x6261.
That loop samples texture bytes through GS:[EBX], treats color zero as
transparent, writes nonzero texels to ES:DI, and uses ADD/ADC carry to
advance packed texture-coordinate bytes. This explains the masked texture
details in the dungeon view and why the POLYFILL.256 module is central to
the direct dungeon animation.
Finally, the dungeon animation has passed through 3D.COM's copy-and-clear
presentation loop at 3D+0x9ef5. The active 3D rectangle is copied from the
offscreen segment to A000h and cleared in the same row-wise dword loop. The
runtime scene is therefore the visible product of a full module pipeline:
loader service, resource archive, 3D transform/projection, face sorting,
polyfill texture spans, and fused present/clear.
3D.COM Module Startup
Extracted 3D.COM:
size: 43,323 bytes
SHA-256: 166903f516f56ff7a19d72ee1e69ac3d8db0624c995c0de31b49ac4ea9c42303
The module starts with a wrapper that saves the caller's DS, SS, and SP,
sets DS=SS=CS, sets SP=fffeh, and jumps to the real module entry at
3D+0x935a.
The real entry:
mov eax,fs:[si]
mov [a835h],eax
add eax,10000h
mov [a839h],eax
mov ax,fs:[si+4]
mov [a7e7h],ax ; offscreen/screen segment from loader
mov [8a15h],cs
...
mov bp,0
int 80h ; loader allocation/service call
...
mov bp,1
int 80h ; load named resources from module list
The module requests:
tx1pic.col
dustmove.col
dustlogo.col
dustlogo.map
3do.com
3dl.com
tsin4096.com
zper2048.com
sqrt_16w.dat
polyfill.256
laser.map
It then configures the music/timer side through int 81h services and prepares
its software framebuffer.
3D Reciprocal Table
At 3D+0xa889, the module clears a 320x200-ish offscreen surface:
mov es,[a7e7h]
xor di,di
xor ax,ax
mov cx,7d00h
rep stosw ; 0x7d00 words = 64000 bytes
Then it allocates 0x1000 paragraphs for a division table and builds a
reciprocal/perspective helper table. The loop is explicit integer division, but
it is done once during setup rather than per pixel:
for ecx = 00010000h; ecx < 00810000h; ecx += 00010000h:
for divisor = 1; divisor <= 80h; divisor++:
eax = ecx
edx = 0
eax = eax / divisor
store dword eax
The important detail is the table shape. The renderer often needs "fixed-point
value divided by small delta" for edge slopes. Precomputing divisions for small
denominators avoids a slow div in the polygon edge loop.
Loading POLYFILL.256
After loading POLYFILL.256, the 3D module copies far-call entry offsets from
the filler's table at offset 0x100:
; 3D+0xa8db, simplified
source = polyfill_segment:0100h
destination = [a7e9h]..[a82xh]
copy 0x13 far entry offsets
Then it initializes the filler:
call polyfill_init_screen_segment
call polyfill_set_clip_rect
The clip rectangle passed at 3D+0xa911 is:
x_min = 16
x_max = 303
y_min = 16
y_max = 183
That is the active 3D window. The renderer draws into an offscreen buffer and later copies only this central rectangle to VGA.
3D Object Traversal
The main 3D traversal starts around 3D+0x963c.
Important segment roles:
FS = object/scene data segment
ES = sine/cosine/rotation table segment
vertex output list = 3D+0x011d
face output list = 3D+0x476d
screen vertex list = 3D+0x2ffd
For each object, the code reads translation fields from the object record:
object.x += fs:[bx+0eh]
object.y += fs:[bx+10h]
object.z += fs:[bx+12h]
Then it applies three table-driven rotations. The table is arranged as two fixed-point streams:
ES:[bp] one trig component
ES:[bp+1000h] complementary trig component
The Y-axis x/z rotation at 3D+0x971d is the canonical form:
x2 = (x * cos + z * sin) >> 15
z2 = (z * cos - x * sin) >> 15
The implementation uses 32-bit signed multiplies and keeps the high words:
movsx eax,word [x]
imul dword ptr es:[bp+1000h]
...
movsx eax,word [z]
imul dword ptr es:[bp]
...
The X-axis y/z rotation at 3D+0x9782 and Z-axis x/y rotation at 3D+0x97ea
repeat the same pattern with different coordinate pairs. After all three
rotations, the object translation is added and the transformed vertex is stored
for projection and face tests.
Projection And Depth
Projection starts around 3D+0x988e. The input vertex has transformed
coordinates:
[bp+0] = x
[bp+2] = y
[bp+4] = z
The z value is converted into an index into ZPER2048.COM:
si = ((0x8000 xor z) negated) >> 3
if si >= 0x1400:
clip/reject
si *= 4
Screen coordinates are:
x_screen = ((x * ztable[si]) >> 16) + 160
y_screen = ((y * ztable[si + 0x5000]) >> 16) + 100
The projected x/y pair is stored in the screen vertex list. A separate distance/shade value is derived from:
distance = (x*x + y*y + z*z) >> 17
shade = ZPER2048[distance-ish] combined with material bits
So the module is not only drawing flat projected polygons. It carries depth and material state forward to the face sorter and polyfill dispatcher.
Face Culling, Clipping, And Lighting
At 3D+0x9937, the module loops over transformed faces.
The first rejects are cheap:
reject if every vertex is too near or behind
reject if every vertex is left of x_min
reject if every vertex is right of x_max
reject if every vertex is above y_min
reject if every vertex is below y_max
Backface culling at 3D+0x99f7 uses the projected 2D cross product:
dx1 = x1 - x0
dy1 = y1 - y0
dx2 = x2 - x0
dy2 = y2 - y0
cross = dx1*dy2 - dy1*dx2
if cross >= 0:
reject
The sign is saved in [8a0d] for later mode decisions.
The lighting path begins around 3D+0x9a58. It computes a face centroid,
optionally computes a normal from the first three vertices, and normalizes using
the SQRT_16W.DAT lookup. The cross product is the usual 3D one:
normal.x = edge1.y*edge2.z - edge1.z*edge2.y
normal.y = edge1.z*edge2.x - edge1.x*edge2.z
normal.z = edge1.x*edge2.y - edge1.y*edge2.x
Then it forms a dot product with a light/vector term, clamps the result into
0..10000h, and stores a shade/material value in the face record.
Face Sorting
The face sorter at 3D+0x9d24 builds a linked list in a table near
3D+0x764d. It is an insertion sort by average z/depth:
for each visible face:
zsort = average transformed z
find insertion point in linked list
insert face before first farther/nearer record according to order
For a 1993 real-mode demo this is a pragmatic choice. The number of visible faces in a frame is small enough that insertion into a linked list is cheaper than a generalized sort, and it keeps records in the exact order the later dispatcher wants to consume them.
Polyfill Dispatch From 3D.COM
After sorting, the renderer iterates the visible face list and dispatches to
POLYFILL.256. The dispatch point around 3D+0x9d84 reads the face type and
selects a far pointer copied from the polyfill entry table.
The type split is:
type < 3:
flat fill variants
3 <= type < 6:
textured / shaded variants with extra per-vertex attributes
type >= 6:
simpler vertex + shade form
The actual call is a far call through a polyfill pointer:
mov es,[8a15h] ; caller/module segment
mov bx,87e9h ; parameter block
lcall far [polyfill_entry]
This means 3D.COM owns scene traversal and high-level polygon selection, while
POLYFILL.256 owns scan conversion and pixel writing.
Copy-And-Clear Inner Loop
After drawing, 3D.COM copies the active 3D rectangle from the offscreen buffer
to VGA and clears the source area. This loop starts around 3D+0x9ef5:
mov es,0a000h
mov ds,[a7e7h]
...
The loop works row by row over about 0xa8 rows and about 0x140 bytes per
row. It is unrolled as dword loads/stores:
for row in active_rows:
for x in active_width step 4:
eax = offscreen[row][x]
vga[row][x] = eax
offscreen[row][x] = 0
The central technical point is that clearing is fused with presentation. The renderer does not clear all 64 KB every frame after drawing. It copies the window it cares about and erases that same memory while the cache/registers are already hot.
POLYFILL.256 Overview
Extracted POLYFILL.256:
size: 56,866 bytes
SHA-256: a114272ce43f47f57a
The first 0x100 bytes are mostly zero. At offset 0x100 is a far-call vector
table. The first entries are:
190a 1900 18f6 2b88 2b7b 2b6e d042 ...
The utility entries near the end are:
18a4 initialize output/caller segments
18b3 set clipping rectangle
18dd copy 256-entry table from GS:ESI to local table
The clipping entry stores:
[0dfa] = x_min
[0dfe] = x_max
[0e02] = y_min
[0e06] = y_max
[0e0a] = y_max + 1
[0e0c] = y_max * 4
[0e0e] = y_max * 4 + 4
The filler uses two per-scanline edge tables:
left x table: [0e16 + y*4]
right x table: [1136 + y*4]
For textured modes there are companion interpolant tables at [0e18+y*4] and
[1138+y*4].
Flat Polygon Edge Builder
Entries 0x190a, 0x1900, and 0x18f6 set a mode in AH and jump to the
common edge builder at 0x1912. The input block begins with a vertex count and
then x/y coordinate pairs.
For each edge:
read x1,y1 and x2,y2
if y1 == y2:
horizontal edge, update min/max directly
else:
walk from top y to bottom y
The general edge path at POLYFILL+0x19ad computes a 16.16 x slope:
dy = y2 - y1
dx = x2 - x1
slope = (dx << 16) / dy
But the division is avoided when possible:
if abs(dx) < 0x80 and dy < 0x80:
slope = reciprocal_table[(abs(dx)-1)*128 + (dy-1)]
else:
slope = real 386 div
The loop clips y against [0e02]..[0e06], then walks one scanline at a time.
For each y it updates the left and right x tables:
if x < left[y]:
left[y] = x
if x > right[y]:
right[y] = x
x += slope
This edge-table model is why the filler can draw arbitrary convex-ish polygons using compact per-scanline spans rather than doing per-pixel edge tests.
Flat Span Fill Inner Loop
After the edge builder, the fill path around POLYFILL+0x1b84 scans the active
y range:
for y in y_min..y_max:
x0 = max(left[y], clip_x_min)
x1 = min(right[y], clip_x_max)
if x0 <= x1:
fill span x0..x1
The byte color in AL is replicated across EAX:
mov ah,al
shl eax,16
mov ax,dx ; effectively AL AL AL AL in EAX
Then the span writer aligns DI and jumps into a generated/unrolled dword
write table:
write leading bytes until DI is dword-aligned
count_dwords = span_width / 4
jump to unrolled writer selected by count_dwords
write trailing bytes
The unrolled writer contains many:
mov dword ptr es:[di+offset],eax
That is a classic 386 VGA optimization. The setup cost is higher than a simple
rep stosb, but the inner body writes four pixels per instruction and avoids a
branch per pixel.
Palette-Remap Span Inner Loop
Entry POLYFILL+0x20d3 is a different span mode. Instead of painting a flat
color, it maps the pixels already on screen through an 8-bit lookup table using
XLAT.
The unrolled dword path is:
eax = es:[di+offset]
al = table[al]
rol eax,8
al = table[al]
rol eax,8
al = table[al]
rol eax,8
al = table[al]
rol eax,8
es:[di+offset] = eax
This is useful for fades, palette-index lighting, and "color effect" passes.
The archive names COLORFX.COL, COLORFX2.COL, PLASMA6.COL,
PLASMA3.COL, and CREDBCK1.COL fit this kind of remap-heavy transition code.
Textured Polygon Edge Builder
Entries 0x2b88, 0x2b7b, and 0x2b6e set mode byte [14a3] to 0, 1,
or 2 and switch to the textured/shaded input format. These vertices are
larger:
x word
y word
attribute0 word
attribute1 word
The edge builder now stores both x and attribute values for the left and right edge of each scanline:
left_x[y], right_x[y]
left_a[y], right_a[y]
right_a[y], right_b[y] depending on mode
At POLYFILL+0x2c6c, it computes:
x_slope = dx / dy
a_slope = da / dy
b_slope = db / dy
Again it prefers reciprocal-table lookup for small deltas and falls back to
div for larger or awkward cases. It packs fractional pieces into byte lanes
using rotates, for example:
ror ebx,16
ror edx,16
mov [1488h],bl
mov [1489h],dl
That packing is not ornamental. The final inner loop consumes fractional carry
from ADD/ADC to advance texture coordinates cheaply.
Textured Span Inner Loop
The most important textured span path starts around POLYFILL+0x60f2, with a
hot unrolled loop at POLYFILL+0x6261.
For each scanline it derives horizontal slopes between the left and right interpolants:
span_dx = right_x - left_x
du = (right_u - left_u) / span_dx
dv = (right_v - left_v) / span_dx
Then it sets:
DI = destination offset in offscreen buffer
EBX = texture base + initial u/v packed address
CL/CH and SI = fractional step/carry pieces
The hot loop repeats this shape:
mov al,gs:[ebx] ; sample texture
or al,al
je skip ; color 0 is transparent
mov es:[di],al
skip:
add edi,ebp ; next destination pixel/stride state
adc bl,cl ; advance packed texture coordinate, low component
add dx,si
adc bh,ch ; advance packed texture coordinate, high component
This is a compact affine texture mapper with transparent texels. It uses:
GSas the texture segment.ES:DIas destination.EBXas a packed texture address/state.ADCto fold fixed-point carry into texture coordinate bytes.
The transparent zero test is why texture maps can have shaped sprites or masked details without a separate mask plane.
Other POLYFILL Variants
There are later variant entry points around POLYFILL+0x9fff and
POLYFILL+0xd042. They use the same broad architecture:
build scanline edge tables
interpolate per-edge attributes
clip x/y
dispatch to an unrolled span writer
The differences are in attribute packing and source addressing. They look like alternate textured or shaded polygon modes used by different object materials. The important conclusion is not "one generic filler"; it is a family of purpose-built span routines behind a shared far-call table.
RZ.COM Rotozoom Loop
Extracted RZ.COM:
size: 7,060 bytes
SHA-256: 889ceddf9acf7cc2
RZ.COM is the zoom-rotate-scroll style module. Its startup clears a large
work area, clears A000, loads palette state, and then runs a fixed-point
sampler into VGA.
The hot loop around RZ+0x0cd4 uses:
DS = A000h
GS = source/map segment
EBX, EDX = fixed-point source coordinate terms
tables at [02b5], [02b9] = rotation/step vectors
For each row it forms a source offset similar to:
src = y*1024 + x + base
Then it writes sampled bytes into A000 in unrolled pairs/words. The distinctive
source constants include 0x01010101-style packed offsets, which let the code
sample adjacent or phase-shifted bytes while keeping the loop branch-light.
Conceptually:
for y in screen_rows:
u = row_start_u
v = row_start_v
for x in screen_cols:
dst[x,y] = source[(v >> frac) * 1024 + (u >> frac)]
u += du
v += dv
row_start_u += row_du
row_start_v += row_dv
The actual code is tighter than that pseudocode: source address construction and two-pixel writes are interleaved so the 386 spends less time in loop overhead.
TU.COM Tube Module
Extracted TU.COM:
size: 6,583 bytes
SHA-256: 9e35cc365824de15
TU.COM uses TUBE01.MAP through TUBE04.MAP and TUBE01.COL. It starts by
loading segment pointers from FS:[SI], installs music/timer callbacks through
int 81h, and allocates two 0x1000-paragraph buffers plus a 0x4000
paragraph work buffer.
Early loops are framebuffer management:
rep stosw ; clear allocated surfaces
rep movsw ; copy A000/current screen into work buffer
Around TU+0x0ae9, it copies the current VGA screen to a private segment, then
computes the tube/map parameters for the effect. The part is table/map driven:
the .MAP files are 64 KB or near-64 KB 8-bit images, and the module's job is
to turn per-pixel or per-column lookup coordinates into a tunnel/tube mapping.
This module was not reconstructed as deeply as the polygon filler, but the memory shape is clear: it is a full-screen map sampler with saved-background state, not a tiny procedural-only tunnel.
AB.COM And AB2.COM
Extracted object modules:
AB.COM 8,520 bytes SHA-256 76910241ef284fe3
AB2.COM 8,719 bytes SHA-256 c5f5808c83a6d3c1
These are the airbag/object-family modules. Their startup pattern is similar to
3D.COM: they receive segment pointers from the loader, set mode/palette/timer
state, clear A000, and traverse object data.
AB2.COM has an object traversal around AB2+0x0e0f with the same broad
stages as the dungeon renderer:
read object vertices/faces
transform coordinates
project to screen
sort or select visible faces
render with module-local routines
They are separate from 3D.COM rather than just data loaded into the dungeon
engine. That is significant: Dust used multiple custom part modules, not one
all-purpose engine for the whole demo.
LS.COM Landscape-Style Module
Extracted LS.COM:
size: 16,306 bytes
SHA-256: e6d1ad7f7a05ebcf
LS.COM allocates several buffers, including 0x1000, 0x280, and 0x800
paragraph regions. One clear initialization loop builds a word offset table:
dx = 00cch
ax = 0000h
repeat dx times:
cx = 0050h
repeat cx times:
stosw ax
inc ax
ax += 0050h
That creates a 0xcc x 0x50 grid of word offsets. This is exactly the kind of
lookup a landscape/heightfield or column renderer wants: precomputed row/column
address increments so the frame loop can index instead of multiply.
I am calling this "landscape-style" because of Stone's NFO credit and the buffer/table shape. A full reconstruction of its final pixel loop is still future work.
Table Files
Several .COM files are really binary tables:
TSIN4096.COM is 20,480 bytes. Its size and use pattern match a 4096-step
trigonometric table bundle.
ZPER2048.COM is 40,960 bytes and begins with dword-looking perspective/depth
values. 3D.COM indexes it during projection and shading.
SQRT_16W.DAT is 32,768 bytes and starts:
00 00 6a 01 00 02 73 02 ...
3D.COM uses it as a square-root/length approximation table in the lighting
path, avoiding a per-face square root.
These tables explain why the effect code contains relatively little expensive math in hot loops. Slow divides and roots are pushed into setup tables or offline data.
Why The First 3D Part Was So Strong In 1993
The first/dungeon part earns its reputation because several expensive decisions are moved out of the frame-critical path:
- The MZ stub only unpacks and hands off. Real work is in the resident loader.
- Archive members are decompressed once into allocated segments.
- Sine, perspective, reciprocal, and square-root operations are table-driven.
- Object traversal is separated from polygon filling.
- The filler uses scanline edge tables, fixed-point slopes, and unrolled dword writers.
- Texture coordinate advancement uses packed state and
ADCcarry instead of recomputing source addresses from scratch per pixel. - Presentation and clearing are fused in the copy-to-VGA loop.
That is a large amount of systems engineering for a 1993 PC demo. It is also why the demo feels very different from smaller single-effect intros of the same period: the impressive part is not only one clever inner loop, but the loader, resource, table, and module structure that lets many loops cooperate.
Known Limits Of This Pass
This pass reconstructs the loader, archive format, 3D module, and polyfill inner loops in detail. The complete direct run now confirms the broad visible roles of the later module families. It still does not assign every transition to an exact child call or reconstruct the complete music-synchronized script.
The remaining high-value follow-up would be:
- Instrument module entry/exit calls to assign exact boundaries to every direct runtime scene.
- Reconstruct the exact music/timer script using the
int 81hcallbacks. - Finish the
LS.COM,INT.COM,LSO.COM, andMO.COMhot loops to the same level as3D.COMandPOLYFILL.256. - Compare the party
UNTITLED.EXEagainst the final to isolate the Sound Blaster support and bug fixes.