Analysis model: gpt-5.5 xhigh

Mantaray by CSG Productions - Technical Dissection

Mantaray is a 1992 MS-DOS demo by CSG Productions. Demozoo lists it as a 1992 MS-DOS demo by CSG Productions, and Pouet lists it as a December 1992 MS-DOS demo. The Hornet mirror carries the file as mantaray.zip, Mantaray by CSG.

Release year: 1992

This is a compact CSG production in the same packed-MZ family as Falling, Evil, and Funny, but it has a cleaner recovered image than some of the others. UNP expands the original 190 KB carrier into a complete 506 KB MZ runtime. The visible demo is built around one central precomputed mantaray object, a page-bank animation table, full-DAC fades, an optional STMIK 0.2 Sound Blaster path, a music-driven bar overlay, a bottom-strip copy path for faster machines, and a keyboard filter that only leaves Escape as a normal BIOS key.

The ZIP also contains demosite.com, a period distribution sidecar with FTP and old contact text. This writeup deliberately omits that sidecar's contact details. The public visual reference below is copied from Pouet, and the technical reconstruction is derived from the recovered executable image.

Sources

Visual Reference

Mantaray public Pouet screenshot

Mantaray recovered carrier and runtime pipeline map

The next image is not a runtime screenshot. It is a contrast-expanded reconstruction of the exact 111x85 window that the recovered runtime copies from selected page banks into VGA memory. The source palette indices are low, so the image multiplies byte values for readability while preserving the geometry and per-bank ordering.

Mantaray contrast-expanded reconstruction of selected 111x85 window banks

The local DOSBox-X 2026.01.02 run now reaches the Sound Blaster detection path and pauses at the IRQ selection prompt before the demo starts:

Mantaray DOSBox-X IRQ prompt during Sound Blaster setup

That is still a useful runtime state. It confirms that the executable probes SB support before entering the visible scene, and it shows the exact gate that needs to be answered before the mantaray animation begins. The current harness still needs better key injection to advance past this prompt, so the article uses the public Pouet frame, the recovered page-bank reconstruction, and this setup-stage screenshot together.

Visual/Runtime-To-Code Concordance

This page already has recovered runtime addresses, so this concordance is a map from the existing images to those specific code paths rather than a new effect guess.

The DOSBox-X IRQ prompt is the verified local runtime gate:

visible image:      mantaray-runtime-irq-prompt.png
code path:          EE39h Sound Blaster base-port probe,
                    EB3Ch..EB5Ah IRQ parser,
                    EB64h STMIK setup call
proved behavior:    the executable reaches the SB setup path before mode 13h
not yet captured:   post-prompt visible mantaray animation from local DOSBox-X

That prompt is why the current local runtime evidence stops before the main scene. It is not a rendering failure: the demo is waiting for IRQ input after the DSP probe and before the VGA animation loop.

The public Pouet screenshot corresponds to the main mode-13h loop after setup:

visible image:      mantaray-csg-pouet.jpg
code path:          EBA9h mode 13h setup,
                    selector table at 5D860h / 7B810h,
                    EE76h central window copy,
                    F417h/F5BCh DAC ramp helpers
proved behavior:    small centered mantaray/object on black VGA page

The central object is not drawn by a general polygon routine. The recovered copy loop at EE76h writes a fixed 111x85 window to A000:2C28h, which is screen position (104,35). The selector tables change DS to one of 26 precomputed banks, and the loop advances that bank only every fifth retrace.

The contrast-expanded reconstruction is the code proof for that mechanism:

visible image:      mantaray-csg-window-recon-bright.png
data source:        recovered 26 object-window banks
code path:          EE76h shifted row copy
geometry:           width 111, height 85, destination x=104, y=35
proved behavior:    banked precomputed object states, not full-screen pages

The reconstruction looks like a long strip because it deliberately exposes the selected banks and their low palette indices for inspection. On screen, EE76h uses only the current bank and copies it into the small central VGA window.

The pipeline map connects the surrounding control flow:

visible image:      mantaray-csg-pipeline-map.png
loader path:        late-entry MZ carrier -> LZ restore -> relocation repair
setup path:         VGA gate -> SB/STMIK probe -> speed prompt
frame path:         retrace wait -> optional bottom strips -> object bank copy
                    -> optional sound bars -> keyboard filter

The important evidence boundary is that the central object animation is well explained by recovered code and recovered data banks, while the local DOSBox-X capture still needs input automation to show the post-prompt loop directly. Until that capture is improved, the public Pouet frame and the reconstructed bank sheet are the visual references for the main scene.

Archive Shape

The Hornet ZIP used here:

mantaray.zip
size       182,023 bytes
sha256     bc98ae462ef898db3414d90de9ace9797f81abc5eebfbcb022cabd2fababdada

The ZIP contains:

demosite.com     1,104 bytes  DOS COM sidecar / TheDraw screen saver
mantaray.exe   190,276 bytes  packed MZ demo

Hashes of the extracted files:

ae4377ea5ad7ace3149992f111f8384a81a71b1d658cd2fe453291ab14b26d6f  demosite.com
34845c63ebc447199ed9f0811f553ea99c76aeaf5510af2d626907ece09e82b0  mantaray.exe

mantaray.exe exposes enough strings even while packed to identify the runtime family:

Sound Blaster
IRQ setting (2,3,5,7) [7]
faster than 16Mhz (y/n) [y]
G Productions, Australia, 1992
<STMIK020>
Scream Tracker Music Interface Kit V0.2
SCRM

The exact CSG Productions text is split by non-text bytes in the recovered image, which is why the raw string search catches the trailing G Productions, Australia, 1992 fragment.

Packed MZ Carrier

The original MZ header:

physical file size       190,276 bytes
MZ header size               160 bytes
load image                190,116 bytes
relocation entries              1
CS:IP at entry          FFF0:0100
SS:SP                   2E75:0200
minalloc                4E74h
maxalloc                FFFFh
relocation table        file offset 0052h
relocation entry        0000:0007

The conventional "entry file offset" calculation gives 0x1000A0, which is obviously beyond a 190 KB file. That is the point of the carrier trick. DOS loads an MZ image at PSP+10h paragraphs. With CS=FFF0h and IP=0100h, the physical address is:

(load_segment + FFF0h) * 16 + 0100h
= load_segment * 16 + 100000h

On a normal real-mode 20-bit address path that wraps back to the beginning of the loaded image. So the real first instruction is at packed load-image offset 0000h, not at 1000A0h.

The first-stage stub begins:

0000: mov ax,7cc0h
0003: mov dx,2e6bh
0006: add ax,0000h
0009: cmp ax,[0002h]
000d: jae not_enough_memory
000f: sub ax,0020h
0012: cli
0013: mov ss,ax
0015: sti
0016: sub ax,0025h
0019: mov es,ax
001b: push ax
001c: mov cx,0122h
001f: xor di,di
0021: push di
0022: mov si,0144h
0025: cld
0026: rep movsw
0028: retf

This first stage is only a mover:

If the memory comparison fails, it prints a DOS $-terminated error at 0132h through INT 21h AH=09h and exits with INT 20h.

LZ-Style Depacker Core

The copied depacker uses BP as a 16-bit bit reservoir and DX/DL as the remaining bit count. Refill is visible everywhere:

ad        ; lodsw
95        ; xchg ax,bp
b2 10     ; dl = 16

The literal path is the shortest case:

00ba: lodsw / refill if needed
00c0: movsb              ; literal byte: DS:SI -> ES:DI
00c1: shr bp,1
00c3: dec dx
00c4: je  refill
00c6: jae literal

When the carry path is taken, the code accumulates selector bits through RCL BX,1, then chooses either a small table-coded match or a longer offset/length case:

00c8: xor cx,cx
00ca: xor bx,bx
00cc: shr bp,1
00d1: rcl bx,1
00d8: rcl bx,1
00da: cmp bl,02h
00dd: jae longer_selector
...
0102: mov bl,cs:[bx+0206h]     ; compact length table
0107: xchg bx,cx               ; CX = length class

The match copy is in-place LZ back-reference from the already-expanded output:

013a: lodsb                    ; low distance byte
013b: mov bl,al
013d: push si
013e: mov si,di
0140: sub si,bx                ; source = output - distance
0142: cli
0143: rep movsb es:[si],es:[di]
0146: sti
0147: pop si
0148: jmp decode_next

That ES: source override is important: the compressed stream is in DS:SI, but a match copies from the output history window, not the packed stream.

The depacker also has explicit segment-normalization escapes. A decoded FEh or FFh enters the far-pointer adjustment path:

01bb: push ax
01bc: lea bx,[di-2000h]
01c0: and di,000fh
01c3: add di,2000h
01c7: mov cl,04h
01c9: shr bx,cl
01cb: mov ax,es
01cd: add ax,bx
01cf: mov es,ax       ; roll output segment forward

01d1: mov ax,ds
01d3: mov bx,si
01d5: and si,000fh
01d8: shr bx,cl
01da: add ax,bx
01dc: mov ds,ax       ; roll input segment forward
01de: pop ax
01df: cmp al,0ffh
01e1: je  relocation_phase

FEh normalizes pointers and continues. FFh ends byte expansion and enters relocation repair.

Relocation Repair And Transfer

After the FFh escape, the depacker patches segment words in the restored MZ image:

020c: pop bx
020d: mov bp,bx
020f: add bx,0010h          ; image load bias
0212: xor ax,ax
0214: lodsb
0215: xchg ax,cx            ; relocation count for this target segment
0216: jcxz next_segment_or_finish
0218: lodsw
0219: add ax,bx
021b: mov es,ax
021e: lodsw
021f: xchg ax,di
0220: add es:[di],bx        ; patch segment word
0223: loop 021eh

Then it restores the final stack and transfers through the reconstructed entry:

0227: lodsw
0228: add ax,bx
022a: cli
022b: mov ss,ax
022d: lodsw
022e: mov sp,ax
0230: sti
0231: lodsw
0232: add bx,ax
0234: push bx               ; restored CS
0235: lodsw
0236: push ax               ; restored IP
...
retf

So the packed executable is not a normal MZ with DOS doing all relocation. It is a self-relocating MZ-restorer that reconstructs a second, much larger MZ image.

UNP-Restored MZ

UNP under DOSBox-X expands MANTARAY.EXE in place:

restored file size        506,462 bytes
sha256                    bbb5e0aa11823d6e46331148050e6a0195285ba9f181db8ef59a7ad91b965aef
MZ header size                512 bytes
restored load image       505,950 bytes
relocation entries             69
CS:IP at entry          0E64:0000
SS:SP                   0000:0100
entry in load image          E640h

The restored entry is tiny:

e640: push ds
e641: mov  ax,0000h
e644: push ax
e645: mov  ax,cs
e647: mov  ds,ax
e649: mov  ax,0a000h
e64c: mov  es,ax
e64e: jmp  eafa

It sets DS=CS, preloads ES=A000h, and jumps over tables/text to the real startup code.

VGA Gate

The first real runtime check is the VGA display-combination call:

eafa: mov ax,1a00h
eafd: int 10h
eaff: cmp bl,08h
eb02: je  continue
eb04: mov ax,0003h
eb07: int 10h
eb09: mov dx,031ch
eb0c: mov ah,09h
eb0e: int 21h
eb10: retf

The accepted return is BL=08h. If the BIOS does not report that VGA colour display path, the program switches to text mode, prints the not-VGA message, and returns out.

Sound Blaster Probe And IRQ Prompt

The Sound Blaster DSP probe starts at EE39h. It scans base ports 210h..260h in 10h steps:

ee39: mov bx,0210h

probe:
ee3e: mov dx,bx
ee40: add dx,0006h
ee43: out dx,al          ; DSP reset high, AL=01h
ee44: call wait_retrace
ee47: xor al,al
ee49: out dx,al          ; DSP reset low
ee4a: call wait_retrace
ee4d: mov dx,bx
ee4f: add dx,000ah
ee52: in  al,dx
ee53: cmp al,0aah
ee55: je  found
ee57: add bx,0010h
ee5a: cmp bx,0270h
ee5e: jl  probe
ee60: mov bx,0000h       ; no sound
ee63: ret

This is a rough but recognizable DSP-reset probe. It writes 1 then 0 to base+6, waits around vertical retrace rather than a calibrated DSP delay, then expects AAh from base+0Ah.

If no base responds, CS:0015 is zero and the sound path is skipped. If a base is found, the program prints the detected message and asks:

Whats your IRQ setting (2,3,5,7) [7] ?

The parser is direct ASCII comparisons:

eb3c: cmp al,'2'   -> cs:03b8 = 02h
eb46: cmp al,'3'   -> cs:03b8 = 03h
eb50: cmp al,'5'   -> cs:03b8 = 05h
eb5a: cmp al,'7'   -> cs:03b8 = 07h

Then it calls the STMIK dispatcher through the segment at 0F72h:

eb64: mov ax,0000h
eb67: mov bl,01h
eb69: mov bh,cs:[03b8h]   ; IRQ
eb6e: mov cx,cs:[0015h]   ; detected base
eb73: mov dx,4650h        ; driver/module-side pointer
eb76: lcall 0f72h:000fh

The recovered image contains the STMIK 0.2 signature and credit:

<STMIK020>
Scream Tracker Music Interface Kit V0.2
Copyright (C) 1991 Sami Tammilehto.

The embedded module begins with SCRM around load-image offset 173ECh. Its sample names include short labels such as a_d_bass, a_d_snar, a_bass1, a_fls1, a_fls2, a_thats, a_groovy, a_right, a_ah, a_squeez, and a_iron.

Fast-Machine Switch

After the sound prompt the program asks whether the machine is faster than 16 MHz:

eb82: print prompt
eb89: int 21h AH=01h
eb8d: cmp al,'n'
eb8f: je  slow
eb91: cmp al,'N'
eb93: je  slow
eb95: mov cs:[0414h],00h      ; default/yes
eb9d: mov cs:[0414h],01h      ; no/slow

Later, inside the frame loop, CS:0414 == 0 enables seven additional strip copy helpers at F481h..F58Fh. Answering "no" skips those helpers. In other words, the prompt is not just decorative; it chooses whether to spend time on extra bottom-strip animation work.

Mode 13h And Startup Sequence

The visible setup after the prompts:

eba3: call f6c4h       ; install keyboard filter
eba6: call f626h       ; small DAC fade helper
eba9: mov  ax,0013h
ebac: int  10h         ; 320x200x256
...
ebc4: lcall 5d86h:0000h ; set DS to first object bank
ebc9: call ee76h         ; copy central 111x85 window
ebcc: call f417h         ; DAC ramp/fade

The 5D86h:0000h far call is not an effect routine in the usual sense. It is a six-byte selector stub:

5d860: mov ax,3f90h
5d863: mov ds,ax
5d865: retf

After that, EE76h treats the selected DS as an object-window data bank and copies a shifted block into A000h.

Part Selector Tables

There are two adjacent table regions made of six-byte far-call targets. The first one is called for part indices 0..12; the second for indices 13..25. Each entry does only:

mov ax,segment
mov ds,ax
retf

Decoded early table:

part 00  table 5D860h  DS=3F90h  image offset 3F900h
part 01  table 5D866h  DS=41DEh  image offset 41DE0h
part 02  table 5D86Ch  DS=442Ch  image offset 442C0h
part 03  table 5D872h  DS=467Ah  image offset 467A0h
part 04  table 5D878h  DS=48C8h  image offset 48C80h
part 05  table 5D87Eh  DS=4B16h  image offset 4B160h
part 06  table 5D884h  DS=4D64h  image offset 4D640h
part 07  table 5D88Ah  DS=4FB2h  image offset 4FB20h
part 08  table 5D890h  DS=5200h  image offset 52000h
part 09  table 5D896h  DS=544Eh  image offset 544E0h
part 10  table 5D89Ch  DS=569Ch  image offset 569C0h
part 11  table 5D8A2h  DS=58EAh  image offset 58EA0h
part 12  table 5D8A8h  DS=5B38h  image offset 5B380h

Decoded late table:

part 13  table 7B810h  DS=5D8Bh  image offset 5D8B0h
part 14  table 7B816h  DS=5FD9h  image offset 5FD90h
part 15  table 7B81Ch  DS=6227h  image offset 62270h
part 16  table 7B822h  DS=6475h  image offset 64750h
part 17  table 7B828h  DS=66C3h  image offset 66C30h
part 18  table 7B82Eh  DS=6911h  image offset 69110h
part 19  table 7B834h  DS=6B5Fh  image offset 6B5F0h
part 20  table 7B83Ah  DS=6DADh  image offset 6DAD0h
part 21  table 7B840h  DS=6FFBh  image offset 6FFB0h
part 22  table 7B846h  DS=7249h  image offset 72490h
part 23  table 7B84Ch  DS=7497h  image offset 74970h
part 24  table 7B852h  DS=76E5h  image offset 76E50h
part 25  table 7B858h  DS=7933h  image offset 79330h

The bank spacing is 24E0h bytes. That is much smaller than a full 64,000-byte screen, so this is not page flipping. It is a set of precomputed object-window states.

Main Timing Loop

The main loop begins at EC00h after the one-time setup:

ec00: call f704h             ; mask keyboard IRQ line
ec03: if sound:
          ax = 0004h
          lcall STMIK
ec13: call ee64h             ; wait full retrace edge

ec16: if cs:[0414h] == 0:    ; fast-machine path
          call f481h
          call f4aeh
          call f4dbh
          call f508h
          call f535h
          call f562h
          call f58fh

ec33: if cs:[001a] != 0:
          jump to frame_divider_tail

      dispatch cs:[0019] through the two selector tables
      call ee76h             ; redraw central object window
      inc cs:[0019]

frame_divider_tail:
ede1: inc cs:[001a]
ede6: if cs:[001a] >= 5:
          cs:[001a] = 0

edf4: if sound:
          call f2d0h          ; music/spectrum overlay
edff: call f70bh              ; unmask keyboard IRQ line
ee02: int 16h AH=01h          ; key pending?
ee06: if no key: jump ec00h

CS:001A is a five-frame divider. The selected object bank only advances when the divider wraps, so the large central object is redrawn every fifth retrace. The sound overlay and keyboard polling happen every loop.

Full-Retrace Wait

EE64h waits for a clean vertical-retrace edge:

ee64: push ax
ee65: push dx
ee66: mov dx,03dah
ee69: in  al,dx
ee6a: test al,08h
ee6c: jne ee69h        ; wait until not in retrace
ee6e: in  al,dx
ee6f: test al,08h
ee71: je  ee6eh        ; wait until retrace starts
ee73: pop dx
ee74: pop ax
ee75: ret

This is the standard two-phase retrace synchronizer. It avoids catching the middle of an already-active retrace and then waits for the next rising edge.

Central 111x85 Object Window

EE76h is the core visible copy loop:

ee76: xor bx,bx
ee78: mov si,bx
ee7a: mov ax,2c28h
ee7d: mov di,ax
ee7f: mov cx,006fh
ee82: rep movsb        ; DS:SI -> A000:DI, 111 bytes
ee84: inc bx
ee85: add ax,0140h     ; next VGA scanline
ee88: cmp bx,0055h
ee8b: jne ee7dh
ee8d: ret

Concrete geometry:

destination start     A000:2C28h
screen x              2C28h mod 320 = 104
screen y              2C28h / 320   = 35
width                 006Fh = 111 pixels
height                0055h = 85 scanlines
pitch                 0140h = 320 bytes

The source is unusual:

row 0 reads DS:0000..006E
row 1 reads DS:0001..006F
row 2 reads DS:0002..0070
...
row 84 reads DS:0054..00C2

So each row is shifted by one byte through the selected bank. The selected window banks are not 111x85 linear bitmaps. They are diagonal/overlapped source strips designed for exactly this shifted copy. That explains why the reconstructed contact sheet shows the mantaray form sliding through a narrow slanted band when the source bytes are expanded for visibility.

The public Pouet screenshot shows the same broad idea: the mantaray object is small, centered near the upper half, and rendered as a warm low-index shaded shape rather than as a full-screen bitmap.

Fast-Machine Bottom Strip Helpers

When CS:0414 == 0, the loop runs seven helpers:

F481h  DS=0010h  source = DS:[0002 + phase]  -> A000:EEC0h
F4AEh  DS=021Ch  source = DS:[0002 + phase]  -> A000:F000h
F4DBh  DS=0428h  source = DS:[0002 + phase]  -> A000:F140h
F508h  DS=0634h  source = DS:[0002 + phase]  -> A000:F280h
F535h  DS=0840h  source = DS:[0002 + phase]  -> A000:F3C0h
F562h  DS=0A4Ch  source = DS:[0002 + phase]  -> A000:F500h
F58Fh  DS=0C58h  source = DS:[0002 + phase]  -> A000:F640h

The routines are nearly identical. One representative:

f4ae: mov ax,021ch
f4b1: mov ds,ax
f4b3: mov si,0002h
f4b6: mov ax,si
f4b8: add ax,[0000h]       ; circular phase
f4bc: mov si,ax
f4be: mov ax,0f000h
f4c1: mov di,ax
f4c3: mov cx,0140h
f4c6: rep movsb            ; one full 320-byte strip
f4c8: inc word [0000h]
f4cc: cmp word [0000h],1f7fh
f4d2: jne done
f4d4: mov word [0000h],0000h
f4da: ret

Each helper copies one 320-byte scanline from a circular buffer into a low VGA line around y=190..197. The phase word wraps at 1F7Fh, so the source is a sliding strip, not a static row. The seven helpers together form a small bottom animation band. The 16 MHz prompt gates these copies because they are extra per-frame memory bandwidth.

Sound-Driven Bar Overlay

F2D0h is the most interesting non-background inner loop. It consumes a stream pointer returned by the sound path and turns recent bytes into vertical bars.

First it decays a 60-byte input slice and stores it into a ring:

f2d0: mov es,cs:[0017h]
f2d5: mov si,cs:[0011h]
f2da: mov ds,cs:[0013h]
f2df: mov cx,003ch
f2e2: mov bx,cs:[084eh]

copy_decay:
f2e7: mov al,[si]
f2e9: mov cs:[bx+0850h],al   ; current/raw sample byte
f2ee: sub al,02h
f2f0: jae no_underflow
f2f2: xor al,al
f2f4: mov [si],al            ; decay original byte by 2, clamp at 0
f2f6: inc bx
f2f7: inc si
f2f8: loop copy_decay

f2fa: add bx,0004h
f2fd: and bx,03ffh
f301: mov cs:[084eh],bx

Then it renders 40 bars:

f306: mov cx,0028h       ; 40 columns
f309: mov di,0e13ch
f30c: mov si,bx
f30e: add si,0014h
f311: mov bp,0014h

The per-column kernel at F314h compares the new height with the previous height:

f317: xor bh,bh
f319: mov bh,cs:[bp+0c50h]   ; previous height
f31e: mov bl,cs:[si+0850h]   ; current height
f323: cmp bl,00h
f326: jne active
f328: cmp bh,00h
f32b: jne active
f32d: jmp next_column

active:
f330: mov cs:[bp+0c50h],bl   ; remember current height
f335: mov cl,02h
f337: shr bl,cl              ; byte -> bar height / 4
f339: shr bh,cl

The draw loop writes a six-pixel-wide vertical bar in three stacked colors:

f341: mov al,20h
f343: mov es:[di+0],al
f346: mov es:[di+1],al
...
f356: mov es:[di+5],al
f35a: inc al
f35c: mov es:[di+0140h],al
...
f375: mov es:[di+0145h],al
f37a: inc al
f37c: mov es:[di+0280h],al
...
f395: mov es:[di+0285h],al
f39a: sub di,03c0h          ; move three scanlines upward
f39e: inc al
f3a0: loop draw_more_height

After drawing the new height, it clears any leftover old height:

f3a2: mov cl,bh
f3a4: sub cl,bl
f3a6: jb  next_column
f3a8: je  next_column
f3aa: mov al,00h

clear_tail:
f3ac: mov es:[di+0],al
...
f3fa: mov es:[di+0285h],al
f3ff: sub di,03c0h
f403: loop clear_tail

Then it advances to the next bar:

f405: pop si
f406: pop di
f407: pop cx
f408: inc si
f409: inc bp
f40a: add di,0008h          ; 6 pixels + 2-pixel gap
f40d: dec cx
f414: jmp f314h

So the overlay is a 40-column, six-pixel-wide, sound-reactive bar field. Each height unit is three VGA scanlines tall, and the color runs upward through palette indices 20h, 21h, 22h, and beyond. The clear-tail path prevents old taller bars from sticking when the current value decays.

Palette Ramps

F417h performs a full 256-colour DAC ramp through ports 3C8h/3C9h.

The basic pass:

f426: mov dx,03c8h
f429: xor al,al
f42b: out dx,al
f42c: mov cx,0100h
f42f: mov dx,03c9h

component_loop:
f432: lodsb
f433: cmp al,cs:[0de2h]
f438: jg  use_source
f43a: mov al,cs:[0de2h]
f43e: out dx,al
f43f: loop component_loop

It repeats that for three 256-byte component streams, waits for retrace, then increments CS:0DE2 until it passes 3Fh. This is a whole-DAC ramp where a moving threshold clamps low component values upward. The visual result is a palette transition rather than per-pixel drawing.

F5BCh is the paired fade in the other direction. It uses threshold CS:0F87, decrements it, and performs the same three-component DAC write loop until the threshold reaches zero.

F626h is a smaller fade-down helper for the first 16 colours:

f662: mov di,0ff1h
f665: mov dx,03c7h
f66b: out dx,al          ; read DAC index 0
f66c: mov cx,0030h       ; 16 colours * 3 components
f66f: mov dx,03c9h
f672: in  al,dx
f673: and al,3fh
f675: stosb

f67b: mov dx,03c8h
f680: out dx,al          ; write DAC index 0
f681: mov cx,0030h
f684: mov dx,03c9h
f687: lodsb
f688: cmp al,00h
f68a: je  already_zero
f68c: dec al
f68e: out dx,al

It reads the current first 48 DAC components, subtracts one from each nonzero component, writes them back, waits one retrace, and repeats under a counter.

Keyboard Filter And Exit

The demo installs its own INT 09h handler at F6C4h:

f6c4: cli
f6c5: push es
f6c6: xor ax,ax
f6c8: mov es,ax
f6ca: mov ax,es:[0024h]
f6ce: mov cs:[04b6h],ax
f6d2: mov ax,es:[0026h]
f6d6: mov cs:[04b8h],ax
f6da: mov ax,1065h
f6dd: mov es:[0024h],ax
f6e1: mov es:[0026h],cs
f6e6: pop es
f6e7: sti
f6e8: ret

The handler itself is at raw load-image offset F6A5h:

f6a5: push ax
f6a6: in  al,60h
f6a8: cmp al,01h
f6aa: je  chain_old          ; Escape
f6ac: in  al,61h
f6ae: mov ah,al
f6b0: or  al,80h
f6b2: out 61h,al
f6b4: xchg ah,al
f6b6: out 61h,al
f6b8: mov al,20h
f6ba: out 20h,al
f6bc: pop ax
f6bd: iret

f6be: pop ax
f6bf: jmp far cs:[04b6h]

Non-Escape keys are consumed: read scan code, acknowledge through port 61h, send EOI to PIC port 20h, and return. Escape chains to the old BIOS handler, which means the later INT 16h polling sees Escape normally.

F6E9h restores the old INT 09h vector. The exit path also stops the sound path when active, runs the palette fade, switches back to text mode 03h, and prints the final DOS $ string.

What The Demo Is Doing

The visible core is simpler and more deliberate than a general-purpose engine:

  1. The MZ carrier reconstructs a large runtime image with its own relocation stream.
  2. Runtime asks for VGA, optional Sound Blaster IRQ, and a fast-machine hint.
  3. Mode 13h is entered.
  4. A six-byte far-call table selects one of 26 precomputed mantaray/object window banks.
  5. EE76h copies a shifted 111x85 window from that bank to screen position (104,35).
  6. Every fifth retrace advances the bank selector.
  7. If sound is active, F2D0h/F314h overlays a 40-column, music-reactive bar field.
  8. On faster machines, seven additional circular-buffer scanline strips animate the bottom of the screen.
  9. Palette transitions do much of the perceived motion and polish.
  10. Escape exits cleanly through the keyboard filter, fade, vector restore, and text-mode restore path.

This is why the public screenshot looks like a single elegant object on black rather than a long multi-effect demo. Most of the code is not a freeform renderer. It is loader, audio setup, palette timing, bank selection, and a few very tight memory-copy kernels wrapped around one carefully prepared image sequence.