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

# Sphinx by UltraForce - Technical Dissection

`Sphinx` is a November 1990 MS-DOS demo by UltraForce, coded by Bram
Graveland. Pouet lists it as an MS-DOS demo released in November 1990, Demozoo
also gives November 1990, and the Hornet 1990 demo index lists `sphinx.zip` as
`Sphinx by Ultraforce` with a `**` rating.

Release year: 1990

This is a compact single-effect VGA production. It is not a multipart demo and
it has no music engine. The whole visible show is one mode-13h scene:

- a golden Sphinx face is line-warped through a 256-entry signed wave table;
- an opaque four-frame mouth/face patch is copied into the source image after
  each warp, becoming input to the following frame;
- a hidden column-major text ribbon is shifted in memory;
- the ribbon is projected through another offset table in two passes, making
  the scroller appear to pass behind and in front of the Sphinx head;
- a transparent bottom signature/logo block is overlaid;
- the final backbuffer is copied to A000h in two halves with a live DAC write
  between them.

That makes it a useful 1990 specimen: the effect is short and approachable, but
the inner loop is not just a flat blit. It already combines VGA palette timing,
line displacement, transparent compositing, an arced scroller, and per-frame
source-image mutation.

The encoded scroller contains old private contact details. Those details are
deliberately omitted here.

## Sources

- Pouet production page:
  https://www.pouet.net/prod.php?which=4087
- Demozoo production page:
  https://demozoo.org/productions/346261/
- Hornet 1990 demo index:
  https://files.scene.org/get/mirrors/hornet/demos/1990/00_index.txt
- Scene.org archive:
  https://files.scene.org/get/mirrors/hornet/demos/1990/sphinx.zip
- Scene.org file page:
  https://files.scene.org/view/mirrors/hornet/demos/1990/sphinx.zip

Pouet gives title `Sphinx`, group `UltraForce`, platform `MS-Dos`, type `demo`,
and release date `november 1990`. Demozoo gives `Released November 1990` and
platform `MS-Dos`. The Hornet index line is:

```text
sphinx.zip        32347 **    Sphinx by Ultraforce
```

## Runtime Capture

Timing zero is the start of `dx-capture /v SPHINX.EXE` in DOSBox-X 2026.01.02
on 2026-06-19 UTC, normal CPU core, `cycles=3000`, MPEGTS H.264 capture. Host
video and audio both used dummy SDL backends, DOSBox-X had `nosound=true`, and
no audio was auditioned. A delayed Escape key ended the run at about 20
seconds. The captured movie duration was about 23.1 seconds including the
post-exit delay.

![Sphinx by UltraForce runtime contact sheet](images/sphinx-ultraforce-runtime-contact.png)

The article uses this contact sheet directly. I did not convert it into a GIF
because the published runtime evidence here is a single composite contact
sheet, not separate same-size frame files. The front-page card is text-only.

Observed timeline:

```text
00:00.800  First stable rendered view: Sphinx face, glowing eyes, bottom
           script/logo, and the arced text band starting near the right edge.
00:03.000  The scroller has advanced around the face; the band is visibly
           split by the face, not just drawn flat on top.
00:06.000  The greeting text crosses the forehead/eyes. The line-warped face
           is still a full-frame source-image copy, not independent sprites.
00:09.000  The band wraps around the left side. This is the two-pass scroller
           projection doing the "behind then in front" trick.
00:12.000  The production title crosses the upper face. The animation patch
           and color changes continue while the same loop runs.
00:18.000  The scroller reaches the credits phrase; no new part starts. The
           demo is a continuous one-effect loop until Escape.
```

The capture is useful because a static decode of `SPHINX.U4C` only shows the
raw Sphinx art. The actual demo constructs the familiar runtime look by
mutating that art, warping the full source page, projecting the text ribbon, and
then doing the A000h copy/palette timing.

The contact sheet also makes the control flow visible in a way the raw asset
files do not. `00:00.800` is the first stable golden face with the ribbon just
entering from the right, `00:03.000` and `00:06.000` are the same face with
the text wrapped deeper across the cheek and forehead, `00:09.000` shows the
scroller on the opposite side, and `00:12.000` / `00:18.000` are later loop
positions. That progression is exactly what the code below does: warp the
source image with the signed wave table, project the text in front of and
behind the face, then keep the same scene alive with palette changes rather
than scene changes.

## Runtime-To-Code Concordance

The runtime contact sheet maps cleanly to one loop body, not to a hidden
multipart script. The stable face visible from `00:00.800` onward is the raw
`SPHINX.U4C` page loaded into segment `7000h` and copied through the line-warp
routine at `0F8Ch`. Only after that copy does `0806h` replace an opaque 68x33
rectangle at source coordinates `(122,117)` for the following frame. Direct
asset decoding shows that this is the animated lower face and mouth, not the
bright eye highlights. Those eye pixels already belong to the raw U4C page.

The arced scroller positions at `00:03.000`, `00:06.000`, `00:09.000`, and
`00:12.000` map to the hidden-ribbon and two-pass projection pipeline. The main
loop first projects 628 29-byte columns through `0D2Dh`, then shifts the
`5000h` ribbon buffer by seven columns and possibly stages another glyph
through `113Eh`. The newly shifted data therefore becomes visible on the next
frame. The first 314-column arc only writes where the warped face buffer is
zero, which is the lower/rear "behind the head" path; the second 314-column arc
overwrites the face, which is the upper/front path.

The bottom signature/logo visible in every runtime frame maps to the
zero-transparent `SPHINX.LGO` mask at `0FF9h`, destination `EA14h`. All 1,151
foreground bytes use palette index `30h`. The same routine updates that DAC
entry between two 32,000-byte VRAM copies, so the bottom line pulses without
changing the mask. That is why the contact sheet shows one continuous effect
with changing colour and scroll phases rather than independent screens.

## Archive

The examined archive is the Hornet mirror `sphinx.zip`:

```text
135da6bdfae365ae62c533a169888fffa8ed86a72b3848716c57007903f0069c  sphinx.zip
```

Archive contents:

```text
SPHINX.BRM   37888 bytes  1990-07-09 04:07
SPHINX.EXE    3979 bytes  1990-09-08 16:44
SPHINX.FNT    8984 bytes  1990-07-10 05:16
SPHINX.LGO    4096 bytes  1990-09-08 15:08
SPHINX.U4C   64768 bytes  1990-07-09 03:27
```

Important file hashes:

```text
366bc97adb2cdd1712cea742a137441514068119149dffe458ab481d53206c59  SPHINX.EXE packed
6649968b7489536edf9787d7b213d68cc7d428bdb55fdb507099eb29a6c5b2fc  SPHINX.EXE after UNP
b116510ec19e373c94659869c435c85832c0468eaf478217eff67ac722d8f066  SPHINX.U4C
76b92236ecd66bfef7a08f2fff47d2d56ee9669216519622a0afc88acd907a2b  SPHINX.BRM
412a1d85d22b2b2152f4f2f3a95a5582f0e627e14fb854d82d00c56407f2b791  SPHINX.FNT
822d2f085485aa6f3f4f61c2ee65dc20347c6e167f51287652dd5f55ed523d1f  SPHINX.LGO
```

File roles:

```text
SPHINX.EXE  packed MZ program, restored by UNP to a 4757-byte EXE
SPHINX.U4C  768-byte VGA DAC palette plus a 64000-byte 320x200 raw page
SPHINX.BRM  768-byte VGA DAC palette plus a 37120-byte glyph bank
SPHINX.FNT  7 ignored bytes, four opaque 68x33 patch frames, 1 ignored byte
SPHINX.LGO  4096-byte zero-transparent index-30h signature mask
```

The two 768-byte prefixes are real but not byte-identical VGA palettes. They
differ only in file entries 226 through 232. Those seven BRM entries are the
gold ramp used by BRM payload indexes 225 through 231 after the rotated upload
described below. `SPHINX.U4C` is exactly `768 + 320 * 200` bytes, so its payload
is a full mode-13h raw page.

The BRM payload uses only eight byte values: zero plus `E1h..E7h`. The 48 glyph
records referenced by the executable occupy ranges through offset `66C3h`; the
remaining payload is not read by the visible text path. `SPHINX.LGO` is even
simpler: 2,945 zero bytes and 1,151 bytes of value `30h`.

Directly applying each FNT record to its actual U4C destination produces this
source-level comparison. It is decoded from the release files, not inferred
from a visually similar runtime panel:

![Raw Sphinx source page and four decoded opaque FNT mouth frames](images/sphinx-ultraforce-source-patch-contact.png)

The patch file is `7 + 4 * (68 * 33) + 1 = 8,984` bytes. The program ignores
the first seven and final one, and each 2,244-byte middle record replaces the
same `(122,117)..(189,149)` rectangle. Nearly every byte is nonzero, so this is
an opaque source-page replacement, not a transparent sprite.

## Unpacked EXE Layout

The original executable is an MZ file with a packed tail entry:

```text
packed size:     3979 bytes
MZ load image:   3947 bytes
header size:       32 bytes
entry:          CS:IP = 00e1:000e, file offset 0e3e
relocations:       0
```

After UNP restoration:

```text
restored size:   4757 bytes
MZ load image:   4725 bytes
header size:       32 bytes
entry:          CS:IP = 0000:0100, file offset 0120
relocations:       0
```

The restored entry at `0100h` is just a jump over data and tables into the
startup code at `0615h`. The useful program has this broad layout:

```text
0100h  entry jump
0103h  XOR-FF encoded scroller text
03dah  256-word phase/base-offset table used by the projected scroller
05dch  filename strings
0608h  runtime variables
0615h  startup and main loop
083fh  projected-scroller offset table
0d2dh  two-pass projected-ribbon compositor
0d8ch  signed 256-word waveform table for line displacement
0f8ch  source-image line-warp copy
0ff9h  logo overlay, screen copy, and mid-copy palette write
107ch  glyph offset table
113eh  glyph/character writer
1222h  rectangle copy helper
1250h  DOS file-open/read/close helpers
```

The filename strings are embedded directly:

```text
05dc  SPHINX.FNT
05e7  SPHINX.U4C
05f2  SPHINX.BRM
05fd  SPHINX.LGO
```

Runtime variables around `0608h`:

```text
0608  byte   palette animation counter, wraps at 40h
0609  word   line-warp scale divisor, initial 0514h = 1300
060b  word   XOR-encoded scroller text index
060d  word   countdown until the next character is emitted
060f  word   line-warp phase step, initial 0012h = 18
0611  word   animation frame counter, cycles 0,1,2,3,4,5
0613  word   projected-scroller phase, incremented by 3 and masked to 00ffh
```

## Startup Loader

Startup sets VGA mode 13h, loads the four sidecar files into fixed real-mode
segments, uploads the palette, initializes working buffers, then drops into the
main loop:

```asm
0615  mov ax,0013h
0618  int 10h

061a  dx=05dc, es=6500h, di=0000h
0625  call 1250h          ; open SPHINX.FNT
0628  cx=ffffh
062b  call 1267h          ; read into 6500:0000
062e  call 125dh          ; close

0631  dx=05fd, es=6300h, di=0000h
063c  call 1250h          ; open SPHINX.LGO
063f  cx=1000h
0642  call 1267h          ; read 4096-byte logo block
0645  call 125dh

0648  dx=05e7, es=7000h, di=0000h
0653  cx=0300h
0656  call 1250h          ; open SPHINX.U4C
0659  call 1267h          ; read palette prefix
065c  di=0000h
065f  cx=ffffh
0662  call 1267h          ; read raw 320x200 page over offset 0000h
0665  call 125dh

0668  dx=05f2, es=6800h, di=0000h
0673  cx=0300h
0676  call 1250h          ; open SPHINX.BRM
0679  call 1267h          ; read palette prefix
067c  ds=6800h, si=0000h
0681  out 3c8h,ffh
0689  call 1071h
068c  rep outsb           ; stream 768 palette bytes to 3c9h
068e  cx=ffffh
0691  call 1267h          ; read BRM payload over offset 0000h
0694  call 125dh
```

Two details are worth calling out.

First, the palette prefixes are not kept at runtime. `SPHINX.U4C` and
`SPHINX.BRM` are both read once at `CX=0300h`; then the file pointer is left
after the palette and a second read starts again at destination offset `0000h`.
So the runtime `7000h` and `6800h` buffers contain raw pixel/glyph payloads at
offset zero, not palette-plus-payload files.

Second, the visible palette comes from `SPHINX.BRM`, not from `SPHINX.U4C`.
The code writes DAC index `FFh`, then streams `0300h` bytes to port `3C9h`.
Because the DAC auto-increments after each triplet, BRM file entry 0 becomes
DAC index 255 and file entry `n` becomes DAC index `n-1`. That one-slot
rotation is why BRM source values `E1h..E7h` receive file-palette entries
`E2h..E8h`, the seven-entry gold ramp.

The subsequent buffer clears have an unusual but bounded pointer history.
Loading AX with `5000h` also makes `AL=0`, and `rep stosb` clears 65,535 bytes
of the ribbon segment from offset zero, leaving only `FFFFh` untouched. DI is
then `FFFFh`; the same 65,535-byte clear in segment `8000h` writes `FFFFh` and
then `0000h..FFFDh`, leaving only `FFFEh` untouched. Neither omitted byte lies
in the 64,000-byte page or ribbon spans used by the frame loop.

The DOS file helpers are minimal and have no error path:

```asm
1250  push cs
1251  pop ds
1252  mov ah,3dh
1254  mov al,c0h
1256  int 21h
1258  mov cs:[124eh],ax
125c  ret

1267  push es
1268  pop ds
1269  mov dx,di
126b  mov bx,cs:[124eh]
1270  mov ah,3fh
1272  int 21h
1274  ret
```

The program simply assumes the files exist and the reads work. It also uses
fixed absolute segments instead of DOS allocations; Escape therefore needs no
heap cleanup.

## Main Loop Shape

After startup, the visible frame loop begins at `06ABh`.

The keyboard handler polls BIOS `INT 16h` once per frame. Escape returns to
text mode and exits. Function keys tune the effect live:

```text
F3 / 3Dh  increment signed 060Fh to +55    line-warp phase step
F4 / 3Eh  decrement signed 060Fh to -55    line-warp phase step
F1 / 3Bh  divisor += divisor >> 4          weaker warp; 1300 reaches 5214
F2 / 3Ch  divisor -= divisor >> 4          stronger warp; 1300 stalls at 15
scan 01h  text mode 3, DOS exit
```

The divisor controls are multiplicative, not unit increments. F1 tests against
5,000 before adding, so the reachable sequence overshoots to 5,214. F2 tests
against 10, but at 15 the right shift becomes zero and the value cannot fall
farther. Other keys are consumed and ignored.

The per-frame order is:

```asm
0727  cx=00c8h
072a  ds=7000h             ; mutable Sphinx source page
072f  es=8000h             ; backbuffer
0734  bp=cs:[0609h]        ; warp divisor
0739  di=0000h
073c  si=0000h
073f  ax=cs:[060fh]        ; warp phase step
0743  call 0f8ch           ; line-warp full source image

0746  inc word cs:[0611h]  ; choose next source-patch frame
075a  call 0806h            ; patch source after current warp

075d  di=word cs:[03dah + 2 * cs:[0613h]]
076b  ds=5000h
0773  es=8000h
0778  dx=001dh
077b  call 0d2dh           ; project current 628-column ribbon

077e  repeat 7 times:
0782      ds=es=5000h
0789      si=001dh
078c      di=0000h
0790      cx=4f4ch
0793      rep movsb        ; shift hidden ribbon left by one 29-byte column
0795      dec word cs:[060dh]
079a      if zero: stage next glyph beyond projected span

07f3  call 0ff9h           ; logo overlay, A000 copy, DAC write
07f6  cs:[0613h] += 3
07fc  cs:[0613h] &= 00ffh
0803  jmp 06abh
```

The important design is that the source image, the hidden scroller ribbon, and
the final backbuffer are different buffers:

```text
6500h  SPHINX.FNT animation patch source
6800h  SPHINX.BRM glyph/source strips
7000h  mutable Sphinx source page
5000h  hidden column-major text ribbon
6300h  transparent bottom logo/signature
8000h  rendered backbuffer
A000h  visible mode-13h screen
```

The order creates two deliberate one-frame handoffs. The face warp sees the
patch written on the preceding frame, because `0806h` runs after `0F8Ch`.
Likewise, projection sees the ribbon before the seven shifts and any new glyph
staging. The logo alone is composited onto the current backbuffer immediately
before presentation.

The fixed bulk work per frame is substantial for this real-mode loop:

```text
face warp                 64,000 copied bytes
opaque source patch        2,244 copied bytes
ribbon projection         18,212 source bytes plus conditional plots
seven ribbon shifts      142,100 copied bytes
logo mask                  4,096 tests, at most 1,151 plots
backbuffer presentation   64,000 copied bytes
```

That is 272,344 unconditional copied bytes before projection and logo writes.
The seven overlapping ribbon shifts are the largest single bandwidth cost.

## Line-Warp Inner Loop

The call at `0743h` is the Sphinx face warp. It copies 200 source rows from
`7000h` into the `8000h` backbuffer, but each row is written at a table-driven
offset rather than at a fixed `y * 320`.

Routine `0F8Ch`:

```asm
0f8c  pusha
0f8d  mov cs:[0d8bh],al       ; per-frame phase step from 060Fh
0f91  mov word cs:[0d86h],00a0h
0f98  mov al,cs:[0d8ah]       ; current wave phase
0f9c  xor ah,ah
0f9e  mov cs:[0d88h],ax       ; wave-table index

0fa2  pusha
0fa3  bx=0d8ch
0fa6  bx += cs:[0d88h] * 2
0fb0  ax = cs:[bx]            ; signed displacement-table value
0fb6  imul cx                 ; scale by descending line counter
0fb8  idiv bp                 ; divide by 0609h
0fba  di=ax
0fbc  di += cs:[0d86h]        ; destination base + signed displacement
0fc1  cx=0140h
0fc4  si=cs:[0d86h]           ; source base
0fca  rep movsb               ; copy 320 bytes
0fcc  popa

0fcd  cs:[0d86h] += 0140h     ; next scanline base
0fd7  if cs:[0d88h] >= 00feh: cs:[0d88h] = 0
0fe7  inc word cs:[0d88h]
0fec  loop 0fa2h              ; 200 rows

0fee  al=cs:[0d8bh]
0ff2  cs:[0d8ah] += al        ; advance phase for next frame
0ff7  popa
0ff8  ret
```

The table at `0D8Ch` starts as a smooth signed wave:

```text
0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 59, 63, ...
```

For each output line, the destination offset is:

```text
dest = line_base + signed_wave[phase] * remaining_line_count / divisor
```

`remaining_line_count` is the active `CX` value from the outer `LOOP`, so the
top of the frame receives a larger displacement than the bottom. `divisor` is
the live value at `0609h`, initially `1300`. This is why the Sphinx looks like a
single warped sheet instead of a pile of independent sprites: the routine is
moving whole 320-byte strips through a time-varying offset field.

The waveform has 256 signed words ranging from -175 to +175. At the default
divisor, even the largest top-row term truncates to 26 bytes:

```text
abs(175 * 200 / 1300) = 26
```

The source and destination bases both begin at `00A0h`, half a scanline into
their segments, and advance by exactly 320 after each copy. Thus the normal
path reads source offsets `00A0h..FA9Fh`, including 160 bytes beyond the loaded
64,000-byte U4C payload on the final line, and leaves the first 160 source-page
bytes unused. At the default controls the last 160 copied bytes land beyond
the visible `0000h..F9FFh` backbuffer page as well, so that overread does not
affect the presented image.

Across every possible starting phase at the default divisor, destination
starts stay between 134 and 63,840. Adjacent 320-byte strips can overlap or
leave narrow gaps as their signed displacements differ; there is no clear or
clip inside `0F8Ch`. The backbuffer's previous contents therefore provide the
gap pixels. F2's interactive low-divisor settings intentionally break those
default bounds and can wrap signed destinations around the 64K segment.

The byte at `0D8Ah` is the starting table phase. The row loop advances through
the table and wraps 254 back to 1; after all 200 rows, `0D8Ah` advances by the
signed low byte of `060Fh`. No retrace wait occurs in this renderer.

## Animation Patch

Immediately after the line warp, the program replaces a rectangle in the
source Sphinx page at `7000:92BA`. Since `92BAh = 117 * 320 + 122`, the patch
is the lower central face at x=122..189 and y=117..149. The decoded comparison
above shows the changing mouth positions directly; the bright eyes are outside
this rectangle and remain part of the static U4C source.

Routine `0806h`:

```asm
0806  bx = cs:[0611h]
080b  if bx == 4: bx = 2
0813  if bx == 5: bx = 1
081b  ax = 08c4h
081e  mul bx
0820  si = ax + 7
0825  es = 7000h
082a  ds = 6500h
082f  di = 92bah
0832  dx = 0044h             ; width 68 bytes
0835  cx = 0021h             ; height 33 rows
0838  ax = 0001h
083b  call 1222h
083e  ret
```

The selected write sequence after startup is `1, 2, 3, 2, 1, 0`, then repeats.
Because the patch follows the warp, the first visible frame uses untouched
U4C data; later visible source states settle into the ping-pong sequence
`0, 1, 2, 3, 2, 1`. Each authored frame is `08C4h = 2,244 = 68 * 33` bytes
apart in `SPHINX.FNT`. There is no transparency test: all 2,244 bytes replace
the source rectangle before the following frame's warp uses it.

The helper at `1222h` has two modes:

```asm
1222  pusha
1223  test ax,0001h
1226  je 123ah

; AX odd: source contiguous, destination row-strided at 320 bytes.
1228  push di
1229  push cx
122a  cx=dx
122d  rep movsb
122f  pop cx
1230  pop di
1231  di += 0140h
1235  loop 1228h
1237  jmp 124ch

; AX even: destination contiguous, source row-strided at 320 bytes.
123a  push si
123b  push cx
123c  cx=dx
123f  rep movsb
1241  pop cx
1242  pop si
1243  si += 0140h
1247  loop 123ah

124c  popa
124d  ret
```

For the animation patch, `AX=1`, so the data in `SPHINX.FNT` is a contiguous
rectangle, and the destination is a normal 320-byte-wide mode-13h page. The
call performs exactly 33 rows by 68 byte copies, with a 252-byte destination
gap between rows.

## Hidden Ribbon And Projected Scroller

The most interesting part is the rotating text band. The demo does not draw the
letters directly onto the face. It maintains a hidden buffer at segment `5000h`
and treats each text column as `29` bytes tall.

Every video frame, the main loop shifts the buffer seven times:

```asm
0782  ds=5000h
0785  es=5000h
0789  si=001dh          ; one 29-byte column ahead
078c  di=0000h
0790  cx=4f4ch
0793  rep movsb         ; overlapping copy, shifts ribbon left
0795  dec word cs:[060dh]
```

Because the source starts at offset `001Dh`, this is a one-column shift in a
29-byte-high column-major buffer. `4F4Ch / 29 = 700`, so one shift copies
exactly 700 columns (20,300 bytes); the seven repeats move 142,100 bytes and
advance the hidden ribbon by seven columns per rendered frame. Projection has
already consumed the current ribbon before these copies run.

When `060Dh` reaches zero, a new encoded character is fetched from the internal
text at `0103h`. The bytes are XORed with `FFh`; the public start decodes to a
greeting, the production name, and credits, and later private contact details
are present but are not reproduced here.

Character fetch and normalization:

```asm
07b0  bx = 0103h + cs:[060bh]
07b5  inc word cs:[060bh]
07ba  al = cs:[bx]
07bd  xor al,0ffh
07bf  cmp al,0ah
07c1  jne 07d2h
07c3  cs:[060bh] = 0001h     ; newline marker wraps scroller text
07cd  al = xor_ff(cs:[0103h])

07d2  cmp al,60h
07d4  jl 07d8h
07d6  add al,0e0h            ; lowercase ASCII wraps into uppercase
```

Then `113Eh` stages the glyph at `5000:4724`. This address is not arbitrary:
`4724h = 18,212 = 628 * 29`, exactly one byte beyond the 628 columns consumed
by the projector. The 700-column shift span leaves 72 columns of staging
lookahead.

## Glyph Writer

The glyph writer receives the decoded character in `AL`, maps it to an index,
uses a table at `107Ch`, and copies variable-width glyph bytes from the
`SPHINX.BRM` payload at `6800h` into the hidden ribbon at `5000h`.

The mapping is deliberately small:

```text
space / CR / LF  blank advance
A-Z              alphabet glyphs
0-9              digit glyphs at index 1Ah..23h
- / ! ( ) + " . , : * &  punctuation glyphs at 24h..2Fh
```

Core of `113Eh`:

```asm
11d7  shl ax,2
11da  bx=107ch
11dd  bx += ax
11df  if bx outside 107ch..113ch: ignore
11eb  si = cs:[bx]           ; glyph start offset
11ee  cx = cs:[bx+2]         ; next glyph start
11f2  cx -= si               ; byte length
11f5  rep movsb              ; DS=6800h, ES=5000h
11f7  cx=001dh
11fa  shl cx,1               ; 58 blank bytes = two 29-byte columns
11ff  rep stosb
1202  rep stosb              ; repeated with CX already zero: no work
1204  cs:[113ch] = di        ; remember end cursor
1209  popa
120a  di = cs:[113ch]
120f  ret
```

For whitespace, it emits a wider blank:

```asm
1210  cx=001dh
1213  shl cx,4               ; 464 blank bytes = 16 columns
1219  rep stosb
121b  cs:[113ch] = di
```

Every one of the 48 table records has a byte length divisible by 29. The
authored widths range from 5 columns for `:` to 26 for `W`; representative
values are `A=19`, `I=10`, `M=25`, `0=17`, and `!=6`. The BRM bytes use zero
as transparency and only seven nonzero gold-ramp indexes, `E1h..E7h`.

After the call returns, the main loop computes the next-character countdown:

```asm
07df  old_di = pop()
07e0  di -= old_di           ; emitted byte width
07e7  di = 003ah             ; 58 bytes
07ea  div di
07ec  cs:[060dh] = ax
```

The exact scheduler is subtler than a normal proportional advance. For an
authored glyph `w` columns wide, the writer emits `w + 2` columns, but the
countdown is:

```text
next_insert_after = floor((w + 2) / 2) one-column shifts
```

The next glyph is always written at the same `4724h` staging address. It
therefore overwrites the still-resident tail of the previous authored span;
only its leading `floor((w+2)/2)` columns survive into the projected region.
Whitespace similarly emits 16 blank columns but schedules the next insertion
after eight shifts. This fixed-point staging/cropping behavior, rather than the
full BRM record width, accounts for the tightly joined lettering visible in
the runtime contact sheet.

## Two-Pass Projection Around The Face

The routine at `0D2Dh` takes the hidden ribbon and projects it through a
precomputed offset table. It is called with:

```text
DS:SI = 5000:0000    hidden text ribbon
ES    = 8000h        backbuffer after the Sphinx line warp
DI    = signed scanline offset from table at 03DAh + 2 * 0613h
DX    = 001Dh        ribbon column height, 29 bytes
```

The routine saves the base `DI`, then runs two similar passes. Each pass draws
`013Ah` columns, and each column consumes `DX` source bytes.

First pass:

```asm
0d31  cs:[0d2bh] = di
0d36  bx = 083dh
0d39  cx = 013ah

0d3c  push cx
0d3d  bx += 2
0d40  di = cs:[bx] + cs:[0d2bh]
0d48  cx = dx
0d4b  lodsb
0d4c  test al,al
0d4e  je 0d59h
0d50  ah = es:[di]
0d53  test ah,ah
0d55  jne 0d59h
0d57  stosb
0d58  dec di
0d59  di += 0140h
0d5d  loop 0d4bh
0d5f  pop cx
0d60  loop 0d3ch
```

Second pass:

```asm
0d62  cx = 013ah
0d65  push cx
0d66  bx += 2
0d69  di = cs:[bx] + cs:[0d2bh]
0d71  cx = dx
0d74  lodsb
0d75  test al,al
0d77  je 0d7bh
0d79  stosb
0d7a  dec di
0d7b  di += 0140h
0d7f  loop 0d74h
0d81  pop cx
0d82  loop 0d65h
0d84  popa
0d85  ret
```

This explains the visual depth in the capture.

The first half is transparent and only writes text pixels where the backbuffer
is still zero. Since the Sphinx face has already been drawn, this pass makes
the rear part of the text band disappear behind the head.

The second half is also transparent for zero source pixels, but nonzero source
pixels overwrite the destination. That front half appears on top of the face.

Each pass consumes `314 * 29 = 9,106` source bytes, so together they read
exactly `18,212 = 4724h` bytes and account for all 628 projected columns. The
rear path performs at most 9,106 plots but requires both a nonzero source and a
zero destination; the front path requires only a nonzero source.

Both arcs are controlled by offset tables, not trigonometry at runtime. Decoded
as `(y * 320 + x)`, the first 314 offsets trace the lower arc from the right
midpoint `(256,100)` through y=130 to the left midpoint `(54,100)`. The second
314 trace the upper arc back from `(54,100)` through y=70 to `(256,100)`.
Runs of up to four identical offsets compress neighboring source columns along
the curve.

The 256-word table at `03DAh` is not another per-column curve. Every entry is
an exact multiple of 320 and ranges from -40 to +39 scanlines. Its selected
value translates the entire two-arc ring vertically. `0613h` advances by three
modulo 256, so all 256 positions are visited before the vertical cycle repeats.
Combining that translation with the fixed arcs keeps the default ring between
roughly y=30 and y=169. This is the complete apparent rotation: a precomputed
closed lower/rear plus upper/front path, moved through a 256-state vertical
sine cycle.

## Logo Overlay And Screen Copy

Routine `0FF9h` finishes the frame. It first overlays `SPHINX.LGO` onto the
bottom of the backbuffer:

```asm
0ff9  pusha
0ffa  ds = 6300h
0fff  es = 8000h
1004  cx = 1000h
1007  si = 0001h
100a  di = ea14h
100e  lodsb
100f  or al,al
1011  je 1017h
1013  stosb                 ; nonzero logo byte
1014  jmp 1018h             ; STOSB already advanced DI
1017  inc di                ; zero is transparent
1018  loop 100eh
```

The overlay destination `EA14h` is near the bottom of a 320x200 page:
`EA14h / 320 = 187`, remainder `84`. That matches the bottom script visible in
the contact sheet. The taken jump at `1014h` is essential: both branches
advance DI exactly once, so this is an ordinary one-byte transparent mask, not
a variable-width writer.

The loop starts at source offset 1 but still executes 4,096 times. It therefore
reads file bytes 1..4095 and one byte just beyond the loaded file. Destinations
are `EA14h..FA13h`; the final 20 lie beyond the 64,000-byte visible page, and
the known file tail is all zero. The one-byte overread cannot affect the
visible image. Within the file, all 1,151 nonzero mask bytes have value `30h`.

Then it animates a palette counter and copies the backbuffer to A000h:

```asm
101a  inc byte cs:[0608h]
101f  cmp byte cs:[0608h],40h
1027  if equal: cs:[0608h] = 0

102d  cx = fa00h
1030  si = 0000h
1033  di = 0005h
1036  ds = 8000h
103b  es = a000h
1040  dx = cx
1042  dx >>= 2
1045  cx = dx
1047  call 1071h
104b  rep movsw             ; first 32000 bytes

104d  cx = dx
104f  call 1071h
1052  out 3c8h,30h          ; update color index 30h
1059  out 3c9h,3fh
105c  al = cs:[0608h]
1061  al >>= 1
1063  al += 20h
1065  out 3c9h,al
1067  al = -cs:[0608h] + 3fh
106b  out 3c9h,al
106d  rep movsw             ; second 32000 bytes
106f  popa
1070  ret
```

The wait helper is:

```asm
1071  pusha
1072  dx = 03dah
1075  in al,dx
1076  test al,08h
1078  jne 1075h
107a  popa
107b  ret
```

This waits only while VGA status bit 3 is set and returns as soon as the card is
outside vertical retrace. If called during active display it returns
immediately; it is not an edge-triggered frame wait and does not establish a
fixed refresh-rate cadence. Runtime speed is consequently CPU/copy bound.

The copy starts at `A000:0005`, not at zero. It copies `FA00h` bytes in two
equal 16,000-word chunks, mapping backbuffer offsets `0000h..F9FFh` to VGA
offsets `0005h..FA04h`. It leaves the first five visible bytes from the previous
frame and writes the final five bytes beyond the 320x200 page.

The mid-copy DAC write changes color index `30h` after the first half. For the
64-state counter `c=0..63`, its 6-bit RGB value is:

```text
(63, 32 + floor(c/2), 63 - c)
```

Only `SPHINX.LGO` uses index `30h` in this path, so the bottom signature pulses
without rebuilding its mask. The DAC update is interleaved with presentation,
but the helper's outside-retrace test is too weak to claim a cycle-stable
horizontal raster split.

## Exit And Ownership

The program installs no timer, keyboard, or audio interrupt. BIOS keyboard
services own input throughout. Escape performs only:

```asm
071d  mov ax,0003h
0720  int 10h
0722  mov ax,4c00h
0725  int 21h
```

There are no DOS allocations to free and no vectors to restore. The sidecar
buffers live in fixed absolute segments covered by the program's DOS memory
block; BIOS mode 03h replaces graphics mode and DOS termination releases the
whole process allocation.

The image ownership is now exact:

```text
eyes and main face       raw U4C source pixels
mouth/lower-face motion  opaque FNT source replacement, visible next frame
gold ring text           BRM glyph bytes through the 628-column projector
bottom signature         LGO zero-transparent index-30h mask
signature colour pulse   live 64-state DAC entry 30h
```

## Why It Works

The demo looks fancier than its file sizes because it reuses a few cheap data
representations very aggressively:

```text
raw page          one full Sphinx source image
mouth records     four opaque frames patched into the next source state
wave table        signed row displacement for 200 whole-line copies
ribbon buffer     700 shifted columns with a 628-column visible span
offset tables     fixed lower/rear and upper/front projection arcs
vertical table    256 signed scanline translations through the closed arc
LGO mask          1,151 zero-transparent signature pixels
single DAC slot   64-state signature color animation
```

The expensive part is still real-mode string-copy work: `rep movsb`,
`rep movsw`, table lookups, and one signed multiply/divide per source line.
The visual trick is the order and the delayed handoffs. The current face is
warped first; the next mouth state is patched; the current ribbon is projected;
the next ribbon state is shifted and staged; the bottom mask is stamped; and
the screen is copied with a DAC update in the middle. For a 1990 mode-13h PC
demo, that is a compact and unusually layered single-effect engine.

## Remaining Boundary

The visual path no longer depends on effect-name inference: buffer sizes,
iteration counts, table geometry, source-patch timing, glyph staging, layer
tests, palette ownership, presentation, controls, and exit are instruction-
backed. Three narrow boundaries remain:

- the original semantic meaning of the seven ignored FNT header bytes and its
  one ignored trailer byte;
- the role, if any, of BRM payload bytes after the highest referenced glyph
  offset `66C3h`;
- cycle-exact raster position of the two outside-retrace waits, which varies
  with CPU speed and is not a fixed frame clock.

None changes the recovered steady-state frame lifecycle or the direct mapping
between the published images and their owning routines.
