Analysis model: gpt-5.5 xhigh

# White Heat by Pure Resistance - Technical Dissection

`White Heat` is a 1995 MS-DOS 100K intro by Pure Resistance. Demozoo gives
the exact release date as 15 April 1995 and lists it as fourth in the NAID
1995 100K intro competition. Pouet lists the same party, compo, month, and
rank.

This is the next available ranked NAID 1995 100K intro after `Less is More`,
the lost `Floppy Disk`, and `High Pressure`.

Release year: 1995

Released: 15 April 1995

## Sources

- Scene.org NAID 1995 100K index:
  https://archive.scene.org/pub/parties/1995/naid95/100k/_readme.txt
- Scene.org `heat.zip`:
  https://archive.scene.org/pub/parties/1995/naid95/100k/heat.zip
- Scene.org `heat.diz`:
  https://archive.scene.org/pub/parties/1995/naid95/100k/heat.diz
- Demozoo production:
  https://demozoo.org/productions/90237/
- Pouet production:
  https://www.pouet.net/prod.php?which=30117

Old personal contact details from the original note are deliberately omitted.

## Archive Identity

The NAID 1995 100K index lists:

```text
heat            "White Heat" by Pure Resistance                         #4
```

The archive contains:

```text
FILE_ID.DIZ      387 bytes
HEAT.EXE       66902 bytes
HEAT.NFO       12452 bytes
HEAT.S3M       47164 bytes
```

The note credits Virtual Seeker and Hades with code. It credits Freejack,
Draygen, and Nexus with music. Demozoo's page also credits Freejack for music,
Krynn and Pyromaniac for graphics, and Virtual Seeker for code.

The note says the intro was first presented at NAID 1995, placed fourth, needs
`HEAT.EXE` and `HEAT.S3M` in the same directory, needs roughly 475K of base
memory, and may show odd palette colors on Sound Blaster because the original
version was GUS-oriented and the SB conversion did not fully match every effect.

Hashes used for this pass:

```text
cb3ed9056f104a7ed62cf79f89df6273be90d90d2eb1c47766828aa3d1a2efeb  heat.zip
60f8432522158f381c16725a2cf439400b9753e0f3494e7c8932da7874f80382  HEAT.EXE packed
a6cafdf75b116e8f8750ed5315953ca0f510c95ba0ad2b7838c3c8003fcc5ad3  HEAT.S3M
e354f66e7d0c78501b44892a329c84e8c1ee6979ef091c17bcffdff862799dfe  HEAT.NFO
```

## Expanded MZ Layout

The shipped `HEAT.EXE` is an MZ executable with a self-extracting PKZIP/PKLITE
signature. UNP expands it from 66,902 bytes to 127,824 bytes.

Expanded MZ header:

```text
file size:          127824 bytes
computed MZ image:  105408 bytes
header bytes:         4288 bytes
load image bytes:   101120 bytes
overlay bytes:       22416 bytes
relocations:          1063
initial CS:IP:      0000:02c8
initial SS:SP:      1e9e:23de
entry load offset:  0x02c8
entry file offset:  0x1388
```

The overlay is data, not a child MZ chain. The release keeps the music as an
external S3M and keeps effect assets inside the expanded MZ image and its data
tail.

The program is a real-mode Borland-style executable. That shows up in the
large relocation table, Pascal-like far-call unit layout, and runtime strings
such as `ERROR! Bounds check.`. The custom code still contains direct VGA,
keyboard, and 386 string-instruction routines where speed matters.

Offset notation in this writeup:

- `load+0x...` means an offset inside the expanded load image after the MZ
  header is removed.
- Far calls are also translated to load offsets. For example, `4DC:0216`
  is `load+0x4fd6`.
- objdump sometimes prints wrapped 16-bit DS references such as
  `[di-0x55f4]`. In this article those are written as the natural wrapped
  offsets, for example `DS:AA0C`.

## Music Module

`HEAT.S3M` is a normal Scream Tracker 3 module:

```text
title:       White Heat Theme
orders:      58
instruments: 20
patterns:    51
global vol:  64
speed:        3
tempo:      125
master:     176
```

Order list:

```text
50 00 01 02 03 09 0a 09 0d 0e 0f 0e 0f 10 11 10
12 13 14 13 14 15 16 15 17 1d 1e 1d 1e 1f 1f 20
20 21 22 21 23 2c 2d 2e 2f 30 31 24 2b 04 05 04
06 1c 1b 1c 1b 1a 19 1a 18 ff
```

Instrument table:

```text
01 Bass Drum          len 2092  vol 64  c2 8363
02 PreSnare           len  914  vol 30  c2 8363
03 Snare              len 4254  vol 64  c2 8363
04 OrchHit            len 2690  vol 64  c2 8363
05 SDBass1            len  128  loop 0-128     vol 64  c2 8363
06 SDBass2            len  128  loop 0-128     vol 64  c2 8363
07 SDBass3            len  128  loop 0-128     vol 64  c2 8363
08 NovaBass1          len  124  loop 0-124     vol 64  c2 8107
09 NovaBass2          len  413  loop 25-400    vol 64  c2 8169
10 NovaBass3          len  376  loop 4-376     vol 64  c2 8107
11 NovaBass4          len  123  loop 0-123     vol 64  c2 8046
12 NovaBass5          len  252  loop 0-252     vol 64  c2 8232
13 NovaBass6          len  123  loop 0-123     vol 64  c2 8046
14 Pling              len 2110  vol 64  c2 8363
15 Guitar Short       len 2810  loop 1874-2790 vol 64  c2 8529
16 TightSynth.Short   len 4988  loop 1200-4740 vol 64  c2 8280
17 empty
18 empty
19 text instrument: Freejack / Pure Resistance
20 text instrument: April 1995
```

The executable contains the sound setup user interface and a copy of the
music/runtime code. Strings identify Otto Chrons' sound stack:

```text
Timer Service v1.5
PAS-DETECT v1.0
SB-DETECT v2.0
SB16-DETECT v1.0
AMP v1.70
MCP v2.6
```

The setup supports Gravis Ultrasound, PAS, Sound Blaster, Sound Blaster Pro,
Sound Blaster 16, and no sound. The manual setup path asks for base I/O port,
IRQ, DMA, and a mixing rate from 4000 Hz up to 21000 Hz.

## Startup Chain

The MZ entry at `load+0x02c8` is mostly a Borland unit initializer chain:

```asm
02c8: call far 0F26:0000
02cd: call far 09A6:0235
02d2: call far 047A:000d
02d7: call far 0474:0050
02dc: call far 043A:0227
02e1: call far 037B:0a30
02e6: call far 02BB:0bf4
02eb: call far 01E8:0ce0
02f0: call far 004D:0e09
02f5: call far 0042:0082
```

After unit init, the main routine:

```asm
0379: push 0000
037b: push 0013
037d: call far 04DC:0216     ; INT 10h, mode 13h
0382: call 0000              ; scene 1
038e: call far 04DC:0074     ; clear A000
0393: call far 037B:067A     ; scene 2
03a1: call far 04DC:0074
03a6: call far 02BB:047B     ; scene 3
03b4: call far 04DC:0074
03b9: call far 01E8:0A86     ; scene 4
03c7: call far 04DC:0074
03cc: call far 01AA:0233     ; scene 5
03da: call far 04DC:0074
03df: call far 0138:007A     ; scene 6
03e4: push 0000
03e6: push 0003
03e8: call far 04DC:0216     ; text mode on exit
```

Between scenes it checks `DS:7D80`, a flag set by the keyboard interrupt
routine at `load+0x041f`.

The keyboard handler reads the raw scancode from port `60h`, acknowledges the
key on port `61h`, sends EOI to the PIC on port `20h`, and sets `DS:7D80`
unless the scancode is `1Bh`:

```asm
0430: in  al,60h
0432: mov [7d8e],al
0435: in  al,61h
0439: or  al,80h
043b: out 61h,al
043d: mov al,ah
043f: out 61h,al
0441: mov al,20h
0443: out 20h,al
0445: cmp byte [7d8e],1bh
044a: je  0451
044c: mov byte [7d80],1
```

Because port `60h` yields a scancode, this is not a normal Escape test.
Standard PC set-1 Escape is `01h`; `1Bh` is a different key code. So this is
either a mistaken ASCII-style compare or an intentional way to exempt that one
scancode from the exit flag.

## Shared VGA Routines

The unit at `4DC:*` is the main VGA helper table.

`4DC:0049` / `load+0x4e09` is a far block copy:

```asm
4e13: push ds
4e14: les di,[bp+08]       ; destination
4e17: lds si,[bp+0c]       ; source
4e1a: mov cx,[bp+06]       ; byte count
4e1d: shr cx,2
4e20: rep movsd
4e23: and word [bp+06],3
4e2a: mov cx,[bp+06]
4e2d: rep movsb
```

`4DC:0074` / `load+0x4e34` clears VGA memory:

```asm
4e34: mov ax,0a000h
4e37: mov es,ax
4e39: xor di,di
4e3b: xor eax,eax
4e3e: mov cx,3e80h
4e41: rep stosd            ; 16000 dwords = 64000 bytes
```

`4DC:0085` / `load+0x4e45` clears an arbitrary far buffer using the same
`rep stosd` plus byte-tail pattern.

`4DC:00AE` / `load+0x4e6e` draws an opaque rectangle from a far source buffer
to the current 320-wide destination pointer stored at `DS:6072`.

The core row loop is:

```asm
4e90: les di,[6072]        ; current destination buffer
4e95: lds si,[bp+0e]       ; source image
4e9b: mul bx               ; y * 320
4ea3: add di,[bp+0c]       ; + x
4ea5: mov ax,0140h
4ea8: sub ax,[bp+08]       ; row skip = 320 - width
4eb1: and dx,1
4eb5: shr word [bp+08],1
4ebb: mov cx,[bp+08]
4ebe: rep movsw
4ec0: cmp dx,1
4ec5: movsb                ; odd pixel tail
4ec6: add di,[bp-02]
4ec9: dec bx
4eca: jne 4ebb
```

`4DC:0170` / `load+0x4f30` copies a rectangle from the active 320-wide screen
buffer into a far destination. `4DC:01E4` / `load+0x4fa4` waits for vertical
retrace by polling port `3DAh`.

`4DC:01F2` / `load+0x4fb2` writes a single DAC entry:

```asm
4fbc: mov dx,03c8h
4fbf: mov al,[bp+0c]       ; palette index
4fc2: out dx,al
4fc3: mov dx,03c9h
4fc6: mov al,[bp+0a]       ; red
4fc9: out dx,al
4fca: mov al,[bp+08]       ; green
4fcd: out dx,al
4fce: mov al,[bp+06]       ; blue
4fd1: out dx,al
```

`4DC:02DE` / `load+0x509e` uploads a palette block from memory. It calculates
`index * 3` and then streams `count * 3` bytes to port `3C9h`:

```asm
50a8: lds si,[bp+0a]
50ac: mov cx,[bp+06]
50af: shl cx,1
50b1: add cx,[bp+06]       ; count * 3
50b4: mov ax,[bp+08]
50b7: add si,[bp+08]
50ba: shl word [bp+08],1
50bd: add si,[bp+08]       ; palette + index*3
50c0: mov dx,03c8h
50c3: out dx,al
50c4: inc dx
50c5: rep outsb
```

These helpers explain most of the visual code: the scenes maintain offscreen
buffers, change `DS:6072` to point at the current target, then call these
rectangle and palette routines.

## Fixed-Point Math Tables

The code uses wrapped DS tables:

```text
DS:A80C  cosine-like table, word entries
DS:AA0C  sine-like table, word entries
DS:5F6A  byte wavetable used for palette and motion
DS:6072  active 320-wide destination pointer
```

The math helpers in the `F26:*` unit do multiword fixed-point arithmetic. The
visual code repeatedly uses this pattern:

```asm
mov ax,value
cwd
call far 0F26:13D0       ; integer to fixed-style accumulator
mov cx,table_x
mov si,table_y
mov di,table_z
call far 0F26:13BC       ; fixed multiply/combine
call far 0F26:13DC       ; fixed result back to word
```

That is slower than hand-written 386 integer math, but it gives the Pascal code
a consistent vector pipeline. The high-throughput pixel work is still done in
custom assembly loops.

## Scene 1: Opening Tile Breaker

Scene 1 starts at `load+0x0000`. It allocates one 64,000-byte screen buffer,
sets mode 13h again, clears the buffer, and reads embedded bitmap data through
the Borland file runtime. The local file strings immediately after the routine
are:

```text
HEAT.S3M
HEAT.EXE
```

The routine reads two words from the data stream into stack locals. Those are
then multiplied and used as a byte count:

```asm
006b: read word -> [bp-4e]
0085: read word -> [bp-50]
00a9: mov ax,[bp-4e]
00ac: mul word [bp-50]
00b4: read ax bytes into the 64000-byte buffer
00be: draw rectangle at x=0,y=0,width=[bp-4e],height=[bp-50]
```

It then makes fifteen 10x10 snapshots from the first row of the displayed
image:

```asm
00e8: mov [bp-42],1
00f2: allocate 100 bytes
010b: les di,[bp+di-40]      ; tile buffer i
0113: ax = (i-1) * 10
011e: call 4DC:0170          ; capture 10x10 at x=(i-1)*10,y=0
0123: loop i=1..15
```

The animation loop then clears the staging buffer, redraws every 10x10 tile
except the active tile, and makes the active tile move through an expanding
rectangle. The moving tile is drawn by the scaled transparent blitter at
`0420:00C9` / `load+0x42c9`.

The core coordinate update is:

```asm
01ed: ax = active_index * 10 + 45h - x_offset
01f8: ax = 5fh - y_offset
0203: ax = active_index * 10 + 4eh + x_offset
020d: ax = 68h + y_offset
0211: call far 0420:00c9     ; scale source tile into that rectangle
0216: y_offset += y_delta
021c: if y_offset > 40 then y_delta = -y_delta
022a: x_offset += x_delta
0230: if x_offset > 40 then x_delta = -x_delta
```

The frame is copied to the display pointer after each step:

```asm
023e: source = work buffer
0243: destination = DS:606E
0249: size = 64000
024c: call 4DC:0049
0251: clear work buffer
0264: repeat until y_offset returns to zero
```

The important inner loop is the scaled transparent blitter. It computes
horizontal and vertical fixed-point steps from source dimensions to destination
rectangle dimensions, then for each destination pixel chooses a source byte and
skips zero:

```asm
42d7: width  = x2 - x1 + 1
42e1: height = y2 - y1 + 1
42eb: x_step = source_width  / width
4310: y_step = source_height / height
434e: di = output_y * 320 + output_x
4359: bx = source_row_accum * source_width + source_pointer
4364: cx = width
436f: al = [bx]
4371: cmp al,0
4375: mov es:[di],al         ; only nonzero pixels are drawn
4378: advance source fraction
437d: loop across row
437f: add di,row_skip
438e: repeat for height rows
```

That makes the opening look less like a raw page flip and more like a small
bitmap logo being pulled apart into elastic chunks.

## Scene 2: Heat Strips, Fire Buffer, And Embedded Images

Scene 2 is the far call `037B:067A`, or `load+0x3e2a`. It allocates:

```text
64000 bytes  main work buffer
13120 bytes  flame / strip field
```

It calls `load+0x37b0` to build a palette. The palette loop fills the first
63 colors with a rising red component, then fills the next 63 with saturated
red and a green half-ramp:

```asm
37e2: for i=1..63:
37ec:   palette[i].r = i
3802: for i=1..63:
381a:   palette[i+63].r = 63
3822:   palette[i+63].g = i/2
3849: upload palette 0..255
```

The hot field is updated by two tiny loops.

`load+0x3850` injects randomness into the bottom row of the 320-wide field:

```asm
385e: i = 1
3865: random(120)
3871: ax = i + 30c0h
3877: di = flame_buffer + ax
387d: [di-1] = random_byte
3881: loop until i == 320
```

`load+0x388a` is the heat diffusion loop. It runs over `0x30C0` bytes,
averages four neighbors, shifts by two, and subtracts one if nonzero:

```asm
388a: si = flame + 320
3892: bx = 30c0h
3895: ax = 0
3899: al = [si]
389c: cl = [si+320]
38a1: ax += cx
38a3: cl = [si+1]
38a7: ax += cx
38a9: cl = [si-1]
38ad: ax += cx
38af: ax >>= 2
38b2: if ax != 0 then ax--
38b5: [si-320] = al
38ba: si++
38bb: bx--
38bc: repeat
```

The renderer at `load+0x38bf` converts the field into wide horizontal bands.
It samples a 160-pixel span from the field and writes each hot byte twice to
the visible buffer, so each source byte becomes a two-pixel pair:

```asm
38c9: es:di = main work buffer
38d1: di += y_scale * line_offset * 320
38e4: ds:si = flame_buffer + source_offset
38ea: rows = 39
38ed: columns = 160
38f0: al = [si]
38f2: if al >= 14h:
38f6:     ah = al
38f8:     es:[di] = ax       ; two adjacent pixels
38fb: di += 2
38fe: si++
3902: si += 160
3906: repeat row
```

The main scene repeatedly calls `38bf` with nine alternating horizontal
offsets:

```text
0, +20, -20, +40, -40, +60, -60, +80, -80
```

That creates mirrored heat panels instead of a single centered flame.

The helper `load+0x39f4` loads two embedded images with dimensions
`0x008B x 0x004A` and `0x0094 x 0x0041`. It uses `4DC:0111`
(`load+0x4ed1`) to place them into the hot strip composition, while the heat
field continues to be diffused underneath.

Scene 2 therefore has three layers:

- palette ramp and field injection;
- nine half-width heat-strip draws;
- two small decoded images composited between the strips.

## Scene 3: Two Animated 3D Point Clouds

Scene 3 is `02BB:047B`, or `load+0x302b`. It starts by allocating two `0x0C30`
byte arrays. Each array holds 6-byte point triples, so each can carry 520
`x,y,z` records.

The point generator at `load+0x2bb0` creates two related point lists. It walks
two fixed-point angular state vectors and stores triples into the two buffers:

```asm
2bbe: state A = 9A7F:9999:1999
2bcd: color A = 3Ch
2bd7: vector 1 = 2183:DAA2:490F
2bff: vector 2 = 2182:DAA2:490F
2c27: compute sin/cos terms from vector 2
2c38: compute sin/cos terms from vector 1
2c49: multiply by color radius
2ce0: store x/y/z into array A record
2d31: step vector 2
2d48: record_count++
```

Then it repeats the same construction with a smaller color/radius:

```asm
2d78: state B = CD7F:CCCC:4CCC
2d87: color B = 14h
2d91: vector 1 = 2183:DAA2:490F
2db9: vector 2 = 2182:DAA2:490F
...
2f2b: store count in DS:A5DA
```

The scene builds a split palette:

```asm
3077: for i=1..128:
3083:   palette[i] = (i, i/4+20h, 1)
30a4: for i=129..255:
30b0:   palette[i] = (i, 63, i/4+34h)
```

The main loop clears four stack arrays, transforms every point from both
clouds, erases its previous pixel, writes its new pixel, and waits for retrace.

For the first cloud, the loop is:

```asm
3195: bounding box = empty
31c0: for point = 1..countA:
31ca:   erase old pixel via 2F34
31da:   load x,y,z from A5D0[point]
321c:   call 043A:0000      ; rotate by three angle bytes
3243:   call 043A:018E      ; project to screen x/y
3271:   x += horizontal drift
3294:   y += wavetable[color_phase] + field_offset - 15
32c2:   clamp/fold x near 20 and 300
3315:   clamp/fold y near 1 and 199
3380:   update min/max bounding box
33e4:   plot new pixel via 2FB6
```

The second cloud repeats the same idea with a different set of local arrays
and with the alternate plotter at `load+0x2fef`, which adds `0x80` to the color:

```asm
2fb6: color = base_color + z/2
2fe8: A000[y*320+x] = color

2fef: color = base_color + z/2 + 80h
3024: A000[y*320+x] = color
```

The drift variables bounce inside the active point bounding box:

```asm
3660: vertical_offset += vertical_delta
3673: if below min_y then flip delta
36a0: if above max_y then flip delta
36cb: horizontal_offset += horizontal_delta
36ef: if left of min_x then flip delta
372b: if right of max_x then flip delta
374f: angle_a -= 2
3754: angle_b += step_b
375c: angle_c += step_c
376c: wait retrace
```

This section is not just random dots. It is a two-cloud 3D point effect with
per-point old-pixel erase, per-frame rotation, projection, palette split, and
moving bounds.

## 3D Rotation And Projection Helpers

The 3D routines live in the `043A:*` unit.

`043A:0000` / `load+0x43a0` applies three angular rotations to an `x,y,z`
triple. It reads sine/cosine words from `DS:AA0C` and `DS:A80C`, multiplies
them through the fixed-point helpers, and writes the transformed coordinates
back through far pointers supplied on the stack.

The shape of the helper is:

```asm
43ae: scale = [606A]
43b5: sin(angle_x) * z
43c9: cos(angle_x) * x
43d5: combine -> temp_a
43ec: sin(angle_y) * temp_a
440a: cos(angle_y) * y
4415: combine -> temp_b
442d: sin(angle_x) * x
4443: cos(angle_x) * z
444d: combine -> temp_c
4464: cos(angle_y) * temp_a
4482: sin(angle_y) * y
4493: store rotated z
44a5: sin(angle_z) * temp_c
44c1: cos(angle_z) * temp_b
44d9: store rotated y
44eb: sin(angle_z) * temp_b
4507: cos(angle_z) * temp_c
451f: store rotated x
```

`043A:018E` / `load+0x452e` projects a rotated point. It uses `DS:606C` as
the viewer distance. If `z == viewer_distance`, it returns `FFFFh` for both
screen coordinates; otherwise it divides by the depth delta:

```asm
4538: viewer = [606C]
4541: dz = z - viewer
4549: if dz == 0 then x=y=FFFFh
4569: projected_y = viewer * y / dz
459b: projected_x = viewer * x / dz
```

`load+0x45c7` precomputes the sine/cosine tables used by these helpers. It
iterates `0..255`, stores cosine-like words to `AA0C`, sine-like words to
`A80C`, and a second triple table to `AC0C`.

## Scene 4: Rotating Object And Sprite Modes

Scene 4 is `01E8:0A86`, or `load+0x2906`. It allocates two full-screen
buffers, initializes the sine/cosine tables, and builds an 8-record object.
Each record is 8 bytes at `DS:A27E`:

```text
x, y, z, original/aux value
```

`load+0x1f24` initializes the base coordinates. The values are small signed
words around `-30..+33`, so this is a compact hand-made object, not an imported
mesh.

Every frame, `load+0x21d5` applies three rotations to the eight records. The
inner loop is:

```asm
21e3: for point = 0..7:
21f3:   read base z
2209:   multiply by sin/cos table for angle A
2223:   read base y
2239:   multiply by paired table
224d:   combine -> temp screen y
2260:   rotate z/y another way -> temp screen x
22c7:   read base x -> temp depth
22df:   store x/y/z into A27E transformed record
2306:   rotate around angle B
23fc:   rotate around angle C
24f6:   subtract global scale/depth term
2531:   perspective x = x * 256 / depth + 0x2000-ish
257b:   perspective y = y * 256 / depth + 0x7000-ish
25b9: sort eight records by depth
```

The depth sort is a small exchange sort:

```asm
25b9: for i=0..6:
25cf:   for j=i+1..7:
25dd:     zi = A27E[i].z
25ea:     zj = A27E[j].z
25f1:     if zi < zj keep order
25ff:     copy A27E[i] to temp
2617:     copy A27E[j] to A27E[i]
2630:     copy temp to A27E[j]
```

The object is then drawn by one of three renderers, selected by music/timer
position:

- `load+0x276c` uses a wide `120x8` captured strip per point.
- `load+0x27f6` uses a smaller `41x35` source sprite at `DS:060C`.
- `load+0x2871` draws a palette-modulated stamp with the palette block at
  `DS:A2C8`.

The wide-strip renderer clears the frame buffer, walks the depth-sorted
records, and calls the blitter at `0474:0000` with each record's projected
position:

```asm
2788: for point = 1..8:
2792:   source = screen_strip[(point-1)*0C80h]
27b0:   x = point.x - 3Ch
27c4:   y = point.y - 23h
27cc:   width = 120
27ce:   height = 8
27d0:   call 0474:0000
27db: wait retrace
27e0: copy back buffer to display
```

The scene also has a transition at `load+0x2659`: it loads a palette, copies
the old frame to a buffer, and repeatedly draws a moving masked image at
coordinates derived from `DS:5F6A`. That transition leads into the later small
sprite mode.

## Scene 5: 200x200 Fire Diffusion

Scene 5 is `01AA:0233`, or `load+0x1cd3`. It allocates a `0x9C40` byte buffer,
exactly 200x200 pixels, and seeds it with border heat:

```asm
1cf1: allocate 40000 bytes
1d01: fill first 399 bytes with 14h
1d15: fill last 336 bytes with 5
1d29: for y=1..200:
1d42:   buffer[y*200] = 5
1d4e: for y=1..200:
1d69:   buffer[y*200 + 199] = 5
1d75: for y=75..125:
1d93:   fill 100 bytes around x=50 with 5
```

It then loads a palette and an embedded bitmap, storing the bitmap dimensions
in `DS:7DB6` and `DS:7DB8`, then allocates a bitmap buffer.

The fire solver at `load+0x1adf` is an 8-neighbor blur over the inner 199x199
area. It first copies the full 200x200 buffer to a temporary buffer using
`rep movsd`, then averages the eight surrounding pixels from the old buffer and
writes the result into the new buffer:

```asm
1afb: copy 40000 bytes from fire to temp
1b09: si = 201
1b0c: di = 201
1b0f: cx = 9b77h
1b16: al = [si+1]
1b19: bl = [si-1]
1b1c: ax += bx
1b1e: bl = [si-200]
1b24: bl = [si+200]
1b2a: bl = [si-201]
1b30: bl = [si+199]
1b36: bl = [si-199]
1b3c: bl = [si+201]
1b42: ax >>= 3
1b45: ax--
1b46: temp[di] = al
1b49: di++
1b4a: si++
1b4b: loop
1b4f: copy temp back to fire
```

The decrement after the average is the cooling term. There is no divide table:
the average is a plain shift by three.

`load+0x1b6d` draws the 200x200 buffer at x=60, y=0:

```asm
1b77: wait retrace
1b7c: source = fire buffer
1b82: x = 60
1b84: y = 0
1b86: width = 200
1b89: height = 200
1b8c: call 4DC:00AE
```

The optional bitmap scaler at `load+0x1b93` draws the loaded bitmap into a
temporary 320x200 buffer, with a bouncing width and height:

```asm
1ba1: center x = 100, center y = 98
1be5: width  += dx
1bee: height += dy
1c14: x1 = center_x - width/2
1c28: y1 = center_y - height/2
1c31: x2 = right_x + width/2
1c37: y2 = bottom_y + height/2
1c40: call 0420:00C9       ; scaled transparent draw
1c45: bounce if height > 80 or < 1
1c61: bounce if width  > 120 or < 1
1c7d: draw temp buffer full-screen
```

The result is a centered 200x200 heat field with an image pulse folded into it.

## Scene 6: Final Text And Expanding Wave

Scene 6 is `0138:007A`, or `load+0x13fa`. The plain strings immediately before
the routine are:

```text
THE END
BACK TO
REALITY
```

The routine creates a 768-byte palette buffer and three 56x8 text strips:

```asm
141e: allocate 0x300 palette bytes
1478: allocate 0x1c0 text strip A
1495: read/capture 56x8 at y=0
14b5: allocate 0x1c0 text strip B
14d2: read/capture 56x8 at y=7
14f2: allocate 0x1c0 text strip C
150f: read/capture 56x8 at y=15
```

It writes a repeating 10-entry color pattern into six rows of the palette
buffer. The pattern is:

```text
32 37 3c 37 32 28 1e 14 1e 28
```

The loop stores those values in the blue component slot of successive DAC
triples:

```asm
1528: row = 0
1530: palette[(row*10 + 1) * 3 + 2] = 32h
1546: palette[(row*10 + 2) * 3 + 2] = 37h
155d: palette[(row*10 + 3) * 3 + 2] = 3Ch
1575: palette[(row*10 + 4) * 3 + 2] = 37h
158d: palette[(row*10 + 5) * 3 + 2] = 32h
15a5: palette[(row*10 + 6) * 3 + 2] = 28h
15bd: palette[(row*10 + 7) * 3 + 2] = 1Eh
15d5: palette[(row*10 + 8) * 3 + 2] = 14h
15ed: palette[(row*10 + 9) * 3 + 2] = 1Eh
1605: palette[(row*10 +10) * 3 + 2] = 28h
161d: repeat row 0..5
```

The main final loop builds expanding rings of tiny plotted points, then draws
the 56x8 text strip with sine/cosine drift. The plotting subroutine is the
small helper at `load+0x1380`:

```asm
138a: es = [DS:7D90]       ; frame buffer
1393: y_index = angle_y
1398: x = cos_table[y] * radius / 128 + x_offset + 160
13b4: y = sin_table[x] * radius / 128 + y_offset + 100
13cc: if x<=319 and y<=199:
13d6:     di = y*320 + x
13d8:     al = color
13db:     es:[di] = al
```

The ring builder uses a dynamic radius and step:

```asm
165f: frame_counter++
166b: ring_step = 3
1670: for radius while radius < max_radius:
1685:   for angle from 0 to active_width step 8:
168f:       x_wave = cos[(200-radius + x_phase) % 255] / 2
16af:       y_wave = sin[(200-radius + y_phase) % 255] / 2
16d9:       plot point with color ramp
16e2:   radius += ring_step
16f4:   every fifth radius, ring_step++
1700: active_width grows up to 254
1719: max_radius grows every other frame up to 220
```

After frame 500, it starts drawing the active text strip with the scaled
transparent blitter. The position follows the sine/cosine tables and is clipped
to the 320x200 screen:

```asm
172c: text_timer++
1742: text_size = (text_timer + 30) / 2
1751: x = cos[(200 - 2*text_size + x_phase) % 255] / 2 + 145
1795: clamp x so x + text_size + 14 <= 320
17ac: y = sin[(200 - 2*text_size + y_phase) % 255] / 2 + 90
17ed: clamp y so y + text_size <= 200
17f6: source = text strip A/B/C
1806: source width = 56, source height = 8
180a: destination rectangle = x,y to x+text_size+14,y+text_size
1839: call 0420:00C9
```

The palette is animated by shifting the 768-byte buffer and re-uploading it
after the retrace wait:

```asm
1862: shift palette buffer by 1 entry
186d: wait retrace
1878: upload palette entries 2..60
1881: copy frame buffer to display
190d: clear frame buffer
```

At frame counters `0x2EE` and `0x3E8`, the code swaps which 56x8 strip is used.
The last phase repeats the point-ring draw while shrinking the active radius
and adding a small wait based on the frame counter.

## Runtime Timing

The scenes use the sound/timer unit at `ABC:*` as a time base. The call
`ABC:1402` appears throughout the scenes and returns a small increasing value
used for scene cuts:

```asm
1e61: call ABC:1402
1e66: cmp ax,25h      ; fire scene duration

2ade: call ABC:1402
2ae3: cmp ax,10h      ; rotating object phase change
2b13: call ABC:1402
2b18: cmp ax,19h      ; second phase change
2b31: call ABC:1402
2b36: cmp ax,1Dh      ; scene end

3775: call ABC:1402
377a: cmp ax,0Dh      ; point-cloud scene end
```

That makes the code music-relative without embedding a hard frame count in
every part. The visual loops still wait on vertical retrace before presenting
their buffers, so the timing source and the VGA pacing are separate.

## Static Code-Path Concordance

This pass is code-path concordance rather than a new runtime capture. No
screenshots, GIFs, or videos are claimed for this page. The useful evidence is
the way the expanded MZ, external S3M, shared VGA helpers, and six scene calls
line up into a recoverable intro script:

- Archive/runtime identity: `heat.zip` contains `HEAT.EXE`, `HEAT.S3M`,
  `HEAT.NFO`, and `FILE_ID.DIZ`; the note requires the executable and S3M in
  the same directory, matching the startup strings and music module analysis.
- Loader boundary: UNP restores the 66,902-byte packed MZ to a 127,824-byte
  Borland-style real-mode program. The overlay is data, not a hidden second
  executable, so the effect code described here is from the restored load image.
- Presentation shell: the entry chain switches to mode `13h`, calls six scene
  routines in fixed order, clears `A000h` between scenes through `4DC:0074`,
  checks the keyboard flag at `DS:7D80`, and returns to text mode at the end.
- Shared visual primitives: `4DC:*` supplies the full-screen copy, arbitrary
  buffer clear, rectangle copy, retrace wait, single-DAC write, and palette
  upload paths. The scene descriptions above are tied to those helpers rather
  than inferred from visual names alone.
- Music-relative pacing: repeated calls to `ABC:1402` gate scene and phase
  changes while the visible frame delivery still waits on `3DAh` retrace. That
  separates soundtrack timeline from VGA presentation.
- Scene 1 proof chain: the top-level call to `load+0x0000` reads embedded image
  dimensions, draws the image, captures fifteen `10x10` strips, and feeds them
  to the scaled transparent blitter at `0420:00C9`, proving the tile-breaker
  interpretation.
- Scene 2 proof chain: `037B:067A` allocates a `64000`-byte target plus a
  `13120`-byte hot field, builds the red/yellow DAC ramp, injects random bottom
  heat, diffuses four-neighbor samples, and draws nine offset strip passes.
- Scene 3 proof chain: `02BB:047B` builds two 520-record point arrays,
  transforms each `x,y,z` triple through `043A:0000`, projects through
  `043A:018E`, erases old pixels, plots new pixels, and uses a split palette.
- Scene 4 proof chain: `01E8:0A86` builds an eight-record object, rotates and
  depth-sorts it, then selects one of three sprite/object renderers according
  to timer/music position.
- Scene 5 proof chain: `01AA:0233` allocates exactly `200x200` bytes, seeds
  border heat, applies an eight-neighbor blur/cooling pass, and copies the
  centered field at `x=60,y=0`; the optional bitmap pulse reuses the same scaled
  transparent draw path as the opening tile effect.
- Scene 6 proof chain: `0138:007A` captures three `56x8` text strips, draws
  expanding sine/cosine point rings, scales the text after frame 500, shifts a
  768-byte palette buffer, and uploads DAC entries `2..60`.

Evidence boundary: without a fresh trusted capture, this section deliberately
does not say which exact visual frame corresponds to each phase. It says which
effect mechanisms are proven by the restored code, data sizes, direct VGA/DAC
I/O, and top-level call order.

## What The Intro Is Doing Internally

The intro is not a tiny one-effect 100K. It is closer to a compact Pascal demo
shell with a set of reusable assembly helpers:

- external S3M playback through AMP/MCP and sound-device setup;
- Borland runtime file and heap support;
- a direct Mode 13h helper unit for clears, copies, DAC writes, and retrace;
- a fixed-point sine/cosine vector unit;
- multiple image assets stored in the executable data area;
- two independent heat/fire solvers;
- two 3D object systems, one for point clouds and one for sprite/object modes;
- a final text effect that combines ring plotting, palette shifts, and scaled
  transparent text strips.

The most instructive inner loops are the diffusion solvers and the blitters.
The diffusion loops are simple but visually effective: average neighboring
bytes, cool the result, and redraw a thresholded field as doubled pixels or a
centered 200x200 buffer. The blitters handle most compositing work: one path is
a rectangular `rep movsw` copy, another is a transparent byte loop, and the
scaled path performs fixed-point source sampling per destination pixel.

The 3D code is more structured than it first appears. It keeps sine/cosine
tables in wrapped DS offsets, transforms compact word triples through a shared
rotation helper, projects them through a viewer-distance divide, and then
either plots old/new pixels directly or draws a sprite per depth-sorted point.
That explains why the intro feels like several disconnected effects while the
binary still has a coherent internal shape.
