Analysis model: gpt-5.5 xhigh

# EKB by Skull - Technical Dissection

Subject: `EKB` by Skull.

`EKB` is a November 1992 MS-DOS VGA demo/advert by Skull. Demozoo describes it
as an advert for EKB, and Pouet lists the release as an MS-DOS demo from
November 1992.

Release year: 1992

This one is useful precisely because it is awkward. The archive looks simple:
one main executable, one config file, and one tiny side program. The main demo
is not simple internally. `!EKB.EXE` is a custom MZ package with a first-stage
entry wrapper, a second-stage LZ-style body restore, an overlay resource table,
and an embedded ProTracker module stored as a named resource. The visible demo
payload is therefore split between restored code and packed data records rather
than laid out as separate images or effects in the ZIP.

The archive and executable contain old BBS/Fido/contact material. This analysis
intentionally omits private contact details and only uses public production
metadata, archive names, hashes, and technical strings.

## Sources

- Demozoo production page:
  https://demozoo.org/productions/179371/
- Pouet production page:
  https://www.pouet.net/prod.php?which=69286
- Pouet Skull group page:
  https://www.pouet.net/groups.php?which=1412
- Scene.org file page:
  https://files.scene.org/view/mirrors/hornet/demos/1992/ekb.zip
- Scene.org download:
  https://files.scene.org/get/mirrors/hornet/demos/1992/ekb.zip

## Visual References

![EKB by Skull public Pouet screenshot](images/ekb-skull-pouet-screenshot.gif)

The public Pouet screenshot is still the only clean reference for the intended
main demo state: a black background, a green skull graphic, and a large `SKULL`
wordmark.

The local DOSBox-X run is useful for a different reason. It documents the
preflight boundary where the executable stops before the main demo:

| Runtime state | Frame | Notes |
| --- | --- | --- |
| config prompt | ![EKB DOSBox-X configuration prompt](images/ekb-skull-runtime-config-prompt.png) | The packaged `!ekb.cfg` is accepted and the program presents its red/black configuration prompt. |
| EMS warning | ![EKB DOSBox-X EMS warning after accepting config](images/ekb-skull-runtime-ems-warning.png) | After accepting the config, the run remains on the same prompt while the lower text warns to remove the EMS driver next time. This is the local failure boundary, not the intended main effect. |

The front-page card uses those images as still previews rather than generating
a GIF. The intended-effect reference is a public Pouet screenshot, while the
local DOSBox-X frames only document the configuration/preflight boundary.

## Runtime-To-Code Concordance

This is a bounded concordance because there is no clean local timed capture of
the main effect. The public Pouet GIF is evidence for the intended visual
state, while the local DOSBox-X frames prove the configuration/preflight failure
boundary.

| Evidence | Code anchor | What it explains |
| --- | --- | --- |
| Public Pouet screenshot showing green skull and `SKULL` wordmark | Overlay resources `SKULL`, `FONT`, `EKBPIC`, `EKBRGB`, and `EKBROT0..EKBROT5` | The intended main visual is consistent with named picture/font/palette resources in the overlay table. The GIF is a public reference, not a locally timed frame. |
| Local red/black configuration prompt | `!ekb.cfg` signature and saved setup bytes, setup strings `SKULL Configuration File`, `Soundblaster`, `No sound`, `286<12Mhz` | The executable reads/uses a real setup state before the main demo. The local capture is correctly classified as preflight/config, not as the main effect. |
| Local EMS warning frame | Setup/preflight strings and environment sensitivity noted by public user reports | The local failure is a boundary condition. It does not contradict the public main visual; it shows that the package refuses or stalls under this DOSBox-X environment. |
| MZ entry shape | Entry at file `0x23`, paragraph mover at `0x0023..0x0047`, far jump to `0C53:0B16` | The first visible program body is not the demo renderer. It is a custom wrapper that repositions packed/restored data before entering a second stage. |
| Restored body mechanics | LSB-first bit reader `0x78BD`, literal path around `0x7936`, match copy loop `0x7930..0x7934`, relocation pass `0x7951..0x7963` | The recovered code proves a custom LZ-style body depacker and 818-entry relocation repair pass. That explains why the DOS MZ header itself looks deceptively small. |
| Overlay structure | 11-entry resource directory at overlay offset `0x7986`, fixed 18-byte records, exact 64,000-byte outputs for `EKBROT0..4`, 768-byte `EKBRGB` | The package is a named-resource container. Several visual resources are exactly VGA-frame-sized, and the palette resource is exactly one 256-color DAC table. |
| Embedded music payload | `MODULE` resource, `M.K.` signature at offset 1080, exact ProTracker size match, WOWII-TPU marker | Audio is not guessed from the screenshot. A raw 4-channel ProTracker module is embedded as a named resource and fits the bundled PC modplayer marker. |
| Failed direct resource decode attempt | Resource table plus body-depacker mismatch boundary | The article treats names, sizes, offsets, raw MOD, and body depacker as strong evidence, but does not claim a complete framebuffer reconstruction from the visual resources. |
| Omitted BBS/contact material | Analysis boundary | Both archive text and executable strings contain old contact details. The article keeps the technical loader/resource story without republishing that material. |

The useful conclusion is narrow but strong: local runtime proves only the
preflight boundary; the intended main screen is public-reference evidence; the
code proves the custom MZ/depacker/resource/MOD container beneath both.

## Runtime Capture Notes

Local DOSBox-X capture did not produce a usable timed run of the main effect.
With dummy video and audio, `!EKB.EXE` reached only the red/black
configuration/preflight screen and then remained there until timeout. Disabling
EMS in the DOSBox-X configuration did not make the main visual sequence run.
Pouet user comments also report that the production is hardware-sensitive and
does not behave well in common DOSBox/PCem configurations; one later working
configuration mentioned a 486-class AMI clone with regular VGA.

For that reason this article does not assign exact timestamps to effects. The
technical analysis below is static analysis of the archive, the MZ wrappers,
the resource table, and the clean recovered inner loops.

## Archive Contents

Examined archive:

```text
ekb.zip   295,026 bytes
SHA-256   91013a50761768bd3d7e4f845355ff88d567363ac7b5677fe63e811eb5ba7214
```

Extracted files:

| File | Size | SHA-256 | Notes |
| --- | ---: | --- | --- |
| `!ekb.cfg` | 34 | `3d5a7e2a6e0268c75e05ac8a157da212e1635c2ea93f812826cfa33f3563a562` | short configuration file |
| `!ekb.exe` | 307,148 | `4d244fad1677acd81f052eb9354af7980e7d3ed9ba3d7e5cf604161b459634e8` | main demo, custom MZ package |
| `starprt2.exe` | 6,400 | `07955e28e32375e96598e48cdc4c6767a6af95158e0ca3c8ec3d484b613564df` | small side executable |

The config file is mostly a signature plus a few binary settings:

```text
53 4b 55 4c 4c 20 43 6f 6e 66 69 67 75 72 61 74
69 6f 6e 20 46 69 6c 65 0b 00 01 00 00 ff 0f 00
3c 00

"SKULL Configuration File" 0b 00 01 00 00 ff 0f 00 3c 00
```

Those last ten bytes are not text. They are the saved setup state read by the
demo.

## MZ Layout

`!EKB.EXE` has a deliberately non-normal MZ shape:

```text
file size:          307,148 bytes
header size:             32 bytes
relocations:              1
initial CS:IP:      0000:0003
initial SS:SP:      136e:4000
MZ image size:       31,110 bytes
entry file offset:   0x0023
overlay start:       0x7986
overlay size:       276,038 bytes
```

The single relocation is not a sign of a trivial program. It is a sign that the
program is carrying its own relocation/depack machinery instead of leaving the
final code image in ordinary DOS-loader form.

`STARPRT2.EXE` has the same family feel:

```text
file size:            6,400 bytes
header size:             32 bytes
relocations:              1
initial CS:IP:      0000:0003
initial SS:SP:      062d:0080
```

Both executables enter at offset `0003`, immediately after the MZ signature
area, which is a common custom-wrapper trick: the header is kept minimal and
the real loader begins almost at the front of the file.

## First Entry Wrapper

The main executable's DOS entry starts at file `0x23`. The first instructions
are a segment-copy wrapper:

```asm
0023  cld
0024  push es
0025  push ds
0026  push cs

0027  mov  ax,cs
0029  add  [0138],ax
002d  mov  dx,07a1h
0030  add  ax,dx
0032  mov  bx,ax
0034  add  ax,0573h

0037  mov  ds,bx
0039  mov  es,ax
003b  xor  si,si
003d  xor  di,di
003f  mov  cx,0008h
0042  rep  movsw
0044  dec  bx
0045  dec  ax
0046  dec  dx
0047  jns  0037
```

The direction flag is cleared, then eight words at a time are copied between
moving source and destination segments. The loop decrements both segment bases
after each tiny copy. This is not a normal `memcpy`. It is relocating a block
of packed/restored code downward or upward through memory while preserving
overlap safety at the paragraph level.

The important details:

```text
source segment starts at CS + 0x07a1
destination starts at source + 0x0573
copy unit is 8 words = 16 bytes
segment registers are decremented after every copy
loop count is driven by DX down to -1
```

Because each paragraph is 16 bytes, copying eight words while moving the
segment by one paragraph makes the loop a paragraph shifter. It is effectively
re-laying the packed image at a different segment address before entering the
second-stage code.

After that move, the stub enters the restored body through a far jump:

```asm
0055  ljmp 0c53:0b16
```

The exact destination is load-segment-relative. The useful point is that the
MZ entry wrapper is only a loader, not the application body.

## Second-Stage Depacker

A clean depacker kernel appears near the end of the MZ image. The core bit
reader is:

```asm
78bd  shr  bp,1
78bf  dec  dl
78c1  jne  78c8
78c3  lodsw
78c4  mov  bp,ax
78c6  mov  dl,10h
78c8  ret
```

This is an LSB-first 16-bit reservoir:

```text
BP holds the active 16 control bits.
The low bit becomes the carry flag after SHR.
DL counts remaining bits.
When DL reaches zero, LODSW refills BP from DS:SI and resets DL to 16.
```

The main copy loop uses that bit to choose between a literal byte and a
back-reference:

```asm
7936  call 78bd
7939  jae  793e
793b  movsb              ; literal: copy input byte to output
793c  jmp  7936

793e  call 78bd
7941  lodsb              ; low offset/control byte
7942  mov  bh,ffh
7944  mov  bl,al
7946  jb   78c9          ; long class
7948  call 78bd
794b  jb   7923          ; short class
794d  cmp  bh,bl
794f  jne  792e
```

The visible classes are:

```text
control bit 1:
  literal byte, MOVSB

control bit 0:
  read another bit and one byte
  select one of several match classes
  build a negative BX offset, usually with BH = 0xff
  build CX as the match length
  copy from already-produced output
```

The byte-copy back-reference loop is the heart of the unpacker:

```asm
7930  mov  al,es:[bx+di]
7933  stosb
7934  loop 7930
```

That form matters. `DI` is the output cursor. `BX` is a negative distance from
the current output cursor. The loop reads from `ES:[DI + distance]` and writes
one byte to `ES:DI`, advancing `DI` via `STOSB`. Because the read address is
computed from the current `DI` each time, overlapping matches naturally expand
run-length data:

```text
if BX = -1 and CX = 80:
  each output byte copies the previous output byte
  one byte turns into an 80-byte run

if BX = -320:
  the stream copies from the previous VGA scanline
  useful for image-like deltas
```

In pseudocode:

```c
uint16_t bp = next_word();
uint8_t dl = 16;

int bit(void) {
    int c = bp & 1;
    bp >>= 1;
    if (--dl == 0) {
        bp = next_word();
        dl = 16;
    }
    return c;
}

for (;;) {
    if (bit()) {
        *out++ = *in++;
        continue;
    }

    /* The real code has several compact classes here. */
    class_bit = bit();
    token = *in++;
    distance = decode_negative_offset(class_bit, token, bitstream);
    length = decode_length(class_bit, token, bitstream);

    while (length--) {
        *out = *(out + distance);
        out++;
    }
}
```

That is the same conceptual family as LZSS/LZ77, but the token classes are
custom. The implementation is tuned for tiny real-mode code: carry from `SHR`
is the branch condition, `LODSB/LODSW` consume the stream, and `STOSB` advances
the output pointer without extra arithmetic.

## Relocation After Depack

The second-stage depacker does not simply jump into raw bytes. It also performs
relocation repair:

```asm
7951  pop  bp
7952  push cs
7953  pop  ds
7954  mov  si,001c
7957  mov  cx,0332h

795a  lodsw
795b  mov  bx,ax
795d  lodsw
795e  mov  es,ax
7960  add  es:[bx],bp
7963  loop 795a
```

The exact register-save context is larger than the snippet, but the behavior
is clear: it walks a relocation table starting at `CS:001c`, reads offset and
segment-style words, and adds the load delta in `BP` to each target word. The
count is `0x0332`, so this stage repairs 818 relocation targets.

Only after that does it enter the restored program:

```asm
7981  ljmp 0000:10fe
```

This is why the MZ header itself has only one DOS relocation. The real
relocations are hidden inside the custom restored image.

## Overlay Resource Table

The overlay starts at file offset `0x7986`. The first byte is the resource
count:

```text
0x0b = 11 resources
```

Each resource record is 18 bytes:

```text
name[8]              ASCII, padded with spaces
unpacked_size:u16
packed_offset:u32    relative to overlay start
packed_size:u16
check:u16            per-resource check/metadata word
```

Parsed table:

| # | Name | Unpacked | File offset | Packed | Check | Role |
| ---: | --- | ---: | ---: | ---: | ---: | --- |
| 0 | `EKBROT0` | 64,000 | `0x007a4d` | 31,650 | `0x6226` | full VGA-sized packed visual data |
| 1 | `EKBROT1` | 64,000 | `0x00f5ef` | 29,312 | `0x2d9d` | full VGA-sized packed visual data |
| 2 | `EKBROT2` | 64,000 | `0x01686f` | 32,397 | `0x7e4c` | full VGA-sized packed visual data |
| 3 | `EKBROT3` | 64,000 | `0x01e6fc` | 31,033 | `0x76f1` | full VGA-sized packed visual data |
| 4 | `EKBROT4` | 64,000 | `0x026035` | 28,606 | `0x5883` | full VGA-sized packed visual data |
| 5 | `EKBROT5` | 43,016 | `0x02cff3` | 22,471 | `0xca98` | smaller packed visual data |
| 6 | `EKBRGB` | 768 | `0x0327ba` | 691 | `0x3adc` | VGA palette-sized resource |
| 7 | `SKULL` | 64,000 | `0x032a6d` | 6,662 | `0x6fd5` | named visual resource |
| 8 | `FONT` | 54,000 | `0x034473` | 16,118 | `0x6f1d` | font/bitmap resource |
| 9 | `EKBPIC` | 64,000 | `0x038369` | 22,297 | `0x7d2b` | named picture resource |
| 10 | `MODULE` | 54,602 | `0x03da82` | 54,602 | `0x9162` | raw ProTracker module |

The names are the strongest high-level map of the demo:

```text
EKBROT0..EKBROT5   rotation/animation frame resources
EKBRGB             256-color VGA palette
SKULL              skull picture resource
FONT               large bitmap/font resource
EKBPIC             EKB picture resource
MODULE             music payload
```

The `EKBROT*` output sizes are exactly VGA mode-13h frame-sized for the first
five records: 320 * 200 = 64,000 bytes. That does not prove they are stored as
direct ready-to-blit framebuffers, but it is a strong sign that the resource
unpacker ultimately feeds full-screen chunky VGA pages.

The small `EKBRGB` output size is also exact:

```text
256 colors * 3 DAC channels = 768 bytes
```

So the likely render path is:

```text
load/depack visual resource -> 64,000-byte screen/work buffer
load/depack EKBRGB          -> 768-byte DAC palette
display/cycle/blend/copy    -> A000h
play MODULE                 -> Sound Blaster or no-sound path
```

## Embedded Module

The `MODULE` resource is not compressed inside the resource table. Its packed
and unpacked sizes are both 54,602 bytes, and the bytes have a normal
ProTracker shape:

```text
module title field: 20 zero bytes
signature:          M.K. at offset 1080
song length:        17
restart byte:       120
max pattern index:  7
patterns:           8
sample data sum:    45,326 bytes
expected size:      1084 + 8*1024 + 45,326 = 54,602
SHA-256:            3e6f53c181e06c0881d68718216d3ad5fb8c7a7e5654d8775c7ed39062ced570
```

The size equality is not an accident: unlike the visual resources, the module
is already stored in final form. The player code can seek to the resource data
and hand the MOD structure to the music engine without inflating it first.

`!EKB.EXE` also contains a public technical marker for the player code:

```text
WOWII-TPU's Copyright (c) 1992 by Jan Ole Suhr, Modplayer programming
```

That fits the archive's early-1990s PC-demo pattern: Amiga-style module data
inside a DOS VGA production, played by a bundled Sound Blaster capable player.

## VGA and Setup Clues

The packed/restored executable contains direct VGA and DOS markers:

```text
A000h     VGA frame-buffer segment
03C8h     DAC write index
03DAh     VGA input status / vertical retrace polling
INT 10h   BIOS video mode calls
INT 21h   DOS file/config/setup calls
```

There are also setup/config strings:

```text
SKULL Configuration File
Soundblaster
No sound
286<12Mhz
```

The setup state therefore covers at least audio mode and speed/hardware
selection. That also explains why the local DOSBox-X run can stop before the
main visual: this package is not just drawing to VGA immediately; it checks
environment assumptions first, reads its config, and then selects a runtime
path.

The expected palette upload loop in this style is small and direct:

```asm
mov  dx,03c8h
xor  al,al
out  dx,al          ; start at DAC index 0
inc  dx             ; 03c9h data port
mov  cx,0300h       ; 768 RGB bytes
rep  outsb          ; stream palette bytes
```

The exact local disassembly around every VGA port is partly obscured by the
custom packing, but the resource table makes the 768-byte DAC payload explicit.

## What The Resource Player Is Probably Doing

The resource naming suggests a short advert-style visual sequence:

```text
1. load `EKBRGB` and initialize the palette
2. show or build the `SKULL` picture
3. use `EKBROT0`..`EKBROT5` as rotation frames or transform states
4. use `FONT` for the large wordmark/scroller/text layer
5. use `EKBPIC` for the EKB-specific picture
6. play `MODULE` while the visual sequence runs
```

I attempted a direct resource decompression pass using the clean LZ-style
depacker structure above. Several resources can be expanded to their advertised
output sizes with a related bitstream interpretation, but the result does not
produce reliable direct framebuffer images. That means one of three things is
true:

```text
the resource compressor has a related but not identical token format;
the resource output is post-processed before display;
or the clean body-depacker loop is not the exact visual-resource unpacker.
```

The article therefore treats the resource table as a structural map, not as a
complete frame decode. The strong claims are: names, sizes, offsets, the raw
MOD, and the recovered MZ depacker/relocation behavior. The weak claim is the
precise visual ordering inside the demo, which still needs a successful
hardware or emulator capture.

## Inner-Loop Summary

The most important recovered loops are:

```text
Paragraph mover:
  Copies 16 bytes at a time while decrementing DS/ES.
  Used by the entry wrapper to reposition the packed/restored body.

Bit reader:
  SHR BP,1 exposes one LSB-first control bit in carry.
  DL counts down from 16.
  LODSW refills BP when the reservoir is empty.

Literal path:
  control bit set -> MOVSB from input stream to output stream.

Match path:
  control bit clear -> decode token class and negative distance.
  CX becomes length.
  Copy loop reads ES:[DI+BX] and writes ES:DI with STOSB.
  Overlap is intentional, so short distances generate runs.

Relocation pass:
  Walks 0x0332 table entries after unpack.
  Adds the load delta to each restored relocation target.
  Far-jumps into the repaired image.

Resource loader:
  Uses an 11-entry overlay directory.
  Names resources with fixed 8-byte ASCII names.
  Stores exact output sizes, packed offsets, packed sizes, and check words.
```

That makes `EKB` more sophisticated than its small public footprint suggests.
It is not just a single mode-13h picture and a scroller. It is a custom DOS
demo container: loader, body restore, relocation repair, named resources,
palette data, full-screen visual records, and an embedded MOD.
