Analysis model: GPT-5 (Codex), reasoning level not exposed
Maple by DarkZone - Technical Dissection
Scope
Maple is DarkZone's MS-DOS/GUS 64K intro that placed third in the PC
64K Intro competition at The Gathering 1995, after Valhalla's Fluid Motion
and Bibo Ergo Sum. This analysis uses the public scene.org archives, the
release text, a complete keyed runtime run, RNC expansion, and static
disassembly of the expanded real-mode code image.
Release year: 1995
Public references:
- Demozoo The Gathering 1995 page
- Demozoo DarkZone group page
- Pouet production page
- Pouet The Gathering 1995 page
- Scene.org TG95
dz_maple.zip - Scene.org TG95
maple_dz.zip - Scene.org DarkZone group archive
Offset notation:
MAPLE.EXE+0x...means a file offset in the packed executable.expanded+0x...means an offset in the RNC-expanded image extracted from the RNC block at file offset0x20.- Real-mode far addresses are also shown where useful. For example,
8d8c:253bis physicalexpanded+0x8fdfb.
This is not a source-level reconstruction. Scene names are inferred from code structure and data movement unless they are stated by the shipped text.
Complete Keyed Runtime Run
I ran the checked MAPLE.EXE under DOSBox-X 2026.01.02. At the released
Where's your GUS? prompt I entered the single digit 4, selecting the
emulated 240h base. No other input was needed: all four visual sections ran,
the final gold object completed its morph, mode 3 was restored, and the program
returned to DOS normally after about 1:15.
| Capture time | Directly observed runtime state |
|---|---|
00:00–00:06 |
The text-mode GUS prompt waits for one digit; 4 selects 240h. |
00:07–00:28 |
A teal full-screen feedback/liquid field folds, smears, and repeatedly resolves into new ridges. |
00:29–00:39 |
A pale shaded form rotates and deforms while the cream-and-red maple badge appears at lower right. |
00:40–00:59 |
A smoothly shaded human head turns through profile and three-quarter views beside the fixed badge. |
01:00–01:14 |
The final gold torus-like mesh rotates and visibly changes shape under moving highlights. |
about 01:15 |
The intro restores text mode and returns to the DOS prompt without another key. |
This continuous excerpt covers the full head rotation in the third section. It is one run segment, not a tiled montage:

The 640x400 source capture has no audio stream. The guest GUS supplied the original timer/player path while SDL used a dummy host audio driver; no audio was monitored or published.
Runtime-To-Code Concordance
The one-digit input is exactly the branch at expanded+0x59e5c: BIOS keyboard
input is converted with sub al,30h, restricted to 0..9, shifted left four
bits, and combined with AH=02h. The observed 4 therefore stores 0240h at
the GUS driver's [0f1eh]. Mode 13h and the driver calls at
0x59e82..0x59ebc follow immediately.
The four directly observed parts match the four recovered scene drivers:
| Captured part | Recovered driver and renderer |
|---|---|
| teal liquid/feedback field | first full scene at 0x5a06e, with the 200-entry row table, 320-entry column table, and eight-pixel feedback sampler at 0x5a185 |
| pale shaded form and badge | second object scene at 0x5eb01, using the 0x5d6a0 transform, per-vertex light clamp, and face loop at 0x5ecda |
| rotating human head | third object scene at 0x633fc, using the alternate smoothly varying span writer at 0x6223a plus the 0xff mask composite |
| gold deforming torus | final morph scene at 0x64d1d, which interpolates among three coordinate sets at 0x64ea2..0x64f2b |
The final runtime boundary also agrees with the binary: 0x64f92 unmasks the
keyboard IRQ, 0x64f96 sets text mode 3, and 0x64f9b exits through DOS. The
clean DOS return in the capture exercises that path rather than inferring it
only from disassembly.
Release Context
The shipped text identifies the production as a 64 KB intro for The Gathering 1995. It credits:
- Code: P-Nut
- Graphics: Electrolux
- Music: Tecon of Supreme
The stated requirements are a 386 or better, with Gravis UltraSound optional. The intro really does start by asking for the GUS base port:
Where's your GUS?
0:200 1:210 2:220 and so on.....
The release text also includes period distribution details. Those private distribution listings are intentionally not reproduced here.
Archive Identity
Three public archive containers were checked:
c164a1b1186fb4e852c4629eedc567f17c2a800d843115f0fe66346999d6aeb4 dz_maple.zip
bfe35dcf594e8b3364006660b67e502c1bf476eb5f29d0831943ab14e5ab16d0 maple_dz.zip
dfe154080d460e94cd2948e73505ac573b63cfd0da6112625894016ad2335179 darkzone-maple.zip
The TG95 archives and the group mirror contain the same executable and NFO:
41928dac22e9e6836c95bf1aa07e20698ccc5834286c7baa57205aa8a8c8bcd0 MAPLE.EXE
3c0259f509b03b6423ec8c40e7e5ddbbdc52b2bb25f9728e6ace0ad8902dc472 MAPLE_DZ.NFO
The dz_maple.zip archive also carries a small FILE_ID.DIZ. The group mirror
adds a scene.org.txt wrapper. The executable itself is identical in all three
packages, so all offsets below apply to every checked copy.
Packed EXE Layout
MAPLE.EXE is a DOS MZ program with a 32-byte header and an RNC ProPack block
beginning immediately after the MZ header.
file size: 48,622 bytes
MZ image size: 48,622 bytes
header size: 32 bytes
relocations: 0
entry point: CS:IP 0b9c:000c
entry file off: 0x0b9ec
stack: SS:SP 9243:060e
RNC block off: 0x00020
The RNC header reports:
method: RNC1
unpacked size: 599,058 bytes (0x92312)
packed size: 47,522 bytes (0xb9a2)
Expanded payload hash:
786bb0173325bb9bb53901c5c9078bc2605349e4dd149a2fd8891e8a21acb6be RNC-expanded image
The expanded image is very sparse. Its first visible text is around
expanded+0x20500, while the main visual code is much later, roughly in the
0x58900..0x65000 range, with the GUS/MOD driver near 0x8f000 and the
embedded module beginning at expanded+0x64fb4.
Large nonzero regions include:
02323c-024453 4,632 bytes tables / object data
03fb20-045f1a 25,595 bytes tables / visual data
05078c-05238d 7,170 bytes tables / visual data
058963-059b8f 4,653 bytes first transform and raster routines
059bb6-05a3e0 2,091 bytes startup and first full scene driver
05d4a3-05e834 5,010 bytes second-scene transform helpers
05e85b-05ee6f 1,557 bytes second-scene driver
061f31-06312e 4,606 bytes alternate triangle filler
063155-064a3d 6,377 bytes third-scene transform helpers
064a64-0650d5 1,650 bytes final-scene driver and MOD header
067bf1-06a289 9,881 bytes module/sample payload
08f274-09055f 4,844 bytes GUS/MOD driver and timer ISR
RNC Depacker
The executable entry at MAPLE.EXE+0x0b9ec is the RNC stager. The first task is
to move the packed image upward/backward so the output area can overlap safely.
b9ec: mov bx,ss
b9ee: mov es,bx
b9f0: mov dx,cs
b9f2: mov ds,dx
b9f4: mov cx,[0008h] ; packed/stub image size field
b9f8: mov si,cx
b9fa: sub si,2
b9fd: mov di,si
b9ff: shr cx,1
ba01: std
ba02: rep movsw ; backward relocation of the packed block
ba04: push bx
ba05: mov ax,002eh
ba08: push ax
ba09: mov bp,[000ah]
ba0d: retf ; continue at the moved copy
The next block walks the source and destination segments down in chunks of at
most 0x1000 paragraphs:
ba0e: mov ax,1000h
ba11: cmp ax,bp
ba13: jbe ba17h
ba15: mov ax,bp
ba17: sub bp,ax
ba19: sub dx,ax
ba1b: sub bx,ax
ba1d: mov ds,dx
ba1f: mov es,bx
ba21: mov cl,3
ba23: shl ax,cl
ba25: mov cx,ax
ba27: shl ax,1
ba29: dec ax
ba2a: dec ax
ba2b: mov si,ax
ba2d: mov di,ax
ba2f: rep movsw
ba31: or bp,bp
ba33: jne ba0eh
Then the actual RNC decode allocates three 0x80-byte Huffman/work tables on
the stack:
ba3a: sub sp,001ah
ba3d: mov bp,sp
ba3f: sub sp,0180h
ba43: mov ax,sp
ba45: mov [bp+08h],ax
ba48: add ax,0080h
ba4b: mov [bp+0ah],ax
ba4e: add ax,0080h
ba51: mov [bp+0ch],ax
The main copy/match loop has the usual RNC shape: decode a literal count, copy literals, decode a match distance/length pair, and copy from the already expanded output:
ba8e: mov dx,[bp+0ah] ; match-distance tree
ba91: call bb5eh
ba94: push cx
ba95: mov dx,[bp+0ch] ; match-length tree
ba98: call bb5eh
ba9b: add cx,2
ba9e: pop ax
ba9f: inc ax
baa0: mov dx,si
baa2: mov si,di
baa4: sub si,ax
baa6: mov ds,[bp+02h]
baa9: rep movsb ; back-reference copy
baab: mov ds,[bp+00h]
baae: mov si,dx
bab0: mov dx,[bp+08h] ; literal-count tree
bab3: call bb5eh
bab6: jcxz baddh
bab8: rep movsb ; literal copy
After the block stream finishes, the depacker applies the RNC relocation table
stored in the EXE image around 0x28c. The table is encoded as a count byte,
a segment word, then byte deltas inside that segment:
bb16: mov si,028ch
bb19: lodsb
bb1a: mov cl,al
bb1c: jcxz bb31h
bb1e: lodsw
bb1f: add ax,dx
bb21: mov es,ax
bb23: xor di,di
bb25: xor ah,ah
bb27: lodsb
bb28: add di,ax
bb2a: add es:[di],dx
bb2d: loop bb27h
bb2f: jmp bb19h
Finally it restores the unpacked stack, subtracts 0x10 from the load segment,
and jumps through the real program vector at cs:[0000]:
bb3d: add [0002h],dx
bb41: sub dx,0010h
bb44: mov es,dx
bb46: mov ds,dx
bb4c: cli
bb4d: mov sp,si
bb4f: mov ss,di
bb51: sti
bb52: jmp far [cs:bx]
So the packed MAPLE.EXE is a normal RNC1 self-extractor, but the payload it
expands is unusually large and sparse for a 48 KB file.
Embedded Music
The embedded module begins at expanded+0x64fb4. It is a ProTracker-style
M.K. module:
module offset: 0x64fb4
title: urgent coma
signature: M.K.
song length: 10 orders
highest pattern: 10
patterns: 11
sample bytes: 4,784
sample data: 0x653f0..0x692a0
The module sample names include an internal music credit and some stylized comment text. I am not reproducing those raw strings here because they add no technical information and contain scene-era styling that is easy to over-read as metadata.
The GUS driver is linked into the expanded image near expanded+0x8f274.
The visual startup uses far calls into that driver:
8d8c:253b -> expanded+0x8fdfb GUS hardware / voice setup
8d8c:2518 -> expanded+0x8fdd8 player state reset
8d8c:268a -> expanded+0x8ff4a module upload / init path
8d8c:2418 -> expanded+0x8fcd8 install timer ISR
8d8c:24b6 -> expanded+0x8fd76 shutdown / restore timer
The 8fcd8 setup hooks interrupt vector 08h, programs PIT channel 0, and
enables the GF1 with the base port chosen at startup:
8fd01: mov bx,es:[0020h] ; old IRQ0 vector offset
8fd06: mov ax,es:[0022h] ; old IRQ0 vector segment
8fd0a: mov cs:[165ch],bx
8fd0f: mov cs:[165eh],ax
8fd15: mov dx,19b4h
8fd18: mov es:[0020h],dx
8fd1d: mov es:[0022h],ds
8fd22: mov al,36h
8fd24: out 43h,al
8fd26: mov al,a9h
8fd28: out 40h,al
8fd2a: mov al,04h
8fd2c: out 40h,al
...
8fd69: mov dx,cs:[0f1eh] ; selected GUS base
8fd6e: mov al,01h
8fd70: out dx,al
The player's hot update loop is an ordinary 16-bit MOD tracker engine: it steps
per-channel records of size 0x34, applies note/effect commands, clamps volume
to 0..0x3f, advances the order/pattern state, and returns through iret.
The shutdown path restores the original timer divisor/vector and then iterates
GUS voices to silence/reset them.
Real-Mode Architecture
Unlike the Valhalla TG95 intros, Maple does not switch into protected mode in
the inspected path. It stays in real mode and leans on 386 operand-size
prefixes for 32-bit arithmetic. The code repeatedly does this pattern:
- load a scene-specific segment into
DS/ES; - keep object vertices and face lists in 16-bit offsets inside that segment;
- use
66-prefixedEAX/EBX/ECX/EDXoperations for matrix math, distance estimates, and packed pixel writes; - draw into segment
0050has a 64,000-byte color buffer; - use the segment
0050h + 0x0fa0as a second 64,000-byte depth/coverage buffer; - copy to
A000honce per frame, synchronized with polling port3dah.
There are several scene-specific copies of the same idea. They differ mainly in which segment contains the object data, where the scratch variables live, and which triangle filler variant is called.
The two VBlank helpers appear several times. The first waits for display enable to fall and rise:
58962: mov dx,03dah
58966: in al,dx
58967: test al,01h
58969: jne 58966h
5896b: in al,dx
5896c: test al,01h
5896e: je 5896bh
58970: ret
The second waits for vertical retrace:
58971: mov dx,03dah
58974: in al,dx
58975: test al,08h
58977: jne 58974h
58979: in al,dx
5897a: test al,08h
5897c: je 58979h
5897e: ret
Startup and Main Timeline
The first main scene begins at expanded+0x59e5c. It sets DS=ES=2050h,
prints the GUS prompt with DOS int 21h, waits for a digit key, and stores the
selected GUS base in the sound-driver segment:
59e5c: mov ax,2050h
59e5f: mov ds,ax
59e61: mov es,ax
59e63: mov dx,0002h
59e66: mov ah,09h
59e68: int 21h
59e6a: xor ax,ax
59e6c: int 16h
59e6e: sub al,30h
59e70: cmp al,09h
59e72: ja 59e6ah
59e74: shl al,4
59e77: mov ah,02h
59e79: mov bx,8d8ch
59e7c: mov fs,bx
59e7e: mov fs:[0f1eh],ax
Then it enters VGA mode 13h, masks the keyboard IRQ in the PIC, builds the
initial object normal/projected-vertex tables, uploads the palette, and calls
the GUS driver:
59e82: mov ax,0013h
59e85: int 10h
59e87: mov al,02h
59e89: out 21h,al
59e8b: call 589d7h ; face normal table
59e8e: call 5897fh ; numeric table builder
...
59ead: call 8d8c:253bh ; GUS init
59eb2: call 8d8c:2518h ; player reset
59eb7: call 8d8c:268ah ; module setup
59ebc: call 8d8c:2418h ; install timer player
The first loop updates three phase values modulo 0x1680, calculates a matrix,
projects vertices, draws face spans, waits for retrace, and then conditionally
does a clear/copy/fade step:
59ec1: in al,60h
59ec3: mov cs:[0000h],al
59ecc: mov ax,es:[2d52h]
59ed0: add ax,es:[2d46h]
59ed5: cmp ax,1680h
59eda: sub ax,1680h ; if wrapped
59edd: mov es:[2d40h],ax
...
59f0b: mov si,2d52h
59f0e: call 59bb6h ; matrix/trig helper
59f11: call 59b4ah ; transform helper
59f1b: mov si,327ah
59f1e: call 58b9dh ; face iterator and rasterizer
59f21: call 58971h ; retrace wait
The frame-copy/clear loop uses two buffers. DS=0050h points to the color
buffer, GS=0ff0h points to a parallel depth/coverage buffer, and ES=A000h
is the visible VGA framebuffer:
59f2c: mov ax,0050h
59f2f: mov ds,ax
59f31: add ax,0fa0h
59f34: mov gs,ax
59f36: mov ax,0a000h
59f39: mov es,ax
59f3b: xor eax,eax
59f3e: xor si,si
59f40: mov di,si
59f42: mov cx,3e80h
59f45: mov gs:[si],eax ; clear depth/coverage dword
59f49: movsd ; copy color dword DS:SI -> A000:DI
59f4b: mov [si-4],eax ; clear color dword just copied
59f4f: loop 59f45h ; 16,000 dwords = 64,000 pixels
This is one of the reasons the intro feels clean rather than flickery: drawing and depth testing happen off-screen, then the entire 320x200 byte buffer is copied to VGA once per frame and cleared for the next frame.
Table Builders
expanded+0x5897f builds fixed-point tables in DS=ES=2050h. The first loop
starts with a seed dword at 0x40, multiplies by 0x3ffff605, uses SHRD to
keep the useful high bits, subtracts the previous dword, and stores the next
dword:
58986: mov dword [0040h],0023be8bh
5898f: mov di,0044h
58992: mov cx,0b3eh
58995: mov eax,[0040h]
58999: mov ebx,3ffff605h
5899f: imul ebx
589a2: shrd eax,edx,1dh
589a7: sub eax,[di-8]
589ab: stosd
589ad: loop 5899fh
The second pass rescales those dwords into words:
589af: mov ebx,00007f90h
589b5: mov di,003ch
589b8: mov si,di
589ba: mov cx,0b40h
589bd: lodsd
589bf: imul ebx
589c2: shrd eax,edx,1eh
589c7: stosw
589c8: loop 589bdh
The table is then copied from 0x003c to 0x16bc as 0x5a0 dwords. From the
later usage, these values act like noise/sine/offset tables feeding the first
scene's scrolling lookup renderer and rotation helpers.
Normal and Projection Pass
expanded+0x589d7 builds per-face normals from a triangle index list at
DS:327a. It reads three 16-bit vertex offsets, adds a vertex base of 0x2d76,
and computes three cross-product components into a normal table beginning at
0x708c.
One component looks like this:
589ff: movsx eax,word ds:[bp+02h]
58a05: movsx edx,word [di+02h]
58a0a: sub eax,edx
58a0d: movsx ecx,word ds:[bp+04h]
58a13: movsx edx,word [bx+04h]
58a18: sub ecx,edx
58a1b: imul ecx
58a1e: mov [bed2h],eax
58a22: movsx eax,word ds:[bp+04h]
58a28: movsx edx,word [di+04h]
58a2d: sub eax,edx
58a30: movsx ecx,word ds:[bp+02h]
58a36: movsx edx,word [bx+02h]
58a3b: sub ecx,edx
58a3e: imul ecx
58a41: sub [bed2h],eax
That is the standard (a-b) * (a-c) cross-product structure, using 32-bit
registers in 16-bit real mode.
Immediately after the normal table is built, the routine normalizes/projects
each normal or vertex-like vector. It sums the squared components, calls
0x58b69, and divides each component by the returned magnitude-like value:
58b07: mov eax,[si]
58b0a: imul eax
58b0d: mov ebx,eax
58b10: mov eax,[si+04h]
58b14: imul eax
58b17: add ebx,eax
58b1a: mov eax,[si+08h]
58b1e: imul eax
58b21: add eax,ebx
58b25: call 58b69h
...
58b32: mov eax,[si]
58b37: shl eax,8
58b3b: idiv ebx
58b3e: mov [di],ax
The helper at 0x58b69 is not a full square-root instruction sequence. It
walks a quadratic-ish accumulator until the input is below the current bound:
58b6e: mov ecx,3
58b74: mov edx,2
58b7a: mov ebx,1
58b80: mov ebp,1
58b86: cmp eax,ebx
58b89: jbe 58b97h
58b8b: add ebx,ecx
58b8e: add ecx,edx
58b91: inc ebp
58b93: jmp 58b86h
58b97: mov eax,ebp
It is an integer magnitude estimator good enough for lighting/projection in a 64K intro.
Face Iterator and Backface Test
expanded+0x58b9d iterates the triangle list. The routine starts by reading a
face count from [SI], then each face consumes three vertex offsets:
58b9d: mov cx,[si]
58b9f: add si,2
58ba2: mov word cs:[023bh],57eah
58ba9: mov di,708eh
58bac: add word cs:[023bh],6
58bb2: push cx
58bb3: push di
58bb4: push si
58bb5: mov bp,[si]
58bb7: mov di,[si+02h]
58bba: mov si,[si+04h]
58bbd: mov dx,3f54h
58bc0: add bp,dx
58bc2: add di,dx
58bc4: add si,dx
The first decision is a 2D signed-area test. If the projected triangle is back-facing or nearly degenerate, the routine skips it:
58bc6: mov ax,[di]
58bc8: sub ax,ds:[bp+0]
58bcc: mov bx,[si+2]
58bcf: sub bx,ds:[bp+2]
58bd3: imul bx
58bd5: mov cx,ax
58bd7: mov ax,[di+2]
58bda: sub ax,ds:[bp+2]
58bde: mov bx,[si]
58be0: sub bx,ds:[bp+0]
58be4: imul bx
58be6: sub cx,ax
58be8: cmp cx,0fffeh
58beb: jge 58bf7h
For accepted faces it calculates an average depth/intensity and stores a small
record for the span filler. It also computes a dot product against a direction
vector at cs:1248, clamps the result to 0..0xff, and stores the byte at
[di-1]. That byte becomes the depth/coverage value used by the span loop.
58c17: mov bp,1248h
58c1a: mov ax,[si]
58c1c: shl ax,1
58c1e: imul word cs:[bp+0]
58c22: mov bx,dx
58c24: mov ax,[si+2]
58c27: shl ax,1
58c29: imul word cs:[bp+4]
58c2d: add bx,dx
58c2f: mov ax,[si+4]
58c32: shl ax,1
58c34: imul word cs:[bp+8]
58c38: add bx,dx
58c3a: cmp bx,00ffh
58c40: mov bx,00ffh ; high clamp
58c43: cmp bx,0
58c48: mov bx,0 ; low clamp
58c4e: mov [di-1],bl
Then it calls the rasterizer at 0x58c71.
Flat Triangle Rasterizer
expanded+0x58c71 is the first triangle filler. It reads three projected
vertices, rejects triangles wholly outside the viewport, sorts by y, computes
fixed-point edge slopes, and calls the span writer once for the top half and
once for the bottom half.
The x and y coordinates are packed into 32-bit registers. The code rotates the registers by 16 bits to access the other half:
58c71: mov bx,[si]
58c73: mov eax,[bx+3f54h] ; vertex 0 packed x/y
58c78: mov bp,[bx+3f58h] ; attribute/intensity
58c7c: mov bx,[si+2]
58c7f: mov ecx,[bx+3f54h] ; vertex 1
58c84: mov di,[bx+3f58h]
58c88: mov bx,[si+4]
58c8b: mov si,[bx+3f58h]
58c8f: mov ebx,[bx+3f54h] ; vertex 2
...
58cc3: ror ebx,10h
58cc7: ror eax,10h
58ccb: ror ecx,10h
58ccf: add ax,0064h
58cd2: add bx,0064h
58cd5: add cx,0064h
The sort is a three-element compare/swap:
58cd8: cmp bx,ax
58cda: jg 58ce0h
58cdc: xchg ebx,eax
58cde: xchg si,bp
58ce0: cmp cx,bx
58ce2: jg 58cf1h
58ce4: xchg ebx,ecx
58ce7: xchg si,di
58ce9: cmp bx,ax
58ceb: jg 58cf1h
58ced: xchg ebx,eax
58cef: xchg si,bp
The edge setup uses 6 fractional bits for x and 7 fractional bits for the attribute:
58d3c: shl dx,6
58d3f: mov [bec0h],dx ; x accumulator
58d43: cwd
58d44: shl ax,6
58d47: idiv cx
58d49: mov [bec8h],ax ; dx/dy
58d57: cwd
58d58: shl ax,7
58d5b: shl bx,7
58d5e: idiv cx
58d60: mov [bec2h],bx ; attr accumulator
58d64: mov [becah],ax ; d_attr/dy
Negative top clipping advances both accumulators before the first span:
58d67: cmp bp,0
58d6a: jge 58d82h
58d6c: mov ax,[bec8h]
58d6f: neg bp
58d71: imul bp
58d73: add [bec0h],ax
58d77: mov ax,[becah]
58d7a: imul bp
58d7c: add [bec2h],ax
58d80: xor bp,bp
This is a conventional but compact flat-shaded triangle pipeline: sort by y, walk two edges, clip top/bottom, and draw horizontal spans.
Span Writer: Duff-Style Jump Into Unrolled Pixels
The first span writer starts at expanded+0x58e9c. It loads the left and right
x accumulators, shifts them down by 6, sorts left/right, computes the attribute
slope across the span, clips the horizontal range to 0..319, and then jumps
into an unrolled code block.
58e9c: mov si,[bebeh] ; row base, precomputed as y*320
58ea0: mov di,[bec0h] ; left x accumulator
58ea4: mov cx,[bec4h] ; right x accumulator
58ea8: sar di,6
58eab: sar cx,6
58eae: mov ax,[bec6h] ; right attribute
58eb1: mov bx,[bec2h] ; left attribute
58eb5: cmp di,cx
58eb7: jle 58ebch
58eb9: xchg cx,di
58ebb: xchg bx,ax
58ebc: sub ax,bx
58ec0: sub cx,di
58ec2: je 59b19h
...
58ef9: add di,si ; destination = y*320 + x
Then it calculates a code-entry address from the span length:
58efb: mov dx,11b9h
58efe: shl cx,2
58f01: sub dx,cx
58f03: shl cx,1
58f05: sub dx,cx
58f07: mov cx,es
58f09: add cx,0fa0h
58f0d: mov gs,cx
58f0f: mov cl,[0022h] ; depth/coverage byte
58f13: mov bh,[0023h] ; color byte
58f17: jmp dx
Each unrolled pixel is:
58f19: cmp byte gs:[di],cl
58f1c: ja 58f24h
58f1e: mov gs:[di],cl
58f21: mov es:[di],bh
58f24: inc di
The whole block is a manual unroll of that sequence. DX points into the tail
so only the exact number of pixels needed executes. The GS buffer is not a
true z-buffer with 16/32-bit depth. It is a one-byte coverage/depth/intensity
buffer: if the stored byte is already greater than the incoming byte, the pixel
is skipped; otherwise the byte and the visible color are updated.
The second major filler at expanded+0x6223a is structurally similar, but it
interpolates BX across the span:
622b2: mov cl,[0022h]
622b6: jmp dx
622b8: cmp byte gs:[di],cl
622bb: ja 622c3h
622bd: mov gs:[di],cl
622c0: mov es:[di],bh
622c3: inc di
622c4: add bx,ax
In that variant, BH changes as BX += AX, so the span can produce a smooth
shade ramp rather than one flat color.
First Full Scene Driver
The far call 5a05:001e resolves to expanded+0x5a06e. This scene uses
segments 9016h, 0050h, 0ff0h, and a000h. It appears to be the
lookup-table distortion/liquid scene before the later object scenes.
It builds two scrolling lookup tables:
DS:0400holds 200 row offsets, one word per row.DS:0900holds 320 column offsets, one word per column.
The row table uses a phase at 13a6h, a sine/noise table around 0e02h, and
a y accumulator in DX:
5a0b3: mov si,0e02h
5a0b6: add si,[13a6h]
5a0ba: mov bp,0400h
5a0bd: mov cx,00c8h
5a0c0: mov dx,0
5a0c3: mov ax,[si]
5a0c5: shr ax,2
5a0d2: mov bx,dx
5a0d4: shr bx,4
5a0d7: add bx,6
5a0da: shl bx,6
5a0dd: add ax,bx
5a0df: shl bx,2
5a0e2: add ax,bx
5a0e4: add dx,0fh
5a0e7: sub ax,5
5a0ea: mov ds:[bp],ax
5a0ee: add bp,2
5a0f1: add si,4
5a0f4: loop 5a0c3h
The column table is the same idea at 320 columns:
5a0f6: mov si,0e02h
5a0f9: add si,[13a2h]
5a0fd: mov bp,0900h
5a100: mov cx,0140h
5a103: mov dx,0
5a106: mov ax,[si]
5a108: shr ax,2
5a10b: mov bx,ax
5a10d: shl ax,8
5a110: shl bx,6
5a113: add ax,bx
...
5a12c: sub ax,0640h
5a12f: mov ds:[bp],ax
The inner 320x200 renderer combines one row offset with four column samples at
a time. It reads from the previous buffer via FS, writes both the current
work buffer via GS and visible A000h via ES, and emits two dwords per
inner iteration:
5a185: mov cx,00c8h ; 200 rows
5a188: push cx
5a189: mov bx,[0e00h]
5a18d: add word [0e00h],2
5a192: mov bx,[bx+0400h] ; row base offset
5a196: mov bp,0900h
5a199: mov cx,0028h ; 40 iterations * 8 pixels = 320
5a19c: mov si,ds:[bp+6]
5a1a0: add si,bx
5a1a2: mov ah,fs:[si]
5a1a5: mov si,ds:[bp+4]
5a1a9: add si,bx
5a1ab: mov al,fs:[si]
5a1ae: shl eax,10h
5a1b2: mov si,ds:[bp+2]
5a1b6: add si,bx
5a1b8: mov ah,fs:[si]
5a1bb: mov si,ds:[bp+0]
5a1bf: add si,bx
5a1c1: mov al,fs:[si]
5a1c4: add bp,8
5a1c7: mov gs:[di],eax
5a1cb: stosd
The second half of the unrolled body repeats the same four-sample pattern,
so the loop advances eight pixels per CX. This is a practical tunnel/liquid
mapper: all the expensive coordinate math has been moved to two 1D tables, and
the hot loop is just indexed byte loads packed into dwords.
This scene also increments non-background bytes in a 32x32 tile-ish region:
5a14a: mov es,[13b0h]
5a151: mov di,6990h
5a154: mov cx,20h
5a158: mov cx,20h
5a15b: cmp byte [si],0fh
5a15e: je 5a163h
5a160: inc byte es:[di]
5a163: inc di
5a164: inc si
5a165: loop 5a15bh
5a167: add di,0120h
Later it uses frame counter cs:001c to start a palette morph. It stores
per-channel deltas scaled by 8 and then applies those deltas for 0x300
palette bytes:
5a293: cmp word cs:[001ch],0302h
5a29c: mov si,16b2h
5a29f: mov cx,0300h
5a2a2: lodsw
5a2a3: add [si+05feh],ax
5a2a7: loop 5a2a2h
So the first full scene is not only a raw texture mapper. It has double-buffered feedback, per-frame table scrolling, and a scheduled palette transition.
Second Object Scene
The far call 5a3c:4741 resolves to expanded+0x5eb01. This scene copies a
large block of prebuilt object data into segment 2c3fh, clears the screen and
two work buffers, then runs a similar transform/draw/clear loop.
Initialization:
5eb01: mov ax,3bf2h
5eb04: mov ds,ax
5eb06: mov si,3c3ah
5eb09: mov ax,2c3fh
5eb0c: mov es,ax
5eb0e: mov di,1c5ch
5eb11: mov cx,0ed7h
5eb14: rep movsw
...
5eb21: mov ax,0a000h
5eb24: mov es,ax
5eb28: xor di,di
5eb2a: xor eax,eax
5eb2d: mov cx,2e90h
5eb30: rep stosd
The visual loop repeats the same three-angle update modulo 0x1680, builds a
matrix through 0x5e85b and 0x5e7ef, computes a lighting vector via
0x5e9ed, transforms object vertices with 0x5d6a0, and draws faces using
0x5d713.
The per-vertex light loop is explicit:
5ec8d: mov cx,[1c5ah]
5ec91: mov si,8e5eh
5ec94: mov di,6feah
5ec97: mov bp,4475h
5ec9a: mov ax,[si]
5ec9c: shl ax,1
5ec9e: imul word cs:[bp+0]
5eca2: mov bx,dx
5eca4: mov ax,[si+2]
5eca7: shl ax,1
5eca9: imul word cs:[bp+4]
5ecad: add bx,dx
5ecaf: mov ax,[si+4]
5ecb2: shl ax,1
5ecb4: imul word cs:[bp+8]
5ecb8: add bx,dx
5ecba: cmp bx,007fh
5ecbf: mov bx,007fh ; clamp high
5ecc2: cmp bx,0
5ecc7: mov bx,0 ; clamp low
5ecca: mov [di],bx
5eccc: add di,6
5eccf: add si,6
5ecd2: loop 5ec9ah
The draw loop reads face batches at 0xacd6, pulls a color byte from
[si-2], stores it to scratch byte 0x22, calls the triangle drawer, and
advances by 8 bytes per face record:
5ecda: mov si,acd6h
5ecdd: mov cx,[si]
5ecdf: add si,4
5ece2: push si
5ece3: push cx
5ece4: mov al,[si-2]
5ece7: mov [0022h],al
5ecea: call 5d713h
5eced: pop cx
5ecee: pop si
5ecef: add si,8
5ecf2: loop 5ece2h
The frame clear/copy path is again dword-wide and buffer-based. This scene uses
only 0x2e90 dwords for its main region, then handles a masked block separately.
Third Object Scene
The far call 5ee7:458c resolves to expanded+0x633fc. This is the same engine
shape using segment 3bf2h for scene state and 2c3fh/88fah as copied object
data and lookup data.
It initializes a palette from 3bf2:9db8, updates angle triples at 3c04h,
builds matrices through 0x63155 and 0x630e9, and transforms a face source
at 0x59e6 through 0x61f4d. Its lighting loop is similar to the second scene,
but it biases and clamps intensity to 0x80..0xff:
6350b: mov ax,[si]
6350d: shl ax,1
6350f: imul word cs:[bp+0]
63513: mov bx,dx
...
63529: add bx,dx
6352b: add bx,0080h
6352f: cmp bx,00ffh
63535: mov bx,00ffh
63538: cmp bx,0080h
6353e: mov bx,0080h
63541: mov [di],bx
This scene calls the alternate triangle pipeline at 0x61f4d and 0x61fdd.
The alternate span writer at 0x6223a increments BX by AX per pixel, so
the high byte used as the color changes across the span. That is the smooth
shading path.
The scene also has a mask/composite pass after the triangle draw:
6359b: mov gs:[si],ebx
6359f: cmp dword cs:[bp+0],0ffffffffh
635a5: je 635ddh
635a7: cmp byte cs:[bp+0],0ffh
635ac: je 635b3h
635ae: mov al,[si]
635b0: mov es:[di],al
...
635dd: mov [si],ebx
635e0: add si,4
635e3: add di,4
635e6: add bp,4
635e9: loop 6359bh
Here the code uses a 0xff mask table in code/data space: if a mask byte is
not 0xff, it copies the corresponding work-buffer byte to A000h; otherwise
the existing visible pixel is left alone. This is separate from the triangle
depth buffer and is probably used for a shaped reveal or overlay.
Final Object / Morph Scene
The far call 6365:16cd resolves to expanded+0x64d1d. This scene starts by
copying object coordinates from segment 8bcah to segment 4c5bh, then calls
the transform builder at 0x6366f.
The interesting part is not a new triangle primitive, but the interpolation between coordinate sets. The scene rotates among three source tables and builds per-coordinate deltas:
64ea2: cmp ah,0
64ea7: mov si,0000h
64eaa: mov di,0960h
64ead: cmp ah,1
64eb2: mov si,0960h
64eb5: mov di,12c0h
64eb8: cmp ah,2
64ebd: mov si,12c0h
64ec0: mov di,0000h
64ec3: mov bp,12c0h
64ec6: mov bx,2580h
64ec9: mov cx,04b0h
64ecc: movsx eax,word gs:[si]
64ed1: movsx edx,word gs:[di]
64ed6: sub edx,eax
64ed9: shl eax,10h
64edd: mov [bx],eax
64ee0: shl edx,0bh
64ee4: mov ds:[bp],edx
Each frame then integrates those deltas:
64efe: mov si,12c0h
64f01: mov di,2580h
64f04: mov cx,04b0h
64f07: lodsd
64f09: add [di],eax
64f0c: add di,4
64f0f: loop 64f07h
Finally it extracts the high words back into the active coordinate table:
64f1e: mov si,2582h
64f21: mov di,387ch
64f24: mov cx,04b0h
64f27: movsw
64f28: add si,2
64f2b: loop 64f27h
That is a key observation: the last scene is a 16.16-ish morph/interpolation system. The active object geometry is not only rotating; its vertices are being pulled between three stored shapes.
The scene ends by restoring the keyboard IRQ mask, returning to text mode, and exiting through DOS:
64f92: mov al,00h
64f94: out 21h,al
64f96: mov ax,0003h
64f99: int 10h
64f9b: mov ax,4c00h
64f9e: int 21h
What Each Part Does
- The MZ/RNC stager turns a 48 KB executable into a sparse 599 KB real-mode image, applies its relocation table, restores the unpacked stack, and jumps into the intro.
- The startup asks for the GUS base port, enters VGA mode 13h, masks the keyboard IRQ, initializes object tables, uploads the first palette, and starts the timer-driven GUS module player.
- The sound system is a self-contained GUS MOD player. It hooks IRQ0, programs PIT channel 0, steps tracker state in an interrupt routine, and writes GF1 registers for voice setup and playback.
- The first visual scene is a table-driven feedback/liquid mapper. It builds 200 row offsets and 320 column offsets, then renders 320x200 by combining row and column lookups into byte reads from the previous buffer.
- The object scenes use 16-bit real-mode pointers but 32-bit
EAX/EBX/ECXmath. They build normals, estimate vector magnitudes, transform vertices, compute per-vertex or per-face light, and draw triangles. - The triangle pipeline sorts vertices by y, clips vertically, computes fixed-point edge slopes, and emits horizontal spans.
- The hot span loop is manually unrolled and entered by a calculated jump, a Duff-device-like trick. It compares a one-byte coverage/depth buffer before writing color to the work buffer.
- Later scenes reuse the same architecture with different data segments and table bases. One variant interpolates shade across the span; the final scene interpolates vertex coordinates between stored object shapes.
- All visible frames are ultimately copied through
A000has mode-13h bytes, usually after waiting for retrace through port3dah.
Why This Is Strong For 64K
Maple is less elaborate as a system than Bibo Ergo Sum: it does not carry a
protected-mode kernel or a large script interpreter. Its strength is a compact
real-mode engine that reuses a few carefully written primitives:
- RNC gives it a very sparse 599 KB working image from a 48 KB EXE.
- 386 operand-size prefixes let real-mode code do 32-bit transforms and packed dword copies without a mode switch.
- The span filler avoids loop overhead by jumping into an unrolled block.
- One-byte coverage/depth testing gives enough hidden-surface behavior for the flat and smoothly shaded objects.
- The first scene's row/column lookup renderer reduces a full-screen distortion effect to two table builders plus a tight byte-sampling loop.
- The final morph scene uses fixed-point coordinate interpolation rather than storing a long sequence of object frames.
That makes Maple a good third piece beside Fluid Motion and Bibo Ergo Sum:
it is not as large-system-oriented as Bibo, and not as singularly effect-focused
as Fluid Motion. It is a compact real-mode collection of reusable raster and
object tricks.