Analysis model: gpt-5.5 xhigh

# Crashtest by J-P/Rebels - Technical Dissection

## Scope

This is a binary-level pass over **Crashtest** by J-P/Rebels, an MS-DOS 4 KB
intro released at Assembly 1995. The official Assembly 1995 results list it as
the third-place entry in the PC 4K intro competition, after **Animate** by
Schwartz and **Heaven** by Barti!/NoooN.

Useful public references:

- Assembly 1995 results: https://archive.scene.org/pub/parties/1995/assembly95/info/asm95res.txt
- Scene.org archive: https://archive.scene.org/pub/parties/1995/assembly95/in4k/crshtest.zip
- Scene.org file description: https://archive.scene.org/pub/parties/1995/assembly95/in4k/crshtest.diz
- Assembly 1995 4K archive directory: https://archive.scene.org/pub/parties/1995/assembly95/in4k/

The bundled text identifies the intro as a 4K by J-P/Rebels for Assembly 1995,
says it needs less than 450 KB of base memory, normal VGA, and a 386-class CPU,
and notes that ESC exits at all times. It also states that the code grabs the
keyboard, uses timer timing, leaves GUS IRQs alone, and uses an "eight bit
resolution z-buffer." Those claims line up with the code. Old personal contact
details from the original text are intentionally not repeated here.

The technical shape is compact but ambitious:

- a J-Packed 4095-byte COM expands to a 4592-byte real-mode image
- startup installs a timer interrupt and allocates six conventional-memory work
  blocks
- precalc builds a radial byte map, a fractal texture, a sine table, and an
  index remap table
- the main show alternates between a rotating quadrilateral/plane effect, a
  vertical height-field pass, and a 3D object pass
- the final text part uses the BIOS 8x8 font as source data, but renders and
  fades it through the same direct frame buffers

## Archive And Recovered Image

The examined party archive:

```text
4fdffe5959076f0c00105c6c6689145f57530e5b8ed5d6ebd6f2e783ed1b5fef  crshtest.zip
```

Archive contents:

```text
CRSHTEST.COM   4095  1995-07-28 23:10
FILE_ID.DIZ      56  1995-08-12 19:34
JOKUDOCU.TXT   2679  1995-07-29 00:10
```

Extracted hashes:

```text
9341ddf04a33daa5358714432131764a5d934a76f3d516d7b224fa1c37b9fde2  CRSHTEST.COM
b47dd9f9693d32e3028dd1141232e0c84e396727d698819f491ed6b488651f6b  FILE_ID.DIZ
1ba8cb0065ef7cb2e9207cb96695d42af00f6f15517405511cd5d5a5ab5f8de0  JOKUDOCU.TXT
```

`CRSHTEST.COM` contains a `J-Packed!` marker near the front. UNP recognizes the
packer and expands the COM to this 4592-byte image:

```text
805a3e96f6a078135e94d8b2f104c884154aae6cb62c76e1f61c9185b5c9727b  CRSHTEST.COM.unpacked
```

All addresses below refer to that unpacked COM loaded at the normal DOS COM
origin, `CS:0100`.

## Startup: Timer, IRQ Mask, And Memory

The entry sequence at `0100` prints a tiny wait message and then takes over the
machine state it needs:

```asm
0100  mov  dx, 0e66h
0103  mov  ah, 09h
0105  int  21h              ; print "\r\nWait...$"
0107  cli
0108  push cs
0109  pop  es
010a  mov  cx, 0e8bh
010e  mov  di, 1958h
0111  rep  stosb            ; clear work variables
0113  mov  al, 02h
0115  out  21h, al          ; mask IRQ1, keyboard interrupt line
```

The keyboard line mask is what the text means by "grabs hold of the keyboard".
The intro does not depend on BIOS keyboard services during the show. It polls
port `60h` directly and exits when it sees scan code `01h`, the Esc make code.

It then saves interrupt vector 8 and installs `CS:0421`:

```asm
0117  xor  ax, ax
0119  mov  es, ax
011b  mov  eax, es:[0020h]  ; old int 8 vector
0120  mov  [1948h], eax
0124  mov  ax, 0421h
0127  mov  es:[0020h], ax
012b  mov  es:[0022h], cs
```

The PIT setup is slightly unusual because it measures against retrace first.
`0413` waits for a full vertical-retrace edge by polling VGA input status port
`3DAh`:

```asm
0413  mov  dx, 03dah
0416  in   al, dx
0417  test al, 08h
0419  jne  0416h            ; wait until not in retrace
041b  in   al, dx
041c  test al, 08h
041e  je   041bh            ; wait until retrace starts
0420  ret
```

Startup programs PIT channel 0, waits through a retrace edge, latches the timer,
derives two timing constants at `1944` and `1946`, and then programs the PIT
with the derived divisor. That gives the show a timer pace tied to the display
environment rather than a hard-coded divisor alone.

After that it resizes its DOS block and issues six `int 21h/AH=48h` allocation
requests. The stored segments are:

```text
194c  generated fractal / source texture buffer
194e  main 64,000-byte frame buffer
1952  per-pixel depth or coverage buffer
1954  radial map / alternate texture buffer
1956  text/fade/texture work buffer
1950  one extra saved segment value
```

The requests are about 64 KB each, matching the bundled claim that the intro
needs less than 450 KB of conventional memory.

The exit path at `03ee` restores vector 8, unmasks interrupts again, returns the
PIT to the default mode, clears the PIC mask, switches back to text mode 3, and
exits through DOS:

```asm
03ee  cli
03f5  mov  eax, [1948h]
03f9  mov  es:[0020h], eax  ; restore old int 8
03fe  sti
03ff  mov  al, 36h
0401  out  43h, al
0403  xor  ax, ax
0405  out  40h, al
0407  out  40h, al
0409  out  21h, al
040b  mov  al, 03h
040d  int  10h
040f  mov  ah, 4ch
0411  int  21h
```

## Timer Interrupt At `0421`

The custom timer ISR is small, but it drives most animation phases:

```asm
0421  pushad
0423  push ds
0424  push cs
0425  pop  ds
0426  cmp  byte [195f], 0
042b  je   0466h
042d  inc  word [1987]
0431  add  byte [1984], 80h
0436  adc  word [1985], 0
043b  mov  eax, [09dbh]
0442  sub  ax, 3e80h
0445  sets bl
0448  shl  bx, 1
044a  dec  ebx
044c  sub  [1961h], ebx
0451  mov  eax, [1961h]
0455  sub  [09dbh], eax
045a  cmp  word [09cah], 0
0461  dec  dword [09cah]    ; only while active
0466  inc  word [18f0]      ; global frame/tick counter
046a  mov  al, 20h
046c  out  20h, al          ; EOI
046e  pop  ds
046f  popad
0471  iret
```

`18f0` is the global tick counter. `1985` and `1987` are phase accumulators used
by the 3D transform code. `09ca`, `09db`, and `1961` are timeline or camera
parameters patched into later loops. The `195f` flag decides whether the ISR
only counts ticks or also advances the heavier phase variables.

This split matters because the intro has multiple parts that reuse the same
renderer with different sources and constants. Some parts want just a frame
counter. Later parts enable the extra phase math and let the timer move the
object/camera state.

## Precalc 1: Radial Byte Map At `094f`

The first real precalc fills the segment stored at `1954`. It treats `190e` and
`1910` as byte-sized X/Y counters and stores into `GS:[BX]`, where `BX` is built
from the low bytes of those two counters:

```asm
094f  push word [1954]
0953  pop  gs
0955  mov  word [190e], 0
095b  mov  word [1910], 0

0961  mov  ax, [190e]
0964  sub  ax, 007fh
0967  sub  ax, ffceh        ; center/offset term
096a  imul ax               ; x*x
096c  xchg ax, bx
096d  mov  ax, [1910]
0970  sub  ax, 007fh
0973  sub  ax, ffe2h        ; center/offset term
0976  imul ax               ; y*y
0978  add  ax, bx           ; radius squared, low word
```

The strange loop at `097a` converts that radius into something like an integer
square-root bucket without using a divide:

```asm
097a  mov  cx, ffffh
097d  mov  bx, cx
097f  inc  bx
0980  inc  cx
0981  inc  cx
0982  sub  ax, cx
0984  jae  097fh
```

It repeatedly subtracts increasing odd-ish values from the radius sum. `BX`
therefore rises with distance. The output byte is a mirrored 0..255 falloff:

```asm
0986  mov  ax, 00ffh
0989  sub  ax, bx
098b  cmp  al, 7fh
098d  ja   0993h
098f  sub  al, 7fh
0991  neg  al
0993  mov  bl, [190e]
0997  mov  bh, [1910]
099b  mov  gs:[bx], al
```

Then the low byte of X increments. On wrap, it shows the spinner, increments Y,
and on final wrap jumps into the next generator:

```asm
099e  add  byte [190e], 1
09a3  jae  0961h
09a5  call 0e42h
09a8  add  byte [1910], 1
09ad  jae  0961h
09af  jmp  0654h
```

The important detail is the addressing: `BL=x`, `BH=y`, so the map is naturally
256x256 in segment order. Only the low bytes matter for the write address.

## Precalc 2: Fractal Texture At `0654`

The next generator targets the segment at `194c`. It is a self-modifying
fixed-point fractal loop. The code initializes two 32-bit accumulators at
`18fa` and `18fe`, iterates up to `20h` times, and writes an iteration-derived
byte.

The heart of the loop is:

```asm
0662  mov  cx, 0020h
0665  mov  dword [18fa], 0
066e  mov  dword [18fe], 0

0677  mov  ebx, [18fa]      ; x
067c  mov  eax, [18fe]      ; y
0680  imul eax
0683  sar  eax, 8
0687  xchg eax, ebx
0689  imul eax
068c  sar  eax, 8
0690  sub  eax, ebx
0693  add  eax, aaaaaaaah   ; c.x, patched by later code
0699  push eax

069b  mov  eax, [18fa]
069f  imul dword [18fe]
06a4  sar  eax, 8
06a8  shl  eax, 1
06ab  add  eax, fffffe8bh   ; c.y, patched by later code
06b1  mov  [18fe], eax
06b5  imul ebx
06b8  xchg eax, ebx
06ba  pop  eax
06bc  mov  [18fa], eax
```

Conceptually it is a Julia/Mandelbrot-family recurrence:

```text
x' = x*x - y*y + cx
y' = 2*x*y + cy
```

The fixed-point scale is tiny and size-driven: products are shifted by 8, and
only the low-byte result eventually becomes a texture byte. Bailout is also a
size hack:

```asm
06c0  imul eax
06c3  and  eax, ebx
06c6  cmp  eax, 00400000h
06cc  jge  06d8h
06ce  cmp  eax, ffc00000h
06d4  jle  06d8h
06d6  loop 0677h
```

Instead of computing `x*x + y*y`, it reuses the just-produced product state and
tests a coarse signed range. The result is not mathematically clean, but for a
4K intro it gives a useful textured field.

After the loop, the remaining iteration count is converted to a byte and stored:

```asm
06d8  sub  cl, 20h
06db  neg  cl
06dd  xchg ax, cx
06de  mov  di, 0000h        ; patched write offset
06e1  shl  ax, 1
06e3  stosb
```

Then the code mutates its own constants:

```asm
06e4  add  dword [0695h], 3 ; modifies c.x immediate
06ea  inc  byte  [06dfh]    ; modifies DI immediate low byte
06ee  jne  0662h
06f2  call 0e42h
06f5  add  dword [06adh], 3 ; modifies c.y immediate
06fb  inc  byte  [06e0h]    ; modifies DI immediate high byte
06ff  jne  0659h
0703  jmp  0739h
```

This is the whole texture raster in a few dozen bytes: patch the complex-plane
constant, patch the store address, write one byte, and repeat until the 256x256
address space has been filled.

## Precalc 3: Sine/Cosine Table At `0739`

The routine at `0739` builds the motion table used by the main loop and 3D
object transform. It starts at `2077`, writes a quarter curve by accumulating an
increasing delta, mirrors/copies it, then normalizes the table in place:

```asm
073b  mov  di, 2077h
0740  xor  ax, ax
0742  xor  bx, bx
0744  mov  cx, 0001h
0747  stosw
0748  add  bx, cx
074a  add  ax, bx
074c  cmp  ah, 02h
074f  jb   0747h
```

That first phase is effectively an integer parabola used as a quarter sine-ish
curve. The following copy/mirror pass reflects it into the rest of the table,
and the final pass scales it down:

```asm
076f  mov  cl, ffh
0771  lodsw
0772  sar  ax, 2
0775  sub  ax, 0080h
0778  stosw
0779  loop 0771h
```

The code uses two table bases:

```text
2077  sine-ish values
20b7  same table with a phase offset
```

Those bases appear everywhere the intro needs circular motion: the early
quadrilateral effect, the object rotation matrix, and the perspective pass.

## Frame Copy And Clear Helper At `0705`

`0705` is the common present/clear helper. It is also a good map of the memory
roles:

```asm
0705  push dword [194e]
070b  pop  ds
070c  push 0a000h
070f  pop  es
0710  mov  cx, 3e80h
0715  xor  di, di
0717  xor  si, si
0719  rep  movsd            ; 64,000 bytes: frame buffer -> VGA

071c  push word [1952]
0721  pop  es
0723  xor  eax, eax
0726  xor  di, di
0728  rep  stosd            ; clear 64,000-byte depth/coverage buffer

072c  push ds
072d  pop  es
072e  pop  ds
0731  xor  si, si
0733  rep  movsd            ; copy work buffer into frame buffer
```

The repeated `CX=3e80h` with `rep movsd` or `rep stosd` means exactly 16,000
dwords, i.e. 64,000 bytes. In other places the code uses `0x4000` dwords for a
full 65,536-byte segment copy. The visible frame is mode 13h's 64,000-byte
`A000` window, but many buffers are naturally 64 KB segments.

## Main Quadrilateral Loop At `0472`

The main loop starts by zeroing `18f0`, then each frame polls Esc:

```asm
0474  sub  ax, ax
0476  mov  [18f0], ax
0479  in   al, 60h
047b  cmp  al, 01h
047d  je   03eeh
```

It uses the frame counter as a sine-table phase. Four points are read at quarter
turn offsets and stored as the corners at `1918..1926`:

```asm
0487  mov  bx, [18f0]
048b  and  bx, 00feh
048f  mov  ax, [2077h+bx]
0493  add  ax, dx           ; x center, usually 160
0495  mov  [1924], ax
0498  mov  ax, [20b7h+bx]
049c  add  ax, cx           ; y center, usually 100
049e  mov  [1926], ax
...
04a1  add  bx, 40h          ; next quarter-turn point
...
04cf  add  bx, 40h
```

Depth/texture endpoint values are then written as four longwords:

```asm
04e6  mov dword [1928], ff85ff86h
04ef  mov dword [192c], ff860080h
04f8  mov dword [1930], 00800080h
0501  mov dword [1934], 007fff86h
```

The loop calls `077c` to convert the four edges into scanline tables, then calls
`0baf` to draw spans:

```asm
050a  call 077ch
050d  call 0bafh
```

When the advanced phase flag at `195f` is off, it falls into the vertical
height-field/background pass at `05a6`. When the flag is on, it copies/presents
and adjusts self-modified constants at `0482`, `051f`, and `05df` to alter
motion and lifetime.

The timeline around `021f..03e3` reuses this same loop several times with
different patched segment selectors and constants:

```text
025d  text/logo setup through 0ce4
0260  patch span source to 194c and depth target to 1952
0271  call 0472
0274  patch span source to 1954 and frame target to 194e
0285  enable extra timer phase by incrementing 195f
028f  copy/present + transform loop until timer thresholds
02b9  amplify generated texture in 194c
02d1  patch span color/depth constants again
02e7  call 0472
0307  patch timer self-modified value at 0462
032b  copy/present + object transform until frame 0206h
037c  final fade loop until timer countdown crosses threshold
```

The code is therefore not "one effect after another" in separated modules. It
is a small renderer whose segment operands and constants are patched between
passes.

## Vertical Height-Field Pass At `05a6`

`05a6` draws vertical columns from the `1952` buffer into the `194e` frame
buffer. It sets:

```asm
05a6  push word [1952]
05aa  push word [194e]
05ae  pop  es              ; destination frame
05af  pop  ds              ; source field
05b0  mov  word cs:[1979], 012ch
```

The outer X/column value starts at `012c` and counts down to `0014`. For each
column, the inner loop walks 200 rows:

```asm
05b7  mov  si, cs:[1979]
05bc  mov  cx, 00c8h       ; 200 samples
05bf  mov  bx, 0120h       ; depth/divisor term
05c2  mov  cs:[1977], cx   ; previous top

05c7  push cx
05c8  lodsb
05c9  add  si, 013fh       ; next source row: +319 after lodsb
05cd  cbw
05ce  dec  ax
05cf  js   0639h           ; empty sample
```

For a non-empty sample it computes a projected top Y using an integer divide:

```asm
05d1  push ax
05d2  neg  ax
05d4  add  ah, 7dh
05d7  cwd
05d8  shld ax, dx, 8
05dc  idiv bx
05de  add  ax, 008ch       ; screen-space baseline
05e1  cmp  ax, cs:[1977]   ; compare against previous top
05e6  jge  0651h
05e8  xchg ax, cs:[1977]   ; old top becomes bottom for span
```

Then it clamps the span and calculates the destination pointer:

```asm
0604  sub  ax, cs:[1977]   ; span height
0609  xchg ax, cx
060a  imul di, cs:[1977], 0140h
0611  add  di, cs:[1979]
```

The color is a tiny filtered sample from nearby source bytes:

```asm
0617  mov  dx, [si]
0619  add  al, dh
061b  rcr  al, 1
061d  add  al, dl
061f  rcr  al, 1
0621  mov  dx, [si+2]
0624  add  al, dh
0626  rcr  al, 1
0628  add  al, dl
062a  rcr  al, 1
062c  or   al, 80h
062e  add  al, 28h
```

The actual vertical span loop is the classic part:

```asm
0630  inc  cx
0631  stosb                ; write current row
0632  add  di, 013fh       ; plus STOSB's +1 = next row, same X
0636  dec  cx
0637  jne  0631h
```

Because mode 13h scanlines are 320 bytes, `stosb` advances one byte and
`add di,013f` advances the remaining 319. The result is a vertical line at a
fixed X. The pass is a size-optimized height field: sample a field, project its
height through a divide, draw from the last top to the new top, and move to the
next source sample.

## Edge Table Builder At `077c` And `0805`

`077c` is a wrapper that copies four vertices into scratch variables and calls
`0805` once for each edge:

```asm
077c  mov  eax, [1918]
0780  mov  [190e], eax
0784  mov  eax, [191c]
0788  mov  [1912], eax
078c  mov  eax, [1928]
0790  mov  [1906], eax
0794  mov  eax, [192c]
0798  mov  [190a], eax
079c  call 0805h
...
07e5  ; fourth edge, vertex 3 -> vertex 0
0801  call 0805h
```

`0805` takes one edge and emits per-scanline data for the span drawer. It first
adds `7f` to the two interpolated attributes, which centers signed values into
the byte range expected by the texture/depth code:

```asm
0805  add  word [1906], 007fh
080a  add  word [190a], 007fh
080f  add  word [1908], 007fh
0814  add  word [190c], 007fh
```

It computes `dy = y1 - y0`; if the edge goes upward it swaps endpoints and
changes the output table base:

```asm
0819  mov  di, 1b21h
081c  mov  cx, [1914]
0820  sub  cx, [1910]
0824  je   094eh
0828  jns  0858h
082a  sub  di, 0196h       ; choose the opposite edge table
082e  neg  cx
0830  xchg ax, [1914]      ; swap y
083a  xchg ax, [1912]      ; swap x
0844  xchg ax, [190a]      ; swap attribute A
084e  xchg ax, [190c]      ; swap attribute B
```

Then it calculates fixed-point deltas. X uses an 8.8 split: low byte in `18f6`,
high/word part in `193c`. The other two attributes use word deltas at `193e`
and `1940`.

```asm
085d  movzx ecx, cx
0861  mov  ax, [190e]
0864  sub  ax, [1912]
0868  cwde
086a  cdq
086c  shl  eax, 8
0870  idiv ecx
0873  mov  [18f6], al
0876  sar  eax, 8
087a  mov  [193c], ax
```

Vertical clipping is applied before rows are written. If the edge starts above
the screen, the code advances the interpolants by `start_y * delta` and starts
at y=0:

```asm
08c6  cmp  word [1910], 0
08cb  jge  08fdh
08cd  mov  bx, [1910]
08d1  mov  ah, [193c]
08d5  mov  al, [18f6]
08d8  imul bx
08da  sar  ax, 8
08dd  add  [190e], ax
...
08f3  mov  word [1910], 0
08f9  add  cx, bx
08fb  jle  094eh
```

The per-row writer at `0929` is compact and important:

```asm
08fd  mov  bx, [190e]      ; x accumulator
0901  mov  dx, [1906]      ; attribute accumulator
0905  mov  dh, [1908]
0912  mov  di, [1910]
0916  shl  di, 1
091a  add  di, [18f4]      ; table base
091e  mov  ax, [18f6]      ; x fractional delta
0921  mov  ah, [193e]      ; attr A delta high byte
0925  mov  cl, [1940]      ; attr B delta high byte

0929  mov  [di], bx        ; edge X for this scanline
092b  mov  [di+032ch], dx  ; packed attributes for this scanline
092f  sub  [1902], al
0933  sbb  bx, [193c]
0937  sub  [1903], ah
093b  sbb  dl, [193f]
093f  sub  [1904], cl
0943  sbb  dh, [1941]
0947  add  di, 2
094a  dec  ch
094c  jne  0929h
```

The use of `CH` as the loop counter is a size trick. Earlier `mov ch, cl`
copies the clipped edge height into the high byte so `dec ch / jne` can loop
without consuming another register.

The tables consumed later are:

```text
198b  left X table
1b21  right X table
1cb7  left packed attribute table
1e4d  right packed attribute table
```

The `077c`/`0805` pair is the bridge between vertex code and the pixel loop.
Everything after this can think in scanline spans.

## 3D Transform And Projection At `0a08` / `09b2`

`0a08` builds a small rotation matrix from the generated sine table. Two timer
phases select table indices:

```asm
0a0c  mov  bx, [1985]
0a10  and  bx, 007fh
0a13  shl  bx, 1
0a15  mov  ax, [2077h+bx]
0a19  mov  [1967], ax
0a1c  mov  ax, [20b7h+bx]
0a20  mov  [196b], ax

0a23  mov  bx, [1987]
0a27  and  bx, 007fh
0a2a  shl  bx, 1
0a2c  mov  ax, [2077h+bx]
0a30  mov  [1969], ax
0a33  mov  ax, [20b7h+bx]
0a37  mov  [196d], ax
```

It then precomputes mixed sine/cosine products:

```asm
0a3a  imul word [196b]
0a3e  sar  ax, 7
0a41  mov  [1971], ax
...
0a61  imul word [196b]
0a65  sar  ax, 7
0a68  mov  [1975], ax
```

The object vertex source starts at `0ff0`, the transformed output starts at
`12f0`, and the transform loop runs `80h` times. Each source vertex is three
signed words. The code computes three output coordinates with `imul`, adds, and
`sar 7` normalization:

```asm
0a6b  mov  cx, 0080h
0a6e  mov  si, 0ff0h
0a71  mov  di, 12f0h

0a74  lodsw
0a75  imul word [196b]
0a79  xchg ax, bx
0a7a  lodsw
0a7b  neg  ax
0a7d  imul word [196f]
0a81  add  bx, ax
0a83  lodsw
0a84  neg  ax
0a86  imul word [1973]
0a8a  add  ax, bx
0a8c  sar  ax, 7
0a8f  stosw                ; transformed X
...
0ac0  stosw                ; transformed Z
0ac1  dec  cx
0ac2  jne  0a74h
0ac4  jmp  09b2h
```

Projection at `09b2` only uses 64 triplets, not all 128 transformed rows. Each
point is projected with a 32-bit numerator and a Z-biased divisor:

```asm
09b6  mov  si, 12f0h
09b9  mov  di, 15f0h
09bc  mov  cx, 0040h
09bf  lodsw                ; x
09c1  lodsw                ; y -> bx
09c3  lodsw                ; z -> bp
09c6  cwde
09c8  add  eax, 000000c8h
09d0  shl  eax, 16
09d4  movsx ebp, bp
09d8  add  ebp, 00001194h
09df  idiv ebp
09e2  sar  eax, 2
09e6  add  ax, 00a0h       ; screen X center 160
```

Then it repeats the divide for Y and stores projected X, projected Y, and depth:

```asm
09ee  shl  eax, 16
09f2  idiv ebp
09f5  sar  eax, 2
09f9  add  ax, 0064h       ; screen Y center 100
09fd  stosw                ; x
09ff  stosw                ; y
0a01  stosw                ; z/depth
```

The hard-coded `1194h` Z bias keeps the divide positive for the intended model
range and makes the projection stable.

## Face List And Backface Test At `0ac7`

The face routine reads a byte index list starting at `0e70`. It loops `80h`
faces:

```asm
0ac7  mov  word cs:[1965], 0080h
0ace  mov  si, 0e70h
0ad1  xor  bx, bx
0ad5  lodsb
0ad6  mov  bl, al
0ad8  shl  bx, 1
0ada  mov  di, [27e3h+bx]  ; remap: index * 6
```

The remap table at `27e3` was generated earlier:

```asm
024f  mov  di, 27e3h
0254  mov  cx, 0080h
0257  stosw
0258  add  ax, 0006h
025b  loop 0257h
```

That turns a vertex index into a triplet offset. The face code loads projected
coordinates from `15f0`, transformed coordinates from `12f0`/`1470`, and builds
the same four-corner scratch layout that the quadrilateral loop uses. For a
triangle, the third vertex is duplicated into corner 3:

```asm
0b4f  mov  [1920], ax
0b52  mov  [1924], ax
...
0b69  mov  [1922], ax
0b6c  mov  [1926], ax
```

The backface test is a 2D signed area check:

```asm
0b77  mov  ax, [1918]
0b7a  sub  ax, [191c]
0b7e  mov  bx, [1922]
0b82  sub  bx, [191e]
0b86  imul bx
0b88  xchg ax, cx

0b89  mov  ax, [191a]
0b8c  sub  ax, [191e]
0b90  mov  bx, [1920]
0b94  sub  bx, [191c]
0b98  imul bx
0b9a  sub  cx, ax
0b9c  jns  0ba6h
0b9f  call 077ch
0ba2  call 0bafh
```

Only one winding goes to the edge builder and span drawer. The object pass
therefore uses the same raster path as the four-point plane, with backfacing
triangles rejected before scan conversion.

## Span Rasterizer At `0baf`

`0baf` is the most important inner loop in the intro. It sets the three segment
registers used by the pixel path:

```asm
0baf  push word [1952]
0bb3  push word [194e]
0bb7  push word [1956]
0bbb  pop  fs              ; texture/source bytes
0bbd  pop  es              ; visible frame buffer
0bbe  pop  gs              ; 8-bit depth/coverage buffer
```

Some operands at `0bb5` and `0bb9` are patched elsewhere, so the exact source
segment can change between phases. The default meaning above is what the
startup layout implies, and the patch sites at `0260`, `0274`, `02d1`, and
`0307` deliberately reroute the span loop.

The routine computes the polygon Y range from the four vertex Y coordinates,
clips it to `0..199`, converts Y to a mode-13h offset, and then processes one
scanline at a time. Per scanline, it reads the two edge tables:

```asm
0c29  mov  bp, [1b21h+si]  ; right X
0c2d  sub  bp, [198bh+si]  ; width = right-left
0c31  jle  0ccfh
0c35  mov  ax, [1cb7h+si]  ; right attributes
0c39  mov  bx, [1e4dh+si]  ; left attributes
```

Then it derives per-pixel deltas. Attribute A uses the low byte and a carried
high byte:

```asm
0c3f  xor  ah, ah
0c41  xor  bh, bh
0c43  sub  ax, bx
0c45  cwd
0c46  shld ax, dx, 8
0c4a  idiv bp
0c4c  mov  [1902], ax
```

Attribute B uses the high bytes of the packed endpoints:

```asm
0c51  shr  ax, 8
0c54  shr  bx, 8
0c57  sub  ax, bx
0c59  cwd
0c5a  shld ax, dx, 8
0c5e  idiv bp
0c60  mov  [1904], ax
```

Horizontal clipping is merged with attribute startup. If `left_x` is negative,
the code shortens the span and advances the texture coordinates as if the
skipped pixels had already run:

```asm
0c71  mov  cx, [198bh+si]  ; left X
0c75  or   cx, cx
0c77  jns  0c94h
0c79  add  bp, cx          ; reduce span width
0c80  push ax
0c81  mov  ax, cx
0c83  imul word [1902]
0c87  add  bl, ah
0c89  mov  ax, cx
0c8b  imul word [1904]
0c8f  add  bh, ah
0c91  pop  ax
```

The actual per-pixel loop starts at `0cb3`:

```asm
0ca8  mov  dx, 7f7fh
0cab  mov  si, [1904]
0caf  mov  cx, [1902]

0cb3  xchg ax, si
0cb4  sub  dl, cl
0cb6  sbb  bl, ch
0cb8  sub  dh, al
0cba  sbb  bh, ah
0cbc  xchg ax, si
0cbd  cmp  gs:[di], ah
0cc0  ja   0ccch
0cc2  cmp  gs:[di], ah
0cc5  mov  al, fs:[bx]
0cc8  or   al, es:[di]
0ccb  stosb
0ccc  dec  bp
0ccd  jne  0cb3h
```

`BX` is the 16-bit texture address. `BL` and `BH` are advanced by subtracting
the high bytes of the fixed-point deltas. `AH` is the per-pixel depth-ish byte.
`GS:[DI]` is the 8-bit per-pixel test buffer. If the stored byte is above the
new value, the pixel is skipped. Otherwise the code samples `FS:[BX]`, ORs the
sample with the current frame byte, and writes it to `ES:[DI]`.

Two things are worth noting:

1. The compare appears twice in the instruction stream:

   ```asm
   0cbd  cmp gs:[di], ah
   0cc0  ja  0ccch
   0cc2  cmp gs:[di], ah
   ```

   The second compare does not feed another branch. It is probably a packed
   size/layout artifact or a left-over byte sequence that still decodes as a
   harmless compare.

2. The loop does not visibly store the new value back to `GS:[DI]` in this exact
   body. The official text still calls the feature an eight-bit z-buffer, and
   the path definitely tests an 8-bit per-pixel buffer. Static disassembly alone
   does not prove every runtime patch/state change around that test, so the
   safest reading is: the shipped intro uses a byte-sized depth or coverage
   surface to accept or reject span pixels, and the visible inner loop is the
   accept/reject and texture sample path.

The write itself is deliberately cheap. `or al, es:[di]` makes new texels
combine with what is already in the frame buffer, giving a bright additive-ish
look without palette math or a blend table.

## Text And Credit Part At `0ce4`

`0ce4` clears the segment at `1956`, sets up a large quadrilateral, runs it
through `077c`, then enters a loop that draws/fades text with the same frame
copy helper:

```asm
0ce4  push word [1956]
0ce8  pop  es
0ce9  xor  di, di
0ceb  xor  ax, ax
0ced  mov  cx, 8000h
0cf0  rep  stosw
...
0d34  call 077ch
```

The script reader at `0d86` reads compact text records from data near `0d84`.
Glyph rendering uses BIOS only as a font source:

```asm
0ddc  push bx
0ddd  mov  ax, 1130h
0de0  mov  bh, 03h
0de2  int  10h             ; ES:BP = 8x8 font
```

The renderer then walks each glyph bit:

```asm
0df0  mov  si, bp
0df2  mov  cl, 08h
0df4  mov  dl, es:[si]
0df7  mov  ch, 08h
0df9  xor  ax, ax
0dfb  rcl  dl, 1
0dfd  jnc  0e01h
0dff  mov  al, 68h
0e01  stosb
0e02  dec  ch
0e04  jne  0df9h
0e06  add  di, 00f8h       ; next glyph row, 320-byte stride
0e0a  inc  si
0e0b  dec  cl
0e0d  jne  0df4h
```

Again the line stride is mode 13h arithmetic: eight `stosb` writes advance by
8, then `+0f8h` advances the remaining 248 bytes for the text layout used by
this part.

The fade routine at `0db9` walks the buffer and decrements paired bytes with
clamps, so letters decay rather than being simply erased. `0e42` is the text
mode wait spinner used during precalc:

```asm
0e44  mov  bx, cs:[193a]
0e49  and  bx, 3
0e4c  mov  ah, 09h
0e4e  mov  al, cs:[0e62h+bx] ; one of - \ | /
0e55  mov  cx, 1
0e58  int  10h
0e5a  inc  byte cs:[193a]
```

## Palette And Mode 13h

After precalc, the intro switches to VGA mode 13h and writes the DAC directly:

```asm
01bf  mov  ax, 0013h
01c2  int  10h
01c4  mov  dx, 03c8h
01c8  out  al, dx
01c9  inc  dx              ; 03c9h, DAC data
```

The first palette loop writes 128 entries where red/green come from `BL` and
blue comes from `BH`, with clamps at `3f`. The second loop fills more entries
by walking `BX` and `AH`, again clamped to the DAC's 6-bit `0..63` range. There
is no high-level palette table. The palette is generated directly through
`3C8h/3C9h`, which saves data bytes and fits the overall strategy: compute
everything that can be computed.

## Why The Intro Feels Bigger Than 4 KB

Crashtest gets its apparent size from three choices:

- It spends startup time generating data instead of storing it: radial map,
  fractal texture, sine table, remap table, palette, and text glyph pixels.
- It uses one scan-conversion path for several jobs. The four-point plane, the
  3D object triangles, and the text/credit quad all feed the same edge tables
  and span loop.
- It patches operands and constants between phases instead of having separate
  routines for each visual state.

The most classic inner loop is the span drawer at `0cb3`: two byte-stepped
texture coordinates, one byte-sized depth test, one texture read, an OR with the
current frame, and a `stosb`. The more distinctive loop is arguably the
height-field pass at `0631`, because it reduces a projected vertical surface to
`stosb; add di,319; dec cx; jne`, which is almost the minimum possible code for
vertical columns in mode 13h.

The result is rough in exactly the way the bundled text hints at: not a clean
engine, but a very compact set of mutually compatible loops. The code is tuned
less like a general renderer and more like a 4095-byte machine made to reuse
every table and every side effect.
