Analysis model: gpt-5.5 xhigh, sol high Last edited: 2026-08-25
Classic by The Brain Slayer - Technical Dissection
Classic is a 1991 MS-DOS VGA/Sound Blaster demo by The Brain Slayer. The
Hornet 1991 index lists it as classic.zip 118372 **+ Classic by The Brain Slayer.
Release year: 1991
This is a close technical relative of Coma Demo, but it is not just the same
program with different assets. Classic opens its own executable, derives the
start of appended data from the MZ page count, scans a small internal resource
directory, and feeds a file-backed compressed block decoder before it starts the
VGA and Sound Blaster paths. The visible code is built around mode 13h, DAC
palette cycling/fading, full-screen image copies, a shrinking rectangle reveal,
a bottom-band text/scroller kernel, and direct DMA sound playback.

The map above is code-derived. The DOSBox-X stills and short clip below are the runtime evidence for the main picture, palette cycling, and bottom text strip.

The contact sheet condenses the visible run into five states: loader/status, the first stable title picture, the yellow warm phase, the red/orange phase, and the later blue/cyan phase. The individual frames below are then used where they line up with the unpacker, copy, reveal, palette, and scroller code.
Sources
- Hornet 1991 demo index: https://ftp.scene.org/mirrors/hornet/demos/1991/00_index.txt
- Scene.org archive: https://ftp.scene.org/mirrors/hornet/demos/1991/classic.zip
- Scene.org file page: https://files.scene.org/view/mirrors/hornet/demos/1991/classic.zip
Archive
The examined archive is classic.zip from the Hornet mirror:
classic.zip 118372 bytes
CLASSIC.EXE 119633 bytes 1991-07-17 12:14
The archive has a historical ZIP comment that is not part of the demo payload and is intentionally omitted here.
Hashes:
aa197f2526cab44d0244b9de53ce6ea712a24635a2bffa746aa14832974cda45 classic.zip
a392a862c966b3f0db02a95d16e77c1d2e03af5212647c216768cf37affc1629 CLASSIC.EXE
8d49d4453b84fa72f5d295c9904a565ca21c834af116e01e61203e3832a1404b classic-unpacked.exe
Runtime Capture
On 19 June 2026 I ran the original packed CLASSIC.EXE under DOSBox-X
2026.01.02, Linux SDL2 64-bit, with machine=svga_s3, normal CPU core,
cycles=30000, EMS disabled, dummy SDL video/audio, and the mixer in silent
mode. The Sound Blaster device was still emulated. Timing zero is the start of
dx-capture /v CLASSIC.EXE; the source executable was the local scratch copy
whose SHA-256 matches the CLASSIC.EXE hash listed above.
The captured stream is MPEG-TS H.264/AAC at 640x400, duration 31.829333
seconds. The queued Escape key was set later than the run length, so the
capture shows the program's visible startup, main title loop, fade-down, and
return to DOS without using that key. The stills below are frame extractions
from the capture stream, scaled to the original 320x200 display size. These are
visual timestamps, not cycle-exact profiler marks. The contact sheet above
keeps the run readable as a sequence instead of as five isolated frames.
The sequence is visually compact: after the decompressor/status card, Classic
settles into one main Brain Slayer picture. The change over time is carried by
the border/reveal phase, palette triplet rotation, and the bottom text/scroller
kernel rather than by a chain of separate scenes. The frames are therefore
chosen to mark those runtime states and to anchor the technical sections that
follow.
| Timestamp | Frame | Notes |
|---|---|---|
00:02.000 |
![]() |
Startup is still inside the unpack/load path. This is the viewer-facing sign of the restored entry, self-open, resource scan, and file-backed block inflation described below. |
00:03.000 |
![]() |
The first stable Brain Slayer picture is now visible. This frame corresponds to the graphics resource load, mode-13h full-screen copy to A000h, palette setup, and rectangle reveal. |
00:08.000 |
![]() |
The steady main loop is active. The top/bottom panels and title image are stable while the DAC triplet rotator and bottom-band scroller/text renderer begin doing the visible work. |
00:14.000 |
![]() |
The same scene has shifted into a warmer palette phase. This makes the palette rotator easy to see, while the lower strip continues to show the column-injection text renderer. |
00:29.000 |
![]() |
Late in the run, the scene is still the same title/scroller state but the palette cycle has moved to blue/cyan. The next visible transition is the fade-down and DOS return path. |

The GIF covers the steady 00:07..00:15 window. It is the useful part to show
as motion: the logo page stays fixed, while the checker floor changes palette
phase and the bottom band advances independently.
The selected frames show public title/scroller material. I do not transcribe the bottom scroller text here, and no private contact detail is used as evidence.
Read together, the frames map cleanly to the code paths that follow. 00:02.000
shows the exit from the block inflater into the first visible resource copy;
00:03.000 is the full-screen page after 0933h has moved the graphics block
into A000h; 00:08.000 and 00:14.000 are the palette-triplet rotator at
work over the same picture; and 00:29.000 is the late-stage blue/cyan phase
that proves the strip text and palette cycle are still running in the same main
loop. In other words, the contact sheet is not just proof that the intro has a
picture. It is the visual evidence for the reveal copier, palette cycling, and
bottom-band text engine documented below.
The runtime frames also separate the title-card phase from the later steady
state more clearly than the static map alone. 00:03.000 is still the initial
title picture, while 00:08.000 and 00:14.000 show the same screen after the
bottom strip has started to carry visible text work. That matters because the
analysis below is not describing one monolithic splash screen; it is tracing
the handoff from reveal to persistent scroller/palette activity.
Runtime-To-Code Concordance
The DOSBox-X media maps to the recovered runtime in this order:
classic-brain-slayer-runtime-00-02-000.pngmaps to the restored startup, self-open, resource scan, and file-backed block inflater. It is the visible loader/status phase before the mode-13h title page is fully copied.classic-brain-slayer-runtime-00-03-000.pngmaps to the first graphics page: resource dispatch through01E4h, full-screen A000h copy at0933h, palette setup through the084Fh/08A0hDAC helpers, and the rectangle reveal at0952h/0997h.classic-brain-slayer-runtime-00-08-000.png,classic-brain-slayer-runtime-00-14-000.png,classic-brain-slayer-runtime-00-29-000.png, andclassic-brain-slayer-runtime-palette-scroller.gifmap to the persistent main visual loop. The code-side anchors are the triplet rotators at0525h/052Chand0540h..058Dh, the bottom-band left-scroll at0533hand065Dh, the text/script slice painter around072Eh, and the DAC upload at053Ch.classic-brain-slayer-runtime-contact.pngis an index over the same sequence, not separate evidence for another scene. The useful motion proof is the GIF: the picture stays fixed while palette triplets and the bottom band move independently.
This mapping also limits what the current media proves. The Sound Blaster DMA and four-stream mixer are code-analyzed later, but the muted capture is visual evidence for the loader, resource copy, reveal, palette rotation, and bottom text strip rather than direct audio evidence.
Code-derived sequence behind the observed capture:
entry unpacker original MZ end-area stub restores a larger image
real startup relocated data segment, self-open, XOR decode
resource scan appended EXE data, 12-byte resource records
block inflation file-backed compressed block decoder
VGA setup INT 10h AX=1A00h, mode 13h
first picture 64000-byte copy to A000h
palette fade DAC table copied, ramped, and uploaded
border/window reveal top/bottom spans and vertical sides
main loop palette triplet rotation, bottom scroller, text
sound path SB probe, DSP reset, DMA channel 1, IRQ refill
exit palette fade down, text/video restore, file close
The direct keyboard-poll exit shape is visible in the main visual loop:
04D1: in al,60h
04D3: mov [02A5h],al
...
051C: in al,60h
051E: cmp al,[02A5h]
0522: je 0513h
The keyboard-port polling above only says that the demo can wait for a keyboard state change at this layer. The capture supplies a practical visual timeline, but it does not turn those waits into cycle-exact timing data.
MZ Layout And Unpacking
The distributed executable is an MZ file whose header-reported size is much smaller than the physical file. That is important: the bytes after the header-reported image are not random junk, they are the appended packed/resource area that the restored program later opens through DOS file I/O.
Packed executable:
file size 119633 bytes
MZ header 32 bytes
MZ reported size 10609 bytes
load image 119601 bytes
relocations 0
min alloc 268Ah paragraphs
max alloc 268Bh paragraphs
entry 027E:000E
entry raw 280Eh
stack 046C:0080
relocation table 007Ch
UNP restores a conventional MZ body:
file size 126569 bytes
MZ header 96 bytes
MZ reported size 17545 bytes
load image 126473 bytes
relocations 14
min alloc 24DDh paragraphs
max alloc 268Bh paragraphs
entry 0000:0360
entry raw 03C0h
stack 1AD5:E000
relocation table 001Ch
Address convention in this note:
03C0h, 00F0h, 0A93h raw file offsets in the UNP-restored executable
280Eh raw file offset in the original packed executable
026Bh, 0AD5h restored relative segment constants before DOS relocation
The restored code uses relocated segment constants. For example, startup loads
026Bh into DS/ES, but that is not absolute real-mode segment 026Bh; DOS
adds the executable load segment through the MZ relocation table.
Restored Entry
The real entry at raw 03C0h sets the stack, selects the relocated data
segment, opens the executable as a file, decodes a small code/data range, checks
for a 386, and probes VGA:
03C0: mov sp,E000h
03C3: mov ax,026Bh
03C6: mov ds,ax
03C8: mov [0000h],es
03CC: mov es,ax
03CE: call 00F0h ; self-open and appended-data boundary
03D1: call 1042h ; XOR-decode 1562h..17ABh with AAh
03D4: mov word [02A2h],0
03DA: call 0A48h ; CPU probe
03EA: mov ax,1A00h
03ED: int 10h ; VGA display-combination query
If the CPU probe returns at least 0386h, [02A2h] is set. That flag is later
used in two ways:
01E4hrefuses to loadMresources unless the CPU is 386 or better.04D1htries the richer far-call path before falling back to the local keyboard loop.
The startup path then sets mode 13h, loads a graphics/palette block through
the resource loader, copies a full 64 KB screen to A000h, fades the palette up,
loads more data, draws the border reveal, enters the main loop, fades down, and
restores text/video state.
Self-Opening Loader
The loader at 00F0h is the first major difference from Coma Demo. Classic
does not just consume an in-memory stream. It reopens its own executable and
seeks to the data appended after the MZ image.
The key steps:
007Eh recover executable path from PSP/environment into 0008h
00F0h open that path with INT 21h AX=3D00h
0104h seek to file offset 2
0112h read four MZ size bytes into 0004h..0007h
0122h calculate appended-data boundary
013Eh close file at shutdown
0165h seek to current [0006:0004]
017Ah read a 12-byte resource record into 0108h
0191h read/compare a 4-byte block marker
01BDh read CX bytes into caller-specified DS:DX
01E4h high-level resource dispatch
The appended-data boundary calculation is the normal MZ page formula:
offset = (pages - 1) * 512 + last_page_bytes
[0006:0004] = high_word:low_word(offset)
That explains the otherwise suspicious MZ-reported size mismatch. The loader uses the header-reported end of image as the beginning of the demo's private payload.
Resource Records
01E4h consumes a five-byte descriptor from the caller:
word 0 requested low word / id
word 1 requested high word / size selector
byte 4 requested type, commonly 'G', 'A', or 'M'
It then seeks to the current appended-data position and scans 12-byte records. The matching logic compares:
record[4] requested type byte
record[0..3] requested word pair
record[6..9] file offset of next candidate or payload
Non-matching records are skipped by a DOS AH=42h seek using fields from the
record. Matching records dispatch by type:
'M' memory/music-ish path; skipped if not on 386+
'A' allocation/table path
'G' graphics/data path; decompresses, copies metadata, copies screen-sized data
The practical point is that the executable is a container. The visible part is not reached by a single unpacker; startup needs the self-file directory, then the secondary block inflater.
File-Backed Block Inflater
The block decoder starts at 0A93h. It is the same family as the Coma Demo
decoder, but it reads from DOS file handle [0002h] instead of from a simple
memory stream.
Setup:
0A93: push ds
0A94: push es
0A96: push ss
0A97: pop es
0A99: mov di,0014h
0A9C: mov cx,2000h
0A9F: xor ax,ax
0AA1: rep stosw ; clear 4000h bytes of work state
0AA4: mov ax,[0002h]
0AA7: mov ss:[051Eh],ax ; file handle
0AAB: mov ax,[02B4h]
0AAE: mov bx,[02B6h]
0AB2: mov ss:[0526h],bx ; output segment
0AB7: mov ss:[0528h],ax ; output offset
0ABF: call 0ACBh ; read block
0AC2: call 0B6Bh ; build CRC table
0AC5: call 0B96h ; expand payload
0ACBh reads a two-byte length into 041Eh, subtracts two, then reads the
remaining block bytes into 0420h.... That makes each compressed member a
length-prefixed chunk inside the appended file stream.
The expansion pipeline is:
0B30h update CRC over output bytes
0B6Bh build a 256-entry CRC table using polynomial words 8320h/EDB8h
0B96h validate block header and select stored/compressed mode
0C08h compressed-block setup
0CE9h nibble RLE for code-length tables
0D1Eh canonical decode-table construction
0DA4h optional secondary table construction
0DF6h prefix histogram/order build
0E9Dh main payload expansion
0F7Ah bit reader
100Bh CRC update plus copy to final output
1016h final output copy to [SS:0526]:[SS:0528]+[0520h]
The literal/copy decision in the main loop is centered at 0F0Eh:
0F0E: mov cl,01h
0F10: call 0F7Ah ; read one control bit
0F13: jb 0EEFh ; literal path
...
0F31: mov [5742h],bx ; copy distance-ish value
...
0F5D: push si
0F5E: mov si,di
0F60: sub si,[5742h]
0F64: dec si
0F65: rep movsb ; LZ-style copy-back
The copy-back is the classic sliding-window shape: source is the current output
position minus a decoded distance, minus one. Because rep movsb is allowed to
copy from already-emitted output, short repeated patterns expand naturally.
Output is staged before being flushed. When the local window reaches its
threshold, 0F9Ah copies a span into the final destination and preserves the
tail needed for later back-references:
100Bh calls 0B30h to include the span in the CRC
1016h copies CX bytes from DS:DX to output segment SS:[0526h]
103Dh advances total output count at 0520h
0F9Ah moves the remaining window bytes back to 0C62h
The block ends with a CRC check at 0BBBh..0BD0h; mismatch triggers int3.
That is a useful static marker because it proves the table/stream logic is not
only a picture depacker. The code tracks integrity as it expands.
VGA Setup And DAC Helpers
The VGA probe is BIOS-level, but the visible work is direct mode 13h and DAC
I/O:
03EAh INT 10h AX=1A00h display-combination query
042Bh mode 13h request
084Fh copy CX palette entries, 3 bytes each, into 02BCh
0916h upload [02BCh] to ports 03C8h/03C9h
006Ch wait for vertical-retrace bit set
0075h wait for vertical-retrace bit clear
0060h wait CX retrace intervals
The palette upload loop is deliberately simple:
0918: mov cx,[029Eh] ; number of DAC entries
091C: lea si,[02BCh]
0923: mov dx,03C8h
0926: out dx,al ; start index 0
0927: inc dx ; 03C9h
0928: lodsb
0929: out dx,al ; red
092A: lodsb
092B: out dx,al ; green
092C: lodsb
092D: out dx,al ; blue
092E: loop 0928h
08A0h is the fade-up routine. It first copies the target palette from 02BCh
to 05BCh and zeros 02BCh. Then it runs a coarse 63-step upward ramp by
incrementing every palette byte. After that, it repeatedly uploads the current
DAC table, waits two retraces, and calls 0901h, which decrements entries
until each one matches the saved target byte.
That is why the code looks backwards on first read:
copy target to 05BCh
zero active palette at 02BCh
increment active bytes 63 times
then decrement active bytes toward target
It is a quick way to produce a bright flash/fade-in without a per-entry multiply or interpolation table.
085Fh is the fade-down routine. It repeatedly uploads the palette, waits two
retraces, and calls 088Ch, which decrements nonzero DAC bytes until all 768
component bytes are zero.
Full-Screen Copy
0933h copies a complete mode 13h frame from the loaded graphics segment to
A000h:
0936: mov ax,[02B6h]
0939: mov es,ax
093B: mov di,[02B4h]
093F: mov si,[02B0h]
0943: mov ax,[02B2h]
0946: mov ds,ax
0949: mov cx,7D00h
094C: rep movsw
7D00h words is 64000 bytes. Unlike the Coma Demo first copy, which uses a
cropped 320x180-ish byte count, this path copies a full 320x200 page.
The 00:03.000 title picture in the contact sheet is the first stable landing
point for this copy; 00:02.000 is still inside the loader and block inflate
path.
Shrinking Border Reveal
The border/window reveal is at 0952h and 0997h. The rectangle state is:
AX = left x
BX = top y
CX = right x
DX = bottom y
0952h starts with left=0, top=0, right=320, bottom=199. For each
outer step it:
draw current rectangle edges
push current rectangle
draw five inset rectangles, each inset by 16 pixels
wait for retrace
restore current rectangle
left++, top++, right--, bottom--
stop when bottom reaches 00B3h
The edge drawer at 0997h does four passes:
top span copy right-left bytes from source to A000
right side copy one byte per row, stepping by 013Fh after each byte
bottom span copy right-left bytes at the lower y
left side copy one byte per row, stepping by 013Fh after each byte
The 013Fh side-step is correct because one pixel has already been copied on
the row:
1 copied byte + 013Fh step = 0140h bytes = 320-byte mode 13h pitch
That is the inner reason the reveal holds together: the spans use rep movsb,
while the vertical sides use a one-byte copy plus a pitch-minus-one increment.
The contact sheet makes the reveal easier to see at a glance: the title picture lands between the loader card and the warmer/red/blue palette states without introducing a second scene.
Main Visual/Text Loop
The old helper list hid the most important hand-off. Addresses in this section
are raw offsets in the restored file; its 60h-byte MZ header means raw
0525h is runtime offset 04C5h. The sound/DMA wait at raw 169Fh calls raw
10C9h, which saves the player registers, selects relocated data segment
026Bh, and far-calls 0000:04C5h. The no-sound fallback in the foreground
loop uses the same far target. One complete visual service pass is therefore:
raw 0525h service palette control block 01F0h
raw 052Ch service palette control block 01F9h
raw 0533h shift the A000h bottom band, parse text, inject one column
raw 0536h rewrite the animated gradient in the RAM palette table
raw 0539h wait until VGA status bit 3 says retrace is high
raw 053Ch upload all 256 RGB entries from 02BCh to 03C8h/03C9h
That order matters. Raw 058Eh is not a text or sprite updater: it only writes
the RAM palette. The only per-pass VGA pixel writes are in raw 065Dh..0784h;
the title and panels above the lower strip remain pixels from the earlier
64000-byte full-screen copy. Their apparent motion in the runtime clip is
palette motion, not replacement geometry.
Two palette-ring controls
The nine-byte control records are fully recoverable:
| Address | live count/reset | service count/reset | palette byte range | RGB entries |
|---|---|---|---|---|
01F0h |
3 / 3 |
2 / 2 |
02BCh+01B0h .. +01FDh |
26 |
01F9h |
3 / 3 |
2 / 2 |
02BCh+0006h .. +002Fh |
14 |
Raw 0540h decrements the service count until it reaches zero. With the stored
value 2, that invokes raw 0551h exactly once per visual pass and then
reloads 2; it is an intra-call count, not a two-frame delay. Raw 0551h
decrements the live count and performs the rotation when that count reaches
zero. Both records start in phase, so both ranges rotate once every third
service pass:
3 bytes first RGB triplet -> scratch 0202h
range-3 rep movsb shifts the remaining triplets left
3 bytes scratch -> final RGB slot
The two triggered rotations write 78 + 42 = 120 bytes of the active palette
and six scratch bytes. The 00:08.000, 00:14.000, and 00:29.000 images are
the same copied picture under three states of these rings and the gradient
editor below, not three scenes.
Gradient-table writer at raw 058Eh
The second palette effect has state at 0208h..0210h: reset/count words,
direction bit 020Ch, current 17-byte record pointer 020Eh, and source
triplet pointer 0210h. The record table occupies 0212h..0299h, eight
records of one destination-byte displacement followed by 16 run lengths. On
each service pass the count of 1 expires, the record pointer advances by
11h, and raw 0608h consumes the run lengths until its global group count
reaches 3Eh (62).
Every record's run-length sum is larger than 62 (91, 93, 96, 100, 104, 108, 112, 116), so the cap is reached on every update. One group copies two RGB
triplets:
source table 08BCh + s -> active palette 02ECh + record[0] + d
source table 08BCh + s + 30h -> the corresponding destination + C0h
The direction bit swaps which source triplet feeds which destination. Each
group advances source and destination by three bytes; each of the 16 outer
runs advances the starting source by another triplet. The steady update is
therefore exactly 62 groups, 124 triplet reads, and 62 * 6 = 372 active
palette byte writes per visual service pass.
When the record pointer wraps at 029Ah, raw 05BBh..05DFh also rotates the
08BCh..0BB8h source table right by one RGB triplet. The backwards copy writes
765 source-table bytes plus three scratch bytes. This happens after the first
six updates from the stored 0234h starting pointer and every eight updates
thereafter. The active 768-byte table at 02BCh is finally streamed in full:
one start-index write to 03C8h, then 768 component writes to 03C9h.
Bottom-band shift, glyph state, and injection
The bottom-band scroller at 065Dh uses A000h as both source and destination:
0666: mov si,E780h
0669: mov di,si
066B: dec di ; destination one byte left
066D: mov cx,0010h ; 16 rows
...
0678: mov cx,0060h
067B: add cx,ax ; row grows from 96 words upward
067D: rep movsw ; shift row data left
0682: add si,013Fh
0686: add di,013Fh
For outer row i = 0..15, the source starts at logical (x=64-i, y=185+i), the destination is one byte left, and the inner count is 60h+i
words. It consequently performs 192+2i overlapping left-shift writes on that
row. The exact total is 3312 VGA-byte reads and 3312 VGA-byte writes. Rows
0..14 account for 3,090 visible writes at display y 185..199; row 15 is 222
writes at logical y 200, in mode-13h memory but below the displayed
320x200 page. The overwritten destination is the erase/background-repair
policy: there is no separate clear pass.
The control parser begins at 06C7h. Bytes 00h..05h are not printable; they
toggle state and immediately re-enter the phase-advance path until a printable
byte is reached:
00/01 disable/enable one animation gate at 155Ch
02/03 select font/rendering mode at 1560h
04/05 select narrow/tall duplication at 155Eh
Printable bytes subtract 20h and use one of two glyph renderers:
0785h 16-row renderer from table 0BBAh
07BDh 8-row/narrow renderer from table 133Bh, with optional row duplication
The phase byte 1556h runs from 7 down to 0. In 16-row mode, each glyph is a
16x16 two-byte-per-row record: 1558h selects even or odd bytes and the script
pointer advances only after both eight-column halves. In the 8-row mode, the
pointer advances after eight columns. Gate 155Ch makes the phase hold on
alternate service passes. The narrow renderer either shifts four blank rows
above and below its eight glyph rows or duplicates each glyph row, according
to 155Eh. Both paths still perform exactly 16 accumulator word updates; the
wide path reads 16 glyph bytes and the narrow path reads eight.
Both renderers shift the selected bit into 16 row accumulators at 1513h.
The following 16 words at 1533h are one-hot masks from 8000h down to
0001h. Raw 072Eh tests accumulator row r against mask r, then paints
one vertical slice into A000h:
072E: mov di,E83Fh
0731: lea si,[1513h]
0735: mov cx,0010h
0738: mov ax,[si+20h]
073B: test [si],ax
073D: jne 0743h
073F: xor ax,ax
0743: mov al,[1557h]
0746: stosb
0747: add di,0140h
074B: add si,2
074E: loop 0738h
This loop always reads 16 accumulator words and 16 mask words and always writes
16 VGA bytes, choosing zero or color 1557h; the new column is opaque, not a
transparent plot. The addresses are logical x 255, y 185..200, so 15
writes are visible and the last is offscreen. Color 1557h then oscillates
between 02h and 0Fh by one per service pass. Including the shift, each pass
does 3,328 VGA-byte writes, of which 3,105 land in visible rows. Raw 0539h
then waits only for retrace-high--it does not first wait for retrace-low--and
the complete DAC upload presents the new palette state.
Sound Blaster Path
The sound path is almost a second subsystem. It probes common Sound Blaster bases, resets the DSP, installs an IRQ vector, prepares DMA channel 1, and keeps refilling sample buffers.
Important offsets:
16D5h try base 220h, 230h, 240h, 250h, 260h, 210h
1304h DSP reset and wait for AAh
1246h select DMA buffers and set channel 1 mode
12B2h send DSP speaker/time-constant setup commands
13E5h IRQ refill-shaped routine
146Ah install IRQ vector with DOS AH=35h/AH=25h
14A4h restore IRQ vector
14BBh restore low interrupt vectors
17DDh temporary IRQ-detection wrapper
188Ch sound-card probe plus IRQ detection wrapper
1893h main sound/demo entry
The base probe is linear and old-school:
CS:[0013h] = 0220h; call 1304h; if OK stop
CS:[0013h] = 0230h; call 1304h; if OK stop
CS:[0013h] = 0240h; call 1304h; if OK stop
CS:[0013h] = 0250h; call 1304h; if OK stop
CS:[0013h] = 0260h; call 1304h; if OK stop
CS:[0013h] = 0210h; call 1304h
1304h performs the standard DSP reset handshake:
write 1 to base+6
burn a few reads
write 0 to base+6
poll read-status at base+0Eh
read data at base+0Ah
expect AAh
1246h prepares DMA channel 1. It chooses safe buffer offsets relative to the
current DS physical address, initializes the current buffer state, masks DMA
channel 1 with port 0Ah, clears the flip-flop at 0Ch, and writes mode
49h to port 0Bh.
The IRQ refill routine at 13E5h acknowledges the PIC and DSP, then programs
DMA and tells the DSP to play another block:
out 20h,20h PIC EOI
in base+0Eh DSP interrupt acknowledge/status
out 0Ah,05h mask DMA channel 1
out 83h,page DMA page
out 02h,low DMA address low/high
out 03h,count DMA count low/high
out 0Ah,01h unmask DMA channel 1
out base+0Ch,14h DSP 8-bit DMA output command
out base+0Ch,CL block length low
out base+0Ch,CH block length high
iret
The IRQ path is only the final consumer. The player at raw 1893h first turns
tracker rows into four independently resampled planar banks, then raw 14F2h
averages those banks into a 512-byte mono DMA block. Player state addresses
below are DS: offsets with player DS=0443h; they are not raw file offsets.
Tracker row and five-tick state
DS:645Ch is the order position and DS:645Eh is the 0..63 row. Raw
190Eh maps the order through 634Ah, selects a pattern segment through
64ADh, and multiplies the row by 16. Four event decoders begin at raw
190Eh, 1AB0h, 1C3Bh, and 1DC6h. Each consumes four bytes:
period = first_word & 0FFFh
instrument = (event[1] & F0h) | (event[2] >> 4)
effect = event[2] & 0Fh
parameter = event[3]
One row therefore reads exactly 16 pattern bytes. The repeated channel state is regular enough to expose the layout rather than merely naming four event helpers:
| State | channel 1 | channel 2 | channel 3 | channel 4 |
|---|---|---|---|---|
| instrument | 640Ah |
640Bh |
640Ch |
640Dh |
| volume | 6464h |
6465h |
6466h |
6467h |
| period/index | 5764h |
5766h |
5768h |
576Ah |
| base period delta | 5724h |
5726h |
5728h |
572Ah |
| five tick deltas | 63D0h..D8h |
63DAh..E2h |
63E4h..ECh |
63EEh..F6h |
| volume delta | 656Dh |
656Eh |
656Fh |
6570h |
A new note clears its phase and derives the playback bounds from its descriptor:
end = descriptor[5F9Ah]
start = descriptor[5F9Ah] - descriptor[5FA0h] + 2
mode = 0001h if start == end, otherwise 0201h
0001h advances and then holds; 0201h byte-swaps between forward and reverse
at the two bounds. Raw 1F51h completes effect decoding. Raw 201Fh then sets
the tick counter to five, and raw 2025h applies, for tick i=0..4, the base
period delta plus tick_delta[channel][i]. Raw 25F5h..2689h removes that
temporary tick delta, applies each volume delta, clamps volume into 0..40h,
and loops until all five ticks have emitted their requested sample spans.
Four 16.8 fixed-point sample lanes
Raw 207Bh chooses one chunk length:
C = min(tick_remaining, 0200h - filled)
Every lane writes exactly C bytes into one planar staging bank:
| lane | setup | forward | reverse | hold/fill | bank |
|---|---|---|---|---|---|
| 1 | 208Eh |
20BBh |
2141h |
21C2h |
+000h |
| 2 | 21DCh |
220Ah |
228Fh |
2310h |
+200h |
| 3 | 232Eh |
2358h |
23DDh |
245Eh |
+400h |
| 4 | 247Ch |
24A6h |
252Bh |
25ACh |
+600h |
The phase records split their fraction and integer fields across adjacent bytes/words:
lane 1 fraction 5F6Ch, integer 5F6Dh, sample segment 5F7Ch
lane 2 fraction 5F70h, integer 5F71h, sample segment 5F7Eh
lane 3 fraction 5F74h, integer 5F75h, sample segment 5F80h
lane 4 fraction 5F78h, integer 5F79h, sample segment 5F82h
The 16.8 step comes from the 1,024-word table at 576Ch + 2*period, built by
raw 13A3h..13D8h. Before entering an active span, each lane bounds its inner
count:
forward q = min(C, floor(((end << 8) - phase) / step))
reverse q = min(C, floor((phase - (start << 8)) / step))
One active output byte performs one sample read, one XLAT volume-table read,
one lane-bank write, and one fixed-point add or subtract. The volume lookup
base is 1604h + volume*256. LODSB is immediately followed by DEC SI, so
the load itself does not move the integer position; only ADD DL,DH plus
ADC SI,BP, or the corresponding subtraction, advances phase. The optimized
kernel handles an odd byte and then emits floor(q/2) word pairs. At a sample
boundary it saves the last quantized byte, swaps the mode bytes, and resumes
with the remaining count. Hold mode repeats that saved byte for C writes and
performs no sample or volume-table reads.
Raw 25C6h..25D5h adds C to the filled count and lane destination. Thus one
chunk always makes 4*C staging-bank writes; active samples add the same number
of source reads and volume-table reads, while held channels do not.
Four-bank mono mixer
When the filled count reaches 0200h, raw 25DDh calls raw 14F2h. The four
banks are planar, not interleaved. One iteration reads one word--two consecutive
time samples--from each bank. The low bytes are summed into DX, the high
bytes into BX, and the resulting two mono samples are written as one word:
1522: mov ax,[si+0200h] ; lane 2, two times
1528: add dx,cx
152C: add bx,cx
152E: mov ax,[si+0400h] ; lane 3
1534: add dx,cx
1538: add bx,cx
153A: mov ax,[si+0600h] ; lane 4
1540: add dx,cx
1544: add bx,cx
1546: lodsw ; lane 1 and advance SI by two
1549: add dx,cx
154D: add bx,cx
154F: shr dx,2
1552: shr bx,2
1555: mov al,dl
1557: mov ah,bl
1559: stosw
For a full block, BP=(0200h/2)=256: the loop reads four words, or eight lane
bytes, and writes one word per iteration. Totals are 2,048 lane-byte reads and
512 DMA-buffer byte writes.
The branch naming in the earlier analysis was backwards. Initialization at raw
11F4h stores FFh at 6400h, so raw 1563h is the default. It clamps each
sum into 0..03FCh, rounds the divide by four through rotate/carry, emits the
byte, then retains sum - 4*output in the accumulator as error feedback. The
raw 1522h branch used when 6400h != FFh simply shifts right by two and
clears both accumulators every iteration; it discards the low bits.
After mixing, 15E0h..1612h converts the selected DMA buffer offset into a
physical DMA address:
physical = DS * 16 + buffer_offset
CS:[0000h] = DMA page/address high piece
CS:[0002h] = DMA address low word
CS:[0004h] = byte count
Then the IRQ/DMA path uses those scratch values. The first block is a bootstrap:
raw 1620h programs DMA/DSP directly and pre-sets CS:0007h=FFh, but control
still enters raw 169Fh, so it performs one visual service call. Later blocks
remain in that wait until raw 1462h in the Sound Blaster ISR sets the flag;
each wait iteration calls raw 10C9h and therefore the complete raw 0525h
visual pass.
For logical block length B, the DMA count ports receive B, while DSP command
14h receives B-1. After the flag is observed, raw 16B0h..16CEh clears it,
toggles the two-buffer selector, switches the planar staging base between
0000h and 0800h, and resets the filled count. This closes the end-to-end
loop: tracker row -> five ticks -> bounded fixed-point lanes -> four-bank mono
average -> DMA buffer -> IRQ-gated wait that services the live VGA work.
Relationship To Coma Demo
Classic and Coma Demo clearly share code families:
VGA detection and mode 13h setup
DAC upload helpers
palette fades
rectangle reveal logic
custom compressed block decoder
Sound Blaster base probe
DMA channel 1 playback/refill
keyboard-port exit waits
The important difference is structure. Coma Demo is more direct after its
outer unpacker; Classic is a self-contained resource container. The self-open
loader and file-backed inflater make it more like a small demo runtime: the EXE
is both program and asset archive.
Practical Reconstruction Notes
To recreate the current analysis:
1. Unpack classic.zip.
2. Run UNP on CLASSIC.EXE under DOS/DOSBox.
3. Treat raw 03C0h as the restored entry.
4. Use MZ relocation-aware thinking for segment constants such as 026Bh.
5. Follow 00F0h before trying to interpret appended payload bytes.
6. Follow 01E4h descriptors to understand which resource path is active.
7. Use 0A93h as the secondary decompression root, not the original EXE entry.
The runtime timestamps above provide visual concordance, while the exact counts in the visual and player sections come from the restored instructions. They are kept separate deliberately: capture-stream seconds show when a state was observed, but do not turn the DOSBox recording into a cycle-exact profiler.




