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

# Xmas '91 by Xerox - Technical Dissection

`Xmas '91` / `x_x_mas.zip` is a 1991 MS-DOS Christmas demo by Xerox. The
Hornet 1991 index lists the archive as `Xmas '91 by Xerox`, and the main screen
credits the code/art as `written by Snoopy and Magician`.

Release year: 1991

This one is much smaller structurally than the loader-driven Christmas demos
from TCB or The Skyhawks. The archive contains one main packed MZ executable,
one GIFEXE sidecar, a BBS ad text file, and the shared `demosite.com` sidecar.
The real demo is `x-x-mas.exe`: a single mode `13h` program with embedded RIX3
art, Scream Tracker Music Interface Kit 0.2, a setup prompt, a script-driven
right-edge font strip, three small sprite blitters, a particle/star table, and
an ending picture reveal.

![Direct Xerox Xmas '91 six-state runtime sequence](images/xerox-xmas-91-runtime-sequence.png)

These six untouched native `640x400` frames come from one complete silent run
of the restored main executable. The upper row samples the live postcard,
17-row strip scroller, three-record sphere path, and particle field; the lower
row follows the even/odd ending reveal into its full hold and fade. They replace
the old decoded-resource sheet as the lead because they are the actual screen
states produced by the loops dissected below.

![Direct Xerox Xmas '91 main-loop motion](images/xerox-xmas-91-runtime-main.gif)

This four-second full-frame excerpt begins at graphics-stream `7.000` seconds.
The upper text advances by a fixed two-pixel-wide source strip, three successive
path records move the shaded sphere art, and every configured one-pixel
particle advances each frame. The stable central logo comes from the first RIX
pixel page displayed with the third RIX palette.

## Direct Silent Runtime

The packed `x-x-mas.exe` carrier still falls into its illegal-instruction stub
under DOSBox-X `2024.03.01`, commit `02f36ba`. The direct visual run therefore
uses the already hash-recorded `XXMAS.EXE` produced from that carrier by UNP;
this is the same restored load image used for the offsets below, not a patched
or rewritten demo.

The 2026-08-25 run used `svga_s3`, 4 MiB, a `normal` 386 core, fixed 12,000
cycles, native internal ZMBV recording, and disabled/dummy audio. DOSBox-X ran
with `-silent` and its output went to an ignored log. The scripted route answered
`Y` to the first “less than 16 MHz” question, which takes the executable's own
no-sound branch, then held Space for the exit test. No demo audio was produced,
monitored, or auditioned. The scratch AVI's dummy PCM stream is sample-exact
zero (`min = max = 0`, RMS `-inf`); published assets are visual-only.

```text
setup stream     720x400, 210 frames, 2.996293 seconds
graphics stream  640x400, 1,779 frames, 25.382991 seconds
video cadence    2190197/31250 ~= 70.086304 frames/second
0.000..~19.0     live postcard/scroller/sphere/particle loop
~19.0..~20.43    100 even scanlines, top to bottom
~20.43..~21.85   100 odd scanlines, bottom to top
~21.85..~23.56   complete ending held for 120 retraces
~23.56..~23.90   visible cumulative palette collapse
~23.90..25.383   remaining programmed all-black fade steps and DOS return
```

DOSBox-X exited with host status 0 after the demo restored text mode, its saved
stack pointer, and returned through DOS function `4Ch`. The approximate reveal
start reflects the scheduled Space event; the retrace-counted durations after
that point are fixed by the executable.

## Embedded Resource And Runtime Concordance

![Corrected Xerox Xmas '91 embedded RIX3 source pages](images/xerox-xmas-91-rix-contact.png)

The earlier version of this sheet was shifted by three bytes because it confused
segment-relative addresses with resource-relative offsets. Each `RIX3` magic is
three bytes after the segment base used by the code. The corrected sheet uses
the standard resource-relative palette at `+000Ah` and pixels at `+030Ah`, with
each source page's own palette. It is useful as a source atlas, but it is not a
runtime screenshot: the live opening combines RIX1 pixels with the RIX3 palette,
and RIX2 is sampled as glyph/sphere data rather than displayed whole.

The archive also contains `(c)law.exe`, a GIFEXE wrapper with a valid embedded
640x350 GIF sidecar:

![Decoded GIFEXE sidecar still](images/xerox-xmas-91-claw-gif.png)

Front-page media note: the card now uses direct main-loop and ending motion plus
a direct still. The corrected source atlas and decoded GIFEXE sidecar remain
inside the article with their separate evidence boundaries.

Historical phone/contact strings exist in the bundled text and executable
data. They are intentionally omitted here.

The corrected atlas is tied to three RIX3 magic offsets in `xxmas.load`:
opening art at flat `008893h`, alphabet/sphere source art at `0185A3h`, and
ending art at `0282B3h`. Their code-facing segment bases are respectively
`0889h`, `185Ah`, and `282Bh`, each three bytes before its magic.

After the main entry at `0003B6h` switches to mode `13h`, it loads the third
RIX palette from `282B:000D`. Flat address `0282BDh` is resource-relative
`+000Ah`, the standard palette position. It later copies the first RIX pixels
from `0889:030D`; flat `008B9Dh` is likewise resource-relative `+030Ah`. The
result is the direct runtime's black-backed Christmas postcard: first-resource
pixels interpreted through the third resource's palette, not the first source
page displayed with its own palette.

The second RIX page is not just reference art; it is the runtime source sheet.
The script/glyph path reads pre-rendered font columns from the RIX2 payload:
the script stream at segment `37FCh` selects character metadata, and the
right-edge strip blitter copies two-byte-wide columns from segment `185Ah` using
source offset `030Dh + glyph_y*320 + glyph_x + phase`. The same second RIX
resource supplies three consecutive `28x27` sphere/path samples drawn from the
table at `038610h`.

The third RIX page maps to the exit sequence. On the nonzero port-`60h` test,
the code copies the ending resource from segment `282Bh` using source offset
`030Ch`, first
filling even scanlines from top to bottom, then odd scanlines from bottom to
top. Because the segment base is three bytes before the magic, this is
resource-relative `+0309h`: one byte before the standard pixel page. Every
destination row therefore begins with the preceding source byte, continues
with source x=0..318, and omits source x=319. The direct ending GIF shows the
actual one-pixel-shifted result and measured timing. A pixel comparison closes
the mapping: after sampling the native 2x presentation, runtime x=1..319 and
corrected RIX3 x=0..318 are RGB-identical (`PSNR = infinity`) across all 200
rows.

The sidecar still has a different boundary. `(c)law.exe` is a GIFEXE wrapper:
UNP expands only the viewer/runtime, while the actual 640x350 GIF starts as
overlay data at packed-file offset `16622`, immediately after the original MZ
image. The decoded sidecar still is therefore an archive asset reference, not a
screen reached by the main `x-x-mas.exe` loop.

The evidence boundary is now explicit: direct native frames prove the live
composition and timing; the corrected RIX sheet proves standard-offset embedded
source pages; and the GIFEXE still remains a separate archive sidecar.

## Sources

- Hornet 1991 demo index:
  https://ftp.scene.org/mirrors/hornet/demos/1991/00_index.txt
- Scene.org archive:
  https://ftp.scene.org/mirrors/hornet/demos/1991/x_x_mas.zip
- Scene.org file page:
  https://files.scene.org/view/mirrors/hornet/demos/1991/x_x_mas.zip
- UNP was run under DOSBox-X against local copies of the packed executables.

## Archive

The examined archive is `x_x_mas.zip` from the Hornet mirror:

```text
x_x_mas.zip  167918 bytes
```

ZIP contents:

```text
(c)law.exe      27674 bytes   1991-12-05 20:21
bbs-ad.txt       5201 bytes   1991-12-20 13:30
demosite.com     1709 bytes   1992-11-16 17:28
x-x-mas.exe    146302 bytes   1991-12-25 21:47
```

Hashes:

```text
cea333c0926fd38ae112a854524f0fa4b110dbd9b4236104580a1f56728d22bb  x_x_mas.zip
378425a54a63f2770aa5e6a9bebb18315d53a9d1c80a911eceac0c984443564e  x-x-mas.exe packed
6412e3e3bc086c307eecd62e1ec4b844e6c644a705fb1774abea7892c8643457  (c)law.exe packed
fd28e7d0ba272e49e0904d210cb4c6f1673520e3e5e4ccec16bd36ea4b558fe1  XXMAS.EXE UNP-expanded
ad9693c9fed758b9da7ee471987f09648af7b30e1cdafc4b4e43d04cce9e8076  CLAW.EXE UNP-expanded
8db49b14f3a1e356a1da2dc61395a31bd4dd5e31c5791819cab81381ff1254bc  xxmas.load stripped load image
ec2ef7a42374cfe63cb35203969f4d65004d2bab2ec5a10bd1e16548b1b1b27c  claw.load stripped load image
```

`file(1)` misidentifies the packed `x-x-mas.exe` as a self-extracting PKZIP
archive, but `unzip` finds no central directory. The useful path is the normal
old DOS-demo path: unpack the MZ with UNP, strip the MZ header, then inspect the
load image.

## MZ Layout After UNP

Packed MZ headers:

```text
file          packed size  MZ image  header  entry
(c)law.exe        27674     16622      32     03F7:000E -> 03F7E
x-x-mas.exe      146302    146302     112     FFF0:0100 -> 100000
```

The `x-x-mas.exe` entry value is a packed-stub trick. After UNP, the main
program is a normal MZ with a raw load image that starts at offset zero:

```text
file          expanded size  MZ image  header  relocs  entry
CLAW.EXE           39472       28420     48       3     0000:0000 -> 00000
XXMAS.EXE         377480      377480    512      29     0000:03B6 -> 003B6
```

The stripped load image for `XXMAS.EXE` is `376968` bytes. Its important flat
offsets are:

```text
000263  one-key yes/no helper
000273  setup prompt/configuration routine
00033a  palette attenuation helper
0003b6  main entry
000a01  <STMIK020> marker
008893  first RIX3 picture resource
0185a3  second RIX3 picture resource
0282b3  third RIX3 picture resource
037fc0  scroller/script text stream
038610  moving-sprite path table
03c130  particle table segment image
```

The sidecar `(c)law.exe` is a GIFEXE wrapper. Its expanded executable load image
is just the viewer/runtime. The actual GIF lives as overlay data in the packed
file at offset `16622`, immediately after the original MZ image. That is why
UNP expansion alone is not enough to recover the sidecar picture.

## Embedded RIX Resources

The main load image contains three RIX3 resources at these flat offsets:

```text
offset   role
08893    opening Xerox logo/reflection screen
185A3    font/alphabet and sprite source screen
282B3    ending "written by Snoopy and Magician" screen
```

Each code-facing segment starts with three bytes of unrelated preceding data;
the byte header beginning at segment offset `0003h` is:

```text
52 49 58 33 40 01 c8 00 af 00 00 00 00 ...
R  I  X  3  320   200  mode  reserved...
```

The standard 320x200 RIX layout puts the palette at resource `+000Ah` and
pixels at resource `+030Ah`. The apparent `+000Dh` / `+030Dh` code offsets are
relative to segment bases three bytes before the RIX magic, so they resolve to
those standard positions:

```asm
0418  mov ax,282bh       ; third RIX segment
041b  mov bx,000dh       ; segment +0Dh = RIX resource +0Ah
0424  mov ax,1012h       ; BIOS set block of DAC registers
0428  mov cx,0100h       ; 256 entries
042b  mov bx,0000h       ; starting DAC index
042e  int 10h
```

Normal page/source copies use segment `+030Dh`, which is resource `+030Ah`.
Only the ending screen uses segment `+030Ch`, or resource `+0309h`, one byte
early in both reveal passes. The corrected atlas decodes the three standard
source pages; the direct ending visuals preserve the executable's shifted
runtime copy.

## Setup Routine

`000263` is a tiny yes/no helper. It reads one DOS console character with
`int 21h, AH=01h`; if the key is `y` or `Y`, it returns with carry set,
otherwise carry clear:

```asm
0263  mov ah,01h
0265  int 21h
0267  cmp al,79h          ; 'y'
0269  je  0271
026b  cmp al,59h          ; 'Y'
026d  je  0271
026f  clc
0270  retf
0271  stc
0272  retf
```

The setup code at `000273` prints DOS `$`-terminated strings from the code
segment and stores answers in a small variable block at `03bf..03cc`:

```text
03bf word  script offset into segment 37fc
03c1 byte  current glyph-column / strip offset
03c3 byte  frame delay countdown
03c4 byte  glyph-column step, default 2
03c5 word  particle/speed count, default 30
03c7 byte  Sound Blaster IRQ, default 7
03c8 word  Sound Blaster base, default 0220h
03ca word  STMIK timing parameter, default 2328h
03cc byte  sound enabled flag, default 1
03cd word  saved stack pointer
```

The prompts are speed and Sound Blaster oriented:

```asm
0273  print first speed question
027e  call yes/no
0283  jae 028f
0285  cs:03cc = 0        ; very slow path: disable sound
028c  jump setup_done

028f  cs:03c5 = 001eh    ; particle count / speed count
0296  cs:03ca = 2134h
029d  print second speed question
02a4  call yes/no
02a9  jae 02b9
02ab  cs:03c5 = 0032h
02b2  cs:03ca = 3e80h

02b9  print SoundBlaster question
02c0  call yes/no
02c5  jb  02d8
02c7  cs:03cc = 0
02ce  cs:03c5 = 003ch
```

If sound is enabled, it asks for a Sound Blaster I/O base and IRQ. The I/O base
parser accepts ASCII `1` through `6` and computes:

```text
base = 0200h + (digit * 16)

1 -> 0210h
2 -> 0220h
3 -> 0230h
4 -> 0240h
5 -> 0250h
6 -> 0260h
Enter -> keep default 0220h
```

IRQ handling is literal. Only keys `1`, `3`, `5`, and `7` update `cs:03c7`;
any other key leaves the default or previous value.

## STMIK Sound Hook

The string `<STMIK020>` appears at `000a01`, followed by the Scream Tracker
Music Interface Kit dispatch wrapper. The main code does not inline a mixer;
it uses far calls to `00a0:000f`.

Startup calls:

```asm
03dd  ax = 0000h
03e0  bl = 01h
03e2  bh = [cs:03c7]     ; IRQ
03e7  cx = [cs:03c8]     ; SB base
03ec  dx = [cs:03ca]     ; timing parameter
03f2  call 00a0:000f

03f8  ax = 0003h, bx = 0001h
03ff  call 00a0:000f

0405  ax = 0001h, bx = 3c2ah
040c  call 00a0:000f
```

Per visual frame, the main loop calls:

```asm
0739  ax = 0004h
073c  call 00a0:000f
```

Exit calls:

```asm
092c  ax = 0003h, bx = 0000h
0932  call 00a0:000f
0937  ax = 0004h
093a  call 00a0:000f
09ce  ax = 0002h
09d1  call 00a0:000f
```

The exact STMIK command names are not recovered from symbols, so the safest
reading is functional: `0000h` initializes with IRQ/base/timing, `0004h` is
called once per frame while the visual loop runs, and `0002h` is part of final
shutdown.

## Palette Helper At 033a

The far routine at `00033a` is a retrace-paced palette attenuation helper.
Inputs on the call site at exit are:

```text
DS:SI = 282b:000d   source palette from RIX3 ending screen
DX    = 282b        destination/scratch segment
AL    = 01h         attenuation step
```

The routine copies 768 palette bytes from `DS:SI` to `ES:000d`, subtracting the
current attenuation value in `AH` and clamping underflow to zero. `DS` and `ES`
are both `282Bh`, so source and destination alias: each pass modifies the table
that the next pass reads.

```asm
033a  mov bh,al          ; bh = attenuation increment
033c  mov ah,00h
033e  mov es,dx
0340  mov cx,0040h       ; 64 attenuation levels
0343  push ax
0344  push cx
0345  push si
0346  mov di,000dh
0349  mov cx,0300h       ; 768 DAC bytes
034c  lodsb
034d  sub al,ah
034f  jae 0353
0351  xor al,al
0353  stosb
0354  loop 034c
```

Then it waits for vertical retrace and writes the full 768-byte table to the
VGA DAC. The copy is split into two blocks of `0x40` iterations, with six DAC
bytes per iteration:

```asm
0371  mov dx,03c8h
0374  xor al,al
0376  out dx,al          ; DAC start index 0
0377  inc dx             ; 03c9h data port
0379  lodsb
037a  out dx,al
037b  lodsb
037c  out dx,al
037d  lodsb
037e  out dx,al
037f  lodsb
0380  out dx,al
0381  lodsb
0382  out dx,al
0383  lodsb
0384  out dx,al
0385  loop 0379
```

It performs a second retrace wait and the same `64 * 6` write block for the
remaining half of the DAC table. After each full 256-color write:

```asm
03ae  pop si
03af  pop cx
03b0  pop ax
03b1  add ah,bh          ; next attenuation level
03b3  loop 0343
```

So `AL=1` gives 64 palette updates over 128 retraces, or about 1.826320 seconds
at the captured cadence. It is not a linear source-minus-level fade. The
in-place table loses cumulative amounts `0, 1, 1+2, 1+2+3, ...`; by the twelfth
upload the cumulative subtraction is 66, greater than every 6-bit DAC component.
The visible picture therefore reaches black after about 24 retraces / 0.342435
seconds, while the helper spends roughly another 1.48 seconds uploading already
black tables. The direct ending GIF and final black tail match that distinction.

## Main Startup

The main entry begins at `0003b6`:

```asm
03b6  push sp
03b7  pop ax
03b8  mov [cs:03cd],ax    ; save stack pointer for final restoration
03d4  cli
03d5  cmp byte [cs:03cc],0
03db  je  0412            ; skip STMIK if no sound
...
0412  mov ax,0013h
0416  int 10h             ; 320x200x256
```

After mode set it loads the third RIX palette through BIOS `int 10h, AX=1012h`,
then explicitly overwrites DAC entries `255..251` with five grayscale-ish
values:

```text
index  RGB6
255    32,32,32
254    28,28,28
253    21,21,21
252    1a,1a,1a
251    13,13,13
```

Particle classes cycle through `1..4` and add `0FBh`, so they use entries
`252..255`. Entry 251 is initialized by the same five-entry block but is spare
for this particle path.

## Particle Table Initialization

The code builds a table of 6-byte records in segment `3c13`:

```text
record +0  x word
record +2  y word
record +4  speed/color-class word
```

The initialization loop starts at `04b1`. It uses `cs:03c5` as count, so the
speed/setup choices also change how many records are created:

```asm
04b1  mov dx,3c13h
04b4  mov es,dx
04b6  xor di,di
04b9  xor bx,bx
04bc  mov cx,0025h       ; x seed
04bf  mov dx,0045h       ; y seed
```

Each record advances the seeds deterministically:

```asm
04c2  add cx,dx
04c4  cmp cx,0140h       ; wrap x in 0..319
04ca  sub cx,0140h       ; repeat until inside range

04d0  add dx,cx
04d2  cmp dx,00adh       ; wrap y in 0..172
04d8  sub dx,00adh
04de  cmp dx,0014h       ; keep y above 20
04e3  add dx,0014h

04e8  inc bx
04eb  cmp bx,0005h
04f0  mov bx,0001h       ; cycle 1..4
```

It stores `(x,y,bx)` and probes the target A000 pixel. If that pixel is zero,
it writes color `BL + 0xfb`, producing palette indices `0xfc..0xff`:

```asm
0501  ax = 0140h * y + x
050a  ds = a000h
0514  lodsb              ; read current screen pixel
051a  cmp al,00h
051c  jne skip_draw
051e  add bl,0fbh
0533  mov al,bl
0535  stosb              ; write one pixel at A000:y*320+x
053a  sub bl,0fbh
```

There is a subtle ordering point: after this table build, the program copies
the first RIX image over the full A000 page:

```asm
056a  mov ax,030dh
056e  mov dx,0889h       ; first RIX segment
0571  mov ds,dx
0573  mov si,ax
0575  mov es,a000h
057a  xor di,di
057d  mov cx,0fa00h      ; 64000 bytes
0580  rep movsb
```

So the durable result of the initialization is the table. Any pixels drawn
before `056a` are overwritten by the opening Xerox picture.

## Main Loop Overview

The visual loop starts at `0588`. It preserves registers with `pusha`, but it
does **not** sample and save an initial keyboard-port byte. `AL` is still zero
from the preceding `mov ax,A000h`; `rep movsb` does not change it. The
self-modified byte at `0586` is therefore a fixed zero baseline, written once
before later iterations jump directly back to `058Dh`:

```asm
0588  pusha
0589  mov [cs:0586],al
058d  in  al,60h
058f  mov bl,[cs:0586]
0594  cmp bl,al
0596  je  059b
0598  jmp 0923           ; any nonzero scan code exits to ending
```

Each iteration has this shape:

```text
1. Handle script delay/glyph control.
2. Scroll a narrow A000 band by two bytes.
3. Blit a small strip from RIX2 into the right edge.
4. Wait for vertical retrace.
5. Call STMIK frame service.
6. Draw three moving 28x27 sprite blocks from RIX2.
7. Update every configured particle/star record.
8. Repeat.
```

The direct route uses held Space, whose make code `39h` differs from the zero
baseline. The test is not a general “port changed since startup” detector; it
is a zero-versus-nonzero poll.

## Script And Glyph Selection

The script stream lives at segment `37fc`, with the current offset in
`cs:03bf`. The beginning is plaintext:

```text
HERE COMES THE   c b X-MAS-DEMO c pp  ... IT COULD NOT BE TESTED WELL...
```

The loop reads one byte from `37fc:[03bf]` and treats four ASCII bytes as
control commands:

```asm
05be  mov bl,[si]
05c0  cmp bl,70h         ; 'p'
05c3  je  delay
05c5  cmp bl,7ah         ; 'z'
05c8  je  step_1
05ca  cmp bl,79h         ; 'y'
05cd  je  step_2
05cf  cmp bl,78h         ; 'x'
05d2  je  step_3
```

Control effects:

```text
'p'  cs:03c3 = 0x28   ; 40-frame pause
'z'  cs:03c4 = 1      ; one-column glyph advance
'y'  cs:03c4 = 2      ; two-column glyph advance
'x'  cs:03c4 = 3      ; three-column glyph advance
```

Normal printable bytes subtract `0x20` and index a 6-byte metadata table at
`37FC:04B8 + (char - 0x20) * 6`:

```asm
061b  sub bx,0020h
061e  mov ax,0006h
0621  mul bx
0623  mov si,04b8h
0626  add si,ax
0628  mov ax,[si+0]      ; source x/base
062a  mov bx,[si+2]      ; source y
062d  mov cx,[si+4]      ; glyph width / span count
```

The byte `cs:03c1` is the current column/phase within that glyph. When it
reaches the metadata width, the script offset advances and `03c1` is reset.
Otherwise the code adds the phase to the source x coordinate and draws the
next strip.

The script offset wraps at `0x04b8`, which is also the start of the metadata
area in the same `37FCh` data segment:

```asm
0608  add ax,0001h
060b  cmp ax,04b8h
0610  mov ax,0000h       ; wrap
0613  mov [cs:03bf],ax
```

## A000 Band Scroll

The scroll step is tiny but important. It copies words inside A000 from
`0282` to `0280`, for `0x0b3e` words:

```asm
066a  mov cx,a000h
066d  mov es,cx
066f  mov di,0280h
0672  mov cx,a000h
0675  mov ds,cx
0677  mov si,0282h
067a  mov cx,0b3eh
067d  rep movsw
```

`0B3Eh` is a **word** count: 2,878 words / 5,756 bytes, not the previously
claimed 11,512 bytes. The destination starts at row 2 (`0280h`) and ends at row
19, x=315 (`18FBh`). Rows 2..18 receive a complete continuous two-byte left
shift; the partial final row receives x=2..317 into x=0..315. This is a narrow
roughly 18-row upper overlay, not a 36-row region.

The direction matters. Because `DI < SI` and `cld` is set, `rep movsw` safely
copies leftward without self-overwriting the not-yet-read source.

## Right-Edge Strip Blit

After shifting the band, the code copies a tiny strip from RIX2 to the right
edge of A000. It stores parameters into self-modified data slots around
`0685..068f`, then performs a generic rectangle copy:

```asm
069d  dst_x = 013eh      ; x = 318
06a9  dst_y = 0002h
06b0  width = 0002h
06b7  height = cx        ; fixed CS:03C2 = 0011h = 17 rows
06bc  ds = 185ah         ; RIX2 segment
06c1  es = a000h
```

The source row calculation is:

```asm
06c7  ax = glyph_source_y
06cb  dx = 0140h
06ce  mul dx
06d0  add ax,030dh       ; RIX2 pixel payload
06d3  add ax,glyph_x_plus_phase
06d8  si = ax
```

The destination row calculation is:

```asm
06da  ax = dst_y
06de  dx = 0140h
06e1  mul dx
06e3  add ax,dst_x
06e8  di = ax
```

The inner rectangle loop is:

```asm
06ea  dx = height
06ef  cx = width
06f4  rep movsb          ; two bytes per row here
06f6  add si,0140h
06fa  add di,0140h
06fe  sub si,width
0703  sub di,width
0708  dec dx
070c  jne 06ef
```

The glyph metadata's third word controls horizontal source width/phase, not
rectangle height. Before the band copy, `CL` is loaded from `CS:03C2`, whose
initialized value is `11h`; it survives the copy on the stack and becomes the
generic blitter's row count. The insertion is therefore always exactly
`2x17 = 34` source and destination bytes at x=318, rows 2..18. It repairs the
cross-row bytes introduced by the continuous 5,756-byte shift while publishing
the next two source columns. No font mask or per-pixel rasterizer is involved.

On a normal non-pause frame, the chunky-memory ledger is therefore:

```text
upper-band shift       5,756 source reads + 5,756 A000 writes
right-edge strip          34 source reads +    34 A000 writes
three sphere blocks    2,268 source reads + 2,268 A000 writes
30-particle route         60 A000 probes + at most 60 A000 writes
maximum observed total 16,236 byte accesses, before loop/control overhead
```

The `p` command's 40-frame countdown jumps directly to the retrace service, so
pause frames omit the 11,580 band/strip accesses while sphere and particle
motion continue. The 50/60-particle setup branches use respectively 100/100 or
120/120 probe/write maxima, but do not change the strip or sphere kernels.

## Vblank And Sound Service

Every visual iteration waits for a clean vertical retrace edge:

```asm
0729  mov dx,03dah
072c  in  al,dx
072d  test al,08h
072f  jne 072c           ; wait until not in retrace
0731  in  al,dx
0732  test al,08h
0734  je  0731           ; wait until retrace begins
```

Immediately after that:

```asm
0739  mov ax,0004h
073c  call 00a0:000f
```

The visual loop is therefore retrace paced, and the sound interface is serviced
once per frame.

## Three Successive Sphere-Path Blits

The larger moving art is also copied from RIX2. The path table lives
at segment `3861`. Word `3861:0000` is a moving pointer into 6-byte records:

```text
record +0  destination x
record +2  destination y
record +4  source selector
```

The first few records are visible in the load image:

```text
0114 0046 0005
0114 0046 0005
0114 0047 0005
0113 0048 0004
...
```

The outer loop draws three records per frame:

```asm
0741  mov cx,0003h
074b  ds = 3861h
0750  si = 0000h
0753  bx = [si]          ; current path pointer
0755  dx = [bx+0]        ; dest x
0757  cx = [bx+2]        ; dest y
075a  ax = [bx+4]        ; source selector
```

The selector is turned into a source x position:

```asm
075e  bx = 001ch
0761  mul bl             ; AX *= 28
0763  sub ax,0015h
```

Then a generic block copy takes `28` bytes per row for `27` rows from RIX2 to
A000:

```asm
0786  source_y = 001eh
0792  width    = 001ch   ; 28 bytes
0799  height   = 001bh   ; 27 rows
07a0  ds = 185ah
07a5  es = a000h
...
07d3  cx = width
07d8  rep movsb
07da  add si,0140h
07de  add di,0140h
07e2  sub si,width
07e7  sub di,width
07ec  dec dx
07f0  jne 07d3
```

After each sprite copy, the path pointer advances by one 6-byte record:

```asm
07fa  pop bx
07fb  add bx,0006h
0800  cmp ax,3b11h
0805  mov ax,0002h       ; wrap pointer
080d  es = 3861h
0810  stosw              ; store new pointer at 3861:0000
```

The pointer runs from `0002h` through `3B0Ch` in six-byte steps: exactly 2,520
records. One frame consumes three consecutive records and copies
`3 * 28 * 27 = 2,268` bytes, so the complete table cycle is 840 frames, about
11.985223 seconds at the captured cadence. These are three adjacent samples of
one shared path stream, not three independently indexed objects. There is no
transparency test, mask, or decompression; the direct GIF shows the source
rectangles' shaded spheres moving through their recorded positions.

## Particle Update Loop

The particle update begins at `0821`. The older reading missed its outer loop:
`CX` starts at the configured count, is restored at `0914h`, decremented, and
branches back to `0826h` until zero. It therefore processes all 30, 50, or 60
records every frame. The current record index at `3C13:0168` advances once per
inner iteration and wraps at `CS:03C5`:

```asm
0821  cx = [cs:03c5]     ; configured record count
082e  bx = [cs:03c5]
0833  ds = 3c13h
0838  si = 0168h
083d  ax = [si]
0840  cx = ax + 1
0843  cmp cx,bx
0847  cx = 1             ; wrap when beyond count
084c  es:0168 = cx
```

The selected record address is:

```asm
0857  si = 0000h
085a  ax = cx
085d  cx = 0006h
0860  mul cx
0863  sub ax,0006h
0866  add si,ax          ; record = base + (index - 1) * 6
0868  cx = [si+0]        ; x
086a  dx = [si+2]        ; y
086d  bx = [si+4]        ; speed/color class
```

Erase is conditional. It reads the current pixel, computes the particle color
`BL + 0xfb`, and only clears if the pixel still matches that particle color:

```asm
0876  ax = 0140h * y + x
087f  ds = a000h
0889  lodsb              ; current pixel
088f  add bl,0fbh
0892  cmp al,bl
0894  jne skip_clear
0896  bx = 0000h
08ab  al = bl
08ad  stosb              ; clear to color 0
```

That prevents the particle eraser from punching holes through the picture,
scroller, or sprite blocks if something else has overwritten the pixel.

The motion is horizontal only:

```asm
08b3  add cx,bx          ; x += speed/class
08b5  cmp cx,0140h
08bb  sub cx,0140h       ; wrap at 320
```

The draw step is also conditional. It only draws if the new target pixel is
zero:

```asm
08c4  ax = 0140h * y + x
08cd  ds = a000h
08d7  lodsb
08dd  cmp al,00h
08df  jne skip_draw
08e1  add bl,0fbh
08f6  al = bl
08f8  stosb
08fd  sub bl,0fbh
```

Finally it writes the new `(x,y)` back to the particle record:

```asm
0907  di = si
0909  ax = cx
090b  stosw              ; new x
090c  ax = dx
090e  stosw              ; y unchanged
```

At the maximum setup count, 60 six-byte records occupy offsets `0000h..0167h`;
the rotating index word begins exactly at `0168h`. One frame performs 60 old-
pixel probes, 60 new-pixel probes, and at most 120 single-byte writes. The
speed/class word both advances x by 1..4 and selects DAC entry 252..255. Thus
the field moves at full frame cadence while its guarded erase/draw avoids
damaging nonzero logo, strip, or sphere pixels.

## Ending Reveal And Exit

When port `60h` differs from the fixed zero baseline, execution jumps to
`0923`. If sound is enabled it makes two STMIK calls, then reveals the third
RIX picture in two passes.

![Direct Xerox Xmas '91 even/odd ending reveal and fade](images/xerox-xmas-91-runtime-ending-reveal.gif)

This untouched five-second full-frame excerpt begins at graphics-stream
`18.800` seconds. Alternating horizontal lines appear downward first; the gaps
then fill upward from the bottom; the complete ending holds; and the cumulative
in-place DAC fade collapses visibly to black long before all 64 programmed
updates finish.

Forward pass:

```asm
093f  bx = 0000h
0942  es = a000h
0947  ax = 0140h * bx
094c  di = ax
094e  ds = 282bh
0953  si = di + 030ch
0959  cx = 00a0h
095d  rep movsw          ; copy 320 bytes = one scanline
095f  wait retrace
0972  bx += 2
0975  cmp bx,00c8h       ; 200
0979  jne 0942
```

Although `BX` advances by two, only one scanline is copied per loop. The pass
therefore fills even-numbered scanlines first. It takes 100 retrace waits,
`1.426812` seconds at the captured cadence.

Backward pass:

```asm
097b  bx = 00c7h         ; 199
097e  es = a000h
0983  ax = 0140h * bx
0988  di = ax
098a  ds = 282bh
098f  si = di + 030ch
0995  cx = 00a0h
0999  rep movsw
099b  wait retrace
09ae  bx -= 2
09b1  cmp bx,ffffh
09b4  jne 097e
```

This fills odd-numbered scanlines from bottom to top. It is another 100 retrace
waits, again `1.426812` seconds.

Then it holds the screen for `0x78` retraces:

```asm
09b6  mov cx,0078h
09b9  wait retrace
09cc  loop 09b9
```

That is `1.712175` seconds. After the hold, the code calls STMIK
shutdown, runs the palette attenuation helper described above, switches back to
text mode `03h`, restores the saved stack pointer, and exits through DOS
`int 21h, AH=4Ch`. The observed status-0 host return closes that cleanup path.

## Effect Timeline

The direct AVI supplies the wall-clock boundary and the explicit retrace loops
supply exact post-Space durations. The central part remains user-controlled;
its ~19-second duration here is the selected observation window, not an authored
automatic endpoint.

```text
time after setup     event
0.000..~19.0         RIX1 pixels/RIX3 palette, strip, spheres, all particles
exit + 0.000..1.427  even scanlines copied top to bottom
exit + 1.427..2.854  odd scanlines copied bottom to top
exit + 2.854..4.566  ending held for 120 retraces
exit + 4.566..4.909  cumulative palette reaches all black
exit + 4.909..6.393  remaining black DAC uploads, text mode, DOS return
```

Instruction time and mode/return work add small overheads, but the
reveal/hold/fade structure is fixed by the code and visually matches the direct
sequence.

## Why It Feels Different From The Loader Demos

The other 1991 Christmas demos in this pass often use separate child programs,
data wrappers, or planar modes. Xerox's demo is closer to a single-screen VGA
postcard with several small overlays:

- The art is embedded as three 320x200 chunky RIX screens.
- The font is not rasterized from a bit font at runtime; the code pulls strips
  from a pre-rendered alphabet page.
- The moving spheres are three consecutive unmasked path-record copies from
  that same source page.
- The "stars" are 30/50/60 one-pixel records, all updated every frame with
  collision-aware erase/draw.
- The ending is a scanline reveal of the third embedded RIX page.

That makes the main loop easy to underestimate. It is not doing heavy math, but
it is quite explicit about VGA timing and memory ownership: every visual write
is either a raw A000 copy, a retrace-paced DAC write, or a guarded one-pixel
particle update.
