Analysis model: gpt-5.5 xhigh

# Crystal Dream 3 Preview by Fat Albert - Technical Dissection

## Scope

`Crystal Dream 3 preview` is a 1993 MS-DOS demo/spoof package by Fat Albert,
distributed as `crystd3p.zip` in the Assembly 1993 PC demo archive directory.
The name deliberately invokes Triton's `Crystal Dream` series, but the bundled
source comment says "Actually by Fat Albert", and the tiny DIZ says only:

```text
Crystal Dream 3 preview by Fat Albert
```

This writeup therefore treats it as a parody preview rather than an official
Triton sequel. The package is obscure but technically useful because it ships
the Turbo Pascal source, a BGI-heavy executable, and a `.DAT` file that is
actually a GIFEXE/FEXE-style executable wrapper around a 640x480 GIF image.

The program contains juvenile sexual and homophobic bait text. Those strings
are relevant to identifying the spoof tone, but not to the technical analysis,
so this page does not reproduce the slurs or explicit lines.

## Public References

- Scene.org archive:
  https://archive.scene.org/pub/parties/1993/assembly93/demo/crystd3p.zip
- Scene.org DIZ:
  https://archive.scene.org/pub/parties/1993/assembly93/demo/crystd3p.diz
- Scene.org Assembly 1993 demo directory:
  https://archive.scene.org/pub/parties/1993/assembly93/demo/
- Scene.org Assembly 1993 results:
  https://archive.scene.org/pub/parties/1993/assembly93/results.txt
- DOSBox-X demoscene compatibility table:
  https://dosbox-x.com/demoscene-compat.html

Scene.org's Assembly 1993 results file lists only the PC demo top ten, and
`Crystal Dream 3 preview` is not in that table.

## Examined Archive

Scene.org reports `content-length: 200496` for the ZIP and a mirror
last-modified time of 3 April 2000. The ZIP member timestamps are:

```text
CDIII.DAT    141340 bytes  1993-08-13 23:00
CDIII.EXE    100320 bytes  1993-08-13 23:00
CDIII.PAS     31583 bytes  1993-08-13 23:00
FILE_ID.DIZ      37 bytes  1996-10-24 19:46
```

Hashes:

```text
40cb81397395058f1d429d2f0532af16978ef075aa9ff953ae067a967cff5856  crystd3p.zip
2e1bd9bce4735489f613e8a310753a6a9d8b32bee227f0cc076239b6a69fe50d  CDIII.DAT
0358903dcde1b88a1419c3b570d7457f951c1640614ce107999bc828bc68672a  CDIII.EXE
bb72e92cbd317f01a972b97fd839406f8689cca61843146c5553ee166423673d  CDIII.PAS
c0f2c684054209fc17f43dc4768dffc42cd26724ec3282c69ce9ba523e4ab7ab  FILE_ID.DIZ
```

`CDIII.PAS` dates the release in-source as Friday, 13 August 1993, which
matches the executable/source member timestamps. The DIZ timestamp is later,
so I treat the source and executable dates as the useful release evidence.

## Runtime Smoke Run

DOSBox-X runs the program through several mode changes before its internal
AVI/ZMBV recorder crashes on a later graphics-mode switch. The valid capture
segments cover roughly 72 seconds:

```text
cdiii_001.avi  640x480  33.37 s  BGI title, "Triton Presents", RGB bars
cdiii_002.avi  720x400  11.99 s  text interlude
cdiii_003.avi  640x480  27.34 s  fake equalizer, cube, Supra modem drawing
```

The captured scenes match the Pascal source:

- BGI stroked-font `Triton` and `Presents` animation;
- red, green, and blue horizontal bars while the title letters appear;
- random star plotting;
- a text-mode interlude;
- a fake `FastTracker II` equalizer with four random 3D bars;
- a rotating wire/fill cube with green text labels;
- a hand-drawn Supra modem/fax graphic.

The run did not reach the `CDIII.DAT` rename/GIF-viewer stage before the
recorder crash. The source and file layout make that later stage clear anyway:
the program renames `cdiii.dat` to `gifs.exe`, executes it, then renames it
back.

## Source Structure

The source is plain Turbo Pascal:

```pascal
program CDIII;

Uses Dos,Crt,Graph,BGIFont,BGIDriv,Adlib,SB_Unit;

{$M 8192,0,65535}
{$L EGAVGA.OBJ}
```

The program embeds/registers the Borland EGAVGA BGI driver and the stroked
BGI fonts:

```pascal
RegisterBGIDriver(@EGAVGADriverProc);
RegisterBGIfont(@GothicFontProc);
RegisterBGIfont(@SansSerifFontProc);
RegisterBGIfont(@SmallFontProc);
RegisterBGIfont(@TriplexFontProc);
```

The top-level call order is short and useful:

```text
Iden_286
Initialize
open
vect_bars
star_text
new_stars
text_inf
setgraphmode(2)
equalizer
cube_rotation
supra
shit_plasma
gifs
ending
creds
```

That is unusually transparent for a 1993 archive: the distributed source
fully explains the visual order, sound calls, BGI dependency, direct mode 13h
sections, and self-renaming GIF wrapper.

## Main EXE Layout

`CDIII.EXE` is a normal MZ executable with no appended overlay:

```text
file size:        100320 bytes
MZ image size:    100320 bytes
header:             3136 bytes
load image:        97184 bytes
overlay:               0 bytes
relocations:         776
entry CS:IP:  0000:3112
initial SS:SP: 182d:2000
minalloc/maxalloc: 0273 / 1273 paragraphs
```

The relocation table nearly fills the header:

```text
relocation table: 28..3132
header bytes:     3136
```

`strings` shows the expected Borland/BGI payload:

```text
BGI Device Driver (EGAVGA) 3.00 - Jul 15 1992
Copyright (c) 1987,1992 Borland International
BGI Stroked Font V1.1 - Jun 5, 1989
Runtime error
Portions Copyright (c) 1983,92 Borland
```

The standard BGI font identifiers are present:

```text
GOTH
SANS
LITT
TRIP
```

The executable also has direct low-level markers from the source's mode-13h
sections:

```text
15 int 10h instructions
38 int 21h instructions
2  mov ax,0013h / int 10h sequences
16 literal A000h segment values
17 literal B800h segment values
```

The 640x480 sections are BGI-driven; the plasma and ending noise sections
drop directly into mode 13h and write bytes to `mem[$A000:word(320*y+x)]`.

## CPU Check

The source includes a small assembler check for 286-or-newer CPUs:

```text
pushf / pop bx
mask the high flag bits
push/pop the modified flags
read flags back
if the high bits still behave like an 8086/8088, abort
```

The failure message says a 286 or better is required. This is not a protected
mode demo; it is a real-mode Turbo Pascal program that just rejects 8086-class
machines before starting BGI.

## BGI Scenes

Most of the visible early program is deliberately simple Borland Graph code:

- `open` grows the `Triton` and `Presents` letters with `TriplexFont`;
- `Vect_bars` draws red, green, and blue bars, then reveals `Crystal Dream III`
  letter by letter;
- `New_stars` repeatedly randomizes 60 points and nudges them away from the
  screen center;
- `Cube_rotation` projects a square with `sin`/`cos`, draws depth lines, then
  fills one side with `fillpoly`;
- `Supra` builds a pseudo-3D modem drawing from BGI lines, filled polygons,
  small pixel clusters, and blinking red status LEDs.

The source calls the equalizer "Real 3D Spectrum with 32-point Fourier
Transform", but the implementation just chooses four random bar heights:

```pascal
for x:=1 to 4 do bars[x]:=trunc(random(200));
```

The audio labels are similarly fake demo jokes: it prints `FastTracker II` and
`Music by: Mr. H`, but the actual sound path is AdLib FM calls, not tracker
module playback.

## AdLib Path

The `Uses` line imports both `Adlib` and `SB_Unit`, but the visible source only
uses AdLib/FM routines:

```text
FMReset
LoadSBI('DOCGUTFZ.SBI', TestInst1)
FMSetVoice
FMKeyOn
FMKeyOff
```

No `DOCGUTFZ.SBI` file is present in the ZIP. The captured run still reaches
and displays the equalizer section, so the missing file does not prevent the
program from entering that scene under DOSBox-X. The archive does not contain
tracker modules, sampled audio, or a separate sound data file.

## Mode 13h Plasma

The source names the plasma routine `shit_plasma`; despite the joke name, the
routine is a normal midpoint-displacement plasma:

```text
set video mode 13h
build 193 palette entries with three 64-color ramps
seed four screen corners with random values
recursively subdivide the 320x200 rectangle
write pixels directly to A000h
rotate palette entries 1..192 for motion
restore the previous graph mode
```

The core write is:

```pascal
mem[$A000:word(320*y+x)] := c;
```

The recursive `subDivide` function uses averaged corner/edge values plus a
random displacement scaled by `F`, with values clamped into the 1..192 palette
range. This is the most demoscene-like technical routine in the file.

## CDIII.DAT Is A GIF Executable

`CDIII.DAT` is not a raw data table. `file(1)` identifies it as an MZ
executable because its first bytes are an executable wrapper:

```text
file size:        141340 bytes
MZ image size:     18670 bytes
header:               32 bytes
load image:        18638 bytes
overlay:          122670 bytes
relocations:           0
entry CS:IP:  0477:000e
initial SS:SP: 0802:0080
minalloc/maxalloc: 05c1 / ffff paragraphs
```

At exactly offset `18670`, the file switches from the declared MZ image to a
GIF:

```text
offset:       18670
signature:    GIF87a
dimensions:   640 x 480
palette:      256-entry global color table
payload size: 122670 bytes
tail marker:  GIFEXE
```

The wrapper strings include fragmented `FEXE 2.0` and Synergistic Consulting
text, plus usage and mode/autoscale strings. The important runtime mechanism
is in `CDIII.PAS`:

```text
ren cdiii.dat gifs.exe
gifs.exe
ren gifs.exe cdiii.dat
```

So the `.DAT` extension is camouflage. The main program temporarily restores
the executable extension, runs the GIF viewer wrapper, then renames it back.

## Why This One Matters

`Crystal Dream 3 preview` is not technically polished and is intentionally
crude as a spoof, but it is an unusually readable preservation target:

- the source code is distributed with the binary;
- the main EXE is a compact Turbo Pascal/BGI MZ with embedded EGAVGA/font data;
- the scene order can be mapped exactly from source to runtime capture;
- the fake equalizer demonstrates the gap between on-screen claim and code;
- the plasma routine is a conventional recursive mode-13h effect;
- the `.DAT` file is really an executable GIF viewer plus a 640x480 GIF;
- the package uses DOS shell rename/exec calls as a simple asset-launcher trick.

That makes it a useful counterpoint to the serious 1993 engines: a small,
source-shipped parody that still touches many period PC demo mechanisms,
including BGI, AdLib FM calls, direct VGA memory writes, BIOS palette setup,
and self-renaming executable payloads.
