Analysis model: gpt-5.5 xhigh

The Good, the Bad & the Ugly by Surprise! Productions - Technical Dissection

Scope

This is a static technical dissection of The Good, the Bad & the Ugly by Surprise! Productions / S!P, released for MS-DOS at The Party 1993. Demozoo lists it as released on 29 December 1993 and as the 2nd-place entry in the The Party 1993 PC demo competition. Pouet lists the same production as an MS-DOS GUS demo released in December 1993, also ranked 2nd in the PC demo compo.

Public references:

The examined binary is the final archive gbu_sp.zip and its GBU.EXE. Offsets below are explicit about their base. EXE+0x8c0e means a file offset inside GBU.EXE; image+0x0d93 means a flat offset inside the unpacked real mode image produced by the MyLZ depacker.

This analysis intentionally spends most of its space on the loader, resource table, VGA timing, and the inner loops that make the visible effects. GBU is a long effect catalog, so this is not a source-level reconstruction of every part, but the key moving pieces are concrete: the packer is reconstructed, the resource table is decoded, and several rendering kernels are followed down to their byte loops and VGA port writes.

Credits And Requirements

The final GBU.NFO credits the demo to Surprise! Productions. The important roles are:

The NFO also gives unusually specific runtime constraints. The demo is meant to run on modest machines and says it was tested successfully on a 286. It needs about 600,000 bytes of free conventional memory, no EMS driver, and a Gravis UltraSound. A 256 KB GUS is enough. The executable itself enforces these rules: startup checks for an EMS marker, asks DOS for the largest free conventional block, prints a GUS-only notice, and offers a key to skip the automatic GUS test.

The detailed NFO credits map well to the recovered resource names and code islands. The ordered part list includes text mode routines, intro, credits, plasma, cyclic plasma, morphing line figures, chess effect, water effect, glentz vector, picture wobbler, chess parallax zoomer, parallax bars with chessplane, 16x16 picture zoom, glentz chess cube, greetings scroller, dot tunnel, motorcycle picture, transforming objects, contour city, rotating door, picture zoomer, rotating fractal zoomer, two glentz cubes, jelly cubes, 3200-dot cubes, and the ending ANSI.

Examined Files

Archive contents:

gbu_sp.zip                560,090 bytes
GBU.EXE                 1,234,198 bytes
GBU.NFO                    16,917 bytes
SURPRISE.NFO                9,962 bytes
FILE_ID.DIZ                   520 bytes
ANGRY!AG.AIN                  644 bytes

Important hashes:

66fe16af582f56c308068261ebda413c0d1c5348508743df8a496c10c53b29e9  gbu_sp.zip
5cec6307626464ee60511eca73f75ae8561d33d9d71c49939e6cceac675b620b  GBU.EXE
37063ed6df56add04a91a762ae31db2da1a175000af03d1aa6834734ff557672  GBU.NFO
ac922f3d87c329cd1d58cb1272353378ec887564286e05b774f53ed45f30b287  SURPRISE.NFO
65be8864bf59ed1897d72d70ec26e232377bed4c92be835a49a5c944b6772bf8  FILE_ID.DIZ
be0b5c66c607ded52606f1af2dd65c15c48a5120e1afd09ccffaf4d46e971833  ANGRY!AG.AIN

FILE_ID.DIZ says the demo requires a 286, VGA, and GUS. That is consistent with the code: it stays in real mode, relies heavily on VGA register tricks, and avoids 386-only instructions in the visible inner loops I inspected.

Runtime Capture

The runtime pass used the verified gbu_sp.zip archive listed above in DOSBox-X 2026.01.02. Because the startup screen recommends skipping the automatic GUS test when detection is unreliable, the capture presses S at the GUS notice and records the resulting visual sequence with a temporary Xvfb display and external ffmpeg X11 grab.

Machine:        svga_s3
Memory:         16 MB
CPU:            normal core, fixed 50000 cycles
DOS memory:     XMS on, EMS off
Audio path:     GUS enabled, SDL dummy host audio
Environment:    ULTRASND=240,3,3,5,5
Startup key:    S at the GUS auto-detect notice
Capture:        existing Xvfb 1024x768 videos; derived assets are direct
                ffmpeg frame/time-slice outputs with no crop or scale
Durations:      180.000 s first pass, 360.000 s continuation pass

GBU runtime contact sheet

The first three minutes cover the startup notice, title/crest/credits, an early plasma or cyclic-plasma section, morphing line/vector material, and a picture scene. A second six-minute pass continues far enough to catch later chess, polygon/object, dot-tunnel, and end-scroller material. The captures are useful because they line up with the decoded resource table and the concrete plasma/vector/dot/scroller kernels below.

GBU title still

GBU intro/title motion

The intro/title GIF is the missing motion context for the static title still: it shows the startup/title phase as an actual timed screen sequence before the later plasma and geometry parts. The file already existed from the direct DOSBox-X/Xvfb-derived frame slices; this pass wires it into the analysis rather than regenerating or altering it.

GBU crest still

GBU plasma still

GBU vector-line still

GBU late runtime contact sheet

Top-Level Executable Layout

GBU.EXE is an MZ executable with a small compressed load image and a large appended data area.

file size:            1,234,198 bytes
MZ image size field:     36,695 bytes
MZ header size:              32 bytes
relocation count:             0
initial CS:IP:        08be:000e
initial SS:SP:        1400:0080
overlay size:         1,197,503 bytes
entry file offset:       EXE+0x8c0e

The MZ header has a MyLZ signature at EXE+0x1c, where a normal MZ program would have relocation-table bytes. The entry point is inside the small loaded image rather than the large appended data. Its first job is to move the depacker out of the way and execute that high copy.

The entry bytes at EXE+0x8c0e decode as:

push es
push cs
pop  ds
mov  ax,cs
add  ax,[000ah]      ; add high-copy paragraph delta, 0x0b0c
mov  es,ax
xor  si,si
xor  di,di
mov  cx,[000ch]      ; copy length, 0x0357
cld
rep  movsb
push es
mov  ax,002bh
push ax
retf

The loader parameters live immediately before that code, at the start of the copied depacker block:

offset  value   role
0x0000  03b1    final entry offset after unpacking
0x0002  0000    final entry segment delta, adjusted at runtime
0x0004  0100    final SP
0x0006  13b9    final SS relative segment
0x0008  08be    number of packed paragraphs copied high
0x000a  0b0c    paragraph delta for high depacker copy
0x000c  0357    byte length of depacker copy

So the first entry does not decompress directly. It copies 0x357 bytes from CS:0000 to CS+0x0b0c:0000, then far-returns to the same code at offset 0x2b in the high copy. That high copy is what moves the 0x08be packed paragraphs away from the destination image and runs the MyLZ decoder.

MyLZ Depacker

The compressed input starts at EXE+0x20, immediately after the MZ header. The depacker first copies 0x08be paragraphs, or 35,808 bytes, from the original load image into high memory. It then uses the high copy as the compressed input and writes the expanded program back into the original low image.

The bitstream is LSB-first. A 1 bit is a literal byte. A 0 bit starts a back-reference. The recovered decoder behavior is:

while true:
    if get_bit() == 1:
        output[di++] = input[si++]
        continue

    if get_bit() == 0:
        length_code = get_bit() | (get_bit() << 1)
        length = length_code + 2              ; 2..5 bytes
        distance = signed16(0xff00 | get8()) ; -256..-1
        copy_match(distance, length)
        continue

    word = get16()
    distance_low = word & 0xff
    packed_high = word >> 8
    distance_high = (packed_high >> 3) | 0xe0
    distance = signed16((distance_high << 8) | distance_low)
    length_code = packed_high & 7

    if length_code != 0:
        copy_match(distance, length_code + 2)
        continue

    escape = get8()
    if escape == 0:
        run_relocations()
        break
    if escape == 1:
        normalize_16bit_segments()
        continue

    copy_match(distance, escape + 1)

The match copy is intentionally ordinary 8086 string work: compute a source pointer relative to the current output pointer, then copy bytes forward. Since the source and destination can overlap, this is the classic LZ property where a short repeated seed can expand into a longer run.

The short-reference path only stores an 8-bit negative displacement and a 2-bit length. That is tuned for repeated nearby instruction bytes, text, and small tables. The long-reference path stores a 13-bit negative distance and a 3-bit short length, with an escape byte for long runs and stream termination.

The stream terminator branches through a *FAB* marker in the high depacker. The marker bytes are at EXE+0x8cf7; the branch lands at EXE+0x8cfc, just after the marker.

The depacker then applies a relocation stream. The relocation records start at high-depacker CS:0158. There are 452 word records. Each record points into the expanded image, and the loader adds the runtime load segment to that word. With a zero base in the offline reconstruction, the bytes do not change, but the relocation list explains why the expanded image contains many real-mode far calls and segment constants.

Offline reconstruction result:

unpacked image size:        80,780 bytes (0x13b8c)
SHA-256:                   30106ddfce5de52959e627da973ee2845a3e7bdf33df50a757c1e9dd3fa53728
literals decoded:          17,194
match copies decoded:       8,542
segment-normalize escapes:      1
compressed stream end:      input offset 0x8bd8
relocation records:             452
final CS:IP:               0000:03b1
final SS:SP:               13b9:0100

Startup Runtime

The unpacked image starts with visible strings and DOS setup state:

image+0x0010  inc\b2.mod
image+0x0039  EMMXXXX0
image+0x0090  GUS-only startup text
image+0x00e0  gbu.exe

The final entry at image+0x03b1 is the real demo startup. Its first part is not visual at all:

That startup shape matters because many later routines take for granted that large conventional blocks are available. GBU is not streaming from disk on every scanline; it allocates individual resources into segment blocks, runs a part, frees the blocks, and then loads the next set.

Useful recovered far-call targets in the unpacked image:

008e:0014  image+0x08f4  DOS allocation wrapper
008e:0063  image+0x0943  free allocated segment at DS:[DI]
008e:04b3  image+0x0d93  named resource loader
008e:1942  image+0x2222  GUS module/sample setup path
008e:1f63  image+0x2843  GUS/timer update path
0731:00a3  image+0x73b3  wait for one timer tick
0731:013c  image+0x744c  enter calibrated timer/IRQ mode
0731:0158  image+0x7468  restore timer/vector state

Resource Loader

The named resource loader at image+0x0d93 is one of the most important functions in the demo. Its inputs are simple:

DS:DX  -> 8-byte resource name
DS:DI  -> word slot that receives the allocated segment

The loader compares the requested name against a 49-entry table at image+0x0a82. Each name is exactly 8 bytes. If the name matches, the index is used to select an 8-byte descriptor at image+0x0c0a.

Descriptor format:

struct gbu_resource {
    uint32_t relative_offset;
    uint16_t byte_size;
    uint16_t extra;          /* observed zero in this table */
};

The resource base is held in words at CS:019e and CS:01a0, giving absolute file offset 0x9c40. The loader adds the descriptor's relative offset to that base, opens gbu.exe, seeks with DOS interrupt 21h function 42h, allocates (size >> 4) + 1 paragraphs, and reads the data with DOS function 3fh.

The loader inner loop is not a hash table or directory parser. It is a direct linear name scan:

table = CS:01a2
for index in 0..48:
    compare 8 bytes from DS:DX with CS:table[index * 8]
    if equal:
        goto found
print "missing resource" error

found:
    desc = CS:032a + index * 8
    seek = resource_base + desc.relative_offset
    paragraphs = (desc.size >> 4) + 1
    allocate(paragraphs)
    read(desc.size bytes into allocated segment)

For GBU this is good enough. The demo has only 49 named resources, and resource loads happen between effects, not inside the scanline-critical loops.

Decoded resource table:

# Name File offset Size Likely role
0 watr_dat 0x004254e 641 water parameters/tables
1 watr_pic 0x00427cf 38861 water picture
2 p3_sin 0x004bf9c 1299 sine/table data
3 p3_chess 0x004c4af 4413 chess/parallax data
4 p3_zoom 0x004d5ec 32000 zoom/source image block
5 p3_outf 0x00552ec 13300 outline/figure data
6 chess 0x00586e0 5580 chess pattern data
7 wave 0x0059cac 16799 wave/wobbler data
8 wave_sin 0x005de4b 3374 wave sine table
9 wave_ran 0x005eb79 2320 wave random table
10 scr_data 0x005f489 8521 scroller/screen data
11 screen2 0x00615d2 8521 second screen block
12 cheffect 0x006371b 832 chess-effect control
13 chesspl5 0x0063a5b 17356 chessplane data
14 presents 0x0067e27 2012 intro/presents graphic
15 heads5g 0x0068603 25523 greets/head graphic data
16 intropal 0x006e9b6 2304 intro palettes
17 p75_data 0x006f2b6 1664 part data
18 plasma 0x006f936 64000 plasma lookup/image table
19 kp3_sin 0x007f336 1024 sine table
20 kp3_sin2 0x007f736 7450 second sine/table block
21 mutamcde 0x0081450 8258 loaded code overlay
22 frakcode 0x0083492 37816 fractal/zoom code/data
23 0 0x008c84a 12905 numbered picture/code part
24 1 0x008fab3 30673 numbered picture/code part
25 2 0x0097284 27241 numbered picture/code part
26 3 0x009dced 22878 numbered picture/code part
27 4 0x00a364b 20293 numbered picture/code part
28 5 0x00a8590 27283 numbered picture/code part
29 6 0x00af023 19845 numbered picture/code part
30 7 0x00b3da8 26850 numbered picture/code part
31 8 0x00ba68a 25639 numbered picture/code part
32 9 0x00c0ab1 27154 numbered picture/code part
33 10 0x00c74c3 8545 numbered picture/code part
34 zoompal 0x00c9624 3072 zoom palettes
35 zoomcde2 0x00ca224 46843 zoom code/data overlay
36 xla02 0x00d591f 10747 loaded part data
37 try4c 0x00d831a 27699 loaded part data
38 titcha08 0x00def4d 18231 loaded part data
39 frak2 0x00e3684 5073 second fractal block
40 citydata 0x00e4a55 64000 contour/city image data
41 citydat2 0x00f4455 28800 contour/city data
42 citydat3 0x00fb4d5 51200 contour/city data
43 bg2 0x0107cd5 24000 background block
44 ugur 0x010da95 14592 object/picture block
45 dot_data 0x0111395 7153 dot tunnel data
46 ugu2 0x0112f86 39600 object/picture block
47 ugu 0x011ca36 64320 object/picture block
48 ending 0x012c576 4000 ending ANSI/data

One useful detail: GBU.EXE begins its large overlay with the module area, not with the named resource table. Around the resource base there are strings for Beastsong, Music, fred, 1993, and the M.K. ProTracker marker. The named resource offsets start later, after that music/sample area.

GUS Music Path

The music path is visible from both strings and code. The startup image has the path inc\b2.mod, and the GUS setup routine at image+0x2222 reads from the same executable-backed data stream.

The module loader reads a 0x43c-byte header block and checks the M.K. marker at offset 0x438. It then builds sample/instrument descriptors in internal tables, converting ProTracker-style lengths, loop starts, and loop lengths into the values needed for GUS memory/register programming.

The sample-upload path reads sample bytes in 0x8000-byte chunks and calls the GUS memory upload routine. The per-tick service at image+0x2843 is called from the timer interrupt path. Its shape is:

for each of 4 channels:
    read the current pattern row/effect state
    update period/frequency
    update volume
    update sample position/loop registers if a new note starts
    write GUS voice registers

This explains why the visual timing code and audio code are coupled. The demo does not just poll music time in the main loop. The IRQ handler advances the module player, and effect code queries the same phase counters to decide when a part should exit.

Timer And VGA Baseline

The timing helper block around image+0x7310 is the foundation for many later parts.

Important routines:

image+0x732a  PIT calibration against VGA retrace
image+0x738a  IRQ0 handler: update tick, call GUS update, EOI, iret
image+0x73b3  wait until the tick counter changes
image+0x73c4  save old int 08h vector
image+0x73d6  restore old int 08h vector
image+0x73e8  install one IRQ0 handler variant
image+0x73f4  install another IRQ0 handler variant
image+0x744c  enter calibrated timer mode
image+0x7468  restore normal timer/vector state

The calibration routine programs and samples the PIT through ports 43h and 40h, but gates the measurement on VGA status port 3dah. It repeats 16 samples and stores an average reload value at CS:0006.

The IRQ0 handler at image+0x738a has this practical shape:

; running as int 08h handler
load calibrated PIT value
out 43h,36h
out 40h,low
out 40h,high
inc word [CS:0004]        ; frame/tick counter
call 008e:1f63            ; GUS/music tick service
mov al,20h
out 20h,al                ; PIC EOI
iret

The visual wait helper at image+0x73b3 is then just:

wait_tick:
    cmp word [CS:0004],0
    je  wait_tick
    dec word [CS:0004]
    retf

That gives most parts a stable "one music/timer tick" primitive without having to repeat the IRQ logic.

The VGA side uses the normal status register:

mov dx,03dah
in  al,dx
test al,08h       ; vertical retrace
test al,01h       ; display enable

The parts that need page flips or raster-stable changes wait on these bits before writing CRTC registers.

CRTC Page Flip And Start Address

The low-level page-flip helper around image+0x74dc writes the CRTC start address registers:

mov dx,03d4h
mov ax,0c00h | high(start)
out dx,ax
mov ax,0d00h | low(start)
out dx,ax

Several effects toggle a start address offset by XORing with 0x3e80. In planar 320x200-ish modes, 0x3e80 bytes is a convenient half-page style offset:

visible_start ^= 0x3e80
wait for safe display/retrace window
write CRTC 0Ch/0Dh with visible_start
render next frame into the other page

This is why the inner loops often draw only 80 bytes per row for 100 or 200 rows. A byte in planar VGA can represent four adjacent pixels, and the selected plane mask controls which pixel lane receives the write.

Mode X Planar Image Uploader

The image uploader at image+0x75a4 is a compact example of GBU's VGA style. It copies an interleaved source image into planar VGA memory by selecting one plane at a time through Sequencer index 2.

The loop sets:

mov ax,0a000h
mov es,ax
mov dx,03c4h
mov ax,0102h       ; index 2, map mask = 1

Then it repeats four planes:

for plane_mask in 1, 2, 4, 8:
    out 03c4h, 0200h | plane_mask
    for y in 0..199:
        for xbyte in 0..79:
            copy two source bytes with a staggered address pattern

The inner row loop is the interesting part:

; ES = A000h, DS = image segment
; one plane, one scanline
mov cx,0050h       ; 80 byte columns
row_loop:
    movsb          ; write first byte to ES:DI, SI++, DI++
    dec si         ; rewind source by one
    add di,004fh   ; jump forward in destination
    movsb          ; write related byte into the next strip
    sub di,0050h   ; return destination to next byte column
    add si,0003h   ; advance source to the next chunky group
    loop row_loop

This is not a simple rep movsb. It is a format conversion. The source data is laid out so one pass through a plane can pick the bytes belonging to that VGA plane and scatter them into two separated vertical regions. The add di,4f / sub di,50 pair temporarily jumps to the paired destination strip, then returns to the normal byte-column progression. Repeating the whole loop under map masks 1, 2, 4, and 8 reconstructs the full planar screen.

The surrounding code also contains planar pattern fillers. One checker helper selects map masks 1, 2, 4, and 8 and fills about 0x3ed0 bytes per plane with these bytes:

plane 0: 55h
plane 1: 33h
plane 2: 0fh
plane 3: 00h

Those constants are bit patterns, not colors by themselves. In planar VGA they combine through the four planes into repeating chess/checker masks.

Plasma Phase Builder

The plasma section uses resource plasma, a 64,000-byte block, plus sine/table data. The phase-builder at image+0xcc86 computes moving offsets before the actual compositor runs.

The shape is:

read phase accumulator
index sine/table segment at offsets 0x0180 and 0x0400
wrap indices at 0x0280
store six moving source offsets:
    CS:[18], CS:[1a], CS:[1c], CS:[1e], CS:[20], CS:[22]

Those offsets are later used as three moving source pointers. The important point is that the frame loop does not compute sine per pixel. It precomputes three table bases per frame, then the inner loop is just byte adds and stores.

Plasma Compositor Inner Loop

The main plasma compositor lives at image+0xcdf2..0xcf11. It double-buffers with the CRTC start address, renders two VGA plane groups per frame, and combines three moving byte tables.

Frame setup:

visible_start ^= 0x3e80
write CRTC start address after the safe wait
destination = A000:visible_start_of_hidden_page

First pass selects planes 0 and 1:

mov dx,03c4h
mov ax,0302h       ; Sequencer index 2, map mask 00000011b
out dx,ax

Then it renders 100 rows by 80 byte columns:

mov cx,0064h       ; 100 rows
y_loop:
    push cx
    mov cx,0050h   ; 80 bytes per row
x_loop:
    mov al,[si]    ; table A
    add al,[bx]    ; table B
    add al,ds:[bp] ; table C
    stosb          ; one byte into selected VGA planes
    inc si
    inc bx
    inc bp
    loop x_loop

    add si,00f0h
    add bx,00f0h
    add bp,00f0h
    pop cx
    loop y_loop

The second pass selects planes 2 and 3:

mov ax,0c02h       ; map mask 00001100b
out dx,ax

and repeats the same 100x80 compositor with different starting offsets. The rendered byte is simply:

pixel_index = table_a[x,y] + table_b[x,y] + table_c[x,y]

where all arithmetic is 8-bit wraparound. The rich motion comes from the source offsets moving through precomputed 64 KB tables, not from heavy per-pixel math. That is exactly the right trade for a 286/386 target: the pixel loop is three memory reads, two adds, and one planar write.

The use of map masks 03h and 0ch is also deliberate. Each byte write lands in two planes at once, halving the number of passes compared with drawing one plane at a time while still staying in planar addressing.

GBU plasma motion

The plasma clip is the visible counterpart to the plasma resource and three-table compositor. The effect looks like a continuous fluid surface, but the recovered path is table phase motion plus byte addition, not expensive per-pixel trigonometry.

Zoom And Picture-Zoom Loops

The picture zoom and 16x16-picture zoom sections use loaded resources such as zoompal, zoomcde2, and the numbered resources 0 through 10. Some of the zoom code is loaded as data and called indirectly, but the visible control logic around image+0xd9bd..0xdb49 is still clear.

One frame builder copies a 0xfa00-byte image/table block, then biases every byte by a phase value:

; source and destination are separate segment blocks
call block_copy_0xfa00
mov al,CS:[0048h]       ; phase/bias byte
mov cx,0fa00h
bias_loop:
    add [di],al
    inc di
    loop bias_loop

This turns a static source into a palette-index-shifted source for the next zoom frame. Because the VGA palette is animated separately, a one-byte add can change perceived lighting or bands across the whole image without touching RGB DAC values per pixel.

The timeline driver at image+0xda38..0xdaa6 wraps that builder with timer waits and calls into a loaded code pointer:

for frame_count supplied by caller:
    wait_one_tick()
    rebuild_biased_source()
    AH = 1
    call loaded_zoom_code_pointer
    advance BP/BX/DI zoom parameters

for another phase:
    wait_one_tick()
    AH = 2
    call loaded_zoom_code_pointer
    advance parameters in the opposite direction

The setup routine at image+0xdab0..0xdb49 loads zoompal, zoomcde2, and the numbered part resources, enters mode 13h, calls the loaded code once for initialization, then drives those frame loops. The inner mapper itself lives in the loaded overlay, but the host code tells us how it is used: a frame-wise parameter ramp feeding a resident mapper, with palette and source blocks swapped around it.

Dot Tunnel Data Flow

The dot tunnel is credited to Antibyte, and its data resource is named dot_data. The code island around image+0xe406 is much richer than a naive "put dots on a circle" loop. It does setup tables, 3D-ish rotation/projection, dynamic plotter generation, page switching, and timed object-state updates.

Initialization at image+0xe45c:

copy a 16-byte local table into a work buffer
write CRTC offset register 13h with 0x20
fill a repeated byte-pattern table at local offset 0x061e
build 400 row-address entries starting at 0xe700, adding 0x40 each row

The pattern table uses these eight bytes repeatedly:

84 a4 9c bc 8c ac 94 b4

That is a hint that plotting is planar/bit-mask oriented. A point's low x bits select a byte mask or code path, while the row table converts y to a screen address cheaply.

Dot Tunnel Projection Loop

The projector at image+0xe4b5 processes 64 points. The loop reads object coordinates from a data stream and applies a perspective divide:

for point in 0..63:
    x = signed_word(data++)
    y = signed_word(data++)
    z = signed_word(data++)

    scale = perspective_constant / z_or_depth
    screen_x = 160 + (x * scale) / divisor
    screen_y = 100 + (y * scale) / divisor

    store screen_x, screen_y into the point table

The actual 16-bit instruction pattern uses imul followed by idiv. That is slow compared with table lookup, so the demo keeps this loop to 64 points and does not run it for every screen byte. Once projected, point plotting is done through generated or selected byte-mask routines.

Dot Tunnel Rotation Loop

The rotation at image+0xe525 uses sine/cosine values from local tables around offsets 0x11a2 and 0x13a2. The core math is the standard 2D rotation:

x2 = y * cos - x * sin
y2 = y * sin + x * cos
z2 = 0 or carried depth/state

It stores transformed coordinates into a separate table. Again, this is not per-pixel. It is per control point or dot, after which the plotted output is made cheap.

GBU morphing vector-line motion

The early line/vector clip is not the later dot tunnel, but it shows the same real-mode design style: update a compact set of geometric state, draw through small specialized routines, then let the VGA page/display helpers present the result.

Dot Tunnel Generated Plotter

The most interesting dot-tunnel routine is the dynamic-code generator at image+0xe5c9. It writes executable bytes into a buffer and ends the generated routine with CBh, a far return.

The generator emits instruction fragments with inline addresses and masks. The shape is:

for projected point / byte lane:
    compute target byte address
    compute plane or bit mask
    append an instruction sequence that ORs the mask into that address
append retf

The point primitive at image+0xe80c converts coordinates to an address and a lane selection. It then uses a small call table at CS:02c5[bx] to choose the plane-specific emitter.

The practical result is that the per-frame drawing call does not have to recompute the whole plot address path for every point in the hot loop. It can run a custom piece of code generated for the current projected state. On a small real-mode CPU this is a reasonable trade: spend time building the routine, then execute a compact sequence of direct memory updates.

The main dot tunnel loop at image+0xea3b..0xeb22 ties it together:

clear the hidden VGA/page buffer
allocate/load dot_data
initialize row and mask tables
project/rotate points
generate the plot routine

while music/timer phase is inside this part:
    wait_one_tick()
    update tunnel/object state
    run generated plot routine
    switch displayed page/start address
    advance point stream

free buffers/resources
return to the demo sequencer

The page switch uses the same CRTC start-address discipline as other parts. The clear routine at image+0xe829 programs VGA graphics state and clears the buffer rows before plotting the next frame.

GBU dot tunnel motion

The continuation capture reaches this later section. Visually it is sparse white points falling into a curved tunnel, which matches the code: the expensive work is in rotating/projecting a small point set and generating the plotter, not in filling a dense bitmap every frame.

Greetings Scroller

The greetings scroller credited to Peci has a readable text block at image+0x1124a beginning with:

THE GREETINGS GO TO THESE GROUPS: CASCADA, DUST, IMPHOBIA, XOGRAPHY, ...

The setup at image+0x11318 loads heads5g and p3_zoom, clears VGA memory, then builds glyph blocks. The glyph builder around image+0x1135c..0x113d4 maps characters to font data like this:

glyph_offset = ((character - 0x20) << 6) + 0x1698

That means each glyph is 64 bytes, or eight rows times eight bytes in the source font/block format.

The builder lays out 25 characters at a time. Its row write pattern uses two different destination strides:

for each of 25 visible character cells:
    glyph = font + ((ch - 0x20) << 6)
    for glyph_row in 0..7:
        copy/expand row bytes into the work buffer
        di += 0x140 for one interleaved step
        di += 0x158 for the paired step

Those large strides are not accidental. The scroller is being prepared in a wider/interleaved work buffer so the display loop can fetch ready-made slices while CRTC offsets and raster waits reposition the visible window.

Greetings Scroller Inner Loop

The main loop at image+0x113db..0x1170a combines three jobs:

The bit-assembly loop is the dense part. It reads signed deltas, accumulates them into BX, indexes a table with that accumulated value, and then packs eight tested bits into one output mask byte.

Pseudocode for the hot mask builder:

for each output byte:
    bx += signed_delta_stream[next]
    value = table[bx]

    dl = 0
    if value & 0x80: dl |= bit_for_pixel_0
    if value & 0x40: dl |= bit_for_pixel_1
    if value & 0x20: dl |= bit_for_pixel_2
    if value & 0x10: dl |= bit_for_pixel_3
    if value & 0x08: dl |= bit_for_pixel_4
    if value & 0x04: dl |= bit_for_pixel_5
    if value & 0x02: dl |= bit_for_pixel_6
    if value & 0x01: dl |= bit_for_pixel_7

    write dl into the work buffer / VGA-facing slice

In assembly this is a sequence of test operations against 80h, 40h, 20h, 10h, 08h, 04h, 02h, and 01h, with conditional bit setting in DL. That means the scroller is not just moving a byte-aligned text bitmap. It is resampling or warping the glyph stream into a per-frame mask.

Every eight ticks the loop appends the next character from the greeting text, wraps the character pointer when needed, and continues. The same loop also waits on display-enable/retrace bits around raster-sensitive register writes, so the text effect and the VGA timing are woven together rather than separated into a pure "render then flip" model.

GBU end scroller motion

The captured end-scroller clip is the visible counterpart to that mask-building path. The letter forms are not just copied as a fixed bitmap; they slide through a warped, blocky display path where per-frame masks and VGA timing do much of the character.

Chess And Planar Pattern Parts

Several of the credited chess/parallax parts use the same Mode X vocabulary: plane masks, byte-pattern fills, CRTC start-address changes, and precomputed chess/image resources.

The helper around image+0x7a6a is a representative chess fill:

select map mask 1
fill N bytes with 55h
select map mask 2
fill N bytes with 33h
select map mask 4
fill N bytes with 0fh
select map mask 8
fill N bytes with 00h

The screen memory is not a packed linear 320x200 framebuffer here. Each write goes to one or more VGA planes depending on the sequencer map mask. Combining the four fills creates a repeated bitplane pattern that can be scrolled or used as a chess base by changing CRTC start and offset registers.

Other nearby loops copy plane blocks from loaded resources into A000h while calling the generic block blitter at 0299:0000. The visible trick is that the source data is already arranged for the plane order the VGA wants; the runtime chooses planes and offsets, then uses fast string copies.

GBU checker spiral motion

The late checker spiral is an example of why these plane-mask fills matter. The visible checker is geometrically animated, but the hot path can still be mostly plane-select, table-copy, and CRTC/palette timing rather than a chunky per-pixel redraw.

GBU polygon object motion

The polygon/object clip is deliberately included even though it is visually sparser than the plasma. It verifies that the long capture reaches the later object material listed in the NFO/resource sequence, where compact geometric state and specialized draw loops take over from the early full-screen effects.

Runtime-To-Code Concordance

The seven GIF clips now have an explicit map to the recovered loader, resource, timer, and VGA mechanisms.

The intro/title GIF maps to the loader/runtime setup and early presentation state rather than to a later effect kernel. It belongs with the startup notice, title, crest, and credits evidence: MyLZ has already restored the 80 KB runtime, the resource table and GUS/timer path are available, and the demo is presenting stable full-screen material before the table-heavy visual parts begin. This clip is useful because it prevents the title still from looking like a static asset dump; it is part of the same timed runtime capture.

The plasma GIF maps directly to resource plasma and the compositor at image+0xcdf2..0xcf11. The code precomputes phase offsets, flips the CRTC start address by 0x3e80, selects VGA plane groups with Sequencer map masks 03h and 0ch, and renders the frame as three byte-table reads plus two 8-bit adds and one planar write. That is why the fluid motion is credible on a 286-class target: expensive sine work is outside the pixel loop.

The vector-line GIF maps to the geometric-state style used before the dot tunnel. The article does not force it onto the later dot tunnel routine, but it does prove the same design language: update a compact set of line/vector coordinates, draw through small real-mode routines, then present through the shared VGA timing/page helpers.

The dot-tunnel GIF maps to dot_data and the code island around image+0xe406. The recovered path builds row/mask tables, projects and rotates 64 points, emits a far-returning generated plotter at image+0xe5c9, clears a hidden page, runs the generated plot routine, and switches the CRTC start address. The sparse white tunnel in the GIF matches that model: a small point set and generated byte-mask writes, not a dense bitmap renderer.

The end-scroller GIF maps to the greetings scroller around image+0x11318..0x1170a. The visible blocky warping is backed by a glyph builder using 64-byte character cells, a signed-delta stream, per-bit mask assembly, and display-enable/retrace waits around the VGA state changes. The clip is useful because a still would miss the per-frame mask evolution.

The checker-spiral GIF maps to the chess/planar pattern family. The code-side anchor is the plane-fill helper around image+0x7a6a: map masks 1/2/4/8 and pattern bytes 55h, 33h, 0fh, and 00h combine into chess/checker bitplanes that can be scrolled, copied, or transformed with CRTC and table state.

The polygon/object GIF maps to the later object material in the NFO/resource sequence, but the exact loaded overlay is intentionally bounded. It proves the long capture reaches the object section and that GBU changes from full-screen table/plasma effects into compact geometric/object state. The safe code-side evidence is the named resource system, loaded code overlays such as zoomcde2, frakcode, and mutamcde, the timer wait primitive, and the repeated part-pattern of load/run/free.

Across all clips, the common infrastructure is the real subject: MyLZ restores the 80 KB runtime, the 49-entry resource table loads named part data from the EXE overlay, IRQ0 advances GUS/music timing, VGA status port 3dah gates safe display changes, and Mode X plane masks plus CRTC starts make many effects look more expensive than their inner loops are.

Water And Wobbler Data

The water and picture-wobbler resources are named plainly:

watr_dat  641 bytes
watr_pic  38,861 bytes
wave      16,799 bytes
wave_sin   3,374 bytes
wave_ran   2,320 bytes

The resource sizes tell the method. watr_pic is the source image, while the small watr_dat, wave_sin, and wave_ran resources are control tables. The effect code does not need to compute wave displacement from scratch for every pixel. It uses table-driven offsets and pseudo-random or sine displacement streams to choose which source byte gets copied into the visible page.

The same table-driven pattern appears across the demo: expensive math is lifted into resources or per-frame phase setup, then the inner screen loop is a small sequence of indexed loads and stores.

Part Sequencing

GBU is a linked sequence rather than one persistent engine. The host runtime loads resources for a part, runs that part until the music/timer counter says to leave, frees the allocations, and moves on.

The common part pattern is:

load one or more named resources through image+0x0d93
set video mode or VGA registers for this part
load palettes, tables, or code overlays
install/enter calibrated timer mode if needed
run a frame loop:
    wait for tick or retrace
    update phase counters
    draw hidden page or current raster slice
    flip CRTC start address / update palette / advance music phase
restore or adjust VGA state
free resource segment blocks through image+0x0943
return to sequencer

That is why the executable can be both long and 286-friendly. Instead of keeping every part resident, it pays disk/overlay loading costs between parts. Inside a part, it uses conventional-memory segment blocks as local worlds.

What The Demo Is Doing Technically

GBU looks "Amiga-ish" because many parts are planar, palette-timed, and table-driven rather than chunky true-color or high-level 3D. On VGA that means the code leans hard on:

The inner loops are mostly exactly what one would want for 1993 real-mode PC demo code: movsb, stosb, rep movsw, byte adds, table lookups, and a small number of integer multiplies/divides only where the object count is low.

Known Limits Of This Pass

The MyLZ stream, relocation list, resource table, timer block, several VGA helpers, the plasma compositor, the dot-tunnel path, the greetings scroller, and the zoom host logic were reconstructed directly. I did not fully label every part in the 80 KB runtime or decompile the larger loaded code resources such as zoomcde2, frakcode, and mutamcde.

The important practical conclusion is still solid: GBU is not hiding behind a large protected-mode framework. It is a hand-linked real-mode demo with a custom MZ depacker, a simple named resource system inside its own executable, GUS timing integrated into IRQ0, and many specialized planar VGA kernels.