Analysis model: gpt-5.5 xhigh, sol high Last edited: 2026-08-25
Space Fun by UltraForce - Technical Dissection
Space Fun is a 1990 MS-DOS VGA/Sound Blaster demo by UltraForce. Pouet lists
it as an MS-DOS production released in June 1990. The expanded executable also
contains the string Written by Remco de Berk in oktober 1990, so the safest
reading is that the public catalog release date and the internal build/credit
text disagree.
Release year: 1990
This is not a big multi-effect demo. It is an autonomous VGA presentation plus a keyboard soundboard, wrapped around five external files:
- a Creative Labs FM resident driver (
SBFMDRV.COM) reached through INT 80h; - a Creative Labs voice driver (
CT-VOICE.DRV); SPACEFUN.TOT,SPACEFUN.ADL, andSPACEFUN.UPCdata files.
The visual engine is still worth documenting because it is a clean early mode-13h composition pipeline: load one 320x200 picture, extract rectangular pieces into local memory, clear and rebuild an off-screen page every frame, animate transparent 8x9 stamps through position tables, then copy the complete page to VGA memory on vertical retrace.
Old contact data exists in the decoded VGA picture and in the original documentation. The public analysis deliberately masks/omits those private details.
Sources
- Pouet production page: https://www.pouet.net/prod.php?which=4086
- Pouet UltraForce group page: https://www.pouet.net/groups.php?which=1300
- Hornet 1990 demo index: https://files.scene.org/get/mirrors/hornet/demos/1990/00_index.txt
- Scene.org Hornet archive: https://files.scene.org/get/mirrors/hornet/demos/1990/spacefun.zip
- Scene.org group archive: https://files.scene.org/view/demos/groups/ultraforce/demos/spacefun.zip
The Hornet index entry identifies spacefun.zip as Spacefun by Ultraforce.
The included document names Remco de Berk as the author, says it was written
for Ultra Force, and describes it as a VGA demo with AdLib sound and digitized
voice. The same document lists VGA, Sound Blaster, and preferably a quick PC/AT
as the target setup.
Direct Silent Runtime
The bundled startup batch runs:
SBFMDRV >NUL
SPACEFUN
An earlier DOSBox-X probe using a later Sound Blaster configuration failed in the bundled FM TSR before the demo could run its normal loop:
Creative Sound Blaster FM-Driver Version 1.02A
Driver's I/O address set at 220 Hex
Error 6001: Sound Blaster Card does not exist or wrong I/O address setting.
That result is a configuration boundary, not a general runtime failure. A
second run matched the original hardware more closely: Sound Blaster 1,
OPL2, base 220h, IRQ 7 and DMA 1. SBFMDRV.COM then reported that the driver
was installed at INT 80h, and the untouched START.BAT entered the demo.
The successful capture used DOSBox-X 2024.03.01 with fixed 1,500 cycles. Host
audio was routed to a dummy device and DOSBox had nosound=true; the retained
file has one video stream and no audio stream. No key was pressed, so it proves
the autonomous visual cycle but not the numbered voice-sample paths.
Capture: spacefun-native-640x400.mkv
SHA-256: 7997fc7cc58e229b8073ce1694844b877b51e9f521de6215c1cf55e234b9e592
Video: 640x400 H.264, 1,320 frames, 88/3 fps, 45.000 seconds
Audio: no stream; dummy/muted host path
Guest setup: SB1, OPL2, 220h, IRQ 7, DMA 1; cycles=1500
Launch: untouched START.BAT; no scripted keys
Timing zero is the first encoded VGA frame, after TSR installation and program
startup—not the launch of START.BAT. Exact frame-PTS transitions are:
00:00.000-00:03.341 UF Presents emblem
00:03.341-00:12.886 SPACE FUN logo
00:12.886-00:20.557 SPACE FUN / CODED / BY
00:20.557-00:28.261 REMCO / DE / BERK
00:28.261-00:34.500 OTHER / MEMBERS / ARE
00:34.500-00:35.795 seven-name member list
00:35.795-00:35.898 torn exit frame
00:35.898-00:45.000 black host output after exit
The central states change in single-frame hard replacements. Two bead trails move independently throughout, while the stone banner and seven-button lower panel remain fixed. This eight-second excerpt is a continuous, uncropped 640x400 extraction from 00:14.000 through 00:22.000, scaled only by the page:

The published GIF is 640x400, 80 frames at 10 fps, 344,023 bytes, with
SHA-256 9f982c8f9f46399a9e30f3d5e68d32702d74b0e523613eb5d0594233660f6f98.
Frames were taken directly from the continuous capture and were not cropped,
padded, tiled, synthesized, or reordered.
The decoded source sheet remains useful because it exposes the complete atlas from which the compositor cuts its live states. It is not a runtime screenshot:

Asset-To-Code Concordance
The direct capture now verifies the moving trails, central state replacements,
and static outer UI. The decoded SPACEFUN.UPC picture independently verifies
their source pixels. Voice playback and numbered-key behavior remain
code-backed only because the successful capture used no keys and audio was
never monitored.
SPACEFUN.UPC is loaded by the routine at 3E31h. Its layout is simple and
visible in the decoded image: a 256-color palette, followed by 64,000 bytes of
mode-13h pixels. Startup reaches that path only after the INT 80h FMDRV
signature gate, mode-13h switch, CT-VOICE load, SPACEFUN.TOT sample-bank
load, SPACEFUN.ADL load, and FMDRV configuration sequence listed at
0040h..005Ah.
The decoded page is not merely a title card. It is the source sheet for the
runtime compositor. After the UPC load, 05BAh..06BCh extracts nine rectangular
regions from the 320x200 page into local buffers; those regions later feed the
state dispatcher at 0410h. The transparent draw routines 06DCh, 0707h,
0730h, 0759h, 0782h, 07ABh, 07D4h, 07FDh, and 0826h all use the
same rule: a zero source byte preserves the existing off-screen pixel, while a
nonzero byte writes the rectangle pixel. That matches the asset sheet's role as
a menu/state atlas rather than a passive screenshot.
The small moving objects are also cut out of the same decoded page. Routines
3D3Fh and 3D5Fh copy two 8x9 sprites from offsets 3351h and 3346h into
local buffers 6806h and 686Ah. The stamp kernels 3DB4h and 3DDEh draw
them through position tables starting near 3C92h, using zero as transparency
and a 320-byte row pitch. The two trail drivers 04C5h/0595h and
0499h/3B6Bh draw sixteen stamps per frame, so the decoded still supplies
both the static UI and the moving sprite material.
The direct capture matches the framebuffer path: the main loop clears the
off-screen page at 9000h, restores the preserved background strip with
3D95h, draws the trails and active rectangle, waits for the leading edge of
vertical retrace, and copies the full 64,000-byte page to A000h through 3E08h.
This is a retrace-synchronized blit, not a hardware page flip, and the copy is
not guaranteed to finish inside the retrace interval.
Archive
Two public archive variants were checked. The Hornet archive contains only the
demo payload; the group archive has the same payload plus a later scene.org.txt
metadata file.
927c5f40a1a7d7ce9d595d6d6031048f126f78bc0af6ce1c7ca6e0c11c7fd20f spacefun-hornet.zip
cc40d5e145d8d89390219b065c887b1ace0a289ee5164ba786c93f6e334537cb spacefun-scene-group.zip
Payload files from the Hornet archive:
CT-VOICE.DRV 2377 bytes 1989-11-27
SBFMDRV.COM 5226 bytes 1990-07-09
SPACEFUN.ADL 21056 bytes 1990-06-20
SPACEFUN.DOC 1592 bytes archive timestamp 1980-01-04
SPACEFUN.EXE 2904 bytes archive timestamp 1980-01-04
SPACEFUN.TOT 102059 bytes archive timestamp 1980-01-04
SPACEFUN.UPC 64817 bytes archive timestamp 1980-01-04
START.BAT 35 bytes archive timestamp 1980-01-04
Important hashes:
5ae9d956bd170264339a5b120116d8f696ab018266c89dc1ae992801e06d2951 SPACEFUN.EXE packed
309827e31ff43db5c36073f2870d4f495634e80bf735aa5ac3d58e6b529b1d73 SPACEFUN.EXE after UNP
0411aed26ece09a5773e37b5fd28815a83ebe2fdf71b55bf64927026170b2090 SPACEFUN.ADL
95bf70dc43a0783e8587637c161244d36d8a4fb97cdaea5282d861e20542e5e1 SPACEFUN.TOT
2b031a4b304648bf5503aa6909a4fe9b1074ce29509fa8c5eaed37ce4b661bb9 SPACEFUN.UPC
63b9ee3aa25d2d2fcc9113cc83b7f1e8c63d95dbaebcf547537fbbdfddee3ad0 CT-VOICE.DRV
952d4d5cc5b7b9384dc09c46596aaab2f80cb94211ef753c7bf43fa28c3420e3 SBFMDRV.COM
84765a2ba78094496a058eb7389254315059d1f857cc4e60851e21c5ba0d2a88 START.BAT
925fc1fa10852054bc394c470414ac8488de55a60fe722864af60cfdd218e735 masked PNG still
File roles:
SPACEFUN.EXE LZEXE-packed launcher/main program
SPACEFUN.UPC uncompressed UltraForce signature, VGA palette, and raw pixels
SPACEFUN.ADL ordinary Creative Music File 1.1 AdLib data
SPACEFUN.TOT seven concatenated Creative Voice Files
CT-VOICE.DRV Creative Labs digitized-voice driver loaded by the EXE
SBFMDRV.COM Creative Labs FM TSR expected at INT 80h
START.BAT installs the FM TSR, then starts the EXE
Packed Program
The distributed SPACEFUN.EXE is a tiny LZEXE MZ:
packed size: 2904 bytes
MZ load image: 2872 bytes
header size: 32 bytes
relocations: 0
entry: CS:IP = fff0:0100
stack: SS:SP = fff0:fffe
min/max alloc: 0f4c/ffff
UNP expands it to a 26,574-byte raw COM-style image. That expanded image starts
at file offset 0000h, contains code and data in one segment, and loads at COM
runtime offset 0100h. This article keeps routine labels in the restored-file
namespace used during the disassembly: file routine 3E31h, for example, is
runtime 3F31h. Bracketed absolute operands retain their actual COM runtime
addresses: runtime data [03CBh] resides at file offset 02CBh. Mixing those
two namespaces was a source of error in the earlier pass.
The packed file itself is an exact 2,904-byte MZ: a 32-byte header plus a
2,872-byte load image, no relocations, and the LZ90 marker at file offset
004Eh. The reliable adjusted disassembly form is:
objdump -D -b binary -m i8086 -M intel --adjust-vma=0x100 SPACEFUN-UNP.EXE
No original source listing or saved author disassembly survives in the audited workspace. Conclusions below come from the shipped binaries, the UNP-restored image, exact resource parsing, and the direct silent runtime.
Startup Gate
The first instructions print the startup text and immediately verify the FM resident driver:
000f mov ah,35h
0011 mov al,80h
0013 int 21h ; get INT 80h vector into ES:BX
0015 mov si,04c3h ; local "FMDRV"
0018 mov di,0103h
001b mov cx,0005h
001e repz cmpsb ; compare DS:SI with ES:0103
0023 je 0038h
0025 print error and exit
This is stricter than just checking whether INT 80h is nonzero. It expects the
interrupt handler segment to contain the five-byte signature FMDRV at offset
0103h. If that compare fails, the demo prints its no-driver error and exits
through DOS.
After the gate succeeds, startup sets mode 13h, stores 9000h as the off-screen
page segment, and calls the asset/driver loaders in a fixed order:
0040 off-screen segment = 9000h
0048 BIOS video mode 13h
004d load/init CT-VOICE.DRV
0050 load SPACEFUN.TOT into 4000h/5000h
0053 load SPACEFUN.ADL into 8000h
0056 start/configure FMDRV through INT 80h
005a load SPACEFUN.UPC, palette, and 64000-byte picture
005d extract nine picture rectangles into local buffers
0078 preserve a large background rectangle
007b extract two 8x9 transparent stamp sprites
0081 copy lower page section to A000h once
0084 clear the off-screen page
0087 rebuild the preserved background patch
008a vblank-copy the off-screen page to A000h
Voice Driver Path
The CT-VOICE path at 0183h loads the driver into a segment relative to the
main code:
019e AX = CS + 1800h
01a1 store driver segment at [03cd]
01a6 open CT-VOICE.DRV
01b4 read up to 7fffh bytes into [03cd]:0000
01d6 far-call driver with BX=3
01e4 far-call driver with BX=2, AX=3
01f0 far-call driver with BX=3 and check AX
01fe far-call driver with BX=2, AX=5
020a far-call driver with BX=3 and check AX
0218 far-call driver with BX=2, AX=7
0224 far-call driver with BX=3 and check AX
024c far-call driver with BX=5, DI=03c9h
The far pointer used for every call is at 03cbh: offset 0000h plus the
loaded driver segment. The command meanings are recoverable inside
CT-VOICE.DRV: command 2 selects an IRQ and accepts only 2, 3, 5 or 7; command
3 resets/probes and initializes the DSP. The first command-3 call tests the
default IRQ 3. If it returns nonzero, Space Fun explicitly retries IRQs 3, 5
and 7 through alternating command-2/command-3 calls.
The earlier article had this success test backwards. At file offsets 01D6h,
01F0h, 020Ah, and 0224h, AX == 0 jumps to successful setup at 024Ch.
Only if every probe returns nonzero does execution print error device driver
at 0232h.
Keyboard-triggered sample playback is a small wrapper at 02afh:
02af push ES/BP
02b1 ES = sample segment from [027f]
02b6 BP = 03cbh, far pointer to CT-VOICE entry
02b9 BX = 6
02bc DI = selected sample offset + 001ah
02c3 far-call CT-VOICE
02c6 restore and return
The +001ah skip is exact, not merely “VOC-like.” Every selected offset begins
a valid 26-byte Creative Voice File header: signature, version 010Ah, checksum
1129h, one type-1 sound block, and a terminator. Adding 1Ah points command 6
at the first VOC block.
Keys are hard-wired to seven sample offsets:
1 ES=5000h, DI=7c75h+1ah
2 ES=5000h, DI=0000h+1ah
3 ES=4000h, DI=b6dbh+1ah
4 ES=5000h, DI=384dh+1ah
5 ES=4000h, DI=0000h+1ah
6 ES=4000h, DI=3b34h+1ah
7 ES=4000h, DI=7625h+1ah
9 text mode, FM stop command, CT-VOICE cleanup, DOS exit
The loaded voice driver directly programs an original Sound Blaster. Its
default base is 220h; it uses base+6 for DSP reset, base+Ah/+Eh for DSP
read/status, base+Ch for DSP write/status, DMA-1 ports 02h, 03h, 0Ah,
0Bh, 0Ch, and 83h, plus PIC mask/EOI ports 21h and 20h.
SBFMDRV.COM stores base 220h at runtime 0109h, probes the DSP, installs
INT 80h, and writes OPL through base+8/+9 (228h/229h). That direct hardware
model explains why the SB1/OPL2 emulation succeeds while the earlier, later-card
configuration did not.
Sound Data Loading
SPACEFUN.TOT is loaded in two chunks:
04ed DS = 4000h
04f7 open SPACEFUN.TOT
0514 read e281h bytes to 4000:0000
051e DS = 5000h
0526 read ac2ah bytes to 5000:0000
052d close file
The total requested bytes are 0e281h + 0ac2ah = 018eabh, matching the
102,059-byte file size exactly. The split at file offset 0E281h is also an
exact VOC boundary, not an arbitrary segment window. The seven concatenated
files begin at:
file offset loaded address soundboard key
00000h 4000:0000 5
03B34h 4000:3B34 6
07625h 4000:7625 7
0B6DBh 4000:B6DB 3
0E281h 5000:0000 2
11ACEh 5000:384D 4
15EF6h 5000:7C75 1
The first E281h read therefore ends immediately before VOC five, and the
second AC2Ah read contains the final three voices.
SPACEFUN.ADL is loaded into 8000h:
3cba DS = 8000h
3cc4 open SPACEFUN.ADL
3ce4 read 5240h bytes to 8000:0000
3ceb close file
This is an ordinary CMF 1.1 file, not just data that resembles one:
signature CTMF
instrument offset 0046h
music offset 00E6h
ticks/quarter 32
ticks/second 65
instruments 10
title PDEMO Theme II
composer WH Sim / J Tan
0560h configures the FM resident through INT 80h after the ADL data is in
memory:
0560 DS = 8000h
0565 BX=8 INT 80h
056a BX=1, DX=CS, AX=3c90h INT 80h
0574 BX=2, DX=8000h,
AX=[8000:0006], CX=[8000:0018] INT 80h
0582 BX=6, DX=8000h, AX=[8000:0008] INT 80h
058c DS = CS
The callback/status byte at CS:3c90h is checked each frame. When it becomes
zero, the main loop calls 0560h again, so the music driver can be restarted or
re-armed without leaving the visual loop.
All three data files are read directly through DOS; there is no custom resource
decompressor. None of the loaders checks the byte count returned in AX. The
TOT and ADL handles are closed, while the UPC handle is left open. Data and
framebuffer segments are fixed at 4000h, 5000h, 8000h, and 9000h, and
the voice driver is loaded at CS+1800h.
UPC Picture Format
SPACEFUN.UPC is a simple custom UltraForce screen file:
file size: 64817 bytes
signature: 49 bytes
VGA DAC palette: 768 bytes
mode-13h pixels: 64000 bytes
The three regions are exactly 0000h..0030h, 0031h..0330h, and
0331h..FD30h; the 49-byte signature ends in DOS marker 1Ah. No bytes are
compressed.
The signature text says this is an Ultra Force 320x200 256-color VGA screen.
The loader at 3e31h maps directly onto that layout:
3e31 open SPACEFUN.UPC
3e4d read 0331h bytes to CS:3fb9
3e58 BIOS AX=1012h, BX=0, CX=100h, DX=3feah
upload 256 DAC entries from the palette area
3e68 DS = 9000h
3e6f read fa00h bytes to 9000:0000
3e76 DS = CS
The first read is 0331h = 817 bytes: 49 bytes of signature plus 768 bytes of
palette. The second read is exactly 320 * 200 chunky pixels.
Frame Loop
The steady loop starts at 008dh:
008d clear 9000:0000..f9ff
0090 copy preserved background patch back into 9000h
0093 draw first 8x9 stamp trail
0096 draw second 8x9 stamp trail and maybe advance menu state
0099 draw the active state rectangle
009c wait for retrace and copy 9000h to A000h
009f if FM callback byte is zero, call 0560h again
00aa poll keyboard
00ae loop if no key
The full-page clear is the classic mode-13h word fill:
3d83 ES = [3f2f] = 9000h
3d88 DI = 0000h
3d8b CX = 3e80h
3d8e AX = 0000h
3d91 rep stosw ; 32000 words = 64000 bytes
The screen copy is retrace-synchronized and full-frame:
3e0a ES = A000h
3e0f DX = 03dah
3e12 wait while bit 3 is set
3e17 wait until bit 3 becomes set
3e1c DS = 9000h
3e21 DI = 0000h
3e24 SI = 0000h
3e27 CX = 3e80h
3e2a rep movsw ; copy 64000 bytes to VGA
So the demo does not draw directly to visible VGA in the animation loop. It
builds a complete off-screen page, waits for the leading edge of vertical
retrace, and then performs a 64,000-byte copy. This is a synchronized full-frame
blit, not a display-page flip; on period hardware the rep movsw is not
guaranteed to finish before retrace ends.
Preserved Background Patch
The loaded screen already contains the complete UI picture. During setup, the program copies a large 32-row, 296-byte-wide strip out of the picture into local memory:
3d20 DS = 9000h
3d26 SI = 0784h
3d29 DI = 42eah
3d2c BL = 20h rows
3d2e CX = 0128h bytes
3d31 rep movsb
3d33 SI += 18h ; 296 copied + 24 skipped = 320-byte pitch
Each frame, 3d95h restores that background strip into the off-screen page:
3d95 ES = 9000h
3d9b DI = 078ah
3d9e SI = 42eah
3da1 BL = 20h rows
3da3 CX = 0128h bytes
3da6 rep movsb
3da8 DI += 18h
Those offsets are source (x=4,y=6) and destination (x=10,y=6). The
six-pixel horizontal shift is deliberate. The loop structure is an ordinary
rectangular blit with 320-byte row pitch and a 296-byte active width.
Extracted State Rectangles
After the UPC image is loaded, 05BAh through 06BCh copy nine rectangular
regions from the raw picture into local buffers. These are setup-time copies:
source is DS=9000h, destination is the program segment.
Representative routine:
05ba DS = 9000h
05c1 SI = 3f4bh
05c4 DI = 094fh
05c7 BL = 1dh rows
05c9 CX = 0037h bytes
05cc rep movsb
05ce SI += 0109h ; 55 copied + 265 skipped = 320-byte pitch
The nine extracted rectangles are:
setup source local dest rows width row skip
05ba 3f4bh 094fh 29 55 0109h
05dc 34ffh 0f6dh 32 50 010eh
05fc 4106h 158dh 21 36 011ch
061c 5a06h 186ch 21 23 0129h
063c 5a1ch 1a3ah 21 31 0121h
065c 3f81h 1cceh 51 63 0101h
067c 3ea9h 2d24h 24 31 0121h
069c 3607h 300ch 30 51 010dh
06bc 623bh 35e8h 23 71 00f9h
At runtime, the dispatcher at 0410h selects one of nine transparent blitters
based on byte 03f8h. The blitter table is a chain of compares rather than an
indexed jump:
state 0 call 06dch
state 1 call 0707h
state 2 call 0730h
state 3 call 0759h
state 4 call 0782h
state 5 call 07abh
state 6 call 07d4h
state 7 call 07fdh
state 8 call 0826h
state 9 reset state to 0
Each draw routine uses the same transparent-byte rule: read a byte from the local rectangle; if it is zero, preserve the current off-screen pixel; otherwise write the byte.
Example state-0 draw:
06dc ES = 9000h
06e3 DI = 3283h
06e6 SI = 094fh
06e9 BL = 1dh rows
06eb CX = 0037h bytes
06ee lodsb
06ef cmp AL,00h
06f1 jne 06f6h
06f3 AL = ES:[DI] ; transparent source byte
06f6 stosb
06f7 loop 06eeh
06f9 DI += 0109h
The runtime destinations are clustered around X=123..147 and Y=40..42 in the menu/centre area of the 320x200 page. The state counter is advanced by the second moving-stamp routine when its position index wraps.
Moving 8x9 Stamp Trails
Two tiny sprites are extracted once:
3d3f copy 9 rows x 8 bytes from 9000:3351h to local 6806h
3d5f copy 9 rows x 8 bytes from 9000:3346h to local 686ah
Those source offsets are (x=17,y=41) and (x=6,y=41) in the UPC atlas.
Each extracted rectangle contains exactly 72 bytes: 64 nonzero colored pixels
and eight transparent zeroes. The two sprites use 17 and 12 distinct byte
values respectively; they are stored shaded bead images, not circles generated
at runtime.
The transparent stamp kernel at 3db4h draws the first sprite:
3db4 ES = 9000h
3dba DI = [3e7f] ; destination from a position table
3dbe SI = 6806h ; sprite pixels
3dc1 BL = 09h rows
3dc3 CX = 0008h bytes
3dc6 lodsb
3dc7 cmp AL,00h
3dc9 jne 3dceh
3dcb AL = ES:[DI] ; zero is transparent
3dce stosb
3dcf loop 3dc6h
3dd1 DI += 0138h ; 8 copied + 312 skipped = 320-byte pitch
3ddeh is the identical kernel for the second sprite, using local source
686ah and destination variable [3e81].
The position tables start near 3c92h and are read as words. Each word is not
used directly; the code subtracts 3e76h, the offset just after the UPC pixel
load, before using it as a screen destination. That makes the table values look
like absolute source offsets relative to the loaded screen area, while the
renderer needs offsets inside the 9000h off-screen page.
The two trail drivers are 04c5h/0595h and 0499h/3b6bh.
The first driver:
04c5 if [0691] >= 010ch, reset [0691] to 000ch
04d3 CX = 10h
04d7 call 0595h ; draw one table-selected stamp
04db loop 04d6h ; draw 16 stamps
04dd [0691] -= 001eh
Inside 0595h:
0595 SI = 3c92h + [0691]
059c [0691] += 2
05a1 AX = word [SI]
05a2 if AX == 0, reset index to 0
05a7 AX -= 3e76h
05aa [3e7f] = AX
05ae call 3db4h
Sixteen calls advance the index by 32 bytes; the final subtract of 30 bytes
leaves a net advance of one word per frame. The result is a 16-stamp moving
trail through consecutive positions in the table. The two runtime indices
start at [0691h]=0000h and [0693h]=0080h.
The second driver is the same shape, but it uses index [0693], destination
[3e81], and sprite 686ah. Its wrap path also increments state byte 03f8h,
which selects the next big transparent rectangle:
0499 if [0693] >= 010ch:
state++
[0693] = 000ch
04ab draw 16 stamps through 3b6bh
04b5 [0693] -= 001eh
This is the core of the visible animation: two small trails glide over a restored background while a larger stored rectangle changes state slowly. The second trail reaches its first state advance after 70 rendered frames and then wraps every 128 frames. Timing is frame-count based; wall-clock duration still depends on CPU speed and skipped VGA refreshes.
The initial state 0 therefore lasts 70 frames. States 1 through 8 each last 128
frames, so the first state-9 reset frame follows
70 + 8*128 = 1,094 rectangle-bearing frames. State 9 matches no draw branch;
the dispatcher resets it to zero without drawing a large rectangle that frame.
Once the position index is in its repeating 12..268 cycle, a full 1,152-frame
period comprises that one blank/reset frame, 127 state-0 rectangle frames, and
eight 128-frame states.
There is one revealing table-boundary quirk. On the last frame before a trail
wrap, the sixteenth lookup reaches runtime 3DBAh, whose word 00B8h is also
the first instruction word after the position table. Subtracting 3E76h
turns it into framebuffer destination C242h. The renderer therefore uses the
first following opcode as one final position, whether by compact intent or an
accepted off-by-one accident.
Exact Steady-Frame Traffic
The transparency branches do not skip destination stores. Every sprite or state byte is written; when a source byte is zero, the kernel first reads the old destination byte and writes that value back. One frame's fixed byte traffic before the active state rectangle is therefore:
off-screen clear 0 reads, 64,000 writes
background restore 9,472 reads, 9,472 writes
32 bead stamps 2,304 source reads + 256 transparent destination reads,
2,304 destination writes
full-page publish 64,000 reads, 64,000 A000h writes
Each sprite contributes 16*72 = 1,152 source reads and destination writes;
its eight zeroes add 16*8 = 128 destination reads. Across both trails that
is 2,304 stamp stores, of which 2,048 carry nonzero sprite pixels and 256
rewrite the pixel already present.
The nine state rectangles add one source read and one destination write per area byte, plus one destination read for each transparent zero. Parsing the exact UPC source rectangles closes the whole frame ledger:
| State | Rectangle | Zero / nonzero bytes | Total frame reads | Total frame writes |
|---|---|---|---|---|
| 9 reset | 0 | 0 / 0 | 76,032 | 139,776 |
| 0 | 1,595 | 1,100 / 495 | 78,727 | 141,371 |
| 1 | 1,600 | 533 / 1,067 | 78,165 | 141,376 |
| 2 | 756 | 533 / 223 | 77,321 | 140,532 |
| 3 | 483 | 330 / 153 | 76,845 | 140,259 |
| 4 | 651 | 456 / 195 | 77,139 | 140,427 |
| 5 | 3,213 | 2,210 / 1,003 | 81,455 | 142,989 |
| 6 | 744 | 524 / 220 | 77,300 | 140,520 |
| 7 | 1,530 | 1,155 / 375 | 78,717 | 141,306 |
| 8 | 1,633 | 1,244 / 389 | 78,909 | 141,409 |
These are byte accesses, so the rep stosw/rep movsw instruction counts are
half their 64,000-byte traffic. The table excludes code fetches, table/index
loads, keyboard/FM state checks, and the variable number of 03DAh polling
reads. It does include redundant transparent rewrites and the complete
off-screen-to-A000h publication. The key performance fact is that the two live
bead trails account for only 2,304 stores; clearing and publishing whole pages
dominates this 1990 compositor.
Initial Lower-Screen Copy
3b49h is a one-time direct copy from the loaded/off-screen page to visible
VGA:
3b4b DS = 9000h
3b50 ES = A000h
3b55 DI = 80c0h
3b58 SI = DI
3b5a BL = 61h rows
3b5c CX = 0140h bytes
3b5f rep movsb
0140h is 320 bytes and 80C0h is scanline 103 exactly, so this copies full
scanlines 103 through 199. After that, the main loop uses the full-page 3E08h
copy.
What The Demo Actually Does
Putting the pieces together:
- The batch file tries to install Creative's FM TSR.
- The EXE verifies the TSR by checking for
FMDRVat INT 80h handler offset0103h. - The EXE enters mode 13h and loads the Creative voice driver.
- The 102,059-byte voice bank is split across segments
4000hand5000h. - The 21,056-byte AdLib/CMF data is loaded to segment
8000h. - INT 80h commands point the FM driver at the music data and status callback.
- The custom UPC picture provides palette plus a raw 320x200 VGA page.
- Setup copies useful rectangles and two tiny stamps out of that page into local buffers.
- Each frame clears
9000h, restores a preserved background strip, draws two 16-position transparent stamp trails, draws one larger transparent rectangle, waits for retrace, and copies the complete 64,000-byte page to A000h. - Number keys call CT-VOICE with hard-coded offsets into the loaded sample banks.
So Space Fun is closer to an interactive VGA/Sound Blaster presentation than
to a procedural demo. The code is straightforward, but the structure is very
1990: separate Creative TSR/driver dependencies, fixed memory segments for data
banks, no generalized asset format beyond one raw picture file, and hand-coded
rectangular blitters for every visible state.