Analysis model: gpt-5.5 xhigh
Revision model: GPT-6 Astra (user-reported)
Last edited: 2026-09-19 21:44:39 UTC

# Project XYZ by Orange - Technical Dissection

`Project XYZ` is Finnish group Orange's January 1995 MS-DOS/GUS demo from
Juhla 1995, ranked second in the PC demo competition. Pouet credits Hoplite for
code, Der Piipo for graphics, and the archive/module evidence identifies Dune
as the musician.

This pass treats the production as a 1995 Orange bridge piece: later than the
small 1994 intros, earlier than the heavier 1996 PMODE/W resource shows, and
already built around full-screen image resources, synchronized text/credit
beats, feedback blur, and a fixed-point geometric spiral.

## Sources

- Pouet production page:
  https://www.pouet.net/prod.php?which=1304
- Demozoo production page:
  https://demozoo.org/productions/9871/
- Demozoo Orange group page:
  https://demozoo.org/groups/487/
- Pouet Orange group page:
  https://www.pouet.net/groups.php?which=30
- Juhla 1995 Pouet party results:
  https://www.pouet.net/party.php?when=1995&which=69
- Scene.org archive:
  https://files.scene.org/view/demos/groups/orange/x_y_z.zip
- Public video reference linked from Pouet:
  https://www.youtube.com/watch?v=HKfRYq_hPD0

Pouet metadata:

```text
type:           demo
platform:       MS-Dos/gus
release date:   january 1995
release party:  Juhla 1995
compo:          pc demo
ranked:         2nd
```

## Examined Files

Archive hash:

```text
38ff92934de1c7b217e0053f0313c6ce472eab4859225741443bf7b9f484f287  x_y_z.zip
```

Extracted files:

```text
81880d39ee3b9410509f5fb1d2d4d0e035e2764a487a46e076cf2ae1e23de317  BASKA.MOD
8ec4ae2c0ac0e4a0c1f466a33a1083673ed527736d30921a966c5cc833baa7d3  DATA.DAT
dcbbd05d462852c9d4ce87a286bd278bba5f136c10d92c560f9dc7290da6290e  FILE_ID.DIZ
5999d119c5d032a674ec919485e914e4938542c32516a13ab20f76ddf9840438  INFOFILE
bc9131d8001953a05cf3507a2a7709a3b20446a93ca3910f202f659b20a692a9  TRIP1501.COM
2d3fa43be7f68383ad09b23113b48314eb0e5deb0874488941f095147693ef19  XYZ.EXE
```

`FILE_ID.DIZ` identifies the package as "PROJECT XYZ", an Orange demo from the
Juhla 1995 demo competition. The info file asks for a 386, recommends a fast
486 with Gravis Ultrasound, and includes old postal contact details. Those
private contact details are intentionally omitted here.

`DATA.DAT` is not an opaque blob in this archive: the file command identifies
it as a 320x200, 8-bit PCX image. Decoding it yields the "Motion Blur" texture
card used later in the video.

![Project XYZ decoded DATA.DAT PCX](images/project-xyz-data-pcx.png)

`BASKA.MOD` is an 8-channel FastTracker module. Its sample text includes
`Dune/Orange` and source-equipment notes such as Ensoniq, Korg, and Kawai
names, matching the public credit line for Dune.

## Complete Direct Silent Runtime

The earlier page said local execution was blocked because Xvfb was unavailable.
That environment limitation no longer applies. I ran the authenticated
`XYZ.EXE` directly under DOSBox-X 2026.01.02 and used the program's own period
no-sound provision: its setup prompt says `for nosound, use a free address`, so
I selected unused GUS base `210h` while the configured emulated GUS remained at
`240h`. The player and visual timing path stayed active, but no device received
the GUS writes. SDL also used a dummy host driver.

```text
Machine:          S3 VGA, 16 MB RAM
CPU:              normal 486 core, fixed 50,000 cycles
Memory:           XMS on; EMS and UMB off
Show path:        original XYZ.EXE, unused GUS base 210h
Capture:          external X11 grab, 25 fps FFV1, no audio stream
Working master:   252.2 seconds including setup
Endpoint:         natural return to DOS; DOSBox exit status 0
Published media:  seven continuous GIF excerpts; no audio or H.264/MP4
```

The direct master agrees closely with the 242.5-second public show reference
once the setup interval is removed, but it is stronger evidence: it ties every
visible state to the exact archive and proves the natural endpoint.

Approximate direct-capture phases:

| Capture time | Directly observed state |
| --- | --- |
| `00:00–00:11` | DOSBox startup and original GUS/free-address selector. |
| `00:12–00:54` | Orange production title, contributor cards and dark transitions. |
| `00:55–01:21` | Brown-gold blown texture/fire field and transition into the framed presentation. |
| `01:22–01:42` | `MOTION BLUR` and contributor-name distortion over soft side textures. |
| `01:43–01:49` | Brief full-screen illustrated composition and white/text handoff. |
| `01:50–02:59` | Text jokes and repeated near/far spiral-lattice transformations. |
| `03:00–03:41` | Soft face/figure imagery passed through the blur/history treatment. |
| `03:42–04:12` | `NEWSPAPER`, final Orange card, fade, and natural return to DOS. |

These are continuous excerpts from the direct silent run:

![Project XYZ Orange production title moving through the opening grid](images/project-xyz-direct-titles.gif)

![Project XYZ brown-gold blown texture field](images/project-xyz-direct-fire.gif)

![Project XYZ Motion Blur title and distortion](images/project-xyz-direct-motionblur.gif)

![Project XYZ brief illustrated composition](images/project-xyz-direct-artwork.gif)

![Project XYZ rotating spiral lattice](images/project-xyz-direct-spiral.gif)

![Project XYZ soft face imagery moving through the history blur](images/project-xyz-direct-face.gif)

## Loader And Resource Shape

`XYZ.EXE` is a high-memory PKLITE-carried MZ executable:

```text
MZ file size:   139027 bytes
header size:   160 bytes
relocations:   1
CS:IP:         fff0:0100
SS:SP:         21f2:0200
minalloc:      0x3eaa
```

Depklite recovery gives a 390,766-byte memory image. It is not a clean LE
object image like later PMODE/W Orange demos; byte zero is still loader/header
material, so legacy routine offsets below are raw offsets inside that image.
The spiral review explicitly switches to protected-relative addresses. The
original carrier now reproduces its own handoff at two MZ load segments;
the old expanded file was unavailable for a whole-file comparison.
Absolute data operands use the program's image-relative address space instead:
for the region reviewed here, add `0x17ae` to locate them in the recovered file.
For example, operand `0x4079` locates `data.dat` at raw `0x5827`, and operand
`0x422e` locates `baska.mod` at raw `0x59dc`. Do not use an absolute operand
as a raw file offset. The image contains the expected runtime strings:

```text
data.dat
GUS I/O:       (for nosound, use a free address)
               1-> 210h
               2-> 220h
               3-> 230h
               4-> 240h
               5-> 250h
               6-> 260h
               7-> 270h
baska.mod
error: not enough xms (2mb needed)$
```

The code path is GUS-first but intentionally has a nosound escape: the prompt
text says to choose a free address for nosound. That matches the period
pattern: a GUS production that still tries to get through setup without a
working card.

## Function-Level Map

The strongest recovered dispatcher region starts at `0x5a36`. It enables
interrupts, asks for the GUS/nosound address, loads `DATA.DAT` and `BASKA.MOD`,
allocates a large working image buffer, calls a frame/asset path, fades the
palette, then enters music-position-gated visual parts.

```text
0x5929  extender/service pointer setup helper
0x594f  GUS/nosound key selection; maps keys 1-7 to 210h..270h
0x597c  byte-pair nibble/inversion transform over 0x9ec1 words
0x5999  save current file handle/path state
0x59b2  restore saved file handle/path state
0x59ea  load/open BASKA.MOD path and initialize module-side state
0x5a36  main setup and visual dispatcher entry recovered in this pass
0x5ab8  DAC black-out; writes 0x300 zero bytes through 3c8h/3c9h
0x5b16  DAC full-white fill after clearing A000h
0x5b59  16-step palette blend/fade loop from 0x3d73 into 0x3a73
0x6e43  blur/history-buffer sequence, two 0xfa00 pages plus 0x177000 buffer
0x6fa2  five-tap feedback blur kernel over one 0xfa00 byte frame
0x7023  reverse/history reveal and weighted fade pass
0x9c5a  symmetric texture/shape rasterizer into a 0x7d000 frame stream
0x9d95  allocator/setup for that frame stream and palette/frame playback
0x36ee9 Mode-0Dh setup, triangle-history controller and planar presentation
0x36f74 triple point-record builder from signed lookup tables
0x3704f fixed-point rotation/projection of the spiral triangle vertices
```

The repeated waits on `[0x18c2]` and `[0x18be]` are the most important timing
clues in the dispatcher. They are not simple frame counters: the code waits for
values such as `0x14`, `0x15`, `0x16`, `0x17`, `0x18`, then later changes
parameters and waits for `0x1d`, `0x1e`, `0x1f`, `0x20`. In context, those
look like module order/pattern and row/tick state exposed by the music player.
This is why the demo's visual changes line up with text/card beats instead of
just advancing after fixed wall-clock delays.

## Blur And Frame-History Path

The earlier analysis connected the decoded `DATA.DAT` "Motion Blur" PCX
directly to the `0x6e43` family. That source attribution was not supported by
the recovered pointers: this family initially displays the embedded image at
image-relative `0x4e4c0`, then seeds its working pages from a different embedded
image at `0x3eac0`. Neither is the first decoded `DATA.DAT` PCX. Keep the
runtime observations separate from this corrected resource ownership.

The `0x6e43` family allocates two
`0xfa00` byte pages and one `0x177000` byte history buffer:

```asm
0x6e43: mov eax, 0xfa00      ; page A
0x6e58: mov eax, 0xfa00      ; page B
0x6e62: mov eax, 0x177000    ; history/frame stream
```

It then sets mode `13h` through the extender/service gate, writes a 768-byte
DAC palette from `0x5395`, and copies exactly 312x198 bytes from the embedded
image at `0x4e4c0` into A000h, starting at row 1, column 4 on both sides:

```asm
0x6e89: mov dx, 0x3c8
0x6e92: mov ecx, 0x300
0x6e97: rep outs dx, byte [esi]

0x6ebb: mov ebx, 0xc6
0x6ec0: mov ecx, 0x138
```

The fade-in is real DAC math, not just precomputed frames. At `0x6f09` each
palette byte is multiplied by `[0x5068]`, shifted down by 8, and output to
`3c9h`; `[0x5068]` increments while `[0x5060]` counts down 0x100 steps.

The blur kernel at `0x6fa2` averages the current byte with samples at offsets
`+0x500`, `-0x280`, `+4`, and `-2`, halving after each add:

```asm
0x6fa2  read center
0x6fa5  add [esi+0x500]   ; four 320-byte rows ahead
0x6fb0  add [esi-0x280]   ; two 320-byte rows behind
0x6fbb  add [esi+0x04]
0x6fc3  add [esi-0x02]
0x6fcb  write destination byte
```

The earlier successive-halving description was correct, but this is not an
equal-weight five-tap average. The exact inner loop is:

```text
for i = 0 .. 63999:
    p = source + i
    a = (mem[p] + mem[p+1280]) >> 1
    b = (a      + mem[p-640])  >> 1
    c = (b      + mem[p+4])    >> 1
    mem[destination+i] = (c + mem[p-2]) >> 1
```

Every intermediate truncates, but the power-of-two nesting is exactly
equivalent to this single final shift (all inputs are unsigned bytes):

```text
mem[destination+i] = (mem[p] + mem[p+1280] + 2*mem[p-640]
                     + 4*mem[p+4] + 8*mem[p-2]) >> 4
```

The weights are `1/16, 1/16, 1/8, 1/4, 1/2` in sample order. Their spatial
centroid is zero away from boundaries, so the asymmetric taps alone do not
prove directional translation, as the earlier prose suggested. One pass issues
320,000 byte reads and 64,000 byte writes. There is no per-row clipping or
border branch: the total read footprint extends from `source-640` through
`source+65279`. Thus a reconstruction must preserve surrounding memory and
possible buffer aliasing, not silently introduce zero-padded borders.

The allocator at `0x1a67` advances one cursor without inter-allocation gaps.
These allocations therefore place physical pages A, B, and H consecutively.
The 1,926 out-of-source-page sample reads per pass can reach the preceding
allocation, the other work page, or history. In particular, positive overflow
from physical A enters already-written bytes at the start of destination B.
The shared-memory dependency matters even though the main page pointers differ.

The history and presentation loops are distinct from that five-tap generator:

```text
N = 64000
allocate A[N], B[N], H[24*N]
A = B = embedded_image[0x3eac0 : 0x3eac0+N]
slot_offset = phase = 0
while slot_offset < 24*N:                    // 0x6f68..0x7022
    H[slot_offset : slot_offset+N] = B       // save BEFORE filtering
    filter_five_taps(A, B, N)
    if phase == 0: slot_offset += N
    phase = (phase+1) % 3
    swap(A, B)
    if keyboard_port == Escape: exit

A = B = VGA[2 : N+2]                       // 0x7023..0x7057
for frame = 0 .. 143:                      // 0x707f..0x714d
    wait_retrace_set_then_clear()
    slot = max(0, 23 - floor(frame/4))
    for i = 0 .. N-1:
        A[i] = (H[slot*N+i] + 31*A[i]) >> 5
    for y = 1 .. 198:
        VGA[y*320+4 : y*320+316] = A[y*320+2 : y*320+314]
    if keyboard_port == Escape: exit
```

With the initial zero phase and offset, precomputation runs 70 passes and
70 history copies. Slot zero is written once; each of slots 1 through 23 is
overwritten three times. There is no retrace wait inside that precomputation
loop. Playback instead performs 144 retrace-paced blends: slots 23 through 1
are each used four times, then slot zero is held for the remaining 52 frames.
The displayed crop is 61,776 bytes per update, with a two-byte source/destination
horizontal displacement. This is history blending, not a fresh five-tap
evaluation at every display update.

The following `0x714e` path copies VGA back into both pages, then uses a
different horizontal filter, `(((p[0]+p[2])>>1)+p[-1])>>1`. Each iteration
presents full-width rows 1 through 198, clears destination rows 0, 1, 197,
and 198 **after** presentation, and swaps pages. Its duration is governed by
the player-state test at `0x722b`; the loaded `0x137` value is not a
decrementing frame budget in this loop.

The dispatcher calls setup/precomputation at `0x5a99`, the player-start path
at `0x5a9e`, then playback at `0x5aa3`. At `0x5aa8` it restores the saved
allocation cursor, releasing these temporary buffers before entering `0x9d95`.
This closes the buffer lifecycle rather than treating generation, presentation,
and the next effect as one continuously running filter.

Verification on 2026-09-17 executed the recovered 32-bit instructions against
a shared-memory model through all 70 precomputation passes and 144 playback
updates, plus six externally gated terminal-filter passes. Complete work,
history and VGA buffers matched, including cross-page reads and post-display
clears. The test used the original embedded seed, synthetic surrounding heap
and initial VGA contents, and mocked keyboard/retrace inputs. It is bounded
instruction verification, not a new full-demo recording. A separate execution
of `0x38abc/0x38ac7` through the decoder at `0x3899d` reproduced all 64,000
pixels of the first `DATA.DAT` PCX, establishing a different direct consumer
for that asset.

## Palette And Timeline Gates

The dispatcher uses palette writes as punctuation. The black-out at `0x5ab8`
writes `0x300` zero bytes through `3c8h/3c9h`; the white-out at `0x5b16` writes
`0x300` bytes of `0x3f`; and the blend loop at `0x5b59` interpolates between a
source palette at `0x3d73` and white:

```asm
0x5b68: value = (src * [0x3a6b] + 0x3f * [0x3a6f]) >> 4
0x5b87: write blended 0x300-byte DAC table
0x5ba5: [0x3a6f]--
0x5bab: [0x3a6b]++
```

More precisely, that is **17 palette uploads spanning 16 transitions**,
paced by retrace polling at `3dah`. Weights start at `0/16`, and the exit
test at `0x5b9c` is after the upload, so the source weight includes both
endpoints `0..16`. The loop outputs 13,056 DAC components and resets the
palette index 17 times, with 16 intervening retrace wait pairs. The separate
white-out before the loop is not included in those counts. A bounded test of
the recovered arithmetic and branches reproduced every component using a
synthetic source palette and mocked VGA I/O; this is not a hardware timing
measurement. The waits that follow are music-position gates:

```asm
wait [0x18c2] == 0x14
wait [0x18be] >= 0x10
wait [0x18c2] == 0x15
...
wait [0x18c2] == 0x18
```

After the `0x18` gate, the code primes the spiral/geometry parameters:

```asm
[0x35d20] = 0x1c
[0x331dc] = 0x8c
[0x331de] = 0x64
[0x331e0] = 0x8c
call 0x36ee9
```

Later gates change those same scale values before calling the same family
again, which explains why the spiral/lattice part reappears with different
projection density and shape.

## Spiral Lattice: XOR Triangles and Two Histories

The spiral is a stream of **filled triangles**, drawn into a one-bit work
image with XOR. Its mesh-like appearance combines a history of triangle
geometry with a separate history stored in VGA planes. The earlier account
of a point/segment ribbon whose old work pixels simply remain on screen
missed both the fill operation and the explicit work-buffer clear.

![Project XYZ triangle lattice and planar history](images/project-xyz-runtime-plane-history.gif)

*Fresh original-executable recording, native stream 001 at 128–132 seconds,
or 133.179307–137.179307 on the concatenated video-frame clock. This
four-second, 30 fps GIF retains the native 640×400 grid. The moving image
is recorded footage; the code, memory and individual-frame comparisons
below have separate, explicit scopes.*

### Original Handoff and Address Mapping

The preserved PKLITE carrier was executed with DOS MZ relocation at two load
segments, 0x1000 and 0x1800. Both runs reach the restored entry at IP 0x03dc.
Executing the original descriptor-building prefix establishes that protected
CS and DS start at the loaded image base plus 0x0ec0. The fresh emulator
snapshots independently locate that protected base at physical 0x9100.

The 384,704-byte extracted body differs at eight load-dependent bytes between
the two loads; all lie below protected 0x07bc, and the spiral's code and data
are identical. The old tool-expanded file itself was not found for a full
comparison. Its 0x17ae raw-file bias is corroborated by original opcode and
string anchors, rather than used as an assumed runtime base.

The following section uses **protected-relative** addresses. The old raw
entry 0x36ee9 is protected 0x3573b; raw 0x36f74 maps to the new-record
calculation at 0x357c6, and raw 0x3704f to projector 0x358a1. The triangle
rasterizer starts at 0x353a0, formerly raw 0x36b4e. Add the live protected
base to an operand when inspecting guest memory, not the old file bias.

### Three New Vertices, Sixty-Four Separate Triangles

One insertion creates three six-byte records: signed 16-bit X and Y, followed
by depth 512. The builder's CX value 0x0200 supplies that depth; it is not a
512-iteration point-building loop. The three new records enter a 192-record,
1,152-byte history which discards its oldest triple. A fixed index table
groups consecutive triples into 64 separate triangles.

For vertex j = 0, 1, 2, the new coordinates use:

```text
x = s16((s16(T[phase+20*j] * scale[j]) >> 7) + offsetX)
y = s16((s16(C[phase+20*j] * scale[j]) >> 7) + offsetY)
z = 512
```

Here T and C are the actual signed-byte tables at 0x332a7 and 0x33300,
89 bytes apart. Their original contents and 16-bit product wrapping matter;
ideal floating-point sine/cosine would be a different implementation.
The first invocation uses scales 140, 100, 140; the second uses 100, 140, 100.
These create three corners of each newly inserted face, not three separately
connected rings.

The cold insertion counter suppresses new records in the first two render
iterations, then inserts on the third and every other iteration thereafter.
The record history starts with depth -32768 sentinels. Setup does not reset
the history or insertion counter for the second invocation.

Every iteration projects all 192 records. It uses each record's old depth
while decrementing its stored 16-bit depth by four for the next iteration.
A newly inserted record is first projected at depth 512 and stored at 508.
Thus geometry itself has a trail: old triangles move through depth while
new triangles keep arriving. This continues independently of the VGA history.

### Rotations and Projection

The projector applies XY, YZ and XZ rotations using signed table values,
32-bit wrapped products and arithmetic right shifts by seven. Translation
follows. The cold translation is (0,0,35). For ordinary non-overflowing
coordinates, its division behaves as:

```text
qx = trunc_toward_zero((x*64) / z)
qy = trunc_toward_zero((y*64) / z)
screenX = ((qx*178) >> 7) + 480
screenY = qy + 900
```

The actual x86 dividend has an important qualification: CDQ executes
**before** SHL EAX,6. In overflow cases, EDX retains the sign extension of
the unshifted value. The independent implementation preserves that exact
64-bit dividend and signed IDIV, rather than replacing it with an unlimited
precision multiply. There is no denominator clamp or general near-plane
clip.

The projected pairs are stored as words. The rasterizer later subtracts
320 from X and 800 from Y, making the nominal centre (160,100).
The X multiplier 178/128 supplies a separate horizontal scale.

Some temporary per-vertex table work is overwritten before the actual
rotation arithmetic; it does not add another deformation to each point.
The address-size-prefixed timer reference uses zero-extended address 0xdee0:
the disassembler's displayed 0xffffdee0 must not be treated as a real
high-memory read. The controller below preserves that addressing and its
two separate counter reads.

### What Drives the Spiral's Motion

There are three different rates in this renderer. Depth advances by four on
**every render iteration**. New triangles arrive every other iteration after
the two-iteration cold delay. The motion controller also runs only on those
insertion iterations, after the current image has been copied and cleared.
Its outputs therefore affect later geometry, not the frame just presented.

The controller combines a changing insertion angle, a rolling view and a
small wandering centre. It does not move the entire retained history rigidly
by the new centre offset: the builder adds that offset to each new triangle,
which then retains its own coordinates while travelling through depth.

The insertion angle uses three quarter-step table phases, A, B and C at
0x33202, 0x33206 and 0x3320a. With T the original signed-byte table and
arithmetic right shifts:

```text
change = (((T[A >> 2] + T[B >> 2]) >> 2) + T[C >> 2]) >> 1
insertAngle = u32(insertAngle + change + 360)
if insertAngle >= 360: insertAngle -= 360
if insertAngle >= 360: insertAngle -= 360
```

The table ranges from -127 to 127, bounding the change by -96 and 95.
The two conditional subtractions normalize an initially valid angle for
that bounded step. They are not an arbitrary-input modulo operation.

Only after computing this change does the controller advance A, B and C:

```text
delta = u32(tickRead - baseline)
A = u32(A + (u32(7*delta) >> 3))
B = u32(B + (u32(4*delta) >> 3))
C = u32(C + (u32(1*delta) >> 3))
baseline = secondTickRead
for phase in A, B, C:
    if phase >= 1440: phase -= 1440
```

These shifts are logical, after 32-bit wrapping, with fractional parts
discarded on each update. Two four-tick gaps advance A/B/C by (6,4,0);
one eight-tick gap advances them by (7,4,1). Equal total ticks therefore
do not guarantee the same phases. The tick counter is read
twice: the second read becomes the next baseline. An interrupt between the
reads can make them differ. A, B and C each receive only one wrap correction;
for example, A = 1439 and delta = 1647 produce A = 1440, outside the nominal
0–1439 phase cycle. The recovered code does not promise a general correction
for long delays. This controlled boundary is not a demonstrated visual fault.

The rolling view follows different phases, R and S at 0x331e2 and 0x331e6:

```text
XYangle = (T[R >> 2] >> 1) + T[S >> 2] + 256
if XYangle >= 360: XYangle -= 360
R += 3; S += 4             # each wraps once at 1440
```

The angle is computed from the old phases. In contrast, the centre phases
U and V at 0x331f2 and 0x331f6 advance first, by four and five with a wrap
at 1440, then produce:

```text
offsetX = T[U >> 2] >> 2
offsetY = T[V >> 2] >> 2
```

Each offset ranges from -32 to 31. These roll and centre steps count controller
updates, while the three insertion-wave phases count elapsed ticks. For
example, sixty controlled render iterations with zero, eight or sixteen ticks
added each iteration produce the same roll and centre phases, but different
insertion angles. Faster rendering can therefore change the relationship
between twisting, centre wander and elapsed-time modulation. The geometry's
depth progression and the separately retained VGA silhouettes add the apparent
approach, enlargement and trail.

The recovered normal controller leaves the YZ and XZ angles at zero and
Z translation at 35. It does not animate a camera moving forward and back.
Even a zero table angle scales by 127/128, so the two rotations give the
actual depth denominator:

```text
den = ((((depth*127) >> 7)*127) >> 7) + 35
```

Once all 64 triangles have replaced the cold sentinels, the depth pattern is:

| Iteration | Input depths, stepping by eight | Stored depths | Denominators |
|---|---|---|---|
| Inserts a triangle | 8 through 512 | 4 through 508 | 41 through 539 |
| Intervening iteration | 4 through 508 | 0 through 504 | 37 through 535 |

Each depth level belongs to three vertices. The oldest zero-depth triple
is discarded on the next insertion before projection. This explains the
normal warm sequence; it does not add a general near-plane guard to the
actual projector. A 132-iteration original builder/projector/controller
run with declared zero elapsed ticks verifies the transition into these
warm depth ranges.

Both invocation-priming blocks change only the three builder scales and the
exit threshold: 140/100/140 with threshold 28, then 100/140/100 with threshold
36. The renderer entry reseeds the timer baseline and obtains a new work
allocation. Its RAM geometry, insertion counter, motion phases, page offset
and stored mask survive. This is a continuation of the geometry/controller
state with new proportions. Retained RAM page/mask variables do not establish
that VGA image history survives the intervening BIOS mode changes.

### The Clock Behind Those Controls

The player setup at protected 0x35b9 installs handler 0x2310 for IRQ index
zero, mapped to IDT vector eight by the extender. It writes 0x36 to PIT port
0x43 and divisor bytes 0xa9, 0x04 to port 0x40: divisor 1193. The handler
acknowledges the PIC and increments the 32-bit counter at 0x1216 before its
player work. Thus this elapsed counter has a PC-timer source even on the
unused-GUS-address route. It is not a count of GUS interrupts or rendered
frames.

Cleanup at 0x3630 restores the saved interrupt-vector offset and programs
zero/zero as the PIT divisor bytes. Executing the original setup, cleanup
and extender get/set-vector functions verifies those port writes, vector
save/restore and preservation of the descriptor's other fields. The original
counter increment also wraps correctly from 0xffffffff to zero. These checks
establish the program's timer wiring, not the emulator's interrupt-delivery
schedule or an exact mapping from these ticks to recorded video frames.

The controller equations match 136 isolated original-code cases and 180
sequenced calls with declared clocks, plus four calls checking the
quantization example and separate values for the two reads. Both original invocation setup paths preserve the stated RAM fields.
This supplies the ordered controller arithmetic needed for a future full
trajectory reconstruction; it does not supply the missing live tick sequence.

### The Triangle Inner Loop Really Fills with XOR

The rasterizer gathers three projected pairs and sorts them by unsigned
16-bit Y. It constructs a short edge chain, top–middle–bottom, and one
long top–bottom edge. For each nonzero-height edge:

```text
step = signed_IDIV(s32((endX-startX) << 14), height)
acc  = u32(startX << 14)
for each edge row:
    edgeX = (acc >> 14) & 65535
    acc   = u32(acc + step)
```

Clipping happens after these edge arrays are built. After removing the
(320,800) offsets, negative X values are clamped to zero; values at or
above 319 are clamped to 319. A span wholly below zero or wholly at/above
319 is rejected. Remaining endpoints are ordered and filled inclusively.
Long spans use end masks and whole-byte XORs; short spans toggle individual
bits. The equivalent pixel operation is:

```text
work[y*40 + (x>>3)] ^= 0x80 >> (x&7)
```

Overlapping faces therefore cancel where covered an even number of times.
Drawing an identical triangle twice restores the previous image. That
parity effect helps produce the patterned lattice; it is neither wireframe
drawing nor alpha blending.

Two boundary details remain part of the recovered behavior. Y = 200 is
accepted, although the displayed image has rows 0–199. Those writes enter
the larger allocation beyond its 8,000-byte displayed prefix; they are
neither transferred nor cleared by the normal image loops. Also, an
all-equal-Y triangle can reuse a retained edge height and scratch arrays.
A controlled original-code test reproduces that scratch-history effect
after a preceding nondegenerate triangle. It is not evidence of a specific
visible defect in the recorded show, nor proof that arbitrary projected
edge heights are safe.

### Five VGA Pages, Four Ages per Page

Entry allocates 24,000 work bytes and sets BIOS mode 0x0d. It does not clear
the allocation before the first iteration. Normal iterations copy and then
clear exactly 8,000 bytes, the 320×200 one-bit image. The other 16,000 bytes
retain allocation contents and any out-of-prefix writes.

The destination page cycles through plane offsets 0, 8000, 16000, 24000
and 32000. The selected plane rotates through 1, 2, 4 and 8. Crucially, the
new mask is written **after** the current copy; the stored mask byte is then
rotated again. Reading that stored byte as the mask of the preceding copy
would assign the wrong history.

Each page is revisited every five render iterations. Five and four are
coprime, so successive visits replace different planes of the same page.
In steady operation, immediately after a page is updated, its four planes
contain images 0, 5, 10 and 15 render iterations old. These are software iterations, not necessarily screen refreshes.
The next visit eventually replaces the oldest plane. The initial BIOS mask
and first copies are a distinct startup case.

Each plane contributes one bit to the displayed colour index. The sixteen
palette entries depend only on the number of set bits:

| Occupied planes | DAC RGB |
|---|---|
| 0 | 17, 5, 15 |
| 1 | 25, 15, 20 |
| 2 | 33, 23, 30 |
| 3 | 55, 42, 45 |
| 4 | 63, 63, 63 |

Coincident silhouettes become brighter through this palette lookup. The
work image is cleared; the older silhouettes survive in the other VGA
planes and pages. This is the second history, distinct from the 64 retained
triangles.

The dispatcher enters the two invocations at music states exactly 24 and
32, with exit thresholds 28 and 36. The renderer checks unsigned word
state >= threshold after an iteration, then restores the allocator cursor
and requests BIOS mode 0x13. Its bottom gate has no separate Escape poll.

### Captured Geometry, Partial Work and Actual VGA

In the first-invocation snapshot at music state 25, row 29, the original
projector and independent arithmetic reproduce all 768 projected-coordinate
bytes and all 1,152 post-decrement record bytes. All 192 denominators in
this state are nonzero, ranging from 41 to 539.

The snapshot interrupts triangle 24, numbered from zero. Replaying the
preceding 24 faces and then 173 stores of that face reproduces **all 8,000
active work bytes**. The matching prefix also reproduces the saved edges
and control scratch. Its last included pixel is (204,127); the next is
(205,127). This is an instruction-constrained partial image, not a claim
that the entire frame had already been rendered or that the acquisition
PC was recorded.

The untransferred 16,000-byte allocation tail is not independently reconstructed.
Later snapshots at states 30 and 36 show the allocator rolled back and BIOS
mode 0x13 requested. Their retained spiral pointers are stale; they are
excluded from active-render proof.

Actual VGA backing was located separately in saved memory of the owned
emulator. A unique page-sized match against exact palette brightness
classes led to its location. Decoding the four bitplanes and original
palette then matches **all 768,000 RGB bytes** of native frame 9115 for
page zero and frame 9114 for page 8000. All 17,043 native frames were
searched; the other three saved page images have no complete match.

Completing the current 64 faces reproduces the full 8,000-byte work image
between original code and independent fill arithmetic. Applying the
original 2,000-DWORD transfer to plane mask 2 at page 8000 also matches an
independent update of the captured backing. That predicted next-page RGB
image has **no complete native match**. A longer original-code continuation now supplies one further recorded
presentation: complete the interrupted image, copy and clear it, then execute
three subsequent render iterations with their controller, copy and clear
steps. The fourth copy, at page 32000 with plane mask 1, matches all 768,000
RGB bytes of native frame **9116**, immediately following the actual saved
page-zero match at frame 9115.

Two declared clock schedules—holding the captured counter value, or adding
128 ticks before each suffix—produce the same four complete work and RGB
images. Each work image also matches independent XOR-fill arithmetic, and
each complete backing update matches an independent plane-copy model.
The agreement has a specific limit: the next insertion uses angle 158 under
both schedules, prepared before their timer phases diverge. The fourth
subsequent render first consumes different insertion angles, 169 versus 174,
and its work images differ. This later divergence is also reproduced by
original code; the matching presentation does not identify a unique clock.
The other two subsequent candidates have no full match in the local native
frame window 8900–9299; the initially predicted image remains unmatched in
the full 17,043-frame stream. This reconstructs a later presentation without
recovering the exact live timer or scanout schedule. It does not establish
that every intermediate render iteration became a recorded video frame.

These new captures use DOSBox-X 2024.03.01, commit 02f36ba, normal 486
emulation at 50,000 cycles, 16 MiB and the original unused-address 210h
selection while the configured GUS is at 240h. Host audio is dummy and the
guest mixer remains enabled. The planned external stop did not close the
emulator; it was subsequently killed. No natural DOS return is claimed
for this run. The recorded video decodes cleanly, and a video-only remux
has the same encoded-packet hash and 17,043 frames as the preserved
original. This separately stopped run does not replace the older complete
route's provenance.


## Symmetric Texture Plotter

The other strong recovered graphics routine is the `0x9c5a` / `0x9d95` family.
It allocates a `0x7d000` byte frame stream, a `0x10cc0` byte work area, and
then draws into four symmetric offsets:

```asm
0x9d1f  write [edi + 0x00000]
0x9d28  write [edi + 0x0f9ff]
0x9d31  write [edi + 0x0013f]
0x9d3a  write [edi + 0x0f8c0]
```

Those offsets match mirrored positions inside a 320x200 byte frame: top-left,
opposite edge, short row offset, and near-bottom row offset. The loop uses
lookup tables at `0x6ab4` and `0x7694`, subtracts a phase-dependent value from
sample bytes, and advances four edge/corner cursors in opposite directions.

The exact traversal at `0x9ce9..0x9d88` is 100 rows by 160 source samples,
not four full-frame evaluations. The four destination offsets for `(x,y)` are:

```text
320*y + x                 63999 - 320*y - x
320*y + 319 - x           63680 - 320*y + x
```

Each source sample controls four distinct reflected pixels. The branch at
`0x9d04..0x9d06` skips all four stores when the sample is zero; this does
**not** write four black pixels or clear the previous contents. For a nonzero
sample, the stored byte is:

```text
phase_during_draw = (saved_phase - 256) modulo 2^32
colour = (sample - 128 - (phase_during_draw >> 5)) modulo 256
```

`SHR` is unsigned here. The routine restores the saved phase at `0x9d8e`.
It performs 16,000 source-byte fetches and between 0 and 64,000 destination
byte stores per invocation. The enclosing setup clears the eight-frame
`0x7d000 = 8*64000` allocation once at `0x9de8..0x9df8`; it does not clear
each slot before every generator call. The `0x9e60` loop generates 64 frames,
advancing the slot offset by 64,000 and wrapping at 512,000 bytes. Therefore
transparent samples can retain earlier contents when a slot is reused.

Three isolated executions of the recovered generator used synthetic coordinate
tables and opaque, mixed-zero, and all-zero source data. They matched complete
framebuffers and every write's address, value and order: 64,000, 42,664, and
zero stores respectively. This verifies the kernel, not a particular authored
texture or runtime scene assignment.

`0x9d95` then plays those generated frames with CRTC/DAC work:

```asm
0x9d9b  allocate 0x7d000 frame stream
0x9db0  allocate 0x10cc0 work/shape area
0x9dfa  CRTC write 0x0309
0x9e09  output 0x300-byte palette
0x9e96  160x100 source expanded horizontally into A000h
0x9eec  palette fade scaled by current loop counter
```

This is the code-side match for the demo's repeated mirrored texture/tunnel
language: the visible design is painterly, but the implementation is a compact
symmetry and frame-stream renderer.

The blown brown-gold field and later face excerpt above show two visibly
different uses of that texture/history vocabulary.

## Runtime-To-Code Concordance

The complete direct run establishes the visible sequence independently of the
old public-video extraction. The resource correction above also limits what
can be claimed: remaining scene-to-family matches below are interpretation,
not instruction-address traces of those captures.

- The earlier mapping from the first decoded `DATA.DAT` PCX to `0x6e43`
  is withdrawn. That routine reads two embedded images, allocates two
  `0xfa00` pages plus a `0x177000` history buffer, and runs the `0x6fa2`
  five-sample filter. The resource and loop are established independently
  of the runtime excerpt; visual resemblance alone does not join them.
- The title, white-out, and transition beats are not just hard cuts. The
  dispatcher has explicit DAC punctuation: `0x5ab8` blacks the
  palette, `0x5b16` fills it white, and `0x5b59` performs 17 palette uploads
  over 16 retrace-paced transitions.
- The text/card timing lines up with the repeated waits on `[0x18c2]` and
  `[0x18be]`. Those gates are the code-side reason the visible jokes and
  scene changes land on module structure instead of fixed wall-clock delays.
- The direct near/far spiral motion maps to the `0x36ee9`, `0x36f74`, and
  `0x3704f` family. Three new vertices feed a 64-triangle geometry history;
  fixed-point rotation and projection lead to inclusive XOR fills. The work
  prefix is cleared each iteration, while five VGA pages retain four plane
  ages. The new spiral section separates exact live work and two recorded
  page matches from the still-unmatched predicted next image.
- The direct blown-texture and soft-face excerpts map to the `0x9c5a` /
  `0x9d95` family. That code writes four symmetric positions
  inside a 320x200 byte frame, allocates a `0x7d000` frame stream, performs CRTC
  setup, expands a 160x100 source into `A000h`, and fades the palette during
  playback.
- The original GUS/free-address prompt and `BASKA.MOD` path explain why the
  silent direct run remains music-structured: the visual dispatcher at
  `0x5a36` waits on player state before advancing into the major visual
  families.
- The natural return to DOS after the final Orange card proves the dispatcher
  completes normally on this free-address no-sound route.

The useful reading is that `Project XYZ` is not a set of unrelated video plates.
It is a 1995 Orange pipeline that turns a small PCX/resource set into a
music-gated sequence of palette events, blur/history buffers, symmetric
texture generators, and fixed-point geometry.

## What Makes It Work

The important thing about `Project XYZ` is not one isolated trick. It is the
way early Orange uses a small set of mechanisms as a visual grammar:

- PCX/image material supplies soft texture and credit fields.
- DAC fades and white/black palette wipes turn static resources into beats.
- `0xfa00` byte pages and the `0x177000` history buffer create the blur/drag
  language.
- Music-position words gate visual parts, so text jokes and scene changes land
  on module structure.
- Signed lookup tables and `>> 7` fixed-point multiplies build the spiral
  geometry without FPU cost.

That combination explains why the demo still feels more fluid than its file
list suggests. The archive is small and the visible assets are often still or
texture-like, but the runtime code is constantly reusing them through palette,
feedback, and fixed-point geometry.
