Analysis model: gpt-5.5 xhigh, sol high
Last edited: 2026-08-25

# X-Mas Demo '90 by Cascada - Technical Dissection

`X-Mas Demo '90` is a November 1990 MS-DOS demo by Cascada. Demozoo lists it
as Cascada's first demo and as an early PC demo with a music system.

Release year: 1990.

This writeup covers the scene.org `xmasdemo.zip` archive, the LZEXE-restored
`X-MAS.EXE`, the numbered sidecar files, the mode-0Dh planar image loader, the
timer-driven PC-speaker/Covox-style sample path, the Christmas-tree animation,
the bottom scroller, and the credits renderer.

## Visual References

The first image is a direct, untouched `640x400` DOSBox-X frame from the
2026-08-25 keyed runtime capture. It catches the preloaded tree-page animation
and the live bottom scroller in the same displayed frame.

![Cascada X-Mas Demo '90 direct runtime tree and bottom-scroller frame](images/cascada-xmas-90-runtime-tree-scroller.png)

The full-frame sheet below follows the actual keyed route. From left to right,
top to bottom, its graphics-stream timestamps are `00:15`, `00:25`, `00:35`,
`00:45`, `00:55`, and `00:85`: title, three tree/scroller states, early
credits, and late credits. Every tile is a complete native capture frame; none
was cropped, padded, or resized.

![Cascada X-Mas Demo '90 direct runtime title, tree-scroller, and credits sequence](images/cascada-xmas-90-runtime-sequence.png)

The public screenshot sequence below is copied from Demozoo's production page.
It remains useful as an independent visual reference, not as local timing
evidence.

![Cascada X-Mas Demo '90 public Demozoo screenshot contact sheet](images/cascada-xmas-90-demozoo-contact.png)

The next contact sheet is decoded directly from the archive's 32,049-byte raw
planar frame files. These are not emulator screenshots; they are reconstructed
from the sidecar file format used by the demo.

![Cascada X-Mas Demo '90 decoded raw frame contact sheet](images/cascada-xmas-90-raw-contact.png)

The sequence GIF below is assembled from those same archive-decoded raw planar
frames. It is not a runtime timing capture; it is a compact view of the
Christmas-tree animation pages and the separate title/credit frame assets that
the static loader analysis discusses.

![Cascada X-Mas Demo '90 archive-decoded raw frame sequence GIF](images/cascada-xmas-90-raw-sequence.gif)

The next image is generated from the archive layout and static disassembly. It
is a code-flow map, not a runtime screenshot.

![Cascada X-Mas Demo '90 reconstructed DOS/VGA/audio pipeline map](images/cascada-xmas-90-pipeline-map.png)

Individual public screenshot references:

- `images/cascada-xmas-90-demozoo-01.png`
- `images/cascada-xmas-90-demozoo-02.png`
- `images/cascada-xmas-90-demozoo-03.png`
- `images/cascada-xmas-90-demozoo-04.png`

Individual archive-decoded raw frames:

- `images/cascada-xmas-90-raw-000.png`
- `images/cascada-xmas-90-raw-001.png`
- `images/cascada-xmas-90-raw-002.png`
- `images/cascada-xmas-90-raw-003.png`
- `images/cascada-xmas-90-raw-004.png`
- `images/cascada-xmas-90-raw-005.png`
- `images/cascada-xmas-90-raw-006.png`
- `images/cascada-xmas-90-raw-007.png`
- `images/cascada-xmas-90-raw-00f.png`
- `images/cascada-xmas-90-raw-010.png`

## Runtime Timing Status

The 2026-08-25 pass captured the unmodified release under DOSBox-X
`2024.03.01` commit `02f36ba`. The machine was `svga_s3` with 4 MiB, normal
core, 386 CPU type, and fixed 30,000 cycles. The selector was given external
hex port `378h`; DOSBox-X's parallel device was disabled, so writes were
intentionally ignored. DOS sound devices and host audio were disabled/dummy.
No audio was captured, monitored, or auditioned.

Graphics were captured directly to native ZMBV AVI with audio excluded. The
graphics stream is `640x400`, contains 6,162 frames, reports an average rate of
`1752157/25000` (about 70.08628 frames/s), and ends after exactly
`87.920203` seconds when the program returns normally to DOS. Timing zero below
is the first graphics frame, not process launch. Fixed 30,000-cycle emulation
makes these timings reproducible for this run; they are not claimed as period
hardware timings.

The scripted emulated-keyboard input schedule was `3`, `7`, `8`, Enter at three
seconds after launch, Space at 25 seconds, a 20 ms Space at 50 seconds, and a
two-second Space at 90 seconds. The first group enters `378` in the selector.
The three Space events release three separate raw port-`60h` scan-code gates;
the short middle hold was deliberate so it could not bleed into the later
credits gate.

| Graphics time | Direct observation | Runtime/code meaning |
| --- | --- | --- |
| `00:15` | Red/blue information and title page. | The first raw Space gate has not yet been released. |
| `00:25` | Tree/logo page with the live bottom scroller. | Title Space has faded the title, installed playback, and entered the main page/strip/scroller loop. |
| `00:35` | A different upright-tree and scroller state. | CRTC page selection and packed-nibble text shifting continue inside the open-ended main loop. |
| `00:45` | Leaned tree with another scroller fragment. | A later preloaded tree page is visible while the lower strip and scroller continue updating. |
| `00:55` | Opening credits text. | The 20 ms main-loop Space has selected `846Fh`, faded out, cleaned up the first timer path, and loaded the credits resources. |
| `01:15` | Mid-credit text. | The plane renderer is feeding new character slices while the CRTC start advances. |
| `01:25` | Late-credit text. | Credits remain open-ended until their own raw Space gate. |
| `01:27.920203` | Graphics stream ends; DOSBox-X exits normally. | The final held Space reaches `85DFh`: fade, text mode, timer/vector/PIC restoration, DOS exit. |

The critical timing result is therefore not a set of authored part lengths.
Title, tree/scroller, and credits duration are all user-controlled. The code's
three direct Space gates explain both the observed route and why an unattended
capture can appear to stop permanently on any one of those screens.

## Runtime/Archive-To-Code Concordance

The direct runtime now supplies phase order and keyed lifecycle evidence, while
the archive decodes prove the source page format and the static disassembly
explains the loops that produce each visible state.

| Visual/archive evidence | Code path / data path | What it proves |
| --- | --- | --- |
| Direct full-frame sequence at `00:15`, `00:25`, `00:35`, `00:45`, `00:55`, and `00:85` | Three raw Space polls at `3D4Bh`, `844Eh`, and `85C2h`; main transition at `846Fh`; final exit at `85DFh`. | The release follows a keyed title -> open-ended tree/scroller -> open-ended credits -> DOS-return lifecycle, rather than automatic fixed-duration parts. |
| Direct `00:35` tree/scroller frame | Preloaded pages selected by `8315h`, lower-strip updater around `3BA3h`, scroller parser at `3E2Fh`, and nibble shifter at `3F03h`. | Page animation and the live packed-pixel scroller coexist in the actual runtime frame shown at the top of the page. |
| Public Demozoo screenshot contact sheet | Independent external visual reference for title, tree/scroller, and credit-style screens. | The public stills agree with the locally observed phase family but are not used as exact timing evidence. |
| Raw decoded frames `X-MAS.000` through `X-MAS.007` | Sidecar frame format: byte 0 marker, 16 DAC triples, then 32000 bytes of row/plane image data; loader at `8604h`. | The Christmas-tree animation pages are concrete archive assets, not inferred screenshots. |
| Raw sequence GIF | Same decoded planar frame set, assembled as a compact asset-order preview. | The GIF documents the animation page family but is not a runtime timing capture. |
| Raw frames `X-MAS.00F` and `X-MAS.010` | `X-MAS.00F` intro/information page and optional D/A-converter help screen; setup path calls `8604h` and `86BFh`. | The setup/title/help screens are loaded through the same planar image loader as the tree pages. |
| Mode `0Dh` visual character | BIOS mode set at `3A56h`, followed by Sequencer Map Mask writes and plane-wise copies. | The demo is direct planar VGA/EGA-style code after setup, not BIOS pixel drawing. |
| Tree page animation | Preload loop at `3D97h` loads eight pages at `DI += 1F40h`; helper `8315h` writes CRTC start registers `0Ch/0Dh`. | The tree "dance" is mostly page selection by CRTC start address, not full-frame copying every visible frame. |
| Moving lower/logo strip | Strip update loop around `3BA3h`, plane masks `0Ch`, `0102h`, and `0202h`, 40-row by 20-byte region, support-bank slice step `0640h`. | The lower animated area is a special-purpose planar strip routine, not a generic sprite engine. |
| Palette fades in public/decoded screens | Fade-in helper `86BFh`, fade-to-black helper `8714h`, palette clear `87EDh`, and DAC ports `03C8h/03C9h`. | Screen transitions are hardware palette operations rather than framebuffer fades. |
| Bottom scroller visible in public references | Text stream at `0D49h`, control bytes after `@`, glyph table at `07A0h`, working buffer `358Bh`, and nibble-rotation shifter at `3F03h`. | The scroller moves packed 4bpp pixels by nibbles; it is not a text-mode scroll. |
| Credits-style pages | `X-MAS.00C` support/font load, `X-MAS.00A` through helper `8888h`, character table `0816h`, and four-plane renderer at `858Eh`. | The credits renderer streams character slices into VGA planes and scrolls via CRTC start. |
| Silent external-port run and normal return | Sound selection stores port in `8E79h`; timer setup installs INT `08h` at `8806h`; ISR output port is self-patched at `883Bh`; both transition paths call cleanup `8C4Dh`. | The complete graphics/control lifecycle runs with ignored `378h` writes and returns cleanly; no claim is made about audible output. |
| Generated pipeline map | Archive layout plus static disassembly of loader, VGA, IRQ/audio, scroller, and credits routines. | The map is explanatory code navigation, not runtime media. |

Together these sources prove the asset formats, loader paths, visible keyed
order, page/strip/scroller mechanisms, credit renderer, audio ISR structure,
and normal cleanup. Only period-hardware timing and audible replay remain
outside the runtime evidence here.

## Public Metadata And Sources

Sources used:

- Demozoo production page:
  <https://demozoo.org/productions/65160/>
- Demozoo screenshots page:
  <https://demozoo.org/productions/65160/screenshots/>
- Pouet production page:
  <https://www.pouet.net/prod.php?which=4112>
- scene.org file info page:
  <https://files.scene.org/view/mirrors/hornet/demos/1990/xmasdemo.zip>
- Direct archive URL used here:
  <https://files.scene.org/get/mirrors/hornet/demos/1990/xmasdemo.zip>

Demozoo gives the title as `X-Mas Demo '90`, group Cascada, platform MS-DOS,
and release month November 1990. It credits Iceman and Pharos for code, and
Zodiak for graphics and music. Pouet confirms the MS-DOS platform and November
1990 release month. Pouet comments also identify the visible shape: bottom
scroll text, a dancing Christmas tree, and 4-channel 8-bit sample playback,
including PC-speaker output.

## Privacy Note

The small `X-MAS.TXT` file and the restored final credits/scroller text contain
old personal contact details. This writeup omits those details and does not
quote that contact block. Technical and production-credit facts are retained.

## Archive Layout

Original archive:

```text
xmasdemo.zip                  316466 bytes
X-MAS.000                      32049 bytes
X-MAS.001                      32049 bytes
X-MAS.002                      32049 bytes
X-MAS.003                      32049 bytes
X-MAS.004                      32049 bytes
X-MAS.005                      32049 bytes
X-MAS.006                      32049 bytes
X-MAS.007                      32049 bytes
X-MAS.008                      93097 bytes
X-MAS.009                      71451 bytes
X-MAS.00A                      43653 bytes
X-MAS.00B                       4448 bytes
X-MAS.00C                       9248 bytes
X-MAS.00D                      16048 bytes
X-MAS.00E                      95612 bytes
X-MAS.00F                      32049 bytes
X-MAS.010                      32049 bytes
X-MAS.EXE                      10779 bytes
X-MAS.TXT                        104 bytes
```

Important hashes:

```text
556783a295251ef3cd9577a15a6ac3e1461f3687a637b7da7592a3fb638c8a75  xmasdemo.zip
bf557fa80b3f6d3f6a39bb00958489d1a53398131ca538214f2575ceeb433162  X-MAS.EXE packed
d49997ec2a5574ec7e47a869ee454b2472ff020303e34dc25d7d26c6248ffdfa  X-MAS.EXE unpacked
4b2e0c60d5a54c6db90bb7185830127c44e9c4b89544754ab56d5aa4400f3faa  unpacked load image
989482a20dd501b5a8c73fb928dccc99bb88021943293fe66df5c59eca9faa45  X-MAS.000
2d85febb7c02dcb6d7cb189e87210e1a4d3fab3c79b01a93fa3e2b4f9c5bbb66  X-MAS.007
ac460bf7ff0e1d18e0cb1e336865aa86d01633d62552c6c0d330b0ee1b132092  X-MAS.00F
0cce98c8c0628868a8252c5ec6e99dbbd1a6cc2304d15a3531f42cd3778711fd  X-MAS.010
7faee5fe749bb83ee5efd7c9e695cadfd9c1cf1244b2eebc42fffdb4fcd4baab  X-MAS.00E
```

`X-MAS.EXE` is LZEXE v0.91 compressed. After UNLZEXE restoration, the program
is a normal MZ:

```text
packed file size:          10779 bytes
unpacked file size:        51325 bytes
unpacked header size:        512 bytes
unpacked load image:       50813 bytes
entry point:               0000:0000
relocation entries:            0
stack:                     0C68:0200
```

The unpacked entry is just a near jump:

```asm
0000  jmp 39A3h
```

Most of the first half of the load image is tables, palette data, text, and
font/source data. The main executable code clusters are around `39A3h` and
`8300h..8E75h`.

## Sidecar File Roles

The restored program contains a zero-terminated filename table at `06F6h`:

```text
x-mas.000
x-mas.001
x-mas.002
x-mas.003
x-mas.004
x-mas.005
x-mas.006
x-mas.007
x-mas.008
x-mas.009
x-mas.00A
x-mas.00B
x-mas.00C
x-mas.00D
x-mas.00E
x-mas.00F
x-mas.010
```

The 32,049-byte files have the format used by the `8604h` image loader:

```text
byte 0      control/unused-by-decoder marker
bytes 1-48  16 VGA DAC RGB triples
bytes 49..  32000 bytes of 320x200x4bpp planar image data
```

The data is arranged per scanline:

```text
row 0: plane 0, 40 bytes
row 0: plane 1, 40 bytes
row 0: plane 2, 40 bytes
row 0: plane 3, 40 bytes
row 1: plane 0, 40 bytes
...
```

Files `X-MAS.000` through `X-MAS.007` are the Christmas-tree animation frames.
`X-MAS.00F` is the intro/information screen. `X-MAS.010` is the D/A-converter
help screen. The smaller `00B`, `00C`, and `00D` chunks are art/font/support
banks. `X-MAS.00E` begins with `FORM ... 8SVXVHDR`, so it is IFF/8SVX-like
sample data. The larger `008`, `009`, and `00A` chunks are loaded through the
generic full-file helper and feed later music/text/credits stages.

## Entry, Memory, And Sound Selection

The entry path at `39A3h` first saves the PIC mask:

```asm
39A3  in   al,21h
39A5  mov  cs:[001Ah],al
```

Then it resizes its DOS memory block and probes for enough free memory:

```asm
39A9  bx = D6D8h >> 4
39B1  ah = 4Ah
39B3  int 21h                 ; resize current block

39B5  bx = FFFFh
39B8  ah = 48h
39BA  int 21h                 ; allocation probe, BX returns max on failure
39BD  cmp bx,61A8h
```

If not enough memory is available, it prints the embedded memory-error string
and exits through the common cleanup path.

The sound setup is surprisingly direct. The program accepts either SPACE for
the internal speaker path, ESC to quit, or a three-hex-digit output port for a
parallel-port DAC/Covox-style device.

```asm
if key == SPACE:
    DX = 0042h                ; PC speaker/PIT data-port path
else:
    collect three hex digits
    DX = parsed_port

CS:[8E79h] = DX
```

The three-digit parser accepts `0..9`, `A..F`, and `a..f`, echoes the typed
characters with DOS `AH=02h`, then combines the nibbles:

```asm
low  = third_digit & 0Fh
mid  = second_digit << 4
high = first_digit
DX   = (high << 8) | mid | low
```

After storing the selected output port, it masks the PIC down to IRQ0 only:

```asm
3A49  mov al,0FEh
3A4B  out 21h,al
```

That is consistent with the later design: timer IRQ0 becomes the audio driver.

## Mode 0Dh And Screen Loading

The demo uses BIOS mode `0Dh`, which is VGA/EGA-compatible 320x200 16-color
planar graphics:

```asm
3A56  mov ax,000Dh
3A59  int 10h
```

It later uses VGA sequencer map masks directly, so even though mode `0Dh` is
BIOS-selected, the renderer is not a BIOS graphics program after setup. It is
planar VGA/EGA-style direct memory code.

## The Raw Image Loader At `8604h`

`8604h` is the reusable sidecar-screen loader. Inputs:

```text
DX = address of zero-terminated filename
DI = destination offset inside A000h
```

The file load part:

```asm
8604  ax = 3D00h
8607  int 21h                 ; open file named by DS:DX
860D  cx = 0031h
8610  dx = 3532h
8616  int 21h                 ; read 49-byte header/palette

8618  ds = [CS:000Fh]
861D  dx = 0
861F  cx = 7D00h
8625  int 21h                 ; read 32000 image bytes
8627  ah = 3Eh
8629  int 21h                 ; close
```

The planar copy loop is the core:

```asm
ES = A000h
SI = 0
BX = 00C8h                    ; 200 rows

for row in 0..199:
    AX = 0102h                ; sequencer map mask, plane 0

    repeat until AH reaches 10h:
        out 03C4h, AX
        CX = 0014h            ; 20 words = 40 bytes
        rep movsw             ; copy one plane row
        DI -= 0028h           ; rewind to same byte row
        AH <<= 1              ; next plane mask

    DI += 0028h               ; next screen row
```

This matches the raw frame format exactly: each scanline stores 40 bytes for
plane 0, then 40 for plane 1, then plane 2, then plane 3. The CPU writes the
same destination byte row four times while changing only the VGA map mask.

That is the important early-PC trick here. A decoded frame is 320x200 pixels,
but the loader writes 40 bytes per plane per row, not 320 individual pixels.

## Optional Converter Help Screen

If the user selects SPACE instead of a DAC port, the setup path calls:

```asm
3A77  call 87EDh              ; clear palette entries
3A7A  dx = 0796h              ; "x-mas.010"
3A7D  di = 0000h
3A80  call 8604h
3A83  call 86BFh              ; fade palette in
```

Then it reads the raw keyboard data port `60h`, acknowledges through port
`61h`, and waits for scan code `39h` (space). This is not BIOS keyboard input.
It is direct port polling:

```asm
in  al,60h
ah = al
in  al,61h
or  al,80h
out 61h,al
and al,7Fh
out 61h,al
cmp ah,39h
```

The public setup screen explains the resistor ladder for an 8-bit D/A
converter on the parallel port. The technical relevance is that the code really
does output sample bytes to a selected I/O port later, not only to the PC
speaker.

## Timer-Driven Sample Output

The sound path installs a new INT 08h handler:

```asm
3B1D  cli
3B21  es = 0000h
3B23  ax = es:[0020h]
3B27  cs:[001Fh] = ax         ; old INT 08h offset
3B2B  ax = es:[0022h]
3B2F  cs:[0021h] = ax         ; old INT 08h segment

3B33  ax = 8806h
3B36  es:[0020h] = ax
3B3A  ax = cs
3B3C  es:[0022h] = ax
```

Then it reprograms PIT channel 0:

```asm
3B41  out 43h,36h
3B45  bx = [06F2h]
3B4A  out 40h,BL
3B4E  out 40h,BH
```

At `3B56h`, the selected output port is patched into the ISR itself:

```asm
3B52  ax = [8E79h]
3B56  mov cs:[883Bh],ax
```

`883Bh` is the immediate word inside this instruction in the IRQ handler:

```asm
883A  mov dx,0000h            ; patched to 0042h, 0378h, 03BCh, etc.
883D  out dx,al
```

So the playback loop pays no per-sample branch cost for "which device did the
user choose?" It self-patches the output port once.

### Sample Preparation At `8865h`

`X-MAS.00E` is loaded, then processed through `8865h`:

```asm
for each byte:
    AL = [SI++]
    AL += 80h                 ; signed-ish sample center -> unsigned-ish
    AL >>= 1
    if selected_port == 0042h:
        AL >>= 1              ; smaller range for PIT/speaker path
    AL++
    [ES:DI++] = AL

    if DI wrapped:
        DS += 1000h
        ES = DS
```

The range conversion explains why the setup text talks about 8-bit sample
output but also supports the PC speaker. The same sample stream is scaled
differently depending on the target.

### INT 08h Handler At `8806h`

The interrupt handler is small:

```asm
push ax, si, ds, dx
DS = [CS:000Fh]               ; current sample segment
SI = [CS:06F4h]               ; current sample offset

toggle/advance sample pointer
AL = [DS:SI]
if AL == 0:
    SI = 007Ch
    [CS:000Fh] = [CS:000Dh]   ; restart sample segment
else:
    out patched_port, AL

out 20h,20h                  ; EOI
pop dx, ds, si, ax
iret
```

When `SI` wraps, the handler adds `1000h` to the sample segment:

```asm
AX = [CS:000Fh]
AX += 1000h
[CS:000Fh] = AX
```

That lets the sample stream cross 64 KiB boundaries without a huge far-pointer
update sequence in the hot path.

The code is crude by later standards, but the structure is already recognizable
as a real sample replay engine: PIT-driven IRQ, stream pointer, segment carry,
device-port patching, and EOI from the ISR.

## Preloading The Tree Animation Pages

After the sound setup, the program preloads `x-mas.000` through `x-mas.007`
with repeated calls to `8604h`:

```asm
3D97  dx = 06F6h              ; "x-mas.000"
3D9A  di = 0370h
3D9D  cx = 8

repeat:
    call 8604h
    dx += 000Ah               ; next filename string
    di += 1F40h               ; next 8000-byte page
```

`1F40h` is 8000 decimal, exactly the byte footprint of one 320x200 16-color
plane address page. The eight decoded frames in the raw contact sheet match
this page-loader pattern.

The page start table near `0025h` and the timing table at `06EDh` drive CRTC
display-start changes during animation. The helper at `8315h` checks a delay
counter and then writes CRTC start registers `0Ch/0Dh`:

```asm
SI = [06EDh]
delay = [SI+1]
if delay == 0:
    [06EDh] = 003Bh           ; loop timing table

[06EFh] = delay
frame_index = [SI]
BX = word [0025h + frame_index*2]

out 03D4h, 0Ch / BH
out 03D4h, 0Dh / BL
[06EDh] += 2
```

That is how the tree "dances" without copying a full image for every visible
frame. The full frames are already in display memory; the CRTC start address
selects which page is visible.

## Strip Update Loop Around `3BA3h`

The animation loop waits through several vertical retrace phases:

```asm
wait retrace start
wait retrace end
wait retrace start
wait retrace end
...
```

Then it clears and updates a strip around the bottom/logo area. The clear uses
VGA map mask `0Ch`, i.e. planes 2 and 3:

```asm
AX = 0C02h
out 03C4h,AX
AX = 0
BL = 28h                     ; 40 rows
repeat BL:
    CX = 000Ah               ; 20 bytes as words
    rep stosw
    DI += 0014h
DI -= 0668h
```

After clearing, it copies two plane slices from the support bank in segment
`[0011h]`:

```asm
out 03C4h,0102h              ; plane 0
40 rows:
    CX = 000Ah
    rep movsw
    DI += 0014h

out 03C4h,0202h              ; plane 1
40 rows:
    CX = 000Ah
    rep movsw
    DI += 0014h
```

`SI` advances by `0640h` and wraps at `3E80h`, so the support bank is treated
as a set of 1600-byte slices:

```asm
SI += 0640h
if SI >= 3E80h:
    SI = 0
```

This is not a general sprite engine. It is a very specific "update the moving
lower strip" routine tuned around a 40-row by 20-byte region and two active
planes.

## Palette Helpers

`87EDh` clears palette entries:

```asm
DX = 03C8h
CX = 20h
BL = 0
repeat:
    AL = BL
    out DX,AL                ; select DAC index
    DX = 03C9h
    out DX,0
    out DX,0
    out DX,0
    DX = 03C8h
    BL++
```

`86BFh` fades selected palette ranges in. It starts with `CH=40h`, waits for
vertical retrace, and repeatedly emits palette components clamped by the fade
counter:

```asm
for fade = 40h down to 1:
    wait retrace
    for DAC indices 0..7 and 10h..17h:
        component = *SI++
        if component >= fade:
            component -= fade
        else:
            component = 0
        out 03C9h, component
```

`8714h` is the opposite style: it reads DAC entries back from `03C7h/03C9h`,
decrements nonzero RGB components by one, writes them back, and repeats `40h`
times. It is a hardware palette fade-to-black, not a framebuffer fade. One
subtle timing detail matters for the keyed runtime: each pass waits until
vertical retrace is high, but does not wait for retrace to end before beginning
the next pass. Several of the 64 decrement passes can therefore execute inside
one retrace interval. The fade is not necessarily 64 whole video frames long,
which is why a long Space hold can survive the transition and reach the next
raw keyboard poll.

## Scroller Text Engine

The main scroller text starts at `0D49h`, with a glyph/source pointer initialized
to `FEA0h`:

```asm
3E21  [0013h] = 0D49h         ; scroller stream pointer
3E28  [0015h] = FEA0h         ; glyph/source pointer
```

At `3E2Fh`, the parser reads one byte from the stream. If it sees byte `40h`
(`@`), it interprets the next byte as a control command:

```text
@1  re-enable interrupts and continue
@2  set bit 3 in state byte [0006h]
@3  clear bit 3 in state byte [0006h]
@4  force a 00FFh delay, set RGB state bytes to 3Fh, clear lower state bits
```

For ordinary characters, it maps ASCII through a word table at `07A0h`:

```asm
BL = character - 20h
BX = BL * 2
AX = [07A0h + BX]
[0015h] = AX
```

Then it copies 22 rows of four bytes/words from the current glyph/source into
a working buffer at `358Bh`:

```asm
DI = 358Bh
DS = [0011h]
SI = [0015h]
CX = 16h
repeat:
    movsw
    movsw
    DI += 28h
```

That gives the scroller its 22-pixel-high character material.

### Nibble-Rotation Shift Loop

The long unrolled block starting at `3F03h` rotates the bottom scroll buffer by
four pixels at a time. The repeated micro-operation is:

```asm
AL = [SI]
ROL AL,4                     ; swap high/low nibbles
BH = AL
AL &= F0h                    ; keep shifted high nibble
AL |= BL                     ; carry low nibble from previous byte
BL = BH & 0Fh                ; next carry nibble
[SI] = AL
SI--
```

That is a 4-bit horizontal shifter over a packed 4bpp buffer. It walks
backwards, carrying one nibble between adjacent bytes. The code is unrolled
rather than looped, which saves loop overhead during a visible scroller path.

The visible effect is a bottom scroller, but the inner loop is not moving text
as characters. It is shifting packed pixel nibbles and only occasionally
injecting new glyph material from the text stream.

## Three Raw Space Gates And Part Ownership

The direct run exposed lifecycle control that the earlier static-only account
left too implicit. Progression is not automatic. All three part boundaries
poll keyboard controller data port `60h`, acknowledge through port `61h`, and
compare the make code with `39h` (Space), bypassing BIOS keyboard services.

The title gate at `3D4Bh` is reached after the intro page and its fade-in. It
stays there until Space, then fades the page out and continues into sample
setup and tree-page preload. This is distinct from the optional converter-help
screen's own local wait described above.

The main tree/scroller loop polls at `844Eh`. A non-Space code falls back into
the page-animation, lower-strip, and nibble-scroller work. Space branches to
`846Fh`:

```asm
844E  in   al,60h
      ; acknowledge keyboard controller through port 61h
      cmp  ah,39h
      jne  main_tree_scroller_loop

846F  call 8714h             ; palette fade to black
      call 8C4Dh             ; restore PIT/INT 08h/PIC state
      ; resize DOS allocation, set mode 0Dh
      ; load X-MAS.00C palette/font support
      ; relocate/load X-MAS.00A credits data
```

Thus the tree pages, special lower strip, and bottom scroller are one
open-ended interactive part. The runtime's brief 20 ms Space at 50 seconds was
long enough for this relatively sparse poll, yet short enough to be released
before the credits poll became reachable.

The credit renderer performs one 23-line by 40-column feed/scroll batch before
polling at `85C2h`. Non-Space returns to another batch. Space selects `85DFh`:

```asm
85C2  in   al,60h
      ; acknowledge through port 61h
      cmp  ah,39h
      jne  next_credit_batch

85DF  call 8714h             ; final fade
      mov  ax,0003h
      int  10h               ; restore text mode
      call 8C4Dh             ; restore timer vector/PIT/PIC path
      mov  al,[001Ah]
      out  21h,al             ; restore separately saved PIC mask
      mov  ax,4C00h
      int  21h               ; return to DOS
```

This polling placement explains the visual cadence: an exit key is consumed
only after a complete credit batch, not once per character slice. It also
explains why a key held across the unusually fast `8714h` fade can skip a later
part. The final capture used a short middle press and a separate long final
press to prove both gates independently.

## Credits Renderer

The credits section loads `x-mas.00C`:

```asm
8498  dx = 076Eh              ; "x-mas.00C"
849F  int 21h                 ; open
84A3  cx = 0030h
84AC  int 21h                 ; read palette
84AE  ds = [0011h]
84B3  cx = 2B20h
84BC  int 21h                 ; read support/font data
```

It sets palette entries twice with BIOS `AX=1012h`, then uses the full-file
helper for `x-mas.00A`:

```asm
84C4  AX = 1012h, BX = 0, CX = 18h, DX = 3533h
84D0  int 10h
84D2  AX = 1012h, BX = 8, CX = 18h, DX = 3533h
84DE  int 10h
84E6  AX = 075Ah              ; "x-mas.00A"
84EA  call 8888h
```

The text source for the final credits begins at `225Ch`, but the embedded
contact section inside that text is intentionally not reproduced here.

The renderer maps 40 characters at a time through a table at `0816h`:

```asm
CX = 28h
DI = 392Bh
SI = [0013h]
repeat:
    BL = [CS:SI]
    if BL == 0: reset text pointer
    BL -= 20h
    BX = BL * 2
    AX = [0816h + BX]
    [CS:DI] = AX
    DI += 2
    SI++
```

The drawing loop at `858Eh` expands those character offsets into four VGA
planes. For each of 40 columns:

```asm
SI = [CS:BX]                 ; character slice source

out 03C4h,0102h
movsw
DI -= 2
SI += 002Ch

out 03C4h,0202h
movsw
DI -= 2
SI += 002Ch

out 03C4h,0402h
movsw
DI -= 2
SI += 002Ch

out 03C4h,0802h
movsw
[CS:BX] += 2                 ; next slice for this character
BX += 2
```

The CRTC start is advanced by `0028h` during the surrounding loop:

```asm
[000Bh] += 0028h
out 03D4h, 0Ch/0Dh with [000Bh]
```

That is a hardware scroll over a plane-rendered text page. The code redraws
new slices at the incoming edge while the CRTC start register supplies the
smooth vertical movement.

## Full-File Helper `8888h`

`8888h` is a generic loader for the larger custom data files. It calls the DOS
file-load helper at `8946h`, then fixes internal segment pointers inside the
loaded structure:

```asm
call 8946h                   ; load named file to allocated memory
ES = returned_segment
CL = ES:[0]                  ; count of pointer records
DI = 1

for each pointer record:
    DX:AX = dword ES:[DI]
    AX = (DX:AX >> 4) + 1
    ES:[DI] = ES + AX
    DI += 8
```

Then it walks four additional data records, normalizes far pointers, optionally
patches references, pushes four far pointers, and calls `8A4Ch`. Without
source, the safest label is "custom data-file loader/relocator", not a generic
depacker. The important point is that `008`, `009`, and `00A` are not raw
screen files like `000..007`; they contain pointer-bearing internal data.

## Cleanup

The common cleanup at `8C4Dh` restores the PIT and original INT `08h` vector,
then reinstates the PIC mask saved for that timer installation:

```asm
8C4D  cli
8C4E  out 43h,34h
8C52  out 40h,0
8C56  out 40h,0

ES = 0000h
ES:[0020h] = [8E69h]
ES:[0022h] = [8E6Bh]
out 21h, [8E6Dh]
sti
```

The main-to-credits branch calls this once before loading the credit resources.
The final `85DFh` path fades, restores BIOS text mode `03h`, calls `8C4Dh`
again for the credit-stage timer state, writes the separately saved process
PIC mask from `[001Ah]` to port `21h`, and exits through DOS `AH=4Ch`. The
87.920203-second run reached that path and returned normally, so teardown is
now direct runtime evidence as well as a static code claim.

## Why This Was A Milestone

The demo is early enough that its own setup text still has to explain the idea
of an external 8-bit D/A converter, but the program is already using several
techniques that define later PC demos:

- LZEXE compression around a larger restored MZ body;
- direct VGA planar frame loading in mode `0Dh`;
- multiple preloaded A000h pages selected by CRTC start registers;
- palette fades through DAC reads/writes instead of framebuffer processing;
- a timer IRQ sample player with a self-patched output port;
- 4bpp nibble-shifted bottom scroller text;
- a separate credits renderer that streams character slices into VGA planes.

The most important inner-loop lesson is that `X-Mas Demo '90` treats the PC as
a register-level video/audio machine, not as a BIOS drawing target. For late
1990 MS-DOS, that is the difference between a seasonal novelty and a real early
PC demo milestone.
