Analysis model: gpt-5.5 xhigh

# 3k of innocence: INNON3K.COM code analysis

## Evidence and address convention

This analysis uses the released `INNON3K.COM`, not a reconstructed source file.
The executable is a 2,912-byte DOS COM image:

```text
cd19f855886a6f560a0d88a25ca3e917678041bccefdd3d65c34453dccf9dd54  INNON3K.COM
```

The package hash is:

```text
fd84e14df64e1d875d5a5d2d02eb585d97c25809f18b4edc4ab4443c1078093a  innon3k.zip
```

COM addresses in this article are runtime offsets relative to the program
segment. File offset zero is runtime `0100h`; the last byte in the file is
runtime `0C5Fh`. Words at `0C60h` and above are zero-initialized workspace
outside the file image.

The included TXT says the intro was written in assembly, uses 386
instructions, requires about 192 KB free, and converts a Scream Tracker 3
tune to a small AdLib stream. Those statements are consistent with the code:
the renderer uses 32-bit operand-size prefixes, the largest temporary segment
ends 192 KB above `CS`, and the file contains an OPL register interpreter
rather than an S3M module. Old personal contact data in the TXT is omitted.

## DOSBox-X run used for control-flow verification

The original COM was run under DOSBox-X 2026.01.02 with a normal 12,000-cycle
core, S3-compatible VGA, 4 MB RAM, and sound disabled. DOSBox-X rendered to an
X11 window under Xvfb; ffmpeg captured that host window. This avoided the
`dx-capture` mode-change crash seen in an earlier attempt.

The external capture is 40.707 seconds including DOSBox startup. It reaches
all visible stages and the final `The end` text. After the program returned,
DOSBox-X logged `Corrupt UMB chain: 0` while shutting down. This run therefore
verifies scene order and visible writes, but is not evidence of clean DOS
memory ownership. Sound was disabled, so the OPL section below is static code
analysis only.

No runtime atlas, generated pipeline diagram, or inferred function names are
used in the published article.

## Top-level call sequence

The entry path is linear. There is no script interpreter for the visual
sequence.

| Address | Operation |
|---|---|
| `0100h` | Set `SP=0E7Bh`. |
| `0103h` | Probe AdLib and replace interrupt vector 08h. |
| `0106h` | Set mode 13h, draw the first Mandelbrot region, and leave `ES=A000h`. |
| `0109h` | Draw the credits stream at `0BE8h`. |
| `0112h` | Wait 70 complete vertical retraces. |
| `011Ah`, `011Dh` | Run two color-1/color-0 row-band passes. |
| `0120h` | Change VGA addressing, clear video memory, and load the second palette. |
| `016Bh` | Generate and display the two-source radial interference field. |
| `016Fh`, `0175h` | Change the band-pass pitch from 320 to 80 bytes and clear the field. |
| `0178h` | Replace the Mandelbrot coordinate constants. |
| `018Ah` | Return to mode 13h and draw the second Mandelbrot region. |
| `018Dh` | Draw the title stream at `0C11h`. |
| `0196h` | Cover the frame with the color-1 band pass. |
| `019Ah` | Run the two-buffer enlargement loop. |
| `019Eh` | Run the color-1 band pass again. |
| `01A1h` | Draw the final stream at `0C43h`. |
| `01AAh` | Restore text mode and the old interrupt 08h vector, then terminate. |

The visual code occupies `0100h..0626h`. The interrupt/OPL code occupies
`062Bh..0890h`. Instrument and event data begin at `0891h`; the display
strings and initial renderer constants occupy `0BD8h..0C5Fh`.

## Mode-13h setup and row-band writer

Routine `01FEh` performs the common setup for both Mandelbrot passes:

```asm
01FE  mov  ax,0013h
0201  int  10h
0203  push 0A000h
0206  pop  es
0207  mov  ax,1124h
020A  mov  bl,03h
020C  int  10h
020E  call 01E0h       ; DAC entries 1..63
0216  mov  word [0C60h],0140h
021C  call 0329h       ; row bands, color 1
021F  call 02E0h       ; line frame
0222  call 01BCh       ; 320 by 159 Mandelbrot pass
```

The code later reads the interrupt 43h vector and consumes 16 bytes per
character row, so BIOS call `AX=1124h` supplies the font data used by the text
renderer. The analysis does not require a stronger claim about a particular
BIOS implementation.

`0348h` is the primitive behind both transition calls. It examines 20 row
positions separated by ten rows. If unsigned `(BL-CX) <= 10`, it writes
`[0C60h]` bytes of color `BH` at a row derived from `BL`, the descending loop
counter, and the ten-row spacing:

```asm
0348  xor  di,di
034A  mov  cx,0014h
034D  xor  ax,ax
034F  mov  al,bl
0351  sub  ax,cx
0353  cmp  ax,000Ah
0356  ja   036Ch
035A  push di
035B  push cx
035C  mov  cx,[0C60h]
0360  add  ax,di
0362  mul  cx
0364  mov  di,ax
0366  mov  al,bh
0368  rep  stosb
036A  pop  cx
036B  pop  di
036C  add  di,000Ah
036F  loop 034Dh
```

`0329h` starts with `BX=011Dh` and decrements `BL`; it writes color 1.
`0337h` starts with `BX=0000h` and increments `BL`; it writes color 0. Both
callers wait one retrace between successive band states. This is the complete
mechanism; labels such as fade, shutter, or reveal are not needed to describe
it.

## Mandelbrot kernel at 0226h

`01BCh` enumerates `x=319..0` and `y=159..1`. `0226h` converts each screen
coordinate to signed Q11 values and iterates the standard Mandelbrot
recurrence. The first pass uses constants stored in the file:

```text
scale [0BDCh] =   10
xBias [0BDEh] = 5100
yBias [0BE0h] = 1586
```

The second pass changes them at `0178h`:

```text
scale =    3
xBias = 2680
yBias = 1039
```

The coordinate setup is:

```text
cr = sign_extend_16(x * scale - xBias)
ci = sign_extend_16((y + 20) * scale - yBias)
```

With the actual scales 10 and 3, the 16-bit products do not overflow. The
32-bit inner loop is:

```text
zr = 0
zi = 0
iteration = 0

repeat:
    next_zr = ((zr * zr) >> 11) - ((zi * zi) >> 11) + cr
    next_zi = ((zr * zi) >> 10) + ci
    zr = next_zr
    zi = next_zi
    iteration += 1
until iteration == 64
   or ((zr * zr + zi * zi) >> 22) > 9
```

The shift by ten in the cross product supplies the factor of two in
`2*zr*zi`. The radius test is performed after both new components have been
computed. The iteration count in `BL` is written directly as the palette
index.

The screen address calculation is exact:

```text
offset = (y - 1) * 320 + x + 0x1A40
       = (y + 20) * 320 + x
```

The generated region therefore occupies rows 21 through 179. One rectangle is
deliberately skipped: when `x > 233` and `y <= 10`, no pixel is written. That
is the untouched lower-right `86x10` area visible under the text/layout code;
it is not clipping inferred from a screenshot.

## Font stream and glyph writes

`0372h` consumes zero-terminated byte strings. Byte `01h` is the only control
code. It rounds `DI` down to a 320-byte row and adds `1E10h`, equivalent to 24
rows plus 16 pixels. Other bytes are character codes.

For a character, the code multiplies the byte value by 16, loads the far
pointer stored at physical `0000:010C` (interrupt vector 43h), and reads 16
font bytes. Each source bit advances the destination by two pixels. A set bit
writes color `3Ch` in this shape:

```text
row 0: .##
row 1: ###
row 2: ##.
```

Successive font scanlines start two VGA rows apart, so row 2 overlaps the next
scanline's row 0. A source glyph is consequently 16 pixels wide and 33 pixels
tall at its maximum extent. After each character, the routine waits ten
vertical retraces. This delay is why the text appears incrementally in the
DOSBox run.

## Unchained 80-byte display and radial interference

Before calling `03EDh`, the entry path blanks output through the PEL mask and
writes these VGA register pairs:

```text
Graphics Controller 06h = 01h
Sequencer          04h = 06h
CRTC               14h = 00h
CRTC               17h = E3h
```

It then clears 64,000 addressed bytes and restores the PEL mask to `FFh`.
The mode-13h CRTC offset remains in place while chain-4 and odd/even addressing
are disabled. With the map mask left at all four planes, one byte write puts
the same index in four adjacent displayed pixels. The effective pitch used by
`03EDh` is therefore 80 addressed bytes for 320 displayed pixels.

`03EDh` allocates one 64 KB table at segment `DS+2000h`. For offsets
`p=0..FFFEh`, let `x` be signed byte `low(p)-127` and `y` signed byte
`high(p)-127`. The stored value is:

```text
r = ((x*x + y*y) >> 7) & 63
if r <= 31:
    value = 64 + r
else:
    value = 64 + 31 - (r & 31)
```

This is a triangularly folded squared-radius table with output indexes
`40h..5Fh`. It is not a bitmap resource.

The display loop runs 560 retrace-paced frames. Its active height starts at
zero, rises by four addressed rows per frame, and stops at 200. A phase word
increments once per frame. For each successful output row, 20 dwords are
written, exactly 80 addressed bytes:

```asm
0484  mov  dx,0004h
0487  lodsd                  ; table A
0489  add  eax,[bx]          ; plus table B
048C  stosd                  ; four addressed bytes
048E  add  bx,dx
0490  dec  cx
0491  jne  0487h
```

Both table values are at most 95, so byte sums remain below 256. Although the
instruction is a 32-bit integer addition, no carry crosses a byte boundary in
this loop.

From one output row start to the next, source A advances `0200h` bytes and
source B advances `0102h` bytes. In 256-byte table coordinates these are
`(dy=2, dx=0)` and `(dy=1, dx=2)`. The visible field is the sum of those two
slanted radial samples. Overflow guards skip rows whose 80-byte source span
would wrap at 64 KB.

## Two-buffer enlargement loop at 04BAh

The final graphics routine returns to ordinary mode 13h. It places two 64 KB
buffers at `CS+1000h` and `CS+2000h`, which explains the release note's
approximately 192 KB free-memory requirement. `[0BE2h]` gives a fixed 210-frame
loop count.

At `0534h`, each frame performs these operations:

1. Copy the current 64,000-byte buffer to `A000h` with `rep movsd`.
2. Swap the source and destination segment words.
3. Resample the old source into the new destination.
4. Increment a 32-by-16 rectangle in the new destination.

The source starts at offset `0288h`, which is row 2, column 8 in a 320-byte
buffer. The horizontal loop expands an approximately centered 300-pixel source
span to 320 pixels. On even phase values, each of 20 groups consumes 15 source
bytes and emits 16 by duplicating the first byte:

```text
20 * (1 duplicated byte + 14 copied bytes) = 300 source, 320 destination
```

On odd phase values, the code copies two leading bytes, runs 19 groups with a
duplicated trailing byte, then copies 14 bytes:

```text
2 + 19 * 15 + 14 = 301 source bytes
2 + 19 * 16 + 14 = 320 destination bytes
```

This alternating 300/301-byte footprint prevents the enlargement center from
being fixed to one side of a source pixel.

Vertical selection uses the high byte of `DX` as an 8-bit phase accumulator
and adds `F8h` once per destination row. A carry advances `SI` by 320. Thus 200
destination rows consume about 193 or 194 source rows. The phase changes by
five each frame at `0514h`, moving the subpixel alignment of both the vertical
and odd/even horizontal paths.

`05F0h` updates a two-word deterministic state at `0C5Ch..0C5Fh` and returns
the upper five bits of the new high word. The caller forms:

```text
x = random_0_31 + 112
y = random_0_31 + 68
```

`05C6h` then increments a `32x16` block at `(x,y)` in the destination buffer.
The next frame enlarges that modified buffer. The visible coarse expansion is
therefore feedback from an injected central block plus the explicit
300/301-to-320 and 193/194-to-200 resamplers; it is not a stored animation.

## Interrupt 08h and OPL stream

`063Fh` probes the OPL status/timer behavior at port `0388h`, saves the old
interrupt 08h vector, and installs `0664h`. The code does not reprogram the
PIT and does not chain the old handler. Every fourth incoming interrupt calls
`07F1h`; every interrupt sends EOI to port `20h` and reads keyboard port
`60h`. Scan code `01h` discards the interrupt return frame and jumps to the
normal exit path at `01AAh`.

OPL writes use register in `AL`, value in `AH`:

```asm
0735  mov  dx,0388h
0738  out  dx,al
0739  mov  cx,0002h
073C  in   al,dx
073D  loop 073Ch
073F  inc  dx
0740  mov  al,ah
0742  out  dx,al
```

If detection succeeds, the code clears OPL registers `FFh..01h` and sets a
far stream pointer to `CS:08B1h`. `07F1h` parses commands until it encounters
`FFh`, then saves `DS:SI` for the next player tick. `FEh` resets the pointer to
`CS:08B1h` and returns.

For a normal command byte:

- low nibble selects the OPL channel;
- bit `20h` consumes an instrument number, keys the channel off, and writes an
  11-byte instrument record through the operator-offset table at `074Eh`;
- bit `10h` consumes a packed note, keys the channel off, writes `A0h+channel`,
  then writes `B0h+channel` with key-on bit `20h`;
- bit `40h` consumes and ignores one additional stream byte.

The note low nibble indexes the 12-word F-number table at `0760h`; its high
nibble is shifted left ten and ORed into the block/F-number word. This is a
small event stream with row terminators, instrument records, and direct OPL
writes. Calling the discarded bit-`40h` byte a delay or effect parameter would
go beyond the code: this player only advances past it.

## Established limits

- The executable and both graphics kernels are fully reachable in the linear
  scene path; no unpacked child or hidden renderer is assumed.
- The external DOSBox-X run verifies the order and broad output geometry, not
  audio behavior or clean memory teardown.
- The OPL parser is decoded at the command level, but the musical composition
  is not transcribed or rendered here.
- No visual label is used as evidence for a code claim. The recurrence,
  table generator, source strides, resampler ratios, and writes above come
  directly from the released COM instructions and constants.
