Analysis model: gpt-5.5 xhigh

Buttman - Twilight Zone

Subject

Buttman - The Terminated v2 is a 1992 MS-DOS demo/dentro by Twilight Zone. The package examined here is the Hornet 1992 archive:

buttman.zip      508233 ***   Buttman by Twilight Zone

Release metadata:

Sources:

The NFO includes an old historical contact block. That block is deliberately not reproduced here.

Runtime Capture

Buttman runtime contact sheet

The contact sheet above is from a local DOSBox-X capture of the original archive. The startup shell and sound-setup frames are not published. Sound was muted in the emulator mixer, but an SB16-compatible device was exposed so the program could pass its setup path.

Emulator:        DOSBox-X 2026.01.02 SDL2
Capture date:    2026-06-19
Machine:         svga_s3
CPU core/cycles: normal, 20000 cycles
Sound:           muted in mixer; SB16-compatible hardware exposed
Setup input:     SoundBlaster path, 23 kHz selection
Command:         dx-capture /v BUTTMAN.EXE
Capture stream:  MPEG-TS/H.264, 640x400 source, 179.150477 seconds
Stop condition:  external timeout after the useful visual sequence
Timing zero:     beginning of captured stream after the screen was cleared

Representative observed timestamps:

The sequence GIF below is assembled directly from the ten published runtime frames. It shows the practical timeline at a glance: warning card, caped character gag, boot crush, title card, and the later red/blue dotted grid as it rotates into a clearer 3D surface.

Buttman runtime sequence GIF showing warning card, character gag, title, and red/blue dotted grid phases

Timestamp Screen state
00:05.000 Full-screen warning card: red triangle/exclamation art with blue text.
00:10.000 Warning card remains stable; useful as a palette/text reference.
00:15.000 Small caped character sprite appears on black, positioned toward the right.
00:20.000 Same sprite sequence, now shifted left/down as the gag continues.
00:30.000 Boot-crush gag: large boot over a red splat.
00:45.000 Main BUTTMAN title card with oval emblem and subtitle.
01:00.000 Title card remains, shifted/framed differently by the capture phase.
01:20.000 Red/blue dotted grid appears as a flat tilted plane.
01:40.000 Dot grid continues with different red/blue phase distribution.
02:10.000 Dot grid has rotated into a more obvious 3D surface orientation.

The captured run holds black after the visible section. I stopped the capture externally rather than treating the black tail as a separate effect.

Runtime-To-Code Concordance

The published GIF and still frames are direct DOSBox-X runtime frames. The code evidence is strongest for the carrier/depacker and archive/resource structure; the detailed post-retf renderer still needs a separate restored-runtime map. This table keeps that boundary visible.

Runtime evidence Code path / data path What it proves
Startup and sound setup omitted from the public frames NFO hardware notes plus the captured setup path with SB-compatible hardware exposed and 23 kHz selected. The public media starts after local setup screens; those setup frames are intentionally not part of the visual article media.
Warning card at 00:05.000 and 00:10.000 Archive contains packed picture/data files buttman.012 through buttman.026, each with the Twilight Zone packer notice. The warning page fits the sidecar picture-resource model rather than being generated by the carrier unpacker.
Caped character at 00:15.000 and 00:20.000 Same resource set plus the post-unpack runtime handoff after copied-stage retf at offset 02B1h. The sprite gag is runtime content reached only after the custom EXE image has been expanded and relocated.
Boot-crush gag at 00:30.000 Resource-driven visual phase with pre-rendered indexed art; exact file-to-frame mapping remains for a deeper restored-runtime pass. The article should not claim a recovered sprite blitter yet; current evidence is runtime capture plus archive layout.
Main BUTTMAN title card at 00:45.000 and 01:00.000 Packed sidecar pictures and restored runtime image, not clear strings or assets embedded directly in the MZ carrier. The title card is part of the loaded resource show chain, separate from the high-memory unpacker.
Red/blue dotted grid at 01:20.000, 01:40.000, and 02:10.000 Runtime behaviour indicates a procedural 3D point lattice or plane transform; the current article has not yet mapped the exact restored loop. This is the main remaining code-analysis target: the visual is clearly procedural, but the article only bounds it from capture evidence.
buttman.exe entry shape MZ carrier with CS:IP = FFF0:0100, COM-like entry, high-memory copied stage, backward packed-body mover, and final relocation/retf. The executable is not a normal flat MZ program; the visible runtime is behind a custom or modified PKLITE-family wrapper.
Literal/match decompressor Bit reservoir in BP, match-length prefix tables, match-distance decode, overlapping rep movsb, segment normalization, and literal xor al,dl. The wrapper is not plain PKLITE; the literal XOR transform is a deliberate alteration that blocks trivial literal extraction.
Four buttman.001 through buttman.004 modules External M.K. ProTracker modules titled TZPACK'92; setup path exposes Soundplayer, SB/SB Pro, and speaker choices. Audio is resource-driven and selected by the runtime setup, even though the published capture was muted.
Black tail after visible sequence External timeout stopped the capture after the useful section. The black tail is not treated as a separate effect or natural ending.

So the current page explains the archive, unpacker, and runtime evidence faithfully, while marking the dot-grid and exact sidecar picture loader as the next deeper recovered-runtime targets.

Archive Contents

Examined archive:

a3e9f27625595f19676469d919c8d9bc9997cd290b2d9171f8dc4009f82dcc42  buttman.zip

Key extracted files:

b6032dd2535e744fa101380508f41ba388468a97b9f1ccb3fed1dc80ae63fed1  buttman.exe    22568 bytes
1a2a8063052d45959102c76c88637186c33f21901bfc9628fceba367da80cbe9  demosite.com    1709 bytes
7f43149d2b98bb6ce7b01f2178752789f6cc8749597b470dbeee47937c77dc0a  twilight.nfo    3971 bytes

The archive has 29 files and a strong part-file shape:

File range Role evidence
buttman.001 - buttman.004 Four M.K. ProTracker modules, each titled TZPACK'92.
buttman.005 - buttman.011 Raw-looking binary data, likely samples, masks, tables, or unwrapped sprite data.
buttman.012 - buttman.026 Twilight Zone packed picture/data files. These begin with a plain packer notice string.
buttman.exe Main MZ launcher/visual executable.
demosite.com Small separate COM file from the package; not needed for the captured visual run.
twilight.nfo Release notes, hardware notes, credits, and omitted historical contact block.

The packed picture/data files identify their wrapper in plain text:

Packed by Twilight Zone in 1992 so you won't edit this nice picture, he he!!

This matters because the demo is not one monolithic compressed EXE. The EXE has its own loader/depacker, then the running demo consumes a pile of sidecar resources. That matches the runtime: static cartoon/title cards from picture parts, separate music modules, and a later procedural dot-grid effect.

Main Executable Header

buttman.exe is a DOS MZ executable with an entry-wrap layout similar to several early packers:

file size              22568 bytes
MZ header size            96 bytes
load image size        22472 bytes
relocation entries         1
minimum extra alloc     6604 paragraphs
maximum extra alloc    65535 paragraphs
entry point          CS:IP = FFF0:0100
initial stack        SS:SP = 0583:0200
relocation table     file offset 0x0052
overlay number       0

The header is 0x60 bytes, so the loaded image begins at file offset 0x0060. With CS:IP = FFF0:0100, DOS enters at PSP:0100, which also maps to file offset 0x0060. That is why the visible entry code starts exactly where a COM program would start, even though the carrier is an EXE.

Clear text in the main executable is minimal:

file offset 0x0091  " Not enough memory$"

There is no clear PKLITE copyright banner in this executable. The carrier is structurally close to a PKLITE-style high-memory unpacker, but the byte decode path is modified. I treat it below as a custom or modified PKLITE-family wrapper, not as plain PKLITE.

Entry Stub

The entry stub is tiny. Its job is not to run the demo; it checks memory, moves the stack upward, copies the real unpacker to a high segment, and far-returns into that copied code:

0060: mov ax,1f53h
0063: mov dx,057dh
0066: add ax,0000h
0069: cmp [0002h],ax       ; PSP top-of-allocation segment
006d: jae 0089h            ; not enough memory
006f: sub ax,0020h
0072: cli
0073: mov ss,ax
0075: sti
0076: sub ax,0025h
0079: mov es,ax
007b: push ax              ; destination segment for copied unpacker
007c: mov cx,0126h         ; 0x24c bytes
007f: xor di,di
0081: push di              ; destination offset 0000h
0082: mov si,0144h
0085: cld
0086: rep movsw
0088: retf

Important points:

The failure branch prints the $-terminated memory error through int 21h, AH=09h and exits with int 20h. No VGA or file work has happened yet.

Copied-Stage Repositioner

The copied stage starts at file offset 0x00a4. It first moves the compressed image to the segment range where the bitstream depacker expects to read it:

00a4: std
00a5: mov bx,ds
00a7: push bx
00a8: add bx,0039h
00ab: add bx,dx
00ad: mov bp,cs
00af: mov ax,dx
00b1: and ah,0fh
00b4: mov cl,04h
00b6: mov si,dx
00b8: shl si,cl
00ba: shr dx,cl
00bc: inc dh
00be: mov cx,si
00c0: shr cx,1
00c2: dec si
00c3: dec si
00c4: mov di,si
00c6: sub bp,ax
00c8: sub bx,ax
00ca: mov es,bp
00cc: mov ds,bx
00ce: rep movsw
00d0: mov ax,1000h
00d3: mov ch,80h
00d5: dec dh
00d7: jne 00c6h

This is a backward paragraph/block mover:

  1. std makes rep movsw walk downward.
  2. DX is split into a paragraph count and a low offset contribution.
  3. SI and DI start near the end of the current chunk.
  4. BP becomes the destination segment and BX becomes the source segment.
  5. Each pass copies a chunk backward with rep movsw.
  6. dec dh / jne repeats until the whole packed body has been relocated.

The backward copy prevents the mover from destroying source bytes that have not yet been consumed. After the move, the code restores forward string direction, sets DS to the relocated input stream, restores the original program segment into ES, and prepares to write the unpacked program at ES:0100.

00d9: cld
00da: mov ds,bp
00dc: pop es
00dd: push es
00de: mov di,0100h
00e1: xor si,si
00e3: lodsw
00e4: xchg ax,bp           ; first 16-bit bit reservoir
00e5: mov dx,0010h         ; bit count / literal XOR source
00e8: jmp 0124h

The push es at 00dd is also important later. The relocation finisher pops that saved segment when it is time to restore the final program's MZ relocation entries.

Bit Reservoir

The depacker uses BP as a 16-bit bit reservoir. Bits are consumed with shr bp,1; the carry flag becomes the next decision bit. DX is mostly a bit counter, but Buttman's literal path also uses DL as an XOR value.

The refill sites all have the same shape:

00ea: lodsw
00eb: xchg ax,bp
00ec: mov dl,10h
00ee: jmp 0134h

There are several refiller labels because the code wants to resume at the exact point where a bit was needed. Instead of a subroutine call, each out-of-bits branch loads a fresh word, resets DL to 0x10, and jumps back into the relevant decision state.

The top-level dispatcher:

011a: lodsw
011b: xchg ax,bp
011c: mov dl,10h
011e: jb 012bh             ; previous carry selects match path
0120: lodsb
0121: xor al,dl
0123: stosb
0124: shr bp,1
0126: dec dx
0127: je 011ah
0129: jae 0120h            ; carry clear: literal
012b: ...                  ; carry set: match

That lodsb / xor al,dl / stosb sequence is the unusual part. A plain LZ/PKLITE literal path would normally write the source byte directly. Buttman XORs every literal byte with the current low byte of DX. Because the refill sets DL = 0x10 and dec dx then walks the counter down, the XOR mask is tied to the bit position inside the current reservoir word. This is enough to break simple literal-stream extraction while keeping the decompressor almost as small as the normal version.

In pseudocode, the top loop is:

refill: reservoir = next_word(); bits_left = 16
loop:
    bit = reservoir & 1
    reservoir >>= 1
    bits_left--
    if bits_left == 0: refill, then resume
    if bit == 0:
        out[di++] = next_byte() XOR bits_left_low_byte
    else:
        decode length and distance, then copy from already-output bytes

Strictly, the literal XOR uses the exact DL value at the instruction, not an abstract bits_left variable. The model above is just the readable equivalent.

Match-Length Decode

The match path begins at 012b. It builds a small prefix code in BX, then maps short prefixes through a table embedded in the copied unpacker:

012b: xor cx,cx
012d: xor bx,bx
012f: shr bp,1
0131: dec dx
0132: je 00eah
0134: rcl bx,1
0136: shr bp,1
0138: dec dx
0139: je 00f0h
013b: rcl bx,1
013d: cmp bl,02h
0140: jae 016ah
0142: shr bp,1
0144: dec dx
0145: je 00f6h
0147: rcl bx,1
0149: test bx,bx
014b: je 0165h
014d: shr bp,1
014f: dec dx
0150: je 00fch
0152: rcl bx,1
0154: cmp bl,05h
0157: jb 0165h
0159: shr bp,1
015b: dec dx
015c: je 0102h
015e: rcl bx,1
0160: cmp bl,0ch
0163: ja 01e1h
0165: mov bl,cs:[020eh+bx]
016a: xchg bx,cx

This is a compact variable-length prefix tree:

The longer path at 01e1 is another prefix extension. It uses a second table near 0219h, and the value 0x19 is a marker meaning "read one extra byte":

01e1: and bl,03h
...
0204: mov cl,cs:[0219h+bx]
0209: cmp cl,19h
020c: je 0211h
020e: jmp 016ch
0211: lodsb
0212: add cl,al
0214: adc ch,00h
0217: cmp al,0feh
0219: jae 021eh
021b: jmp 016ch

So most matches have a short table-derived length. A special long-length token adds a literal extension byte. Extension bytes 0xfe and 0xff are also control markers for segment normalization and end-of-stream handling.

Match-Distance Decode

Once CX holds the length, the decoder builds the distance in BX:

016c: xor bx,bx
016e: cmp cx,0002h
0171: je 019dh
0173: shr bp,1
0175: dec dx
0176: je 0108h
0178: jb 019dh
017a: shr bp,1
017c: dec dx
017d: je 010eh
017f: rcl bx,1
0181: shr bp,1
0183: dec dx
0184: je 0114h
0186: rcl bx,1
0188: shr bp,1
018a: dec dx
018b: jne 0191h
018d: lodsw
018e: xchg ax,bp
018f: mov dl,10h
0191: rcl bx,1
0193: cmp bl,02h
0196: jae 01aeh
0198: mov bh,cs:[0234h+bx]
019d: lodsb
019e: mov bl,al

The distance is a hybrid:

The extended high-distance path continues through several thresholds:

01ae: shr bp,1
01b0: dec dx
01b1: jne 01b7h
01b3: lodsw
01b4: xchg ax,bp
01b5: mov dl,10h
01b7: rcl bx,1
01b9: cmp bl,08h
01bc: jb 0198h
...
01c9: cmp bl,17h
01cc: jb 0198h
...
01d9: and bx,00dfh
01dd: xchg bl,bh
01df: jmp 019dh

The and bx,00dfh / xchg bl,bh pair is a tight way to finish a wider offset class and move the accumulated bits into the high-byte position before reading the low distance byte.

Match Copy Inner Loop

The actual LZ copy is the classic overlapping backward-window copy:

019d: lodsb
019e: mov bl,al
01a0: push si
01a1: mov si,di
01a3: sub si,bx
01a5: cli
01a6: rep movsb es:[si] -> es:[di]
01a9: sti
01aa: pop si
01ab: jmp 0124h

In normal 8086 notation, rep movsb reads and writes through ES here. The code temporarily repurposes SI from "compressed input pointer" into "source offset inside the already-unpacked output":

copy_source = di - distance
repeat length times:
    ES[di] = ES[copy_source]
    di++
    copy_source++

Because movsb naturally increments both pointers and reads from the same output segment, it supports overlapping matches. That is what lets a short back-reference expand repeated bytes or repeated patterns. The push si and pop si preserve the compressed input pointer around the copy.

The cli/sti pair around rep movsb is typical of old DOS unpackers that do not want an interrupt to observe or disturb a transient DS/ES/stack state. It is not a rendering wait. This is still only the unpack phase.

Segment Normalization and End Marker

The decompressor writes into a growing real-mode segment:offset stream. When the output offset gets too far from a comfortable range, the code normalizes ES:DI; at the same time it normalizes the compressed input pointer DS:SI:

021e: push ax
021f: lea bx,[di-2000h]
0223: and di,000fh
0226: add di,2000h
022a: mov cl,04h
022c: shr bx,cl
022e: mov ax,es
0230: add ax,bx
0232: mov es,ax
0234: mov ax,ds
0236: mov bx,si
0238: and si,000fh
023b: shr bx,cl
023d: add ax,bx
023f: mov ds,ax
0241: pop ax
0242: cmp al,0ffh
0244: je 026fh
0246: jmp 0124h

This keeps real-mode offsets bounded while the logical stream advances:

This is one of the easiest places to misread the code. It is not switching video pages or moving the demo's framebuffer. It is only keeping the unpacker's far pointers sane while expanding an EXE image.

Relocation Restore and Final Far Return

After the 0xff end marker, the unpacker applies relocations and transfers to the restored executable:

026f: pop bx
0270: mov bp,bx
0272: add bx,0010h
0275: mov dx,bx
0277: mov es,dx
0279: lodsw
027a: inc ax
027b: je 028fh             ; AX was FFFFh: relocation stream finished
027d: dec ax
027e: je 0277h             ; AX was 0000h: switch/advance relocation group
0280: xchg ax,cx
0281: nop
0282: lodsw
0283: xchg ax,di
0284: add es:[di],bx
0287: loop 0282h
0289: add dx,0fffh
028d: jmp 0277h

The saved original program segment is popped into BX. The unpacked image is based at BX + 10h, which accounts for the PSP paragraph. The relocation stream is compact:

That add dx,0fffh group stride is a compact way to cover a large restored image without storing a full segment value beside every relocation offset.

The final tail restores stack and entry point:

028f: lodsw
0290: add ax,bx
0292: cli
0293: mov ss,ax
0295: lodsw
0296: mov sp,ax
0298: sti
0299: lodsw
029a: add bx,ax
029c: push bx              ; restored CS
029d: lodsw
029e: push ax              ; restored IP
029f: mov es,bp
02a1: mov ds,bp
02a3: xor ax,ax
02a5: mov bx,ax
02a7: mov cx,ax
02a9: mov dx,ax
02ab: mov bp,ax
02ad: mov si,ax
02af: mov di,ax
02b1: retf

After this retf, the carrier is done. The runtime demo starts in the restored program image with a cleaned register set and corrected segment references.

Runtime Structure Inferred From Evidence

The visible runtime divides cleanly into several systems:

  1. Setup and hardware selection run before the capture's published frames. The NFO and menu path agree on VGA plus optional Sound Blaster-family output.
  2. The warning and cartoon/title sections are resource-driven. The archive has many Twilight Zone packed picture/data files, and the captured cards look like pre-rendered indexed art rather than procedural VGA effects.
  3. The four TZPACK'92 ProTracker modules are external resources, so the restored program almost certainly contains a loader/player dispatcher rather than embedded music data.
  4. The red/blue dot-grid section is procedural. It behaves like a small 3D point lattice or height/plane transform: points rotate in perspective while color phase splits them into red and blue populations.

I have not published a post-retf runtime disassembly for this article. The inner loops above are therefore the loader/depacker loops that are recovered with high confidence. The renderer side is described from file layout and capture evidence, not from a complete symbolic reconstruction of the restored program.

Reconstruction Notes

To continue this one deeper, the next useful breakpoint is the carrier's final retf at copied-stage offset 02b1h. A debugger run can stop there, dump the restored program image, and then map file/resource calls from the unpacked runtime. That would answer the remaining detailed questions:

For the present pass, the important correction is that the visible EXE is not just a generic PKLITE wrapper. Its copied-stage literal loop includes the xor al,dl transform, and its relocation tail uses a compact sentinel/count stream before far-returning into the real demo.