Analysis model: gpt-5.5 xhigh, sol high
Last edited: 2026-08-26
The Stage Remake by THG FX - Technical Dissection
The Stage Remake is a 1991 MS-DOS VGA intro by THG FX. It is a particularly
useful early-PC specimen because almost the entire visible result can be tied to
one 440-byte code block: a static 320x200 backdrop, one 16-row software
scroller, and a VGA CRTC split that makes the same scroller storage visible in
two places.
Release year: 1991
The name needs a provenance warning. Demozoo distinguishes two productions:
The Stage, a December 1991 64K intro, was an internal Turbo Pascal version that Demozoo marks lost and says was never released;The Stage Remake, classified as a 1991 32K intro, is the pure-assembly conversion examined here.
Demozoo also says the remake was not released as a standalone intro at the
time. It was used inside The Humble Review 1 with a different scrolltext. The
single-file archive now preserved under lost_found_and_more is therefore a
later recovery of the standalone-shaped executable, not evidence of a normal
1991 standalone release. Its packed payload and embedded text are internally
consistent with the assembly-remake account.
Sources
- Demozoo, The Stage Remake: https://demozoo.org/productions/274680/
- Demozoo, original The Stage: https://demozoo.org/productions/197640/
- Demozoo, The Humble Review 1: https://demozoo.org/productions/93369/
- Scene.org file page: https://files.scene.org/view/demos/compilations/lost_found_and_more/the_stage_remake.zip
- Scene.org archive download: https://files.scene.org/get/demos/compilations/lost_found_and_more/the_stage_remake.zip
Demozoo credits Dawnrazor with code and graphics and Peeping Tom with code. It notes a 25 October 1991 file date. The recovery ZIP itself has a modern archive timestamp, so that 1991 date is treated as catalogue provenance rather than as a timestamp independently preserved by this ZIP.
Examined Artifact
The downloaded ZIP is 20,704 bytes and contains one file:
THGFX.EXE 21,589 bytes
Hashes:
2c577752f9b5e2c4092e3d6927ab14e3e0b8eb8401f84a97661b2808db73d430 the_stage_remake.zip
d8b656ae93aadc517c9750078b939ef904496877fe3de214ac684744fb244c7c THGFX.EXE packed
d7465b2ed3b756e2dd18b0dbcabd889b8eff287452370d362350f32ec6663822 THGFX.EXE after UNP
3445bab3c07942c0a89b7f938a94ed5a32ea2a055ec91144e092acfa57ed8c95 THGFX.IMG load image
The executable contains the PKLITE marker. UNP restores a 136,386-byte MZ; removing its 512-byte header leaves a 135,874-byte load image. There is no appended overlay or tail after the declared MZ extent.
Direct Runtime Capture
The retained runtime evidence comes from the packed THGFX.EXE, not from a
relinked or patched analysis copy. It was run with DOSBox-X 2024.03.01 using:
machine vgaonly
CPU 386, normal core, fixed 8000 cycles
host audio disabled
guest SB/GUS disabled
render no scaler, no aspect correction
capture ZMBV, 640x400 host frame
The useful VGA stream is 68.601135 seconds. The run was stopped externally after the scheduled headless Escape mapping failed, so the visible steady state is direct runtime evidence while the key-triggered cleanup is verified from code only.

The image is a direct 640x400 capture frame. It has not been tiled, cropped, or
reconstructed. The repeated text at the bottom is not a capture glitch: both
copies come from the same bytes at A000:C1C0.

The 18-second silent GIF is cut from capture seconds 48 through 66 and sampled
at 35 frames per second. It covers the authored Faster/Slower sequence. The
background does not animate; the changing horizontal displacement and speed
belong entirely to the scroller routine described below.
Restored MZ Shape
The restored program enters at CS:0000. Its seven relocations point at image
offsets:
0014 0038 005e 00f5 00fa 0139 01a8
They patch segment literals used for the resource bank, local work segment,
font bank, publish routine, and exit string. Consequently, raw values such as
001Bh, 01ACh, and 117Ch are load-relative paragraphs, not physical low
memory.
The compact image layout is unusually elegant:
| Image range | Size | Ownership |
|---|---|---|
00000..001B7 |
440 bytes | executable code |
001B8..00448 |
657 bytes | scroll script including FEh terminator |
0044A..0044B |
2 bytes | default speed, value 2 |
0044C..00478 |
45 bytes | DOS exit credit and small state gap |
00478..01877 |
5,120 bytes | 320x16 mutable scroller work band |
01878..01A77 |
512 bytes | 256-entry word glyph-pointer table |
01AC0..01AC1 |
2 bytes | mutable current glyph pointer |
01AC2..01DC1 |
768 bytes | 256-entry 6-bit VGA palette |
01DC2..117C1 |
64,000 bytes | static 320x200 backdrop |
117C2..212C1 |
64,000 bytes | 320x200 glyph atlas page |
Two segment choices deliberately overlap their resources by two bytes:
- segment
01ACh, offset0002his the palette and offset0302his the backdrop; - segment
117Ch, offset0002his the first atlas byte.
This saves separate aligned resource wrappers. The code compensates with
explicit +2 offsets.
Main Control Loop
The complete entry path begins at 0181h:
0181 mov ax,0013h
0184 int 10h ; 320x200x256 VGA
0186 call 0164h ; line compare = 44
0189 call 014eh ; display start = 2fd0h
018c call 0003h ; palette, backdrop, buffers
018f call 005dh ; advance software scroller
0192 call 0138h ; publish 320x16 band
0195 call 004fh ; wait for next vertical retrace
0198 mov ah,01h
019a int 16h ; key pending?
019c jz 018fh
019e mov ah,00h
01a0 int 16h ; consume key
01a2 mov ax,0003h
01a5 int 10h ; restore text mode
01a7 mov ax,001bh
01aa mov ds,ax
01ac mov ah,09h
01ae mov dx,029ch
01b1 int 21h ; print loader credit
01b3 mov ax,4c00h
01b6 int 21h
There is no music driver, timer interrupt, page-flip manager, palette cycle, or multi-part dispatcher. One foreground loop owns every changing pixel. BIOS mode 3 is also the only hardware restoration; the intro does not manually put the changed CRTC registers back.
Initialization: Fixed Traffic and Resource Ownership
Routine 0003h performs four large operations:
7D00hword stores clear all 64,000 visible VGA bytes;- BIOS
INT 10h / AX=1012huploads 256 RGB triples from image01AC2h; - one
rep movsbcopies the 64,000-byte backdrop from image01DC2htoA000:0000; 0A00hword stores clear the 5,120-byte software band at image00478h.
The first VGA clear is visually superseded by the backdrop copy, but it gives the BIOS/DAC setup and any transient display interval a known zero page. The routine then copies default speed word 2 into the mutable speed slot.
Initialization traffic attributable to explicit string instructions is:
| Destination | Reads | Writes |
|---|---|---|
| VGA clear | 0 | 64,000 VGA bytes |
| backdrop copy | 64,000 resource bytes | 64,000 VGA bytes |
| work-band clear | 0 | 5,120 local bytes |
The BIOS palette upload additionally consumes 768 resource bytes and programs 768 DAC component values, but its internal BIOS I/O sequence is not attributed to the intro's own instructions.
CRTC Composition: Why the Scroller Appears Twice
Start address
Routine 014Eh writes CRTC registers 0Ch:0Dh with 2FD0h. In standard
mode-13h doubleword addressing this selects byte address:
2FD0h * 4 = BF40h = 48,960 = 153 * 320
The top of the physical display therefore begins at logical VGA row 153.
Line compare
Routine 0164h writes low line-compare register 18h with 2Ch, then clears:
- bit 4 of CRTC overflow register
07h, the line-compare bit 8; - bit 6 of maximum-scan-line register
09h, the line-compare bit 9.
The effective compare is exactly physical scanline 44. When the scan counter passes that line, VGA resets the display address to zero. Mode 13h doubles logical lines, and this is an odd 45-scanline upper region, so the boundary cuts through the doubled-line cadence rather than landing on a neat 320xN logical rectangle.
Shared band
Routine 0138h always publishes at:
A000:C1C0 = 49,600 = 155 * 320
The start-address viewport reaches source row 155 after the first two logical
rows, so the 16-row band appears near the top. After the line-compare restart,
the lower display begins again from A000:0000; as that scanout later reaches
row 155, the same band appears again near the bottom. The runtime frame proves
that both are live aliases of one VRAM region, not two software blits.
The ownership chain is therefore:
local 320x16 work band
|
| one 5,120-byte publish
v
A000:C1C0, source rows 155..170
| |
| start BF40 viewport | post-split scan from A000:0000
v v
upper scroller copy lower scroller copy
There is no second scroller buffer and no second publish pass.
Scroll Script and Mutable State
Segment 001Bh is the local state base. Important offsets relative to it are:
| Local offset | Image offset | Meaning |
|---|---|---|
0008 |
001B8 |
script start |
029A |
0044A |
default speed = 2 |
02C2 |
00472 |
current speed word |
02C4 |
00474 |
script index, initially FFFFh |
02C6 |
00476 |
current glyph phase, initially 7Fh |
02C7 |
00477 |
current script byte |
02C8 |
00478 |
work band |
16C8 |
01878 |
glyph-pointer table |
1910 |
01AC0 |
current atlas pointer |
The script is 657 bytes including its FEh terminator. It contains 635
printable/spacing bytes below F0h and four command values:
| Byte | Count | Action |
|---|---|---|
F0h |
3 | wait for 60 vertical retraces |
F2h |
9 | increase speed by one pixel per update |
F3h |
9 | decrease speed unless already 1 |
FEh |
1 | wrap script index to FFFFh and restore default speed 2 |
Commands are consumed in a tight parser loop. They occupy no glyph cell and
normally no extra visual update. The three adjacent F0h values are different:
all three execute during one call to 005Dh, giving 180 consecutive retrace
waits before the next printable byte is selected. At nominal 70 Hz that is
about 2.57 seconds with no band update and no keyboard poll.
The authored speed sequence starts at 2, reaches 11 after the nine F2h
commands, and returns to 2 after the nine F3h commands. F3h refuses to
decrement only when the value is exactly 1; it is not a general saturating
clamp for a malformed value. There is no upper bound check for F2h; safety
relies on the authored command stream.
Atlas and Pointer Table
The 256-word table at image 01878h maps byte values directly to offsets in a
320-byte-pitch atlas. Representative entries are:
'A' -> 0000h 'B' -> 0017h
'M' -> 1540h 'Y' -> 2A80h
'!' -> 3FC0h ':' -> 5500h
The horizontal cell pitch is 17h, or 23 bytes. The vertical starts differ by
1540h, which is 17 * 320 bytes. A glyph is therefore selected from a 23-wide,
17-high atlas cell, although the renderer reads only 16 rows.
The loader adds 2 to the table result before drawing. That is not a two-pixel
left margin inside every cell: segment 117Ch begins two bytes before the
64,000-byte atlas page, so pointer + 2 lands on the table's intended atlas
byte at image 117C2h + pointer.
For one consumed atlas column, movsb advances the source by one and the code
then adds 013Fh. The net source increment is exactly 320 bytes per row:
1 from MOVSB + 319 explicit = 320
The current pointer advances once per outer insertion iteration, so the next iteration consumes the next vertical slice of the same atlas cell. As shown below, only the first of those iterations writes into the live work band.
Inner Loop at 005Dh
The routine has three phases: select a character when needed, shift every row,
then consume speed atlas columns. A missing destination rebase makes the last
phase substantially stranger than a normal adjacent-column append.
Normalized pseudocode preserving its exact bounds is:
s = current_speed
if phase > 23:
phase = 0
do:
byte = script[++script_index]
if byte == FE:
script_index = -1
current_speed = default_speed
else if byte == F2:
++current_speed
else if byte == F3:
if current_speed != 1:
--current_speed
else if byte == F0:
repeat 60: wait_for_vertical_retrace()
else:
glyph_pointer = glyph_table[byte] + 2
break
while true
s = current_speed
for y in 0..15:
copy work[y][s .. 319] to work[y][0 .. 319-s]
dest = work_base
remaining = s
while remaining != 0:
dest += 320 - remaining
for y in 0..15:
if phase < 23:
program_segment[dest] = atlas[glyph_pointer + y*320]
else:
program_segment[dest] = 0
dest += 320
++phase
++glyph_pointer
--remaining
The assembly implements the row shift with 16 rep movsb operations of
320-s bytes each. Source begins s bytes ahead of destination, so forward
copy is overlap-safe: every source byte is read before that address can be
overwritten later in the same row.
For outer iteration j, its first destination is:
D[j] = 02C8h + 320 - s + j(5440-s) + j(j+1)/2
and its 16 stores land at D[j] + 320r, for rows r=0..15. Only j=0
describes one vertical column in the live band: x coordinate 320-s in all 16
rows. The assembly leaves BX at the end of that 16-row walk, then adds another
row pitch before the next outer iteration. It never restores BX to the band
base.
Consequently, iterations 1..s-1 do not fill the remaining right-edge pixels.
At the authored speeds, their aggregate destinations are load-image offsets
01AE3h..0ECB6h: first the already-uploaded palette copy, then the already-
copied backdrop resource. Neither source is read again after initialization,
and the sink remains below the font atlas at 117C2h, so the mistake is stable
rather than immediately destructive.
The live trailing-edge lifecycle is therefore:
- shift
320-sbytes in every row; - write one fresh sampled atlas column at x
320-s; - leave x coordinates
321-s..319untouched; - consume the other
s-1atlas columns into dead backing storage.
Those untouched edge bytes are not ignored forever. The next shift copies them leftward while also leaving their original edge locations unchanged, so at a fixed speed they behave as a small persistent source reservoir. At normal speed 2, x 319 begins as zero and is never directly written; the scroller is an alternation of one sampled glyph column and one zero column. Speed changes can leave other stale slices in the wider trailing reservoir. Whether this was a deliberate shortcut or a tolerated indexing bug is not provable from the binary.
Phase 23 and Source-column Consumption
The comparisons are intentionally asymmetric:
- a new script byte is selected only when phase is greater than 23;
- atlas data is read only when phase is less than 23.
Phase 23 is therefore always consumed as a zero rather than an atlas read. If
one update crosses beyond 23, the remaining outer iterations in that update
also store zero into their destinations; the next glyph is not parsed until
the next call. For a glyph beginning at phase zero, total source columns
consumed at speed s are:
consumed_width(s) = s * ceil(24 / s)
zero_phase_slots(s) = consumed_width(s) - 23
Examples:
| Speed | Updates per cell | Consumed width | Phase slots stored as zero |
|---|---|---|---|
| 1 | 24 | 24 | 1 |
| 2 | 12 | 24 | 1 |
| 3 | 8 | 24 | 1 |
| 4 | 6 | 24 | 1 |
| 5 | 5 | 25 | 2 |
| 7 | 4 | 28 | 5 |
| 11 | 3 | 33 | 10 |
For the authored speeds 2 through 11, a simulation of the actual script never
begins an update at phase 23. The live j=0 store therefore always receives an
atlas byte; zero-phase stores occur only in the dead iterations. The table is a
source-consumption ledger, not a claim that all of those columns are appended
adjacently to the visible strip. The sparse and sometimes repeated fast-speed
appearance instead comes from one fresh visible sample, s-1 persistent edge
bytes, and an s-pixel shift.
Exact Per-update Traffic
Let:
s = current speed
d = consumed columns whose starting phase is below 23, 0 <= d <= s
The shift stage performs:
16 * (320-s) local reads
16 * (320-s) local writes
The insertion stage performs:
16 * d atlas reads
16 live-band writes
16 * (s-1) dead backing-store writes
The total program-segment write count is invariant:
16*(320-s) + 16 + 16*(s-1) = 5,120 bytes
Routine 0138h then uses 0A00h word copies to publish the band:
5,120 local reads + 5,120 VGA writes
So every ordinary visual update owns exactly:
| Traffic class | Bytes |
|---|---|
| Live work-band writes | 5,136 - 16s |
| Dead palette/backdrop-source writes | 16(s-1) |
| Total program-segment writes | 5,120 |
| VGA writes | 5,120 |
| Total writes | 10,240 |
| Local work-band reads | 5,120 - 16s |
| Atlas reads | 16d |
| Publish reads | 5,120 |
| Total reads | 10,240 - 16s + 16d |
When every consumed column is live atlas data, d=s, and total reads are also
10,240 bytes. On a phase tail, reads fall by 16 bytes per zeroed consumed
column, but writes remain constant because the branch substitutes zero stores.
At normal speed 2, most updates consume two live columns and account for 10,240 reads and 10,240 writes. The final phase-22 update consumes one atlas column and one zero column, so it falls to 10,224 reads while retaining 10,240 writes. There is no hidden second 5,120-byte VGA copy for the duplicate on-screen scroller; scanout aliases the first copy.
Across one complete authored script cycle, including all speed changes, there are 6,372 rendered updates and 6,552 retrace waits. Payload traffic totals 65,230,928 reads and 65,249,280 writes. The 180-wait difference is exactly the three-command stop.
Presentation and Timing
The retrace helper at 004Fh first waits until any current vertical retrace
ends, then waits until the next retrace begins:
dx = 03dah
while (in(dx) & 8) != 0: pass
while (in(dx) & 8) == 0: pass
The normal loop updates and publishes before this wait. Consequently the VGA copy may occur during active display; the code synchronizes the end of the iteration, not the beginning of the blit. On a sufficiently fast machine the next update begins just after retrace starts, giving approximately one update per 70 Hz mode-13h frame. It does not prove tear-free presentation on every period machine.
The F0h command calls the same full helper 60 times. Because that helper
always waits out a currently active retrace first, each call advances to a new
retrace rather than accidentally counting repeated status samples inside one
retrace pulse.
Keyboard polling happens after the regular frame wait. Ordinary exit latency is therefore about one visual iteration. During the three-command pause, BIOS is not polled until all 180 waits finish, so a key can remain pending for about 2.57 seconds plus the remainder of the current update.
Bounds and Failure Surface
The authored speeds 2 through 11 are safe:
- shift count
320-sremains positive; - source and destination stay within each 320-byte row;
- the one live insertion starts at x
320-s, inside the row; - dead insertion stores remain within image
01AE3h..0ECB6h; - 16 rows stay within the 5,120-byte local band;
- publish range
C1C0..D5BFstays inside the 64K VGA aperture; - atlas row reads remain inside the 64,000-byte second resource page for the table's authored characters.
The routine is not a defensive general-purpose scroller. A modified stream can
increment speed without limit. At speed above 320, 320-s underflows the
unsigned rep movsb count and the insertion destination arithmetic wraps. A
modified character byte can also select an uninitialized pointer-table entry.
There is no clipping, range check, or guard allocation designed to contain
those cases.
Runtime-to-code Concordance
The retained frame and speed GIF match the binary at each important boundary:
| Runtime observation | Binary ownership |
|---|---|
| static blue THG FX scene | one 64,000-byte copy from image 01DC2h |
| 16-pixel-tall metallic font | 16-row atlas column loop at 010Ch |
| top scroller | start-address viewport beginning at source row 153 |
| repeated lower scroller | same A000:C1C0 band reached after line compare |
| both copies move identically | one work band and one VGA publish |
| speed-up and slow-down | nine F2h and nine F3h script commands |
| sparse/repeated fast-speed slices | one fresh sample plus s-1 persistent trailing bytes |
| temporary complete stop | three adjacent F0h commands, 180 retraces |
| no background animation | main loop writes only the 5,120-byte band |
This is also why a generic screenshot caption such as “animated background with two scrollers” would be wrong. The backdrop is fixed, and the apparent pair is one storage region exposed twice by CRTC address generation.
What Remains Unproven
- The catalogue's 25 October 1991 file date is not preserved as the timestamp of the recovered ZIP member.
- The lost Turbo Pascal original is not reconstructed from this executable. The remake's script describes conversion from that source, but only the assembly remake binary is available here.
- The exact integration wrapper and alternate text used by
The Humble Review 1were not compared in this pass. - The key exit was not completed in the retained headless capture. Mode 3, credit printing, and DOS termination are static-code findings.
- “Approximately 70 Hz” timing assumes standard VGA mode 13h cadence; workload and emulator scheduling can change wall-clock update rate.
Closing Assessment
The Stage Remake is not technically deep because it has many effects. Its
interest is the economy of one carefully shared data path. A 23-column atlas
cell is streamed into a 320x16 software strip; each update rewrites exactly
5,120 program-segment bytes, although only 5,136-16s of those writes remain
inside the live strip; one fixed copy publishes exactly 5,120 VGA bytes; and
CRTC start/line-compare addressing turns that one published strip into two
visible scrollers around a static 64,000-byte picture.
The speed commands preserve the same fixed write budget while changing source traffic, source-column decimation, stale-edge reuse, and pixels per frame. That combination of invariant memory work and variable visual cadence is the intro's central inner-loop idea—and the duplicated runtime image only makes sense once the VGA scanout ownership is included with the software loop.