Analysis model: gpt-5.5 xhigh

Revision model: GPT-6 Astra (user-reported)

Last edited: 2026-09-19

Optic Nerve by The Silents - Technical Dissection

Scope

This is a static binary dissection of Optic Nerve by The Silents PC. It was released in July 1993 and placed 2nd in the Assembly 1993 PC Demo competition, behind Second Reality and ahead of Elements.

Sources used for identity and placement:

This is not a source-level reconstruction. Offsets below are file offsets in OPTIC.EXE unless explicitly stated otherwise. The executable contains a custom protected-mode runtime, and the same file contains real-mode code, 32-bit protected-mode code, data tables, and appended resources. I used the code shape, hardware ports, interrupt usage, strings, and local loop behavior to identify parts.

The September revision independently executes the resource decoder, landscape projection-table builder and column kernel. It corrects the old sine/phase interpretation of that table, the zero-count RLE packet description and the claim that every column always samples all 256 depths. The follow-up recovers the released landscape resources and executes its complete frame routine for ten stored camera states. A further correction replaces the claimed weighted RGB greyscale conversion with the actual red-only loads. This is original-code verification in a harness, not a new complete runtime capture.

Archive Contents

The main archive contains:

RAVSROCK.COM   BBS advert / TheDraw COM screen
README.TSL     release text
FILE_ID.DIZ    BBS description
OPTIC.EXE      main demo executable
FILE_ID.FIX    patch note
OPTICPAT.EXE   later 386 patch, TinyProg compressed

The separate patch archive contains the same OPTICPAT.EXE and a shorter patch FILE_ID.DIZ.

Hashes:

ff982511ea927f64a4e65ca3933433ad94c5bbd96f0df931ca6ec8f9e2afe504  opticnrv.zip
108bce77aa0668df7fb1b061ec9572aabeaad937b37ee1308878593981e70974  opticpat.zip
c227c766dbc29975d838e1b58cc637759b60075db23046c676ffd3a81b21f1b9  OPTIC.EXE
c8e06fbe5e5691680be2c4f953e5559408109b71e737a30bb0fda5ace184257a  OPTICPAT.EXE
97d483210a0491906e29b00f0908e3d53b2ab552efbd3a6a4cb3755caf837c70  RAVSROCK.COM
80907f10fe6a27c0921e74f5dd1e4527df3f2c83c966dab8b6f866ad7f0a3d90  README.TSL
98bf637bfab4821869df4f0b017111aaed541a79db2bf8ebe733257216b30bd5  FILE_ID.DIZ

The release note is terse but useful: it says Optic Nerve dislikes programs using memory above 640 KB, including memory managers and disk caches. The DIZ says it requires a 486 and 4 MB RAM. The patch note says OPTICPAT.EXE is a 386 patch, released 16 January 1994.

Executable Shape

OPTIC.EXE is a large MZ executable with appended data:

file size:            2973635 bytes
MZ image size:         416656 bytes
header paragraphs:        32
relocations:              72
initial CS:IP:       5e52:0190
initial SS:SP:       6499:1000
entry file offset:   0x5e8b0

The first real entry instruction at 0x5e8b0 is:

mov ax, 0013h
int 10h

So the demo starts from BIOS VGA mode 13h, then immediately enters its own runtime. It does not rely on a standard DOS extender string like PMODE/W. It has its own exception messages:

Kernel Panic 00: Division by Zero
Kernel Panic 13: General Protection
Kernel Panic 14: Page Fault
Kernel Panic 48: Out of memory during file load

It also has direct startup failure strings:

Sorry, you need a 486 to run Optic Nerve.
Please remove memory managers like HIMEM, EMM386, QEMM etc.
Sorry, you need at least 4MB to run Optic Nerve.
Processor is already running in protected mode!
Address line A20 failed to Gate open!

That matches the reputation: this is a hardware-sensitive DOS demo that expects to own the machine.

Named Parts In The Binary

The executable contains embedded part titles and credits:

PROTECTEDMODE
INTERFACE
RADIO MOSCOW
COMPOSED JESPER KYD
INTRODUCTION
LANDSCAPE
OPTIC PLASMA
GOURAUD SHADING
STRETCH
THE END

The main scheduler around 0x5e930 calls a sequence of effect routines:

call 5ead4h
call 5e95ch
call 52668h
call 5ea9dh
call 5eae4h
call 5eb92h
call 5ebd1h
call 5ed2ah
call 5ed64h

This is not a tiny single-loop demo. It is a custom runtime plus a sequence of separate visual engines, with file-load services and screen/palette services underneath.

Protected-Mode Runtime

The protected-mode entry path is around 0x5d171. It checks environment state, date, memory, and CPU requirements, then sets up a GDT and enters protected mode:

0x5d1a9: lgdt [0000h]
0x5d1ae: call 5c863h      ; build interrupt/service table
0x5d1b1: call 5c985h      ; enter protected mode

The actual PE transition at 0x5c985 does several low-level things:

cli
in   al, 21h             ; save PIC mask
in   al, a1h             ; save secondary PIC mask
out  21h, al             ; install runtime masks
out  a1h, al

call 5cb9bh              ; save/set hardware interrupt vectors
mov  ah, dfh
call 5be8eh              ; keyboard-controller/A20 helper
in   al, 92h
or   al, 02h
out  92h, al             ; fast A20 gate

in   al, 61h
or   al, 80h
out  61h, al
and  al, 7fh
out  61h, al             ; short hardware delay / speaker-port toggle

mov  ax, 47h
call 5cb65h              ; PIT setup

mov  eax, cr0
or   eax, 1
mov  cr0, eax
jmp  0008:00000bce

After the far jump, it loads selectors:

mov ax, 18h
mov ss, ax
mov ax, 10h
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
lidt [0168h]
sti
ret

The return path reverses this: it restores real-mode IDT state, restores PIC masks, clears CR0.PE, far-jumps back to real mode, disables A20, and returns to DOS. The runtime therefore owns the machine much more completely than a DPMI client would.

Custom Interrupt Services

The demo uses its own software interrupts heavily:

int 30h   general runtime service, file/data load and text/palette commands
int 31h   frame/tick wait or scheduler tick service
int 33h   mode/runtime control path, not ordinary mouse use here

There are hundreds of int 30h calls, but they must not all be interpreted as resource loading. The earlier description of AH=3 as a loader/copy service was wrong. Its handler at 0x5C58E edits a GDT descriptor. This handler is 16-bit protected-mode code, while the landscape calling it is 32-bit code.

mov ah, 03h
mov ecx, 00162d90h       ; linear base of prepared columns
mov esi, 00004e20h       ; size input for descriptor-limit calculation
mov bx,  0088h           ; descriptor/selector to rebind
mov dh,  0              ; writable data descriptor
int 30h

That call at 0x609AE does not read or copy the 20,000-byte column array. Loading selector88 into DS afterwards makes DS-relative addresses refer to that existing memory. The descriptor-writing core is:

descriptor = GDT_area + BX;
descriptor.base_low16 = ECX & 65535;
descriptor.base_mid8  = (ECX >> 16) & 255;
descriptor.base_high8 = ECX >> 24;
limit = (ESI >> 12) + 1;
descriptor.limit_low16 = limit & 65535;
descriptor.flags_and_limit_high =
    (descriptor.flags_and_limit_high & 0xf0) | (limit >> 16);
if (DH == 0) descriptor.access = 0x93;
else {
    descriptor.access = 0x9b;
    descriptor.flags_and_limit_high &= ~0x40;
    if (DL != 0) descriptor.flags_and_limit_high |= 0x40;
}

The existing granularity bits are preserved, so the size input is not an exact byte-copy count. The code branch additionally chooses 16- or 32-bit default operand size through descriptor bit40h; the data branch leaves that bit alone. One thousand controlled executions of the original descriptor-writing core matched all eight bytes, including retained flags. The handler saves/restores the general registers it uses before IRETD; its result is the descriptor update, not a transferred payload.

The scheduler at 0x60821 loops over 100 columns, calculates each ray and vertical bias, and calls 0x608BA. That helper binds two selectors:

selector88 base = 00162D90h + column*200   ; colour column
selector78 base = 0015C990h + column*256   ; depth-side buffer
column = 0..99

The 25,600-byte depth bank ends exactly where the 20,000-byte colour bank starts. The per-column AH3 calls select views of prepared RAM; they are not repeated disk/resource reads. Appended resources and separate loader operations still exist, but must be traced through their own services rather than attributed to AH3.

int 31h is used like a frame wait:

cd 31h
mov ecx, 0d2h
wait_loop:
    int 31h
    dec ecx
    jne wait_loop

Many visible sections use this idiom for timed holds and transitions. It counts returns from the wait service, not the elapsed ticks returned in AX. The landscape controller, by contrast, uses that elapsed count to skip camera records. Neither idiom alone proves vertical-retrace synchronization.

VGA Mode Strategy

Optic Nerve starts with BIOS mode 13h, but it does not stay in plain chained mode all the time. It has explicit routines to switch between chained mode and planar/Mode-X-like behavior.

The unchain/setup routine at 0x5ff0e:

mov dx, 03c4h
mov ax, 0604h
out dx, ax          ; sequencer memory mode, chain-4 disabled

mov dx, 03d4h
mov ax, 0014h
out dx, ax          ; CRTC underline/location byte-mode related bit cleared

mov ax, 0e317h
out dx, ax          ; CRTC mode control
ret

The restore-chain routine at 0x5ff29:

mov dx, 03c4h
mov ax, 0e04h
out dx, ax          ; mode-13h style chain-4

mov dx, 03d4h
mov ax, 4014h
out dx, ax

mov ax, 0a317h
out dx, ax
ret

The key thing is not only the CRTC values. The renderers change the sequencer map mask constantly:

mov dx, 03c4h
mov al, 02h
out dx, ax          ; select sequencer register 2

mov dx, 03c5h
mov al, mask
out dx, al          ; choose VGA plane(s)

Masks used in one render path include:

0f  all planes
07  planes 0,1,2
08  plane 3
03  planes 0,1
0c  planes 2,3
01  plane 0
0e  planes 1,2,3

That explains why the demo is so VGA-card-sensitive. It writes directly to VGA planes, assumes predictable sequencer behavior, and depends on mode bits that DOS extenders, Windows, and emulators often virtualize badly.

Screen Copy And Clear Paths

The simplest visible copy at 0x5fe38 sets source selector 0x28, destination selector 0x110, and copies a whole mode-13h screen:

mov ax, 0028h
mov ds, ax
mov ax, 0110h
mov es, ax
xor esi, esi
xor edi, edi
cld
mov ecx, 0fa00h
rep movsb
ret

0xfa00 is 64000 bytes: exactly 320x200x8bpp.

The planar clear path at 0x5fe59 temporarily unchains VGA, clears a 25600-byte region with word stores, and restores the chained mode:

call 5ff0eh          ; unchain / planar setup
mov ax, 0028h
mov es, ax
xor ax, ax
xor edi, edi
mov ecx, 03200h
rep stosw
call 5ff29h          ; restore chain-4
ret

0x3200 words is 25600 bytes. In planar addressing that is enough for a 320x200 screen because one byte address covers four possible pixels across VGA planes.

Palette Fade Engine

The palette system is one of the cleaner subsystems. Routine 0x5d083 accepts a target palette and a step count in AL.

First it copies the 768-byte target palette to an internal buffer:

cld
mov bl, al
mov ax, 0010h
mov es, ax
mov es:[193bh], bl
xor edi, edi
mov di, 103bh
mov ecx, 0300h
rep movsb

Then it reads the current VGA DAC:

mov ax, 0010h
mov ds, ax
mov dx, 03c7h
xor al, al
out dx, al          ; DAC read index 0
add dx, 2           ; 03c9h
mov di, 0a3bh
mov cx, 0300h
xor ah, ah

read_loop:
    in  al, dx
    xchg al, ah
    stosw            ; current component in high byte
    xchg al, ah
    dec cx
    jne read_loop

If a fade duration was supplied, it computes a per-component delta:

source = current_component_word_high_byte
target = target_palette_byte
delta  = (target - source) / steps

The update routine at 0x5d0e5 emits one fade step. It writes DAC index zero to port 0x3c8, then loops over all 768 components:

mov dx, 03c8h
xor al, al
out dx, al
inc dx              ; 03c9h
mov si, 0a3bh       ; current accumulators
mov di, 103bh       ; target bytes
mov bp, 133bh       ; per-step deltas
mov cx, 0300h

component_loop:
    ax = current_accumulator
    if high_byte(ax) != target:
        ax += delta
        current_accumulator = ax
    al = high_byte(ax)
    out dx, al
    advance current, target, delta
    loop component_loop

This is a real fixed-point palette fade, not a blind table swap. Current DAC values are stored as 16-bit accumulators, and each component moves toward its target through a signed per-step delta. That makes palette transitions smooth without touching the framebuffer.

Resource RLE And Deinterleave

The unpackers at 0x5ffeb and 0x6003a decode two channels of a large interleaved image or height/texture resource. They read from selector 0x98, starting at offset 0x80, and write to selector 0xa8.

First channel:

mov ds, 0098h
mov es, 00a8h
mov esi, 80h
xor edi, edi

next:
    al = [esi++]
    if al >= 0c0h:
        count = al - 0c0h
        if count == 0: count = 256
        value = [esi++]
        repeat:
            es:[edi*2 + 0] = value
            edi++
            if edi == 100000h: return
            count--
            if count != 0: repeat
    else:
        es:[edi*2 + 0] = al
        edi++
    if edi != 100000h: next

Second channel is the same but stores at es:[edi*2 + 1]. The output is an interleaved two-byte-per-sample buffer. The control scheme is simple:

Each channel stops at exactly 1,048,576 output bytes, even in the middle of a run. The two routines differ only in destination parity, preserving the other byte of each sample. Original-code tests exercised all 256 controls in both kernels, matching both complete output channels, final-run clipping, consumed input length and untouched companion bytes. These are format tests with controlled input, not a claim that a particular released resource uses C0h.

After that, 0x60089 copies the expanded 0xa8 data to selector 0x58:

mov ds, 00a8h
mov es, 0058h
xor esi, esi
xor edi, edi
mov ecx, 080000h
rep movsd

That is a 2 MB copy. The landscape part clearly uses large precomputed or expanded tables, not tiny procedural generation only.

Reciprocal Height-Projection Table

The old "sine/gradient" description of 0x5FF44 was wrong: this routine contains no trigonometry. It builds a 512-height × 256-depth signed-word projection table in selector 0x60. The inner calculation is:

; BL = depth index. EBX initially FFFF0000h; increases100h per height row.
xor eax,eax
mov al,bl
imul eax,eax,40h
add eax,64h               ; denominator = 64*depth +100
mov esi,64h
xchg esi,eax             ; EAX=100, ESI=denominator
rol eax,16               ; EAX=100<<16 =6553600
mov edx,0
idiv esi                 ; Q16 reciprocal-like distance scale
mov edx,ebx
sar edx,8                ; signed height row: -256..255
shl edx,6                ; height *64
mov esi,edx
imul esi                 ; signed product in EDX:EAX
sar eax,16
mov [edi],ax

INC BL wraps after256 depths without carrying into the height row; ADD EBX,100h advances that row. The exact integer reconstruction is:

for (row = 0; row < 512; ++row)
    for (depth = 0; depth < 256; ++depth) {
        reciprocal = 6553600 / (64*depth + 100); // integer truncation
        projection[row*256+depth] = (reciprocal * 64*(row-256)) >> 16;
    }
// Final shift is arithmetic: negative products round downward.

All 131,072 words matched execution of the unmodified builder. There are two quantization steps; replacing the expression with a single real-number divide would not preserve every word. Products in this table's input range fit signed 32 bits, so the use of only the product's low dword before the shift does not discard significant height information.

The landscape loop puts the depth byte in DL, the height-map byte in DH, then adds an immediate whose on-disk value is 3700h. In that unpatched case it reads row height+55, whose signed height is height-201. The newly traced caller patches that immediate's second byte from the camera record, so the general row is height+height_offset, not a permanently fixed height origin. The loop then adds its separately patched signed vertical bias. This remains perspective height projection, not a sine or plasma phase lookup.

The Landscape / Height-Column Loop

The most interesting visible inner loop is around 0x60913. This appears in the landscape renderer. The setup binds selectors 0x88 and 0x78 to the current colour/depth buffers using the descriptor service above, then sets:

ds = 0078h
es = 0088h
fs = 0058h
gs = 0060h
edi = 0
eax = 0
ebx = 0
ecx = 0
edx = 0

The inner column/sample loop:

sample_loop:
    edi = esi
    edi &= 000ffc00h

    ecx = ebp
    ecx >>= 22
    edi += ecx

    edx = eax
    dh = fs:[edi*2 + 0]       ; height / color component A
    edx += 3700h

    cx = gs:[edx*2]           ; projected height lookup
    cx += 1234h               ; patched constant / phase bias

    if cx <= bx:
        goto advance_ray

    if cx > 200:
        goto fill_to_bottom

    dh = fs:[edi*2 + 1]       ; color component B
draw_span:
    es:[ebx] = dh
    bl++
    if bl != cl:
        goto draw_span

advance_ray:
    ebp += 12345678h          ; patched x/y stepping constant
    esi += 12345678h
    eax++
    if eax != 256:
        goto sample_loop
    call 6099bh               ; fill remaining column with ffh
    ret

The fill_to_bottom path writes the same color until BL == 200:

fill_to_bottom:
    if bx == 200:
        goto done_fill
    dh = fs:[edi*2 + 1]
fill:
    es:[ebx] = dh
    bl++
    if bl != 200:
        goto fill
done_fill:
    ; Stop sampling. Fill the remaining depth-side bytes, NOT screen pixels.
    while eax != 256:
        ds:[eax] = 200
        eax++
    ret

This is a classic voxel-landscape style renderer:

The routine takes at most 256 map samples, not always256 as previously claimed. When a projected height exceeds200 it finishes the column in that sample's colour, writes200 into DS:[depth..255], and returns without advancing the ray through those remaining depths. Reaching exactly200 takes the normal branch and does not itself terminate sampling. Only the non-early path calls 0x6099B to fill unpainted screen bytes with FFh.

An exact high-level reconstruction separates the 200-byte column from that 256-byte depth-side buffer:

drawn = 0;
for (depth = 0; depth < 256; ++depth) {
    index = (ray_y & 0x000ffc00) + (ray_x >> 22); // 1024x1024 map
    h = map[2*index]; colour = map[2*index+1];
    y = s16(projection[(h+height_offset)*256+depth] + patched_bias);
    if (y > drawn) {
        if (y > 200) {
            fill(column+drawn, column+200, colour);
            fill(depth_side+depth, depth_side+256, 200);
            return;
        }
        fill(column+drawn, column+y, colour); // old endpoint included, new excluded
        drawn = y;
    }
    ray_x = u32(ray_x + patched_x_step);
    ray_y = u32(ray_y + patched_y_step);
}
fill(column+drawn, column+200, 255);

Fifteen controlled column cases matched all screen bytes, depth-side bytes and final ray coordinates against the original instructions. They include 256-sample columns, immediate one-sample termination, and delayed termination after205 samples. The patched bias and ray-step immediates were explicitly supplied for each test. The caller schedules 100 columns through the descriptor-bound buffers above. Later consumers of the depth-side bytes still need tracing; the planar colour writer is reconstructed below.

Camera Records, Tilt Tables And Patched Rays

The frame dispatcher at 0x6015F reads a ten-byte record from selector A0h:

word +0: X position          masked with0FFFh → state DS128:E69
word +2: Y position          masked with0FFFh → state DS128:E6D
word +4: height-origin byte  masked with00FFh → state DS128:E89
word +6: direction offset   masked with1FFEh → state DS128:E75
word +8: tilt parameter     masked with01FFh → state DS128:E87

After drawing, INT 31h supplies a value whose low byte advances the record pointer by that many ten-byte records. The interrupt handler waits for a nonzero word at runtime DS:3AEh, returns it in AX and clears it. The outer stream has a block count and per-block record counts; its last-block path explicitly redraws the final record before the closing palette sequence. This is a stored camera path, not evidence for procedural steering. The recovered payload contains five blocks of 605, 511, 960, 730 and 565 records: 3,371 ten-byte camera states, with the counts and records consuming all 33,722 bytes. The timer producer and record-skipping policy are recovered below; stored records are not necessarily consecutive displayed frames.

One frame at 0x60380 prepares state, patches the height origin, rotates two ray endpoints, interpolates 100 ray endpoints, builds tilt-dependent bias and scanline-offset tables, renders 100 columns, and calls the planar writer. At 0x603CD, the low byte of E89 replaces file-offset 0x6092F in the column kernel. Thus:

projection_row = map_height + camera_record.height_offset;
signed_height = projection_row - 256;
// Range0..510 fits the512-row projection table; do not wrap this sum to8bits.

The direction offset indexes two signed-word coefficients at selector68h offsets direction and direction+800h. Routine 0x603D1 transforms the two vectors (1536,2048) and (-1536,2048), taking the signed high word of each individual product, then adds 2048 to each coordinate. The endpoint table at 0x604A9 adds camera X/Y and interpolates each coordinate into 100 two-word records. The recovered coefficient resource contains 5,120 signed words, all matching round(32767*sin(i*pi/2048)): one 4,096-sample turn followed by a quarter-turn extension. The second read, 2,048 bytes later, supplies cosine. The direction field is a byte offset, so masking with 1FFEh selects one of 4,096 directions. This real trigonometric table is separate from the reciprocal height/depth projection table previously misidentified as sine generation.

The related interpolation helpers use a distinctive Q16 start bias. For ascending endpoints A<B and count N:

step = ((B-A+1)<<16)/N;
start = (A<<16) + step;
start = (start & 0xffff0000) | ((start & 65535)>>1);
// Each output is the high word; advance start by step.

Descending endpoints negate the similarly computed step and add 10000h after halving only the low word. Equal endpoints use zero step. The endpoint writer 0x60517 additionally masks each result to14 bits and writes every fourth byte, allowing separate X/Y passes. This is not the same as adding half of the entire Q16 step, especially when its integer part is nonzero.

Tilt preparation uses the point version at 0x60714, with count 512 and the record's tilt 0..511. Interpolating 0→130 produces R; the 100 per-column vertical biases interpolate from R to 130-R. Interpolating 0→80 produces P; the 201 scanline offsets interpolate from 80-P to P. The planar writer consumes the first 200. This connects one tilt parameter to both the projected skyline's slope and the horizontal per-row shear, rather than treating those tables as unrelated effects.

Finally, ray setup 0x60575 receives endpoint (A,D) and camera-centre (B,C). The caller adds 2048 to camera X/Y before supplying B/C. The exact reconstruction below applies 32-bit wrapping and arithmetic signed shifts:

sx = u32((abs(B-A)+1)<<20)/257;
sy = u32((abs(C-D)+1)<<10)/257;
if (B >= A) sx = -sx;
if (C >= D) sy = -sy;
ray_x = u32((B<<20) + (sx>>1) + (B>=A ? 0x100000 : 0));
x_step = u32((sx>>1)<<1);
ray_y = s32(u32(2*(C<<10)+sy)) >> 1;
if (C >= D) ray_y = s32(ray_y+1024);
ray_y >>= 2; y_step = sy >> 2;

It writes X/Y steps directly into the immediates at 0x6095F/0x60965 and returns the starting ray coordinates. The quarter-texel input scale becomes the column kernel's X-high-ten-bits and Y-masked-row address. Even equal input coordinates take the abs(delta)+1 path rather than producing a zero step; the 257 divisor and half-step rounding must be retained for matching pixels.

Verification matched 1,015 original ray setups in all quadrants, 1,000 complete interpolation tables and 1,024 tilt-point cases. Twenty-five column cases also checked dynamic height origins, including 0 and 255. These extend the isolated kernel tests into its input setup. The released-resource frame tests below also cover their composition; full frame timing remains outside these tests.

VGA Plane Writer For The Landscape

The landscape plane writer around 0x609ae is built around sequencer map masks. It reads a mode selector from a table:

dx = fs:[ecx] & 3

Then it chooses how to write the planar data:

case 0:
    map_mask = 0fh
    call 60b50h

case 1:
    map_mask = 07h
    call 60b50h
    map_mask = 08h
    esi += 0c8h
    call 60b50h

case 2:
    map_mask = 03h
    call 60b50h
    map_mask = 0ch
    esi += 0c8h
    call 60b50h

case 3:
    map_mask = 01h
    call 60b50h
    map_mask = 0eh
    esi += 0c8h
    call 60b50h

Each map-mask write is the standard VGA sequence:

mov dx, 03c4h
mov al, 02h
out dx, ax
mov dx, 03c5h
mov al, mask
out dx, al

The helper 0x60b50 writes 40 words:

add esi, 0c7h
mov edx, 28h

copy_40:
    al = [esi]
    esi += 0c8h
    ah = [esi]
    es:[edi] = ax
    edi += 2
    esi += 0c8h
    edx--
    jne copy_40
ret

That is 80 bytes per call. In planar VGA, that lines up naturally with 320 pixels split across four planes. The renderer is not doing a naive linear framebuffer write. It writes a plane-selected view of the prepared column data, sometimes in one all-plane pass and sometimes split into two passes depending on alignment.

What The Plane Masks Actually Display

The complete writer uses a word per screen row from linear address 167C78h. It splits that word into a starting column (word>>2) and pixel alignment (word&3). For each of 200 screen rows it reads 80 successive colour columns, using their vertically reversed sample position 199-y:

// Complete mapping for in-bounds row offsets:
for (y = 0; y < 200; ++y)
    for (x = 0; x < 320; ++x)
        screen[y][x] = colour_columns[(x + row_offset[y]) >> 2][199-y];

Each software column expands to four horizontal pixels. The 100-column bank represents 400 virtual pixels, with a 320-pixel viewport; row offsets 0..80 fit that bank. Changing the offset per row shears the displayed landscape horizontally. The reversal also establishes that the column kernel's increasing fill position measures height upward from the screen bottom, not screen Y downward.

For alignment 0, mask 0Fh broadcasts the same 80 bytes to all four planes. With alignment 1, mask 07h writes planes 0–2 from one column and mask 08h writes plane 3 from the next; alignments 2 and 3 split at masks 03h/0Ch and 01h/0Eh. Both partial passes start at the same VGA row address. The writer then advances to the next 80-byte VGA row and decrements the source height.

The CPU writes 80 bytes per aligned row or 160 per split row, yet each row updates 320 visible pixels because map masks broadcast stores to selected planes. Eight complete original-code writer runs matched all 512,000 visible pixels against the formula, including every alignment, offsets 79/80 and varying offsets per row. Tests modelled each VGA plane separately, not a linear framebuffer copy. Descriptor binding was supplied before entering the original writer at 0x609C2.

Together, these routines turn at most 25,600 map samples into 100 colour columns and then a 320×200 planar image. The frame-input arithmetic is described above; the released-resource checks below connect it to actual landscape images. Depth-buffer consumers and a complete timed runtime capture still need recovery.

Released Landscape Data Through The Complete Frame Routine

The actual resource reader is INT 30h/AH=5, at 0x5CCC7, not AH=3. Its eight-byte directory entry contains an offset and size. The offset is relative to the end of the executable's MZ image, 0x65B90: the self-open routine computes that base from the MZ page count and final-page byte count at 0x5CC90. The landscape's directory segment immediate 1142h is MZ-relocated; its on-disk directory starts at 0x11620. AH=5 seeks in the executable, reads through a DOS bounce buffer in chunks of at most FA00h bytes, and copies the result into protected-mode memory.

The landscape uses these directory slots (slot offsets, not ordinal indices):

Slot Data Role in the renderer
08h 635,428-byte compressed height channel Even bytes of the 1,024×1,024 interleaved map
00h 812,397-byte compressed colour channel Odd bytes of that same map
28h 768 palette bytes Components shifted right twice for the six-bit DAC
38h 10,240 coefficient bytes Sine plus quarter-turn extension for ray-endpoint rotation
A0h 33,722 camera-path bytes Five blocks supplying position, height origin, direction and tilt

Both map resources begin with a 128-byte header containing Kyle DTA. Executing the original even/odd decoders matches every one of the 1,048,576 expanded bytes in each channel against an independent decoder. Each stops 769 bytes before its resource ends. Neither released channel uses a C0h packet: the earlier 256-byte-run correction describes decoder behaviour, not a packet found in this particular map. Routine 0x60089 then copies the two-megabyte interleaved map from 200000h down to 180000h; its forward copy is safe despite overlap because the destination is lower.

For an end-to-end check, the first and last record of each of the five blocks were passed through the original frame routine at 0x60380, using the real map, projection table and direction coefficients. An independent integer model matched all ten frames in all of these intermediate and final results: 400 endpoint bytes, 200 vertical-bias bytes, 402 scanline-offset bytes, 20,000 colour-column bytes and 64,000 visible pixels per frame. Matching the intermediate tables also checks the low-word interpolation bias, individual signed-product truncations and self-modified ray steps, rather than merely accepting a similar-looking skyline.

Optic Nerve landscape reconstructed from block 1's final camera record

Original-code reconstruction, block index 0 / record 604 (zero-based). The released map, camera state and palette feed the original frame routine; the image is enlarged 2× with nearest-neighbour sampling. Not a DOSBox capture.

Optic Nerve landscape reconstructed from block 3's final camera record

Original-code reconstruction, block index 2 / record 959. The tilted mountain edge comes from the stored camera direction and the coupled column-bias / scanline-shear tables, not from rotating a finished bitmap.

The harness supplies AH=3 descriptor base bindings and models sequencer masks as four separate VGA planes. It executes the original frame instructions and their helper calls, but does not run the DOS loader, interrupt clock, sound player or palette fades. These images use the loaded landscape palette; they do not establish its fade level at a particular playback timestamp. The full-frame test compares colour output, not the depth-side buffer; the separate column tests cover that kernel's depth-marker writes.

Timer Ticks, Skipped Camera Records And Block Endings

The counter producer is the interrupt routine at 0x5C2DF. It increments the 16-bit word at runtime DS10h:3AEh, calls the PIT programming helper with AX=47h (71), sends the master PIC a specific end-of-interrupt command 60h, then calls the palette-update routine at 0x5D0E5. The PIT helper at 0x5CB65 writes control byte 36h and divisor 1193180/71 = 16805 to channel zero. Startup uses that same rate. This establishes a nominal 71 Hz timer setup, not an observed 71 rendered frames per second.

There is a hardware wrinkle worth preserving: after programming the PIT, the handler reads port 3DAh and repeats the programming call while bit 7 is set. This is not a test of vertical-retrace bit 3. The timer is reprogrammed inside the handler, and callback execution also takes time; exact wall-clock timing still needs a complete runtime measurement rather than division of the record count by 71.

INT 31h at 0x5C6FD enables interrupts, waits for a nonzero counter, disables interrupts, copies the word into AX, clears it and returns via IRETD. Thus a slow render can accumulate several ticks before the caller consumes them. The counter wraps at 16 bits. The landscape then masks EAX with FFh: a returned count of 256 advances zero records, while 257 advances one. These are verified edge behaviours, not evidence that normal playback stalls this long.

The path controller at 0x600DD first consumes one wait result without using its count. It then processes each block independently. Its effective normal playback loop is:

for each block {
    request_landscape_palette(64);
    i = 0;
    fade_requested = false;
    do {
        draw(masked_record(block, i));
        // The first draw also starts the prepared palette transition.
        i += wait_ticks() & 255;
        remaining = record_count - 1 - i;
        if (!last_block && !fade_requested && remaining < 32) {
            request_transition_palette(remaining & 255);
            fade_requested = true;
        }
    } while (remaining >= 0);
}
draw(masked_record(last_block, last_record));
// Then enter the final palette/greyscale sequence.

At a block boundary the real code restores the saved start pointer and count, then advances by exactly record_count*10 to locate the next block header. Overshoot from the last tick batch is discarded; it does not skip the opening records of the next block. Only the final block forcibly redraws its last stored pose. Intermediate blocks may leave before ever displaying their last record. With one tick per draw, the controller makes 3,372 draw calls including the final repeat; with two ticks per draw, it makes 1,688. Those are controlled schedule results, not measurements of a particular PC.

The transition request has another literal edge case: its threshold is a signed comparison of remaining against 32, but its duration argument is the low byte. A large skip past the block end can therefore request a wrapped byte value, not a duration clamped to zero. The review checks the argument passed to the palette service; it does not yet claim the resulting fade image.

Verification executed the original controller against all five released blocks for 110 tick schedules, including one/two/three-tick steps, low-byte wraps and mixed batches. Every selected record and its field masks, every block restart, the final redraw and all transition-request counts matched an independent model. Frame rendering and interrupt services were intercepted for this controller test; the separate full-frame tests above exercise the renderer. Ten original PIT-programming cases and twelve original wait-core cases also matched, including injected delayed ticks. This does not emulate interrupt delivery timing, the full interrupt return or the entire DOS run.

Palette Fade Setup And Interrupt Inner Loop

INT 30h/AH=8 calls 0x5D083 to prepare a transition. AL supplies a byte duration N and DS:ESI points to 768 target DAC components. The routine copies the target to runtime offset 103Bh, reads the current hardware palette through 3C7h/3C9h, and stores each current component as a Q8 word at A3Bh. For nonzero N it builds 768 signed increments at 133Bh:

accumulator[j] = current[j] << 8;
step[j] = trunc_toward_zero(((target[j] - current[j]) << 8) / N);

The division is signed 16-bit CWD; IDIV CX, not a 32-bit divide. AH=9 arms the update flag at 193Ch and stores AL at 193Dh as a one-shot advance argument. If the flag is already one, another AH=9 request does nothing. The landscape supplies zero for this argument; its duration goes through AH=8 instead. Preparation and activation are separate operations.

The timer callback at 0x5D0E5 returns immediately when inactive. Otherwise it consumes and clears the advance byte, selects DAC write index zero, and processes all 768 components. N=0, or an advance argument greater than N, copies the target directly and clears the active flag. In the normal zero-advance path the component loop is:

if ((accumulator[j] >> 8) != target[j]) {
    ++unequal_components;
    accumulator[j] = u16(accumulator[j] + step[j]);
}
out(0x3c9, accumulator[j] >> 8);

This tests equality before advancing; it does not clamp an overshooting step to the target. For example, a controlled 0→10 transition with N=3 has step 853 and emits 3, 6, 9, then 13, missing 10 on that pass. That is an executed-kernel edge case, not an observed landscape glitch. The landscape's 64-tick entry and 32-tick closing transitions divide the Q8 scale exactly; one should not substitute those convenient durations for every service call.

Two register details also survive execution tests. On the zero-advance path, the routine sets BL to zero but does not clear BH before counting unequal components. Its completion decision therefore depends on incoming BH as well as the palette; a nonzero BH can keep it active after the colours have arrived. The interrupt saves registers but does not initialize BX for this callback. On the nonzero advance≤N path it first adds step*advance to every accumulator and then performs the ordinary conditional step. That multiply writes DX as well as AX; DX is not restored to 3C9h before output. The resulting output port is the high word of the final multiplication, not the DAC data port. The landscape's zero-advance calls bypass this latter path.

Twenty-six controlled fade tests matched 1,428 original callback invocations: target copies, palette reads, signed increments, accumulator words, active flags and every output port/value. These include repeated activation, snap paths, incoming-BH variation and nonzero advance. One short-duration random transition still had unequal components after N+260 callbacks, matching the unclamped model. These are sequential service/core tests with modelled port reads, not a test of interrupt interleaving or a claim that all fades converge within their requested duration.

Greyscale Conversion: The Old Luminance Claim Was Wrong

The earlier analysis recognized the constants 2990, 5870 and 1140, then mistakenly treated them as proof of 0.299R + 0.587G + 0.114B. The loads disprove that interpretation. In both 0x62827 and 0x62879, all three terms read [ESI]. None reads [ESI+1] or [ESI+2]; ESI advances by three only after the output for that colour has been written.

The exact arithmetic therefore collapses to:

r = source_rgb[3*i] & 63;
intensity = (r*2990 + r*5870 + r*1140) / 10000; // exactly r

Routine 0x62801 directly extracts that same red component into a 256-byte lookup table. 0x62827 computes the redundant weighted sum into a similar table. 0x62879 writes the result three times into a 768-byte RGB palette: (r,r,r). It is red-channel greyscale, not luminance-weighted greyscale. The coefficients suggest an intended luminance conversion, but intention does not change what the released instructions load.

All three original routines were executed against the released landscape palette, primary-colour tests and 100 random palettes: 306 converter runs matched red-only output byte-for-byte. Of the 256 released landscape entries, 230 differ from the previously claimed weighted result. At six-bit DAC scale, pure red/green/blue/white become 63/0/0/63, whereas weighted luminance would produce 18/36/7/63. This is a visible difference, not a rounding discrepancy.

The final landscape path at 0x60316 converts the loaded palette at state offset B68h into 2CFEh using 0x62879, then requests a 32-tick transition to it at 0x60329. The final geometry is already drawn: the greyscale ending changes the palette, and its destination brightness comes only from red. The tests establish that target palette and fade mechanism, not a timestamped capture of the ending.

Proportional-Font Title Streams, Not Generic Sprite Packets

The earlier description of 0x6270A as a sprite/picture packet decoder missed its glyph helper. Its first word is destination pitch in bytes, not a line count. The released title streams use 0140h, or 320 bytes. Multiplication by 15h produces the destination displacement for a 21-pixel text line.

Routine 0x626AA interprets the input byte as a character. It subtracts ASCII space (20h), multiplies by four, and indexes the metric table at state selector 128h:21ADh. Each entry is a source-offset word followed by a width word. The font pixels live in selector 130h. The source resource is directory slot 60h, 40,960 bytes; loader 0x6266A reads it, then the loop at 0x6269C adds 40h to every byte. It selects the font's palette-index range, not a geometric displacement.

The glyph kernel's inner copy is an address-size-overridden REP MOVSB:

(source, width) = metrics[character - 32];
saved_destination = DI;
repeat 18 times {
    copy width bytes from DS:SI to ES:DI; // 16-bit SI/DI addressing
    restore this row's starting SI and DI;
    SI += 640;                          // font atlas pitch
    DI += destination_pitch;
}
DI = saved_destination + width;          // next character's x position

SI, DI and row additions use 16-bit offsets. The helper preserves the input stream pointer and caller's count while returning the advanced DI. Every glyph is 18 rows high, but widths vary: A=18, I=4, W=24 and space=9. It copies the entire rectangle, including its background bytes; there is no transparent-pixel test or run-length expansion in this loop.

The enclosing stream consists of a pitch word, one byte of horizontal offset, character bytes and a zero terminator. After zero, the next byte is either FFh to finish, or the next line's offset. The three directly called release streams are:

State offset Text Initial horizontal offset Call site
216Eh LANDSCAPE 84 0x5EB09
217Ch OPTIC PLASMA 68 0x60BDE
2199h GOURAUD SHADING 43 0x5EBF6

All three callers set initial EDI to 7080h, row 90 in a 320-byte-pitch framebuffer. The atlas uses a 640-byte source pitch independently of that destination pitch. The stream also contains a nearby STRETCH title. The Stretch section's setup prepares its pointer but returns without calling this renderer, as traced in the Stretch section below; it is not an established fourth displayed title card.

There is a non-obvious multiline detail: the parser initializes BX to zero, not the supplied initial destination. At each line ending it adds pitch*21 to BX and assigns DI from BX. Thus only the first line uses the caller's initial EDI; a second line starts relative to destination offset zero. These three single-line title cards do not exercise that reset. A controlled two-line test with nonzero initial EDI does, and matches the original behaviour.

Reconstructed GOURAUD SHADING title from Optic Nerve's original font renderer

Original-code title reconstruction using the released font atlas, metrics, stream and target palette at state offset 23D1h, on a cleared 320×200 buffer enlarged 2×. This is the section's title card, not its shaded-object effect, and not a timed DOSBox capture or a measured fade state.

Verification matched all 40,960 original palette-index additions, 59 glyph cases and all 65,536 destination bytes for each of the three released title streams plus the controlled multiline stream. Stream endpoints and final DI also match. The earlier zero/end-marker observations were correct; the line count and generic sprite interpretation were not.

Optic Plasma: Two Sine-Table Samples Per Pixel

The plasma path is called at 0x5EB94: title card, screen clear, selector setup, coefficient load, table construction, palette activation and the controller at 0x60CBE. It uses the same released sine resource in directory slot 38h as the landscape, but builds a different table at 0x60C51. This is the actual plasma lookup generator; 0x5FF44 remains the landscape's height/depth projection table.

The generator advances through signed sine words in steps of 16 samples, biases each into unsigned range, shifts each right twice, adds the two values and stores the high byte. Its complete 321×256-byte result is:

wave(i) = (sine[i & 4095] + 32768) >> 2;
T[y*256+x] = (wave(16*x) + wave(16*x+32*y)) >> 8;
// x=0..255, y=0..320; 82,176 bytes, each in0..127.

The two source pointers advance by 20h bytes per output. After each 256-byte row, the second pointer advances another 40h bytes. This is two phase-related sine samples per table byte, not a trigonometric calculation per screen pixel. The renderer subsequently wraps its lookup addresses to 16 bits, so it only reads the first 65,536 bytes of the larger generated table.

The pixel kernel at 0x60DEC starts at framebuffer offset 640h, row 5, and draws 190 rows of 320 pixels. The top and bottom five rows are untouched. It fetches two table bytes, adds them, and writes two pixels at a time as one word. Address A advances by FF01h (−255) for each pixel. Address B advances by FFFFh (−1) between the pair's pixels, then by FEFFh (−257) before the next pair. At each new row it restores the saved row starts and changes A by −257 and B by −254.

For screen-relative x=0..319 and y=0..189, the exact lookup addresses are:

a = u16(phase_a - 257*y - 255*x);
b = u16(phase_b - 254*y - 258*(x/2) - (x&1)); // integer x/2
screen[(y+5)*320+x] = T[a] + T[b];

These are additions to packed 16-bit offsets: carries cross byte boundaries. Treating the high and low bytes as independently wrapped x/y coordinates changes pixels. B's alternating increments also matter; it is not a uniform step of −129 per pixel. Since each table value is at most 127, the two-sample sum fits a byte without overflow. The released palette at state offset 44Ah maps these sums into the contrasting bright bands and dark regions.

Optic Plasma reconstructed from consecutive original-code phase states

Original-code reconstruction using the released coefficients and target palette. Thirty-two consecutive one-tick phase states, enlarged 2× and slowed to 25 fps for inspection. The loop jumps back to the first state; it is not a complete effect cycle, timed DOSBox capture or capture of the palette fade. The otherwise untouched border rows are presented with cleared index zero.

The released initial phases are (0,16448). Its controller consumes the low byte of the timer count, subtracts it from the current countdown, draws with the existing phases, and only then advances them by (+513,−255)*ticks, wrapping at 16 bits. The released control record contains a 512-tick count followed by the FFFFh termination marker. Reaching zero or borrowing exits before drawing or advancing again. Under a controlled one-tick schedule this means 511 draw calls, using phase states 0 through 510; two ticks per return produce 255 draws. A returned 256 again becomes zero after the byte mask.

On exit it reuses the palette-conversion path described above, including the red-only greyscale destination. After the closing fades and holds, caller 0x5EBCD invokes 0x60BAB, which renders once more with ES bound to selector 118h rather than VGA. That stores a plasma image in RAM; its later consumer is not traced here. The extra call is not another displayed frame.

Verification matched all 82,176 generated table bytes, all 64,000 framebuffer bytes in 37 original render calls (including deliberately prefilled borders), and 106 controller schedules. The latter checked every drawn phase pair, the countdown's wrapped remainder, termination and final phase state, with the clock and draw call intercepted. These tests recover the plasma's complete pixel mechanism and released control record, not measured playback timing.

Gouraud Object And View Transforms: Two Fixed-Point Scales

The geometry loader initializes each object's 80-byte transform header with its translation and a zero rotation flag. That path through 0x63C2F adds the translation to every stored mesh/reference point and emits the object origin as an additional leading triple. It does not rotate these points in that branch. The camera transform then operates on the origin and all points together. The separate object-local rotation branch contains an INT3 and is not exercised by the translation-only tests below.

Geometry slots 40h and 88h are paired with camera resources 48h and 90h. Each camera resource is exactly 25,946 bytes: a word count of 1,081 followed by that many 24-byte records. Each record supplies three coefficient offsets and three signed camera offsets. These are stored records, not a measurement of displayed-frame count or playback duration.

Four original section-loader/parser executions verified this resource-to-buffer layout for configuration values 0, 1, 2 and 3. Only value 2 selects the 88h/90h geometry/camera pair; the others select 40h/48h. The emitted 80-byte object header, translated-origin fields, untransformed point payload, face stream, palette bytes, camera bytes, coefficient bytes and projection settings all matched the reconstructed layout. The harness supplied the resource-copy interrupt services and prebound segment views, then executed the original parsing and slope-table setup through the start of playback; it was not a DOS disk-I/O test.

The common coefficient resource, slot 30h, contains 1,797 signed dwords. It follows a Q30-scale cosine cycle with 1,440 samples per turn; the extrema are ±1,073,741,823. A second read 5A0h bytes later supplies the quarter-turn shifted coefficient. Camera angles are byte offsets into this table, not direct degree values. The released table words must be retained: replacing them with a newly rounded ideal cosine can change the last bit.

Matrix builder 0x63AF2 uses signed IMUL followed by SHLD EDX,EAX,2, retaining the low 32 bits of the signed 64-bit product shifted right by 30. Define that operation as Q(a,b). For the three record angles, let C1/C2/C3 be their cosine-table values and S1/S2/S3 their quarter-shifted values. S denotes the actual shifted read, not an assumed positive-sine convention. The nine stored entries are:

M00 = Q(C3,C2)
M01 = Q(-S3,C1) + Q(Q(C3,S2),S1)
M02 = Q(S3,S1)  + Q(Q(C3,S2),C1)
M10 = Q(S3,C2)
M11 = Q(C3,C1)  + Q(Q(S3,S2),S1)
M12 = Q(-C3,S1) + Q(Q(S3,S2),C1)
M20 = -S2
M21 = Q(C2,S1)
M22 = Q(C2,C1)

Each Q and addition preserves 32-bit wrapping. Nested Q operations truncate at their intermediate products; one combined multiply and final shift is not equivalent. The camera offsets occupy the fourth dword of each matrix row and are preserved by this builder.

The view transform at 0x63D5C does not use that Q30 rescaling. It keeps EDX directly after each signed multiplication, equivalent to an arithmetic shift by 32, then adds the three separately truncated terms:

for output_component j in 0..2:
    out[j] = s32((point[0]*M[0][j] >> 32)
               + (point[1]*M[1][j] >> 32)
               + (point[2]*M[2][j] >> 32)
               - camera_offset[j]);

With Q30-scale matrix entries this introduces an effective quarter scale before subtracting the camera offset. It is not an ordinary Q30 vector transform written differently. Negative products round downward at each high-word extraction, so rearranging the arithmetic can change coordinates. The origin-relative shades below inherit those rounding effects: transforming a reference vector alone need not exactly equal the difference between two separately rounded point transforms.

Verification matched 1,000 original matrix builds against the nested-integer formula, including preservation of the offset fields. For each released geometry/camera pair, eight stored poses were passed through the original translation-only object transform, matrix builder, view transform and shade builder. All 22,944 transformed triples and 21,872 packed shaded faces matched an independent model. These actual resource/pose inputs extend the controlled shade tests below. The projection and pixel-coverage follow-ups below extend these tests through the complete selected-frame output.

Gouraud Projection, Rejection And Object Ordering

Projector 0x63E19 overwrites each transformed point's X/Y while preserving Z. For Z >= 1, with the released projection settings, it computes:

screen_x = trunc_toward_zero(x * 200 / (z + 200)) + 127;
screen_y = 100 - trunc_toward_zero(y * 167 / (z + 200));

The signed integer divisions matter: negative coordinates truncate toward zero, not downward. The separate origin triple is not projected. A point with Z < 1 skips projection altogether, leaving its original X/Y in place; this is neither a near-plane intersection calculation nor face rejection.

Projected coordinates must satisfy 1 <= X < 255 and 1 <= Y < 199. An outside point flags the object; the subsequent path at 0x63FCA loads EBX = FACEFACEh and reaches INT3 at 0x63FCF. There is no polygon clipper on this path. Thus the authored camera/geometry staying in range is an important assumption, not a capability supplied by the rasterizer.

Face expansion reads the three indexed projected vertices and evaluates:

D = (x0-x1)*(y2-y1) - (y0-y1)*(x2-x1);
keep_face = D < 0;

The products and subtraction use the signed 64-bit result. Zero-area and oppositely wound faces are discarded. Accepted faces retain their authored order and packed shade bytes; each output record contains the three X/Y pairs ready for the triangle dispatcher. There is no per-face depth sort in this stage.

The insertion routine at 0x63FD6 does sort the object-list entries by descending signed key, preserving input order on ties. However, at its 0x63F21 call site EAX still contains the last point's projected Y, or its Z when projection was skipped. Calling this a depth sort would be incorrect. Both released geometry resources contain one object, so this key cannot change inter-object order in those resources.

Verification executed 100 complete original projection/face-list runs with one to three controlled objects, checking all projected coordinates, 2,587 face decisions, expanded records and sorted list pointers/keys. Seven explicit boundary tests confirmed inclusive X/Y=1, rejection at X=255 and Y=199, and unchanged X/Y at Z=0 and -1. The harness intercepts the actual INT3 instruction; it does not claim to reproduce the demo's exception handler or recovery behavior.

The released-resource test also checked projection and every expanded face in eight selected poses per geometry variant. All points in those 16 poses had Z >= 1 and stayed inside the accepted rectangle. It then executed the original clear, triangle rasterizer and display copy to reconstruct the images below.

A subsequent exhaustive model sweep evaluated every point, including the shade-reference points, at all 1,081 stored camera records per variant:

Geometry Point evaluations Projected X range Projected Y range View Z range
40h, face 886,420 26..235 17..174 3,891..201,298
88h, bull 2,211,726 22..236 13..196 1,245..200,986

None of these 3,098,146 evaluations triggered a near-threshold skip or an outside coordinate. This supports the authored-path assumption above: the bull approaches Y=199 but remains inside. This exhaustive sweep uses the integer transform/projector model checked against original code at the selected poses; it does not execute every original frame or verify timing, runtime configuration changes, or triangle coverage.

Optic Nerve face, geometry slot 40h and camera record 512, reconstructed with original code

Optic Nerve bull head, geometry slot 88h and camera record 512, reconstructed with original code

These are original-code reconstructions using the released geometry, camera records and full resource palettes, enlarged 2× with nearest-neighbor sampling. They are not DOSBox captures or timed fade states. Coordinates, shades and face expansion and final triangle pixels match independent integer models for all 16 selected poses, including the centered display copy. This does not make the stills captures of the timed demo playback.

Gouraud Camera Controller: Advance Before Draw

After loading the scene, the controller requests its palette with AH=08h, AL=0 and then arms it with AH=09h, AL=0. It reads the camera count, clears the render buffer and discards one INT31h clock result. Each subsequent iteration clears EAX before reading the clock, so the returned AX is used as an unsigned 16-bit advance, not the landscape controller's low-byte advance. Its camera selection is effectively:

remaining = stored_count;
camera_index = 0;
discard_clock_result();
for (;;) {
    ticks = clock_ax();
    remaining -= ticks;
    if (remaining < 0) break;
    camera_index += ticks;
    draw(camera[camera_index]);
}

The advance happens before the draw. With one tick per iteration it starts at record 1, not record 0. More importantly, the exit test at 0x64159..0x6415B accepts a zero remainder. With 1,081 stored records, an accumulated advance of exactly 1,081 therefore selects index 1,081, one past the last valid index 1,080. An overshoot exits instead. This is a resource-boundary bug, not evidence that the final valid pose is forced.

Twenty original-controller tests, ten scripted tick schedules for each camera resource, matched the advance-before-draw model. A recognizable six-dword sentinel immediately after the camera payload was copied into the view header when equality occurred, proving the out-of-resource read. Rendering calls were intercepted: the test does not claim that these sentinel values are present in a real run, or establish the resulting pixels, trap behavior or hardware tick schedule. Thus the exhaustive stored-record bounds sweep above does not prove that every controller draw is inside those bounds.

The original-loader tests also filled the destination with a recognizable pattern beforehand and checked the 28 bytes immediately following the camera payload. All remained untouched: this loader does not append a fallback camera record or clear that tail. The overread therefore consumes whatever RAM contents precede this section, not a defined extra pose.

Constant advances of 1/2/3 produce 1,081/540/360 draw calls respectively; only the first of those reaches the sentinel record. Advance 1,081 makes one out-of-resource draw; 1,082 exits without drawing. The tested controller issues the initial palette requests once and no fade-out request on normal exit. At exit it zeros the first RGB triple in its palette buffer, which is not itself a hardware palette update. These are clock-injected control tests, not measurements of elapsed playback time.

Gouraud Shade Sources: Separate Authored Direction Vectors

The section loader selects geometry resource 40h or 88h, depending on the runtime configuration value returned by AH=0Ah. Both resources parse exactly to their final zero object-count marker. Their point lists contain two distinct sets, not just the visible mesh:

Geometry slot Mesh points referenced by faces Separate shade-reference points Triangles
40h 1..410 411..820 718
88h 1..1023 1024..2046 2,016

The shade-reference vectors are short and nearly constant-length: about 216.7..218.3 in the first resource and 203.7..206.0 in the second, in stored coordinate units. They form a normal-vector-style lighting source distinct from the much larger mesh coordinates. The face records explicitly select these references per corner; the association is not always simply mesh_index + number_of_mesh_points.

Each face stores three dword shade descriptors before its mesh indices. A descriptor's low word selects a shade-reference point; its high word is an authored brightness bias. Every bias in these two released resources is one. The object pipeline carries an origin triple followed by all its point triples. At the shade builder's input, scene offset CED54h, the third component is the transformed Z value: the projection routine also uses this component as its depth denominator input.

Routine 0x64227 computes each corner shade as follows:

reference = descriptor & 65535;
bias = descriptor >> 16;
delta = s32(transformed[reference].z - transformed[0].z);
if (delta < 0) delta = 1;
shade = (delta + bias) & 255;

The reference is a separate direction point, not the visible mesh corner's depth. Subtracting the transformed origin removes the common position term, leaving the direction's Z contribution, subject to the transform's integer quantization. There is no per-corner normal construction, normalization or explicit light-vector multiply in this shade-packing routine; the authored reference vectors and upstream transforms supply its inputs. This establishes how the shade is derived without assuming a conventional normal-dot-light implementation elsewhere in the demo.

Two literal details matter. Negative deltas are replaced by one, not zero, and the final sum wraps to a byte rather than saturating. With the released bias of one, delta −1 produces shade 2, delta 0 produces shade 1, and delta 255 produces shade 0. The last example is a controlled edge case, not a claim that it occurs in the released animation.

The three shade bytes are packed into one dword. The face's mesh-index list is then copied unchanged to the output at scene offset 1307D4h, preserving the separation between lighting references and visible corners. The later dispatcher expands those packed shades into the temporary vertex records described below.

Verification executed the original builder for both released face lists under 12 controlled sets of post-transform coordinates each: 24 runs, 32,808 face records and 98,424 shade bytes, including copied indices and untouched output guards. The tests include negative, zero and wrapping shade cases. Those controlled tests isolate the shade builder; the released-pose tests above additionally execute the preceding transforms. The geometric construction of the authored vectors and complete animated object frames remain outside these checks.

Gouraud Triangle Handoff And Colour-Span Backend

After the GOURAUD SHADING title, 0x5EC4E calls the section loader at 0x63982. Its triangle-dispatch path at 0x63A37 walks lists of screen-space faces and passes compact vertices to rasterizer 0x643A4. A face begins with a dword vertex count, required to be three, followed by a dword containing three shade bytes and six coordinate dwords. The dispatcher takes the low word of each coordinate and expands each packed shade into a word, giving three six-byte (x,y,shade) records at scene offset 186DCh. It swaps the first and third complete records before calling the rasterizer. Unsupported vertex counts enter an INT3 path; they are not general polygons handled by this particular dispatcher.

The rasterizer initially sorts using the low bytes of the coordinate words. For distinct Y values it rearranges the complete six-byte records into descending Y order: bottom, middle, top. The upstream projector accepts 1 <= X < 255 and 1 <= Y < 199, with the rejection behavior documented above; it does not provide polygon clipping. It would be wrong to assume this entry accepts arbitrary 16-bit screen coordinates just because the temporary vertex fields are words.

The slope table builder at 0x6435B produces 256×256 words:

slope[dy][magnitude] = dy ? (magnitude << 8) / dy : 0;
// dy and magnitude both0..255, integer quotient.

Edge setup packs the vertical difference into DH and the absolute horizontal or shade difference into DL, reads FS:[EDX*2], and negates the result when the original difference was negative. It therefore trades many edge divisions for table lookups. Q8 edge starts use a fractional byte of 80h. The table is separate from both the landscape projection table and plasma sine-sum table. The cross-span shade setup still contains a division; the existence of this table does not make the whole rasterizer division-free.

For distinct-Y triangles, let T/M/B denote the sorted top/middle/bottom vertices. The three horizontal edge increments are signed, truncated Q8 slopes for T→M, M→B and T→B. Starts are 256*x + 128; the long-edge shade likewise starts at 256*T.shade + 128. Its vertical shade increment comes from the same slope table, using the T→B shade difference.

The two vertical counters are initialized to M.y-T.y+1 and B.y-M.y+1. In particular, the cross-span shade setup evaluates the long edge after M.y-T.y+1 steps, not exactly at M.y. It keeps the wrapped low word of that Q8 X and takes its high byte. The two branches form a signed width as either M.x-long_x or long_x-M.x. Nonpositive width gives a zero horizontal shade step; otherwise the signed difference between 256*M.shade and that advanced, word-wrapped long-edge shade is divided by the width, truncating the magnitude and restoring the sign. This setup convention is not interchangeable with an ideal plane-gradient calculation at the exact middle vertex.

An independent model matched the original pre-span state for 2,000 distinct-Y triangles and 600 flat-edge triangles: complete-record sorting, three horizontal slopes and starts, long-edge shade slope/start, both counters and the cross-span shade division. Both setup branches were exercised (1,287 and 1,313 cases in total).

Equal-Y pairs do not use a separate flat-triangle filler. The same setup uses the slope table's zero-denominator row and initializes the zero-height section's counter to one. Ties are not stable-sorted: the selected record permutation depends on which original vertices share Y and which vertex is above them. The 600 cases check these explicit tie branches as well as the resulting setup state. With all three Y bytes equal, the early return at 0x64433 bypasses setup and rendering; 200 further cases verified unchanged vertex records, setup memory and the full 65,536-byte framebuffer region. The setup tests stop before the pixel loops, so the counters alone do not establish exact scanline/endpoint ownership or whether an edge row is drawn.

The four colour-writing loops are at 0x64786, 0x64811, 0x64A7E and 0x64AFF. Their common operation is:

do {
    ES[DI] = DH;          // high byte of Q8 shade DX
    DX = u16(DX + SI);    // signed Q8 shade increment, with word wrapping
    DI = u16(DI + direction); // +1 or-1, depending on span branch
} while (--BP != 0);

These are palette-index writes with linearly changing intensity. There is no texture fetch, perspective division or depth-buffer comparison inside the span. That establishes the pixel operation, not the upstream face-order or visibility algorithm. The two forward and two backward loops cover the two vertical portions of the triangle with different edge arrangements.

The surrounding code packs edge positions and shades into opposite halves of EBX/ECX and uses 16-bit rotates to switch between them. The span consumes DX as its temporary shade while the edge shade survives in the other register state for the next scanline. Likewise, the row address and row count are retained in opposite halves of EDI and EBP. This is why replacing all registers with flat 32-bit counters loses important state even though the effect runs in a 32-bit code segment.

Exact Scanline And Endpoint Rules

The first section visits Y=T.y through M.y inclusive. Each row advances both Q8 X edges and the long-edge shade, even when its span is skipped. The second section visits Y=M.y+1 through B.y inclusive, but resets the short edge to 256*M.x+128 on that first row: it does not pre-advance the new short edge to compensate for the row increment. The long edge and its shade continue from the first section without a reset.

Let L/R be the high bytes of the current left/right Q8 edge positions. The width test is byte arithmetic: compute E = (R+1)&255, and skip when E <= L. Otherwise the first section draws E-L pixels, starting at the long edge and walking toward the short edge. The second right-to-left section uses the same count. The second left-to-right section at 0x647FF..0x64806 increments the count once more, drawing E-L+1 pixels. Its extra endpoint pixel is real; imposing a symmetric inclusive or top-left rule changes the output. Byte wrapping at R=255 also matters: the increment becomes zero and the span is skipped rather than treated as an ordinary width.

Each span starts with the current long-edge shade, adds the setup's horizontal shade increment per pixel, and uses word-wrapped framebuffer offsets. An independent implementation of these row, endpoint and shade rules matched all 65,536 framebuffer bytes for 1,200 complete original triangle calls: 800 distinct-Y, 300 flat-edge and 100 all-equal-Y cases. This checks unchanged background as well as drawn pixels.

The same model then composited the independently expanded faces in their authored order, reversing corners exactly as the dispatcher does. All 64,000 raster-buffer bytes and all 64,000 visible display-copy bytes matched the original code at each of the 16 selected released poses. Thus the face and bull reconstructions above now have independently checked final pixels, not merely checked transform inputs. Arbitrary out-of-range coordinates and exhaustive timed playback are outside these tests.

Pixels are first drawn into selector 58h's RAM buffer, not directly into the VGA aperture. Clear routine 0x641EC zeros 64,000 bytes. Copy routine 0x64204 transfers those bytes to VGA starting at destination offset 32. That adds the 32-pixel left margin for the 256-wide coordinate range within a 320-wide display. The literal copy writes through offset 64,031: it is a contiguous transfer, not a clipped per-row copy. The last 32 transferred bytes are beyond the ordinary 64,000-byte visible image.

Verification matched all 65,536 original slope words, 4,000 original span executions in both directions, 800 triangle-record handoffs and the complete clear/copy memory ranges. Span tests checked untouched bytes and final offset/shade/count words, including 16-bit wrapping. The dispatcher tests intercepted the rasterizer entry to check its exact input records; span tests entered the inner loops with controlled inputs. These are not yet complete triangle-coverage tests by themselves; the complete coverage follow-up above adds that verification. The separate projection pass establishes the coordinate, rejection and ordering behavior. The transform and shade-source passes recover the inputs to its colour ramps for the loaded translation-only objects.

Stretch: A Full-Screen Repeating Logo Mapper

The path called at 0x5ED2C maps a rotating, repeating SILENTS logo across the screen. Resource slot 50h contains a 256×256 indexed image: a ten-byte RIX3 header, 768 six-bit palette bytes and 65,536 texels. Selector 58h starts 778 bytes into the loaded resource, so its zero offset is the texture, not the file header. The resource palette exactly matches the palette used at state offset 3BFEh.

The nearby STRETCH title is not proof of a displayed title card. Helper 0x60EF0 clears the screen and prepares its stream pointer and destination, but returns at 0x60F13 without calling the text renderer on this path.

Motion slot 98h holds 4,400 eighteen-byte records. Its header, 4,399, is an inclusive last index. Each record contains an angle and four X/Y pairs. The original controller draws before advancing and uses only the low eight bits of each tick count. Eighty-four scripted tick/abort schedules matched: one-tick steps draw records 0 through 4,399, whereas 257 also advances one record and 256 advances none. Unlike the Gouraud controller, the tested Stretch loop does not read beyond its motion payload.

The angle patches sine/cosine immediates in a four-point transform. Actual coefficients are doubled signed words from the released sine table; the zero-angle cosine is 65,534, not an exact Q16 identity. Coordinates are loaded as unsigned words, products and sums wrap at 32 bits, and arithmetic right shifts occur at intermediate stages. Each output word receives an additional 16,384. Replacing this with ideal floating-point rotation changes the sample positions.

Two endpoint-table builders interpolate the transformed left and right edges over 200 screen rows. Their exact integer interpolation was checked in 1,009 original calls, including signed inputs: the endpoint comparison is unsigned, and one branch rotates rather than shifts the starting value by sixteen bits. This is not interchangeable with a conventional signed fixed-point lerp.

However, those negative-coordinate edge cases are not exercised by the released motion records. Executing all 4,400 original transforms matched 17,600 complete XYZ triples against the integer model, with the four Z words evolving between records from their released initial values. The resulting X range is 13,816..19,566 and Y is 12,782..18,948: no negative signed-word endpoints or sign-crossing row pairs occur. The 16,384 bias therefore keeps this animation in the positive interpolation range; the texture fetches later wrap the large coordinates to eight bits per axis. This exhaustive check covers transforms, not every full frame's pixels.

For each row, mapper 0x61293 computes Q8 X/Y increments with magnitude ((abs(start-end)+1)*256)/320, rounded down and signed toward the endpoint. The body at 0x61362..0x62447 is fully unrolled: 320 texture loads and 160 word stores. Each fetch uses ((Y>>8)&255)*256 + ((X>>8)&255), independently wrapping both texture coordinates. There is no per-pixel perspective divide, depth test or texture-boundary clipping. The original spans matched an independent model in 1,007 tests, including destination guards and final coordinate state.

Composing the exact transform, endpoint interpolation and span model matched all 64,000 screen bytes in ten selected released poses, plus two varied-Z controls. All 1,600 endpoint-table bytes and framebuffer guards matched too. The resulting static-palette reconstructions identify the repeating logo effect; they are original-code reconstructions, not timed DOSBox captures.

Stretch at released record 0, original-code reconstruction

Stretch at released record 2200, original-code reconstruction

Original-code reconstructions using the released texture, motion records and full resource palette, enlarged 2× with nearest-neighbor sampling. The first is a highly enlarged portion of the logo; the second shows its repeated SILENTS lettering. Both match the independent pixel model. These are not DOSBox captures or timed palette-fade states.

Stretch Exit: White, Red-Only Greyscale, Black, Then Snapshot

The exit at 0x6104c..0x610fe changes the palette while retaining the last framebuffer. It requests the all-63 white palette at DS:29fe with duration zero, then executes converter 0x62879 from the released colour palette at DS:3bfe into DS:2cfe. As in the landscape ending, this is red-only greyscale, not weighted RGB luminance. It requests that target with duration 32, waits, and requests the all-zero palette at DS:26fe with duration 64. All three requests arm service AH9 with AL zero.

The two explicit hold loops call INT31 210 and 64 times. Together with five standalone calls, the exit consumes 279 clock returns; it does not add the tick counts returned in AX. Consequently, these loop counts are not an exact wall-clock duration or proof that a palette fade has completed.

Finally, 0x610f7..0x610fc copies 64,000 bytes from framebuffer selector 28h into selector F0h using REP MOVSB. It does not clear the framebuffer or convert its pixel indices to greyscale. The palette supplies the visible colour change, while the snapshot retains the original indices.

Five original-exit executions with different injected clock values matched all six palette setup/arm requests, the 768 converted palette bytes, all 64,000 snapshot bytes and untouched source/destination guards. Palette services and IRQ delivery were intercepted: this verifies the requested sequence and copy, not actual DAC timing or the snapshot's later consumer.

Credits: Saved Frames On A Curled Sheet, Then A Point Morph

The Stretch snapshot is reused in the later credits sequence. At 0x63586..0x635cc, the code remaps its 64,000 pixel indices in place through the released palette's red-channel lookup, then calls 0x628d8 to gather a 256×128 image. This is a stored image warp, not newly projected sheet geometry.

Resource 70h contains 32,768 unsigned source offsets; 80h contains 32,768 additive bytes. The mapper first zeroes source pixel zero, then executes:

for (i = 0; i < 32768; ++i) {
    offset = source_offsets[i];
    sample = offset == 0xffff ? 0 : saved_frame[offset];
    output[i] = (sample + additive[i]) & 255;
}

There are 25,609 sentinel offsets and 7,159 actual source fetches; all actual offsets are within the 64,000-byte snapshot. The additive table ranges from 0 to 51 and supplies image structure outside the sampled area too. The composed result depicts a curled sheet. A second red-channel lookup using the palette at DS:1871 converts this composite into the morph's brightness indices. Nine remap/gather tests matched all bytes and guards, including one using the released tables with a controlled snapshot.

Point Correspondence And Precomputation

0x62934 scans nonzero source pixels in ascending address order and nonzero destination pixels in descending order. It pairs their 16-bit addresses, repeating the shorter list until both contain the larger count. These are pixel addresses in a 256×128 image, so the low byte is X and the high byte Y. Twenty nonempty-image tests matched all pairs, counts and untouched memory, including strongly unequal populations and fully populated images.

0x629e4 then performs exactly 131,072 swaps of source endpoints only. One cursor advances sequentially; the other advances by 128 pair entries plus a source-image word masked with FFFCh and divided by four. A cursor that passes the list end resets to zero rather than taking a remainder. The source word is read at remaining_swaps & 7fffh. Correspondence therefore depends deterministically on the image bytes; it is not a nearest-point match or a fresh random choice each frame. The same twenty tests matched the complete shuffle, including its word read across the source image's end.

The builder 0x62a59 traverses each pair and writes its point into 64 different frame buffers before moving to the next pair. X, Y and brightness use Q8 accumulators. For the released brightness range, the increments are four times the endpoint differences: dividing a Q8 difference by 64. The loop stores the current position/brightness first, then advances them. Later pairs overwrite earlier ones when points collide. Brightness subtraction uses a byte intermediate and conditional signed shift, so unrestricted eight-bit colours must retain those instruction semantics rather than assume the same simple formula.

Selector 50h aliases frame zero of 60h; selector 58h is the original destination image at frame 64. Clearing 0x62917 preserves these endpoints and zeroes frames 1 through 63. The complete buffer occupies 65×32,768 bytes, or 2,129,920 bytes. Twenty-four controlled builder tests matched every byte of all 65 frames and guards, including aliasing, collisions, extreme X/Y differences and full-byte brightness edge cases.

Playback And Released-Resource Reconstruction

Forward routine 0x62b86 copies frames 0 through 64; reverse routine 0x62be8 copies 64 through 0. Both copy 128 rows of 256 bytes into a 320×200 screen at (32,50), preserving the surrounding pixels. Each performs one INT31 wait per buffered frame and ignores the returned elapsed-tick value. Six forward/reverse tests matched all screen bytes across all 65 copies. Playback is thus a frame copy, while the point interpolation happens earlier.

In the Stretch branch, 0x634b4..0x63518 prepares the preceding programmer credits as the destination image. 0x63563..0x635f9 prepares the warped Stretch snapshot as the source. The builder runs, and 0x6369c calls reverse playback, turning the credits into the sheet rather than the other way round. The preceding palette request at 0x6363f targets DS:1b6b.

Original-code credits-to-Stretch-sheet morph reconstruction

Original-code reconstruction using released font, palettes and warp tables, with Stretch stored pose 4,399 as the snapshot. The 9,258 sheet points pair with 4,372 credit points. Independent models matched the sheet, pairing, shuffle, all 65 RAM frames and all 65 screen copies. Shown at an illustrative 25 fps with endpoint holds and a static target palette; this is not a timed DOSBox capture. Other clock schedules may leave a different Stretch pose in the snapshot, and the GIF loop jumps back to the credits.

Timing And Self-Modifying State

The handler around 0x5d5f8 saves registers and segments, switches to runtime selectors, and updates a set of counters under ds:0x4124..0x4138. It also contains the literal string:

WRITE YOUR OWN CODE!

That string sits in a code area that otherwise manipulates countdowns and patches bytes into the runtime state:

mov BYTE PTR fs:[03d2h], 0ebh
mov BYTE PTR fs:[03d3h], 051h
...
sub DWORD PTR ds:4128h, 2
dec DWORD PTR ds:4138h

This suggests a timer/scheduler or event interpreter that can patch small jump or opcode bytes into a control area. The analysis should not overstate that as a full virtual machine, but it is more than a passive frame counter.

Why It Is Fragile

The fragility is not accidental. The binary assumes:

That explains the release warning and the later 386 patch. It also explains why Pouet comments often mention that Optic Nerve is unusually hard to run.

Part Map

Part Binary evidence Likely technical role
Protectedmode / Interface startup strings, 0x5c985, 0x5d171 custom protected-mode runtime, A20, GDT/IDT, PIC/PIT setup
Radio Moscow music strings and MusicKernel text Henning Semler music kernel, Jesper Kyd module playback
Introduction early scheduler calls and full-screen blits resource images, title cards, palette fades
Landscape 0x60380, 0x60913, 0x609ae voxel/height-column renderer with Mode X plane writes
Optic Plasma table builder 0x60C51, pixel kernel 0x60DEC, controller 0x60CBE two moving sine-sum samples per pixel, alternating pair increments, 190-row output and tick-driven phases
Gouraud Shading projector 0x63E19, dispatcher 0x63A37, rasterizer 0x643A4 released face/bull transforms, authored lighting vectors, culling and Q8 spans independently matched through selected-frame pixels; controller has a boundary overread
Stretch transform 0x610FF, row tables 0x6112A/0x6118C, mapper 0x61293 rotating, repeating SILENTS logo; 200 rows of unrolled 320-pixel wrapped texture sampling, independently matched through selected full frames

What Needs A Second Pass

This pass identifies the runtime and several key loops, especially the palette fade and landscape/planar writer. A deeper pass should:

The main low-level conclusion is already solid: Optic Nerve is not just a linear mode-13h demo. It uses a custom protected-mode runtime, file-backed resource loaders, fixed-point/palette table machinery, and direct planar VGA writes with sequencer map-mask control.