Analysis model: gpt-5.5 xhigh
Phenotype by Purge - Technical Dissection
Scope
Phenotype is the Purge MS-DOS demo that placed third in the Wired 1995 PC
demo competition, behind Valhalla's Solstice and Legend Design's Just.
Release year: 1995. Pouet lists the release date as 1995-11-15, and the fixed archive files are dated 1995-12-27.
Public references:
The Wired 1995 result file lists:
Demos Competition
1. Valhalla "Solstice" 590 pts
2. Legend Design "Just" 304 pts
3. Purge "Phenotype" 286 pts
This writeup is based on archive inspection, PMODE/W PMW1 flattening, static 386 disassembly, resource-table mapping, and byte-level checks against the shipped files. It is not a source-level reconstruction. Internal names below are descriptive labels inferred from offsets, constants, data flow, and call sites.
The documentation contains personal contact information. That block is intentionally not reproduced here.
Release Context
The fixed info file says the demo was adjusted for a Wired 1995 competition PC: 486DX2/66, 8 MB RAM, Gravis UltraSound, and an ET4000/W32p VLB card. It also says the code was developed on 486-class ET4000/GUS machines, warns about disk caches and some EIDE drivers, recommends a clean boot, and strongly expects a GUS setup.
Credits from the shipped info file:
- Code: Hoodoo and HSMF.
- Music: Faun.
- Graphics: Rad-Ad.
- Design: deliberately minimal, by the group's own description.
That context matches the binary. The demo is less like a tightly directed storyboard and more like a sequence of high-quality routines sharing one music and timing layer: palette-heavy logo scenes, planar picture transfers, a texture/feedback tunnel, and several 3D or 2D mapped render stages.
Examined Files
Archive:
34f38346657e1d2b2ceb23fdbacf512017c9619f79d1ab3e4934f2129d7b949c phenofix.zip
Extracted files:
2000c973d709e9e80aeebcd39ea05bb9993209b9b11d409828b9d48b34b628ba FILE_ID.DIZ
665fec8f5c3f56efcba868a6a120ed8c31c901aabf5fc212e619eb7c001ffeea HER.DMF
850ef36b135c45d0279836a98af258c2f67b507dfbaa77fbd124bbb4196d1a2f PHENOTYP.EXE
7302bdbfda7068cc38a3068aa26a05494fdfa6790cdf706abdd362d46d7124f0 PHENOTYP.INF
d5b486c3aea98eb768caef40b8d1d10b2041d42afc3e603a3477151addbb4cb5 PHENOTYP.PUR
File roles:
PHENOTYP.EXE MS-DOS MZ executable with PMODE/W PMW1 protected-mode payload
PHENOTYP.PUR custom data archive, 967,391 bytes, 33 resources
HER.DMF Xtracker DMF module, title "Her Eyes", composer Faun
PHENOTYP.INF release notes, hardware notes, credits, contacts
FILE_ID.DIZ compact release description
Archive listing:
PHENOTYP.EXE 181,475 bytes
HER.DMF 408,781 bytes
PHENOTYP.PUR 967,391 bytes
PHENOTYP.INF 4,480 bytes
FILE_ID.DIZ 649 bytes
The fixed archive is large for the period, but it is straightforward: the EXE
holds the runtime and effect code, the .PUR file holds nearly all visual
payloads, and HER.DMF is a separate music module.
Executable Shape
PHENOTYP.EXE begins as a normal MZ executable:
MZ image size: 9,808 bytes
header paragraphs: 4
relocations: 0
initial CS:IP: 0000:0059
initial SS:SP: 0344:0100
PMW1 marker offset: 0x2650 / decimal 9808
The real-mode stub contains the PMODE/W banner:
PMODE/W v1.21 DOS extender - Copyright 1995, Daredevil and Tran.
Flattening the PMW1 payload yields:
flat image size: 1,856,976 bytes
entry point: 0x0002f60c
stack pointer: 0x001c55d0
objects: 4 decompressed protected-mode objects
The entry point falls inside WATCOM C/C++32 startup. The actual demo work starts
earlier in the flat image, especially in the 0xe000 to 0x18000 range for
the custom runtime and in the 0x2e000 range for heavier effect code. The
runtime library and DMF/player strings are clustered near 0x110000.
Important embedded strings:
her.dmf
[Main]: Not Enough Memory Available!
[DMF-Player]: Not Enough Memory Available!
phenotyp.pur
DMF Player ERROR:
RATIONAL DOS/4G
WATCOM C/C++32 Run-Time system
Gravis Ultrasound
soundblaster
silence
The RATIONAL DOS/4G string is part of linked runtime/player code, not the
active extender. The executable itself is PMODE/W.
High-Level Boot Order
The startup sequence around 0xe2bd and 0xe4e7 resolves to this:
- Allocate the main work buffers:
- several 768-byte palette buffers,
- several 64,000-byte chunky images,
- a 128 KiB texture/map buffer,
- 95,000-ish byte and 45,000-ish byte geometry/effect blocks,
- a 1 MiB DMF/player block.
- Initialize the DMF player and load
her.dmf. - Open
phenotyp.pur. - Read the
.PURresource directory from the end of the file. - Set VGA mode
12hfor early 16-color planar setup, then later mode13hfor 256-color unchained work. - Install keyboard and timer hooks.
- Load visual resources by index into allocated buffers.
- Run the script-like sequence of effect calls.
- Restore the timer and keyboard vectors, free DPMI memory, and return to text mode.
The main sequence is visible around 0xe736 to 0xea7d. It calls a series of
named-by-offset effect routines, waits on state bytes updated by the timing
system, frees old resource buffers, then enters the next routine.
Keyboard IRQ 1
The keyboard handler starts at 0xe058.
Inner path:
push all registers and segment state
call WATCOM/PMODE thunk restore at 0x2f8d8
cli
in al,60h
clear AH, copy scan code to BX
if bit 7 is clear:
set global key-available byte at 0x136087
set key-state table[scan] at 0x135f4c + scan
toggle port 61h bit 7 to acknowledge keyboard latch
out 20h,20h
sti
restore registers and iret
The code does not do high-level BIOS keyboard polling during the effects. It keeps a 128-byte key-state table and a "new key" byte. That is why visual loops can poll one memory byte instead of calling BIOS.
The installer at 0xe09d uses DPMI interrupt functions 0204h and 0205h:
get old IRQ 1 vector -> save selector:offset at 0x13606e/0x136072
install protected-mode IRQ 1 handler -> CS:0xe058
clear the 128-byte scan-code table
The remover at 0xe13d restores the saved selector:offset.
Timer And Frame Counter
The timing setup starts at 0x10238. It measures vertical retrace using VGA
status port 3dah and the PIT:
wait for bit 3 of 3dah to enter retrace
wait for bit 3 to leave retrace
program PIT channel 0 with mode 3 via port 43h
write 0,0 to port 40h
wait for the next retrace span
latch/read PIT channel 0
derive a half-period value, save it at 0x1360e2
install IRQ 0 handler at 0x102fc
unmask IRQ 0 at PIC port 21h
The IRQ 0 handler at 0x102fc is small:
cli
save EAX, EDX, DS
DS = 0
program PIT mode 3
wait for vblank edge through 3dah
write saved reload value from 0x1360e2 to port 40h
increment dword frame counter at 0x1360d8
out 20h,20h
restore and iret
Many visual loops spin on 0x1360d8:
old = frame_counter
while frame_counter == old:
wait
draw or upload the next frame
That is the central pacing primitive. The code avoids asking DOS, BIOS, or the music player for visual timing once the effect engine is active.
PHENOTYP.PUR Resource Archive
The .PUR file has no filename table. Its directory is at the end:
last byte resource count
previous count*8 bytes directory entries
each entry uint32 offset, uint32 size
payload area raw resources, contiguous
PHENOTYP.PUR ends with 33 entries:
count: 33
table start: 0x000ec1d6
file size: 0x000ec2df
Directory map:
00 off 00000000 size 0000fa04 first words 0140 00c8
01 off 0000fa04 size 00010004 first words 0100 0100
02 off 0001fa08 size 00000300 palette
03 off 0001fd08 size 00010004 first words 0100 0100
04 off 0002fd0c size 00010004 first words 0100 0100
05 off 0003fd10 size 00020004 first words 0100 0100
06 off 0005fd14 size 00010004 first words 0100 0100
07 off 0006fd18 size 00002a88 structured visual data
08 off 000727a0 size 00000300 palette
09 off 00072aa0 size 00002184 structured visual data
10 off 00074c24 size 00000300 palette
11 off 00074f24 size 00000300 palette
12 off 00075224 size 00000300 palette
13 off 00075524 size 00000300 palette
14 off 00075824 size 00000300 palette
15 off 00075b24 size 00000300 palette
16 off 00075e24 size 00000300 palette
17 off 00076124 size 00000300 palette
18 off 00076424 size 00010004 first words 0100 0100
19 off 00086428 size 00000300 palette
20 off 00086728 size 00002444 structured visual data
21 off 00088b6c size 00002ab6 structured visual data
22 off 0008b622 size 00000300 palette
23 off 0008b922 size 00008320 structured visual data
24 off 00093c42 size 00000300 palette
25 off 00093f42 size 0000fd20 structured visual data
26 off 000a3c62 size 00000300 palette
27 off 000a3f62 size 0000bf44 structured visual data
28 off 000afea6 size 00006404 structured visual data
29 off 000b62aa size 00006e04 structured visual data
30 off 000bd0ae size 0000fd20 structured visual data
31 off 000ccdce size 0000fa04 first words 0140 00c8
32 off 000dc7d2 size 0000fa04 first words 0140 00c8
The two common image headers are:
40 01 c8 00 -> width 320, height 200, then 64,000 bytes
00 01 00 01 -> width 256, height 256, then 65,536 bytes
That matches the sizes:
0xfa04 = 4 + 320*200
0x10004 = 4 + 256*256
0x300 = 256 RGB triplets
The loader at 0x16a55 takes a resource index in edx:
file_handle = [0x135fec]
offset = directory[index].offset
size = directory[index].size
seek(file_handle, offset, SEEK_SET)
allocate_or_use_buffer(size)
read(file_handle, buffer, size)
The low-level file wrappers are normal DOS calls:
0x16a01 int 21h AH=3fh read
0x16a06 int 21h AH=3eh close
0x16a0f int 21h AX=4200h seek absolute
0x16a25 int 21h AX=4201h and 4202h get file size
The directory read in the main setup is:
seek handle to EOF-1
read 1 byte into resource_count
seek handle to EOF - (resource_count*8 + 1)
read resource_count*8 bytes into 0x13174c
That is a compact archive design: no names, no compression inside .PUR, and
direct indexed fetches.
VGA Setup
The code uses both BIOS modes and direct VGA reconfiguration.
Early path:
int 10h AX=0012h
Mode 12h gives 640x480x16 planar VGA. The demo uses it for early logo or
setup screens before switching into 256-color work.
Later path:
int 10h AX=0013h
Then 0x10a6c turns the standard 320x200 chunky mode into an unchained planar
mode:
port 3c4h index 04h: clear bit 3
port 3d4h index 14h: clear bit 6
port 3d4h index 17h: set bit 6
port 3d4h index 09h: clear low five scanline bits
port 3c4h index 02h: map mask 0fh
clear A0000 with 0x1f40 dwords
The clear count is important:
0x1f40 dwords = 8,000 dwords = 32,000 addressable bytes
map mask 0x0f = write same clear into all four VGA planes
effective clear = 128,000 plane bytes
This is a Mode-X-style planar screen. Many later loops select one plane with
sequencer index 02h, write packed dwords into 0xa0000, then switch plane
or line/offset state.
Palette Upload And Fades
The code writes DAC colors by programming port 3c8h then streaming to
3c9h. A full 256-color palette is 768 bytes.
The simplest upload wrapper is 0x16ae0:
dx = 3c8h
al = 0
out dx, al ; start color index 0
inc dl ; dx = 3c9h
ecx = 0x300
rep outsb ; write 768 palette bytes from DS:ESI
Black-To-Palette Fade
The fade around 0xe79e ramps one palette from black:
esi = palette
bl = 0
repeat until bl > 16:
out 3c8h, 0
ecx = 0x300
while ecx:
al = *esi++
ax = signed(al) * bl
ax >>= 4
out 3c9h, al
ecx--
esi = palette
wait one timer tick
bl++
It operates on individual RGB bytes, not palette entries. The range is effectively:
output_channel = source_channel * step / 16
step = 0..16
That produces a 17-step fade without touching the framebuffer.
Palette Crossfade
The crossfade around 0xe88b blends the current palette toward a target:
bl = 16 down to 0
for colors 1..255:
r = base_r + ((target_r - base_r) * bl >> 4)
g = base_g + ((target_g - base_g) * bl >> 4)
b = base_b + ((target_b - base_b) * bl >> 4)
write r,g,b to 3c9h
wait one timer tick
It starts at DAC index 1, leaving color 0 alone. That matters when black is used as a stable transparent or border color.
Timed Tint Fades
Routines 0x10338, 0x1044a, and 0x10585 use the same pattern with
different constants:
wait for frame counter to change
for each DAC entry:
blended = (source * down_weight + fixed_tint * up_weight) >> shift
write whole palette
Examples:
0x10338 blends palette data toward RGB-ish constants 0a,3f,21.
0x1044a blends toward 3f,05,0a.
0x10585 fades a loaded palette toward white-ish 3f,3f,3f.
The visual work is often a palette effect over a stable framebuffer. The cost is only 768 output bytes per frame, which is very cheap compared with drawing a full 64,000-pixel image on a 486.
Planar Picture Blitter
Routine 0x10585 is one of the more explicit VGA-plane loops. It receives a
pointer to a packed planar picture stream in eax.
Important steps:
save source pointer at 0x1360e4
fade in the currently loaded palette
set sequencer map mask to 0f
read a start line and an end line from the stream
clear the top region of A0000
derive dword count for the visible slice
for plane mask 1,2,4,8:
set sequencer map mask to plane
copy count dwords from stream to same VRAM offset
restore map mask 0f
clear the trailing region
fade the palette out
The inner plane copy is:
dx = 3c4h
ax = 0201h / 0202h / 0204h / 0208h
out dx, ax
edi = start_vram_offset
ecx = count
rep movsd
Because unchained VGA maps each address byte to one of four planes, the same
linear edi address is reused for all four passes. The stream stores one plane
after the other. This is not a chunky-to-planar conversion at runtime; the
resource is already in VGA-friendly plane order.
CRTC Pitch Reveal
At 0x1042c, the demo animates CRTC register 13h:
dx = 3d4h
al = 13h
ah = 28h
repeat once per timer tick:
out dx, ax
ah--
until ah == 0
CRTC register 13h is the offset register, the byte pitch from one scanline to
the next. Starting from 0x28 matches a 320-wide planar layout. Decreasing it
warps the stride and collapses the displayed image horizontally/diagonally
without redrawing pixels. It is a classic VGA trick: changing address stepping
changes the way existing VRAM is interpreted.
Texture Wobble / Planar Mapper
Routine 0x10ab7 is a strong "classic inner loop" candidate. It sets up an
unchained planar mode, uploads a palette, advances sine-based phase values, then
draws a texture through a precomputed coordinate map.
The setup:
wait for timer tick
call unchained-mode clear at 0x10a6c
upload palette from 0x1360fc
save current frame counter in several state dwords
Then it advances phase counters with sine lookup table 0x19e4e8:
phase_a = [0x11069e]
phase_b = [0x1106a0]
phase_c = [0x1106a2]
per elapsed timer tick:
phase_a += (sin([0x11069a] & 0x7ff) >> 11) + 4
phase_b += (sin([0x11069c] & 0x7ff) >> 11) - 1
[0x11069c] -= 2
phase_c -= 4
byte_phase += 2
Before drawing, it builds a 256-byte displacement table at 0x110598:
for i in 0..255:
a = sin((i + phase_a) & 0xfff)
b = sin((i + phase_b) & 0xfff)
wave = (a + b) >> 9
extra = sin((phase_c >> 4) & 0x7ff) >> 11
displacement[i] = wave
phase_c += 10 + extra*2
The draw address is:
plane_index = [0x110590]
row_index = [0x110594]
edi = 0xa0000 + row_index * 80
source_map = [0x1360f8]
texture = [0x136100] + 16-bit offset
The plane selection is:
dx = 3c4h
ax = 0201h << plane_index
out dx, ax
The inner sampler reads 16-bit coordinate words from the map. For each word:
bx = coordinate_word
dl = low_byte(bx)
bh += displacement[dl]
sample = texture[bx]
Then it packs four samples into a single 32-bit store:
al = sample0
ah = sample1
eax <<= 16
al = sample2
ah = sample3
stosd
The emitted code is manually unrolled. The visible pattern is:
read coordinate at esi+00h
sample texture
read coordinate at esi+02h
sample texture
pack two bytes into AX
shift into upper half of EAX
read coordinate at esi+04h
sample texture
read coordinate at esi+06h
sample texture
stosd
repeat for the next coordinate groups
This is optimized for Mode X. One stosd writes four adjacent pixels on the
currently selected plane. Four plane passes complete the logical screen, but
each pass avoids per-pixel VGA masking.
The loop's character:
- Precompute expensive trigonometry once into tables.
- Use 16-bit fixed-point coordinates in a dense map.
- Use a 256-byte per-frame displacement table as a cheap warper.
- Write four pixels per store.
- Use hardware planes instead of converting chunky bytes to planar bytes at the end.
Feedback / Plasma Texture Routine
The heavier effect path around 0x2e580 allocates two 64,000-byte buffers and
uses a feedback texture loop.
Setup:
clear visible VRAM
allocate buffer A, 0xfa00 bytes
allocate buffer B, 0xfa00 bytes
upload palette from resource 0x11ab30
clear buffer A
initialize two phase words at 0x11ae68 and 0x11ae6a
The core generator uses two sine tables at 0x11ae78 and 0x11b078 to produce
texture-space stepping terms:
angle0 = [0x11ae68] & 0x3ff
angle1 = transformed(angle0)
cx,bp = sine-derived x/y scale terms
start_u,start_v = mixed terms using cx,bp and sine table values
Then the inner mapper draws four bytes per dword:
si,dx = starting texture coordinates
cx,bp = per-pixel deltas
repeat across one row:
bx = si
bl = dh
al = texture[0x1a4508 + bx]
ror eax,8
si += cx
dx -= bp
repeat three more times
stosd
The row loop is bounded by fixed-point sign checks:
ecx += 0x10000
while sign set: continue x loop
edx += 0x10000
while sign set: continue y loop
After mapping, it applies a blur/decay pass:
for 0xf780 bytes, starting one row inside the buffer:
sum = left + right + up + down
value = sum >> 2
if value != 0:
value--
*pixel = value
That is the classic fire/liquid feedback kernel: average four neighbors, then subtract one for decay. The second pass samples jittered rows from the buffer using a small offset table:
for each output row:
source = buffer + row_offset[row] + small phase offset
for 320 bytes:
destination_byte |= source_sample
source advances by a fractional 0xf0 step
Finally:
copy buffer B to A0000 with 0x3e80 dwords
swap buffer A and buffer B
advance phase words
wait on frame/state byte
Routine 0x2e7fb is a close variant. It clears a larger scratch area, uses a
different scale term, combines mapped bytes with or [edi],eax, and feeds the
result into another 256x256 buffer. Both are in the same family: table-driven
texture sampling plus feedback smoothing.
Sprite / Bitmap Additive Blitter
Routine 0x2e425 draws small loaded bitmaps into a 320x200 work buffer. The
resource loader before it stores up to 256 tiny items in an 8-byte table:
item_base[index]
item_width[index]
item_height[index]
item_present[index]
The draw call receives:
edx = sprite index
ecx = y position
ebx = x position
It clips top, left, bottom, and right against:
height 200
width 320
The hot loop:
destination = row_ptr[y] + x
source = sprite_data + clipped_offset
mask = 0x11911c + x
for each row:
for each pixel:
al = *source++
al *= *mask++
destination_byte += ah
destination++
source += source_skip
destination += destination_skip
mask += destination_skip
Using the high byte of the multiplication gives an 8-bit scaled contribution:
added = (source_pixel * mask_pixel) >> 8
So this is not a plain opaque blit. It is an additive/translucent bitmap path, good for text, glows, or small overlays on a software framebuffer.
3D Keyframe And Matrix Path
The object path around 0x11d6d and 0x11fd9 uses a 320x200 software buffer
at 0x136134, then copies it to VRAM:
clear 0x136134 with 0x3e80 dwords
update keyframed camera/object values
build matrix
transform vertices
classify faces
draw sorted faces
copy 0x136134 to 0xa0000 with 0x3e80 dwords
The keyframe records are 0x16 bytes each:
int32 delta_x
int32 delta_y
int32 delta_z
int16 delta_angle_a
int16 delta_angle_b
int16 delta_angle_c
uint32 duration_or_end_tick
Each frame computes elapsed ticks from the timer counter:
dt = current_tick - previous_tick
if current_tick passed segment end:
dt -= overshoot
for each component:
value += delta * dt
if segment end reached:
advance to next 0x16-byte record
That is a compact script interpreter for camera or object motion.
The matrix builder at 0x13b08 uses sine/cosine tables:
0x196c70
0x197070
0x197470
Angles are shifted right by 6 before lookup. The code combines sums and differences of the three angles, performs table reads, halves or quarters the terms, and stores a 3x3 matrix plus translation-like terms at:
0x11574c, 0x115750, 0x115754
0x11575c, 0x115760, 0x115764
0x11576c, 0x115770, 0x115774
0x115758, 0x115768, 0x115778
The vertex projector at 0x13dbf processes 0x20-byte vertex records:
for each vertex:
tx = x*m00 + y*m01 + z*m02 + trans_x
ty = x*m10 + y*m11 + z*m12 + trans_y
tz = x*m20 + y*m21 + z*m22 + trans_z
vertex.depth = tz
screen_x = 160 + ((tx >> 24) / tz)
screen_y = 100 + ((ty >> 24) / ((tz >> 2) * 5))
set clip flags for x < 0, x >= 320, y < 0, y >= 200
The y division is unusual:
effective_y_denominator = (z >> 2) * 5
That is a cheap aspect adjustment. It keeps the vertical field of view from matching x exactly while using only integer operations.
Face setup at 0x14023:
for each face:
gather its three vertices
reject if vertex flags indicate a trivial off-screen case
compute screen-space cross product
if facing away: skip
depth = average or combined vertex depth
store face pointer and depth/key into 0x198470
Sorting uses a quicksort at 0x13f98, comparing the depth/key field in the
face list.
The draw dispatcher around 0x1756b:
sort visible faces
for each sorted face:
load the three projected vertices into 0x116a14..0x116a2a
load face material/key into 0x116a10
jump through a face-type table
There are at least two raster families:
0x179a8: unclipped or lightly clipped triangle spans.0x19562: more defensive span setup, with explicit screen clipping against x0..319and y0..199.
The triangle span setup is classic:
sort or arrange the three y values
for each edge:
dx_dy = (x2 - x1) / (y2 - y1)
du_dy = (u2 - u1) / (y2 - y1)
dv_dy = (v2 - v1) / (y2 - y1)
write left/right x and u/v edge tables per scanline
The hot span body uses a jump table keyed by span length. It avoids a counted pixel loop for every small span:
for each scanline:
width = right_x - left_x
compute du_dx and dv_dx
destination = row_base[y] + left_x
jump to unrolled writer for this width
The unrolled writer repeats:
ch = high byte of u
cl = high byte of v
u += du
color = texture[base + cx]
v += dv
*destination++ = color
In address form, the software framebuffer base in these spans is reached through offsets like:
[edi + 0x135ff5]
Because edi has already been biased by the row base and left edge, those
stores land in the active 320x200 work buffer. The texture used by the span is
at 0x176c70 in the sampled paths.
That gives the 3D path its shape:
- Transform all vertices once.
- Cull and depth-sort faces.
- Build per-scanline edge tables.
- Draw spans with unrolled texture lookups.
- Copy the full software frame to A0000.
DMF Music Path
HER.DMF begins with:
DDMF
version 8
tracker string: XTRACKER
title: Her Eyes
composer: faun
The executable strings and call sites show a linked DMF player. The setup at
0xe18c calls into player routines through far-call stubs around 0x11800,
allocates a 1 MiB block, initializes the player, opens her.dmf, loads it, and
starts playback.
Relevant error strings:
[DMF-Player]: Not Enough Memory Available!
DMF Player ERROR:
not a DDMF file
not a supported DDMF file
diskread error
could not open file
The menu/setup strings around 0x130c00 contain hardware choices for GUS,
Sound Blaster variants, and silence. The release notes and binary both make
GUS the intended path.
Scene Script Shape
The main script is not a bytecode VM in the same sense as some later engines.
It is a C/assembly call chain with resource indices and wait states. The call
sequence around 0xe7e3 to 0xea78 shows this pattern:
draw or fade intro image
wait until state byte reaches a cue
free previous image buffer
draw next planar image
wait
draw next planar image
wait
fade palette out
clear VRAM
switch to mode 13h and install timer
allocate work buffers
load palettes/images/resources
run texture/feedback routines
run 3D routines
free buffers between major sections
State bytes are updated through calls near 0x11868; those routines integrate
timing/player state and store cue values such as:
0x136082
0x1360f6
0x136132
0x1c4516
The demo therefore couples scene changes to a small timing structure, not to hardcoded busy-wait counts alone.
What The Inner Loops Say About The Demo
Phenotype is very direct 1995 PC demo code:
- It lets PMODE/W and WATCOM provide protected-mode startup, DOS file access, heap support, and DPMI memory.
- It keeps the visual engine close to the hardware: raw VGA port writes, direct A0000 stores, palette streaming, and map-mask plane selection.
- It stores resources in file order with an end directory. The runtime can fetch resource N without filenames or parsing overhead.
- It precomputes or ships tables aggressively: sine tables, coordinate maps, palette tables, row pointers, and texture data.
- It spends CPU where it matters: unrolled texture samples, dword stores, feedback filters, and integer matrix/span code.
- It uses palette changes as a primary animation method whenever possible, reserving full framebuffer work for texture, feedback, and 3D scenes.
The fancy part is not one mysterious algorithm. It is the stacking of several well-tuned 486-era choices:
PMODE/W flat memory
indexed resource archive
timer/vblank pacing
Mode-X planar writes
palette animation
precomputed sine/coordinate tables
unrolled texture spans
software framebuffers copied by rep movsd
That combination lets Phenotype feel dense and varied despite the code being
quite pragmatic internally.