Analysis model: gpt-5.5 xhigh, sol high
Last edited: 2026-08-26
Spacedemo by The CodeBlasters - Technical Dissection
Spacedemo is an April 1991 MS-DOS EGA demo by The CodeBlasters. Beneath its
small packed executable is a 382,334-byte all-real-mode program with a
retrace-paced planar scroller, a 25-point XOR starfield, a four-voice software
mixer running from IRQ 0, and a second section built from a 1,000-position
hardware viewport pass.
The release's five numbered files are not animation frames. They are raw signed 8-bit sample streams. The pictures, font, score, and scroll text are inside the executable; the numbered files supply four simultaneous voices, with the fifth stream replacing one voice for the credits.

This continuous direct-runtime excerpt covers graphics-stream frames 630
through 909, or 00:08.989..00:12.970. The large two-plane glyphs cross the
top while the 25 XOR stars move behind the fixed TCB composition. It is the
main scroller described below, not the later credits viewport.
Release year: 1991
Sources
- Demozoo production page: https://demozoo.org/productions/343660/
- Pouet production page: https://www.pouet.net/prod.php?which=90317
- Preserved release archive: https://oldskoolpc.untergrund.net/space.zip
- Defacto2 release record: https://defacto2.net/f/ae19cac
Demozoo dates the production to April 1991. The release files themselves are dated 9-10 April 1991. The ZIP's distributor comment contains obsolete contact material and is not reproduced here.
Release And Two Packing Layers
space.zip 59,924 bytes
SPACE.EXE 43,107 bytes 1991-04-09 21:06
SPACE.000 2,067 bytes 1991-04-09 20:15
SPACE.001 6,514 bytes 1991-04-09 20:16
SPACE.002 6,451 bytes 1991-04-09 20:17
SPACE.003 3,496 bytes 1991-04-10 16:30
SPACE.004 6,056 bytes 1991-04-09 21:12
c75d892d7aa96b608fe60f852f2a2d605a497f324ca3e68a9a7e97753bd4bd71 space.zip
18abacda9a8d18d4a4c4370e9e74832694d2c8f66478a3633982de4ee5883148 SPACE.EXE
The 43,107-byte release executable is a packed MZ with no relocations, a
112-byte header, and a deliberately wrapped FFF0:0100 entry that lands at
the start of its load module. Its stub copies a decoder to a safe segment and
expands a second MZ.
One UNP pass exposes a 45,373-byte intermediate, but that is still packed:
size 45,373 bytes
header 96 bytes
relocations 0
entry 0AF5:000E
entry file offset AFBEh
marker *FAB*
SHA-256 246d2684c51762f28168933a10dedf915fd94c7616c0b76e6eee01740c58aac4
A second pass reaches the actual program:
size 382,334 bytes
header 144 bytes
load module 382,190 bytes
relocations 27
entry 5BB3:0A28
entry file offset 5C5E8h
stack 0000:0800
SHA-256 2c4ee6e8a730b1bd479bc6c4535ea7c8f984fbc3714f6414c0f19d854c60f969
For the restored image, code segment 5BB3h begins at file 5BBC0h and the
principal data segment 5221h begins at 522A0h. Offsets such as
5BB3:0785 below refer to this second, fully restored program.
Startup And Section Flow
The entry at 5BB3:0A28 makes the lifecycle explicit:
load SPACE.000 through SPACE.003
draw sound-system selector and wait for keys 1..4
install IRQ 0 mixer
draw fixed main composition
run 141 star/transition frames
enter glyph scroller + starfield until Escape
restore IRQ 0
load SPACE.004 over SPACE.003's voice slot
install IRQ 0 mixer again
construct 1,000-line credits viewport backing
hardware-scroll credits until Escape
restore IRQ 0, restore text mode, exit through DOS
Option 1 takes the output base from BIOS data 0040:0008 (LPT1), option 2
uses 0040:000A (LPT2), and option 3 enables the internal-speaker path.
Option 4 displays construction instructions and returns to the selector. The
runtime media here used option 3 while host audio remained disabled.
The Numbered Files Are PCM
The loader at 5BB3:0023 opens .000 through .003 and issues ordinary DOS
INT 21h/AH=3Fh reads. The separate loader at 5BB3:0000 later replaces the
second voice with .004. There is no image decoder, frame directory, or
record parser on these paths.
| File | Physical bytes | Read request | Bytes returned | Destination | Unread suffix |
|---|---|---|---|---|---|
SPACE.000 |
2,067 | 2,000 | 2,000 | 5221:0FFC |
67 |
SPACE.001 |
6,514 | 6,500 | 6,500 | 5221:2384 |
14 |
SPACE.002 |
6,451 | 6,400 | 6,400 | 5221:4A94 |
51 |
SPACE.003 |
3,496 | 9,900 | 3,496 at EOF | 5221:71A4 |
0 |
SPACE.004 |
6,056 | 4,000 | 4,000 | 5221:71A4 |
2,056 |
The streams have smooth adjacent deltas, broad signed ranges, and strong
waveform recurrence. Several have a conspicuous 128-sample rhythm, but the
loader cuts .000, .001, and .004 inside that rhythm, proving that 128 is
not a file-record boundary. It is waveform periodicity.
One harmless build artifact closes the distinction further:
SPACE.002[1900h..1932h], all 51 bytes beyond the runtime read, exactly equals
SPACE.001[1900h..1932h]. The player never loads those bytes.
15.9 kHz Four-Voice IRQ Mixer
The installer at 5BB3:02BE writes a new vector directly to IVT
0000:0020, then programs PIT channel 0 in mode 3 with divisor 004Bh = 75:
1,193,182 / 75 = 15,909.093 mixer IRQs/second
The IRQ routine at 5BB3:0154 maintains four fixed-point phase accumulators.
Each interrupt adds that voice's current score increment, advances the source
pointer by the accumulator's integer byte, fetches one signed sample, and
leaves the fractional residue for the next interrupt. The output kernel is:
a = sample_002[position_a] + 0x80;
b = sample_003_or_004[position_b] + 0x80;
c = sample_001[position_c] + 0x80;
d = sample_000[position_d] + 0x80;
output = (a + b + c + d) >> 2;
That is an arithmetic four-way average every IRQ. External-player choices write the byte to the selected parallel port. The fallback path converts it to a PIT channel-2 pulse for the internal speaker.
The score decoder at 5BB3:00AC reads four words per event. Channels A, C,
and D divide their score words by two; channel B uses its word directly. A
first-channel word of 00FFh restarts the sequence. Its initial countdown is
500 IRQs (31.429 ms); subsequent events use 1,500 IRQs (94.286 ms).
SPACE.001 has an explicit sustain region. When its relative position passes
1900h = 6,400, the mixer subtracts 0BB8h = 3,000 while preserving phase
overshoot, looping approximately offsets 3,400 through 6,399. The interrupt
does not chain the BIOS clock; the restore path at 5BB3:0295 reinstates the
saved vector and returns PIT channel 0 to divisor FFFFh before DOS exit.
Score Periods And Buffer Aliasing
The two embedded scores can be closed exactly without transcribing their
content. The main score starts at 50D0:000A, contains 674 complete four-word
events, and ends with 00FFh. The credits score starts at 5CB3:0004; its
311th event ends two bytes before the restored executable's EOF, and the final
two file bytes are its 00FFh terminator.
main score 674 * 1,500 = 1,011,000 IRQs = 63.548562 s
credits score 311 * 1,500 = 466,500 IRQs = 29.322853 s
one-time lead-in 500 IRQs = 0.031429 s
A zero score word retains that channel's current increment and pointer. A
nonzero word resets its source pointer and fractional phase, even when the
post-division increment becomes zero. The credits score never supplies a
nonzero channel-D word, so that channel carries its main-section state across
the mixer reinstall. Only channel B's buffer is replaced by SPACE.004.
The source limits are not the physical file lengths. The program reserves larger adjacent regions and tests the logical position before adding the next fixed-point step, allowing a one- or two-byte overshoot:
| Channel | Base | Runtime position | What those positions contain |
|---|---|---|---|
| A | 4A94h |
0..8001 |
SPACE.002[0..6399], then 1,602 initialized zero bytes |
| B, main | 71A4h |
0..6402 |
SPACE.003[0..3495], then 2,907 initialized zero bytes |
| B, credits | 71A4h |
0..6402 |
SPACE.004[0..3999], then 2,403 initialized zero bytes |
| C | 2384h |
repeating through 0..6402 |
entirely inside the 6,500 loaded bytes of SPACE.001 |
| D | 0FFCh |
0..6401 |
SPACE.000[0..1999], 3,000 zero bytes, then SPACE.001[0..1401] |
That last row is a genuine cross-channel alias. The 3,000-byte gap ends
exactly where channel C's SPACE.001 buffer begins. During the first complete
main-score traversal, channel D makes 685,574 reads from SPACE.000, 125,206
from the zero gap, and 200,220 from the start of SPACE.001. Once the score
has looped, the retained end position changes those counts to 103,574,
125,206, and 782,220 per 1,011,000-IRQ cycle. Calling all four inputs simply
independent file streams would therefore be wrong: the arithmetic has four
voices, but one voice spends much of its steady cycle reading another voice's
allocation.
Main Screen: 25 XOR Stars
The star table at 5221:0CC8 contains exactly 25 (x,y) word pairs. Routine
5BB3:09C6 draws all 25 through the VGA/EGA latch-and-XOR pixel kernel at
5BB3:039F; 5BB3:09ED then updates their x coordinates.
One complete star frame at 5BB3:0A16 is:
draw 25 points by XOR
wait through one complete vertical-retrace boundary
draw the same 25 points by XOR again, erasing them
update all 25 x coordinates
That is exactly 50 pixel operations per frame, with no background save buffer. Speed comes from the loop's remaining count:
speed = floor(remaining_stars / 8) + 1;
The resulting distribution is exact:
| Speed | Stars |
|---|---|
| 4 pixels/frame | 2 |
| 3 pixels/frame | 8 |
| 2 pixels/frame | 8 |
| 1 pixel/frame | 7 |
When x >= 320, the updater subtracts 320. Before handing control to the
long scroller, the entry path runs 141 star frames: one setup frame, 100
steady frames, and 40 frames coupled to the EGA line-compare transition. The
earlier 142-frame count was one high.
The speed classes also close the whole starfield period. Individual x periods are 80 frames at speed 4, 160 at speed 2, and 320 at speeds 1 and 3, so all 25 stars return to their initial x positions after exactly 320 frames. One star frame executes 50 XOR pixel calls. Each call makes one VRAM latch read, one VRAM write, and eight VGA port-output instructions: two plane-selection writes in the caller and six Graphics Controller writes in the pixel kernel. The 141-frame pre-scroller section therefore performs 7,050 point calls before the first large glyph column.
The 40 transition values are not an inferred fade. 5221:002B receives
0,2,4,...,78; 5BB3:031D splits that ten-bit value across CRTC register
18h, register-7 bit 4, and register-9 bit 6. Star motion and the line-compare
boundary consequently advance once per retrace together.
Main Screen: Glyph-Column Scroller
The scrolling text starts at 5221:0085; obsolete personal contact text in
the original stream is not quoted here. Each byte maps through the character
table at 5221:004A, selecting one 0280h-byte glyph.
The glyph organization explains both its size and the outlined look:
8 columns x 2 EGA planes x 40 scanline bytes = 640 bytes per glyph
For each of the eight columns, 5BB3:0785 selects plane masks 1 and 2
separately and copies 40 bytes to each plane. The destination stride is
50h bytes, so those bytes become one 40-scanline-tall vertical slice. The
per-character work is therefore:
80 planar writes/column x 8 columns = 640 planar writes
8 CRTC start-address advances
8 complete star frames = 400 XOR pixel operations
After each column, the CRTC start address advances by one byte and one complete
star frame supplies the retrace wait. The next 8-pixel column therefore enters
from the right without copying the fixed TCB page. Escape scan code 01h is
polled directly from port 60h inside the column loop.
The stream has 3,138 printable bytes before its terminator. One uninterrupted pass is therefore 25,104 columns/star frames, about 358.19 seconds at the captured 70.086 Hz. Its content remains omitted, but its workload does not:
per character
640 font-source reads + 640 one-plane VRAM writes
400 star VRAM latch reads + 400 star VRAM writes
3,200 star VGA port-output instructions
32 Sequencer plane-selection outputs
16 CRTC start-address outputs
8 complete retrace boundaries
total VRAM writes 1,040
total port outputs 3,248
The star phase itself repeats every 40 characters because 40*8 = 320
frames. At the text terminator, 5BB3:089C clears 32,000 addressed bytes from
VRAM offset 3200h with all four planes enabled, advances the circular base by
another 32h bytes, and restarts the same 3,138-byte stream.
The visible motion is consequently a plane-selective circular writer plus hardware panning, not a 64,000-byte frame blit.
Credits: An 800-Line Authored Strip
After Escape, .004 replaces .003, the timer mixer restarts, and
5BB3:0D43 enters EGA mode 0Dh. Two adjacent embedded sources are copied
into video memory:
source 3190:000B 400 rows x 4 planes x 40 bytes = 64,000 bytes
destination VRAM row 200, byte offset 1F40h
source 4130:000B 400 rows x 4 planes x 40 bytes = 64,000 bytes
destination VRAM row 600, byte offset 5DC0h
The first 1F40h = 8,000 bytes of every plane are cleared. The resulting
virtual surface is 1,000 scanlines tall: 200 blank rows followed by an authored
320x800 credits strip.
The construction ledger is exact: the two source blocks cause 128,000 source
reads and 128,000 one-plane VRAM writes. 5BB3:08D6 then clears the same
8,000-addressed-byte, 200-row prefix after each 400-row upload. Because all
four planes are enabled, those two redundant clear calls issue 16,000
addressed byte writes representing 64,000 plane-byte zeros. The second clear
does not change the final image, but it is real setup work.

This is a byte-for-byte planar reconstruction from the two embedded sources, not a runtime screenshot. Each source row was decoded from four 40-byte bitplanes. It shows exactly the authored 800-line object consumed by the viewport loop.
Credits: 1,000 CRTC Phases
The display loop at 5BB3:0DF9 never redraws the credits. It advances the
CRTC start address by one 40-byte scanline, waits for retrace, writes registers
0Ch/0Dh, and wraps at 9C40h:
start += 0x28;
if (start == 0x9c40) start = 0;
9C40h / 28h = exactly 1,000 viewport phases
At the approximately 70 Hz mode-0Dh refresh, one pass is about 14.27 seconds. Decoded capture frames 980 and 1980 have the same complete-frame MD5 and are exactly 1,000 source frames apart, independently confirming the code-derived period.
Each viewport phase has zero framebuffer reads and zero framebuffer writes.
It performs one complete retrace wait followed by two word-sized CRTC output
instructions for registers 0Ch and 0Dh. A full cycle is therefore 1,000
waits and 2,000 CRTC outputs while the 15.9 kHz mixer proceeds independently.

This direct-runtime GIF covers source frames 980 through 1979,
00:13.983..00:28.237: one exact 1,000-phase input cycle. It retains every
second source phase as 500 frames at approximately 35 fps. Unlike the tall
reconstruction above, this is the actual 320x200 viewport, doubled to 640x400
by DOSBox-X.
Dormant Raster Code
The restored image also contains a substantial EGA Bresenham rasterizer at
5BB3:03F1, with horizontal, vertical, shallow, and steep paths. Its callers
belong to the rectangle helper at 5BB3:0643, but no reachable path from the
program entry invokes that helper. It is resident library code, not a hidden
live vector effect, and is not credited as part of the demo's visible work.
Runtime Capture And Verification
The direct capture used DOSBox-X 2024.03.01, EGA/VGA-compatible mode 0Dh, a
fixed 12,000-cycle CPU setting, internal-speaker option 3, and disabled host
audio. DOSBox-X's graphics-stream capture produced approximately 70.086 frames
per second. No public media contains audio.
The visual/code concordance is component-specific:
main GIF stars 25 records, 50 XOR calls/frame, exact 320-frame period
main GIF top text 3,138 chars, 1,040 VRAM writes/char + CRTC advance
credits strip PNG exact 128,000 embedded planar source bytes
credits GIF 1,000 start-address phases; frames 980 and 1980 repeat
The analysis never assigns the sound selector to the main GIF or the authored strip to the starfield. Each picture is attached only to the mechanism that produces it.
What Makes Spacedemo Interesting
The demo spends memory to save frame work in two different ways. Its main screen retains a fixed composition while a narrow two-plane glyph column and 25 XOR points are repaired around one retrace. Its credits go further: 128,000 embedded planar bytes become a tall authored surface, and animation reduces to one CRTC start-address update per refresh.
At the same time, the audio path is more ambitious than the visuals suggest: four continuously resampled signed streams are averaged at 15.9 kHz from a custom IRQ 0 handler, with selectable parallel-port hardware or a speaker fallback. The result is a compact April 1991 production whose most important inner loops are column writes, XOR repair, fixed-point sample stepping, and hardware viewport movement rather than full-screen software animation.