Analysis model: gpt-5.5 xhigh, sol high

Last edited: 2026-08-25

# Drunken by Drunken ROM Group - Technical Dissection

`drunken.zip` appears in the Hornet 1991 demo index as `Drunken by Drunken ROM
Group`. The executable and plain text payload timestamps are from April 1991;
the alternate encoded text file is from November 1991; the external music/sample
file has a later January 1993 timestamp. The safest release metadata is:

Release year: 1991, with a later timestamp on the bundled `mod` payload.

This is a compact VGA board/ad intro rather than a multipart effects demo. The
visible program shows a chrome-styled `DRUNKEN ROM GROUP` logo, a white gothic
slogan, moving red/blue side blocks, and a red bottom scroller inside a grey
rail. The bottom scroller contains private postal/contact-ad text, so the public
image below masks that strip. The text files are also described only
structurally, not reproduced.

![Drunken music-driven side-block pulses, direct silent runtime](images/drunken-runtime-side-pulses.gif)

This is a continuous direct `00:04..00:12` graphics-time excerpt from a fresh
silent run, reduced from approximately 70.086 fps to 10 fps. The static logo
pixels do not move; the four authored block regions appear and decay because
the program rewrites their DAC entries from four player-state slots. Output
rows `y=340..399` on the 640x400 capture canvas are masked pure black in every
frame to omit the private bottom scroller. The visible field above that mask is
uncropped and otherwise unaltered.

![Drunken DOSBox-X runtime contact sheet, private scroller masked](images/drunken-runtime-contact.png)

The front-page card uses the direct masked GIF. The older masked contact sheet
remains secondary article evidence only. Both show the same one-screen effect;
neither publishes the bottom text.

## Sources

- Hornet 1991 demo index:
  https://ftp.scene.org/mirrors/hornet/demos/1991/00_index.txt
- Scene.org archive:
  https://ftp.scene.org/mirrors/hornet/demos/1991/drunken.zip
- Scene.org file page:
  https://files.scene.org/view/mirrors/hornet/demos/1991/drunken.zip

## Archive

The examined archive is `drunken.zip` from the Hornet mirror:

```text
drunken.zip  58822 bytes
sha256       a25f1fb2841f39e12882b1e98ea010da971a8b70ca1abfaf677fc842edaaa7d0
```

ZIP contents:

```text
code.exe    4252 bytes  1991-04-10 18:00
drunk        236 bytes  1991-11-22 21:50
drunk.exe  15624 bytes  1991-04-10 18:00
mod        53576 bytes  1993-01-18 19:24
text         236 bytes  1991-04-10 18:00
```

Hashes:

```text
efce8fed1ac951a790e50e5d6d33850f2446975081a75688c11e517361c9cb7c  code.exe
d5ba5e81c705fe988b1e2b1382c7090107aca22c895a21ac9ee1006fd6d23839  drunk
82dbd3b8ae3b36fc1d991b5e55ea61217d0048c18f97cf21ade37ae5faf0ee69  drunk.exe
fbb4e7e9e30ba93ab4a280146b990f19a39a1045b2c9cef36f32ef2132beeff2  mod
b26f34af23ee010d5ad7689460005833d0c4791393709a9e3be60ada1bf2006e  text
```

File roles:

```text
drunk.exe   main intro executable; packed MZ, restored by UNP
mod         external player/sample data; not a ProTracker MOD despite the name
text        plain 236-byte private/contact advert payload, omitted here
drunk       encoded 236-byte companion payload, same kind of private content
code.exe    PKLITE/PKZIP-marked side utility; not the runtime intro
```

`code.exe` contains the PKLITE copyright marker plus fragments like `TEXT->`,
`FILE&WRITE`, `BY HARD...`, and `1991`. It looks like a helper for generating or
writing the small text payload rather than the visual intro itself.

The file named `mod` has no ProTracker `M.K.`, `M!K!`, `FLT4`, `4CHN`, S3M, or
Impulse Tracker signature. Its front starts with lookup-table-looking byte
ramps, and around offset `5976h` it contains an IFF/8SVX-looking region with
`8SVX`, `VHDR`, `NAME`, `ANNO`, `BODY`, the sample name `BlastCon`, and the
annotation `Audio Master`. The executable treats it as custom module/player
input, not as a normal Amiga module file.

## Direct Silent Runtime And Timestamps

The fresh run used DOSBox-X `2024.03.01`, `machine=svga_s3`, normal core,
9,000 cycles, and 16 MiB. Automated input selected option `1`, so the guest
executed its PC-speaker player branch, but all DOSBox-X sound devices and mixer
output were disabled and SDL used dummy audio. Capture requested video only;
the raw AVI wrapper nevertheless carried an inert PCM stream, which was
discarded without monitoring or auditioning. A numeric `volumedetect` pass
reported both mean and maximum at `-91.0 dB`; the normalized evidence is
video-only.

```text
DOSBox-X version       2024.03.01 Commit 02f36ba
capture command        dx-capture /v /-a DRUNK.EXE
selected sound option  1, PC speaker
graphics stream        640x400 ZMBV, 1,418 decoded frames
normalized stream      640x400 FFV1, video-only
capture duration       20.232 seconds
graphics rate          about 70.086 fps
timing zero            start of the 640x400 graphics segment
```

The public GIF is 80 frames at 10 fps, 640x400, 64,840 bytes, and hashes as:

```text
800b832bc63ea4de7d8f7be86dc679117b29164ab4b004b3cb692d51cb336499  drunken-runtime-side-pulses.gif
```

The older `2026.01.02` 29.930667-second capture remains the source of the
contact sheet and the coarse landmarks below. Its H.264 stream had decode
warnings and an AAC wrapper; it is now secondary to the fresh silent run and
was never published as playable media.

Observed frame points:

```text
00:00.500  logo, slogan, empty or near-empty bottom rail
00:02.000  bottom scroller begins; side blocks appear around the logo field
00:05.000  logo/slogan remain static; bottom scroller has advanced
00:09.000  a different subset of fixed side-block masks is palette-visible
00:13.000  scroller continues; left/right blocks continue stepping
00:17.000  blue/right mask is bright while a red mask has decayed
00:21.000  multiple fixed red/blue masks are simultaneously palette-visible
00:25.000  same title screen; text strip continues across the rail
00:29.930  capture ends after the intro exits
```

The public GIF and contact sheet mask the bottom rail, because the rail is where the
private postal/contact text scrolls. The visual point is still clear: this intro
is a single animated identity/ad screen with a real bottom-strip renderer and a
real music interrupt path.

## Runtime-To-Code Concordance

The `00:00.500` frame maps to the static picture path. After the selected
sound option is read, the program allocates `0FA00h` bytes at `0A2Fh`, expands
the embedded `7D00h` 4-bit picture at `0A53h..0B09h`, selects and verifies
mode `13h` at `0B0Ch..0B1Ah`, programs the DAC at `0B24h`, and copies the full
expanded picture to `A000:0000` at `0BE1h`. That is why the chrome logo and
white slogan are already complete in the first published runtime frame.

The `00:02.000` through `00:25.000` frames show one live screen, not separate
scenes. Each iteration waits for retrace to begin and then to end at
`0E31h..0E3Ch`; `0636h` starts its DAC and memory writes just after retrace,
during active display. The seven-row software scroller shifts 2,226 history
bytes, recolours its two edge zones, publishes 2,100 bytes to
the seven row windows spanning `A000:DFCAh..E875h` with scanline gaps, and only
then inserts the next two glyph columns for the
following frame. The images mask the private text content, but the recovered
address and timing chain remains exact.

The red/blue side-block changes at `00:09.000`, `00:17.000`, and `00:21.000`
map to `024Dh..038Ch`. The static picture already owns four block masks using
indexes `0Ch..0Fh`. The update consumes one event/loudness byte from each of
the four `22h`-byte player-channel records, converts it to a frame countdown,
and rewrites those four DAC entries: slots 0/1 pulse red, slots 2/3 pulse blue.
No block pixels move and no rectangle is filled per frame; apparent motion is
four independently triggered palette visibility states.

The capture was made with option `1`, so the audio path in the recorded run is
the PC-speaker branch. The menu selection stores `0000h` into `[F1B6h]` at
`0A23h..0A2Ah`, `12F2h` installs the timer/player framework, `1376h..1388h`
programs PIT channel 2 and enables port `61h`, and the IRQ output side writes
the mixed sample-derived divisor to port `42h` at `0EBDh..0EC7h`. The Sound
Blaster and latent parallel-port branches are real code paths, but they are not
the selected runtime path for this published capture.

## Original And UNP-Expanded MZ Layout

The shipped `drunk.exe` is a small packed MZ:

```text
original file size  15624 bytes
header size            32 bytes
relocations             0
initial CS:IP      03B2:000E
initial SS:SP      0BE8:0080
entry raw          3B4Eh
```

The entry point lands near the end of the file in an EXEPACK-family depacker. It
first moves the packed image downward, then reads a bitstream:

```asm
3b83  ba 10 00        mov dx,0010h       ; bit count
3b86  ad              lodsw              ; fetch bit bucket
3b89  d1 ed           shr bp,1           ; next flag bit
3b95  a4              movsb              ; literal byte
...
3bc8  ad              lodsw              ; match token
3bcd  d2 ef           shr bh,cl
3bd2  80 e4 07        and ah,07h
3bdb  26 8a 01        mov al,es:[bx+di]  ; back-reference copy
3bde  aa              stosb
3bdf  e2 fa           loop 3BDBh
```

UNP running under DOSBox-X restores a conventional executable:

```text
UNP-expanded size      48416 bytes
UNP-expanded sha256    e6dea3ad0c5df818b8e72550c5d40a32de37fbdefdcd0a065457ad700ad609db
header size              416 bytes = 001Ah paragraphs
load image size        48000 bytes
relocations               95
initial CS:IP          0000:09BF
entry raw              0B5Fh
initial SS:SP          12AC:4000
```

Offsets below are load-image offsets in the UNP-expanded executable unless
explicitly marked otherwise.

## Entry Flow

The restored entry begins at `09BFh`, immediately after display strings and
character tables. It is still compiled through a Borland-style runtime, but the
interesting hardware work is direct 8086 code.

High-level flow:

```text
09BF  Borland/runtime initialization
09D3  write intro/menu strings
0A15  default sound port = 022Ch, the Sound Blaster DSP write/status port
0A1B  read sound option
0A23  if option is '1', set sound port to 0000h for PC speaker
0A2F  allocate 0FA00h bytes for the full 320x200 nibble-expanded screen
0A53  expand packed 4-bit logo/slogan picture into that 0FA00h buffer
0B0C  set mode 13h and verify it
0B24  program DAC entries
0BE1  copy the expanded picture to A000:0000
0C0C  prepare Pascal string `mod`
0C42  initialize selected sound device and module player
0D19  set initial keyboard-port baseline
0E2E  enter retrace-boundary, active-display frame loop
0E4B  exit on keyboard-port change
```

The executable contains a small Pascal-style menu string:

```text
ANOTHER INTRO BY HARD CORE
[1] - Pc Speaker ...
[2] - Great SoundBlaster
```

I have omitted one insulting adjective from the menu string in this public
writeup. Mechanically, option `1` stores `0000h` into the device selector;
anything else leaves `022Ch`, which selects the Sound Blaster DSP path.

## 4-Bit Picture Expander

The first real visual loop is the unpacked-picture builder at `0A53h..0B09h`.
It expands an embedded 4-bit-per-pixel image into a full 64,000-byte mode-13h
buffer.

Important state:

```text
source      DS:09D4h..86D3h  = 7D00h packed bytes
dest        heap segment stored through C438h
dest bytes  0FA00h           = 320 * 200
output      two mode-13h pixels per source byte
```

The code does not use shifts for the split; it rebuilds both nibbles bit by bit:

```asm
0A53  inc word [8718]              ; packed-byte index
0A5B  mov al,[di+09D3h]            ; source byte
0A6C  test al,01h / add low,1
0A79  test al,02h / add low,2
0A87  test al,04h / add low,4
0A95  test al,08h / add low,8
0AA3  test al,10h / add high,1
0AB0  test al,20h / add high,2
0ABE  test al,40h / add high,4
0ACC  test al,80h / add high,8
0ADA  store high nibble at out[2*i-1]
0AEE  store low nibble  at out[2*i]
0B01  loop until i == 7D00h
```

Equivalent logic:

```c
for (uint16_t i = 1; i <= 0x7d00; i++) {
    uint8_t packed = image[i - 1];
    frame[(i * 2) - 1] = packed >> 4;
    frame[(i * 2)]     = packed & 0x0f;
}
```

That produces `0x7d00 * 2 = 0xfa00` visible bytes, but the one-based indexing is
not memory-safe in C terms. The allocated block is 64,000 bytes while the loop
writes offsets `1..64000`; offset zero is unused and the final byte is one past
the requested allocation. The screen copy at `0BE1h` starts at heap offset `1`
and copies 64,000 bytes, so A000 receives every high/low nibble in order. The
off-by-one stays inside whatever heap storage follows this block in the tested
runtime, but it is a real recovered boundary rather than an unused first screen
pixel.

## Mode 13h And DAC Setup

The graphics mode setup is straightforward:

```asm
0B0C  mov ax,0013h
0B10  int 10h
0B12  mov ah,0Fh
0B14  int 10h
0B16  cmp al,13h
0B1A  if not mode 13h, restore text mode and exit
```

The DAC programming is split into three small loops:

```text
colors 01h..0Bh  RGB triplets from table 08C3h
colors 0Ch..10h  forced black
colors 11h..20h  generated red ramp, green=0, blue=0
```

The first loop writes one palette index to `03C8h`, computes `index * 3 - 2`,
then writes three bytes to `03C9h`:

```asm
0B2F  mov al,[8716]        ; color index
0B32  mov dx,03C8h
0B35  out dx,al
0B39  xor ah,ah
0B3D  shl ax,1
0B3F  add ax,si            ; ax = index * 3
0B45  mov al,[di+08C3h]    ; red
0B49  mov dx,03C9h
0B4C  out dx,al
...
0B74  out dx,al            ; blue
```

The screen copy at `0BE1h` moves the full `0FA00h` expanded picture to
`A000:0000` through a runtime far-copy helper. That explains the first captured
frame: the large logo and slogan arrive as one prepared bitmap, not as freshly
drawn vector letters.

## Main Frame Loop

The main loop starts at `0E2Eh`:

```asm
0E2E  call 143Fh           ; install timer music IRQ if not already active

0E31  mov dx,03DAh
0E34  in  al,dx
0E35  test al,08h
0E37  je  0E34h            ; wait for vertical retrace to begin
0E39  in  al,dx
0E3A  test al,08h
0E3C  jne 0E39h            ; wait for retrace to end

0E3E  call 0636h           ; update visible strip/blocks

0E41  mov dx,0060h
0E44  in  al,dx
0E45  cmp al,[8720h]       ; compare with initial keyboard-port byte
0E49  je  0E31h            ; keep running until key state changes
```

The two wait loops have an important phase consequence. The first returns when
retrace becomes active; the second spins until bit 3 clears. `0636h` therefore
begins after retrace has ended, not at retrace entry. The effect is refresh-
paced but writes four DAC entries and the scroller during active display. The
keyboard byte is sampled only after that complete update, so the frame that
sees a changed port value has already been presented.

## One Complete Visible Iteration

One return from `0636h` has this fixed order:

```text
024D  decrement four palette-pulse countdowns; consume/reload player events;
      upload DAC indexes 0Ch..0Fh
0643  advance an otherwise write-only 190-entry table phase; increment frame word
0667  shift seven offscreen strip rows left by two bytes: 7 * 318 = 2,226 bytes
06E5  inspect 15 columns * 7 rows at each edge: 210 tests; rewrite nonzero
      pixels with gradient indexes 11h..1Fh
0798  copy seven 300-byte windows to A000h: 2,100 visible bytes
07DE  only when glyph phase is zero, map the current text byte through 40 entries
0814  normalize zero phase to one
0824  test two font columns across seven rows; conditionally write colour 20h
08A0  phase += 2; at phase 9 clear the trailing column, reset phase to zero,
      advance/wrap the text index; return
0E41  poll keyboard port 60h after all visible and next-frame work
```

The table-derived byte at `D0AEh` and frame word `BAD0h` are written here but
have no reader in the recovered load image. They are not needed to explain a
visible effect. The state that does cross frames is the four pulse countdowns,
the seven rasterized strip rows, glyph phase/character indexes, and the live
VGA pixels/DAC entries.

The fixed common path issues 16 DAC `OUT`s, writes 2,226 shifted history bytes,
performs 210 edge probes, and writes 2,100 VGA bytes. Conditional work is one
normal-memory recolour for each nonzero edge probe and up to 14 glyph-column
writes; every fourth glyph frame also performs the eight-byte spacing clear.
No full-screen copy, page flip, background save, clipping, or repair follows.
The 64,000-byte title remains resident in A000h and the next refresh simply
overwrites the same 300x7 rail window.

## Bottom Scroller Renderer

The bottom strip is a 7-scanline software scroller. The code keeps an offscreen
text-strip buffer in normal memory, shifts seven rows left by two bytes,
recolours its edge caps, copies a 300-pixel window to the visible rail, and only
then draws the next two glyph columns at the right edge for the following frame.

At the start of `0636h`, the update calls `024Dh` exactly once. The old version
of this article incorrectly read the procedure prologue as a second call:

```asm
0640  call 024Dh
0643  inc byte [BAC6h]       ; animation phase/index
```

Then it shifts seven rows. Each row is 320 bytes apart (`0140h`), and each copy
uses `013Eh = 318` bytes from `src+2` to `src`, which is a 2-pixel left scroll:

```asm
0667  src = 9CFDh, dst = 9CFBh, count = 013Eh
0679  src = 9E3Dh, dst = 9E3Bh, count = 013Eh
068B  src = 9F7Dh, dst = 9F7Bh, count = 013Eh
069D  src = A0BDh, dst = A0BBh, count = 013Eh
06AF  src = A1FDh, dst = A1FBh, count = 013Eh
06C1  src = A33Dh, dst = A33Bh, count = 013Eh
06D3  src = A47Dh, dst = A47Bh, count = 013Eh
```

Before publication, two nested loops cover columns `1..15` and rows `1..7` on
both sides of the offscreen strip. Each of the 210 tested bytes is left alone
when zero; a nonzero byte is replaced by `column+10h`. The left address is
`9BB9h + row*320 + column + 2`; the right is
`9BB9h + row*320 + 013Bh - column`. This produces symmetric red-gradient edge
caps from palette indexes `11h..1Fh`; it is separate from the logo-side blocks
at indexes `0Ch..0Fh`.

`07A3h..07D7h` then copies the visible subwindow to the bottom rail:

```asm
07A3  row_index = [8716]
07A8  source = 9BB9h + row * 320 + 8
07BD  dest   = A000:DE80h + row * 320 + 10
07CF  count  = 012Ch = 300 bytes
```

For row indexes `1..7`, the destination is exactly screen rows `179..185`,
columns `10..309`. The seven calls therefore publish 2,100 bytes. The rail
artwork is in the static bitmap; only this inner 300x7 window is replaced. The
first row occupies `A000:DFCAh..E0F5h`, the last `E74Ah..E875h`; the apparent
overall range includes each scanline's untouched 20-byte gap.

Publication happens before new glyph insertion. The writer at `0824h..0899h`
tests seven rows of a glyph bitmap table and writes colour `20h` into the right
edge of the offscreen strip, so those new columns first become visible on the
next frame:

```asm
082A  current x phase = [C546h]
0839  glyph byte index = glyph_index * 56 + phase * 8 + row - 65
0847  if glyph[row,phase] != 0:
0853      dest = row * 320 + 013Eh
085C      offscreen[dest] = 20h

0868  second column uses glyph_index * 56 + phase * 8 + row - 57
088A      dest = row * 320 + 013Fh
0894      offscreen[dest] = 20h
```

When phase is zero, `07DEh..0812h` first scans the 40-byte character map for
the current text byte and stores its glyph index. Phase is then changed to one.
The writer consequently uses phases `1,3,5,7`, two font columns per frame. The
phase advances by two:

```asm
08A0  add word [C546h],2
08A5  cmp word [C546h],9
08D5  if phase >= 9, reset phase and advance the text character index
```

At phase 9 the code clears eight right-edge bytes. The first seven coincide
with the second candidate column emitted at phase 7, making it an explicit
blank spacing column; the effective glyph is seven columns plus one blank.
It then resets phase to zero, advances the independent text-stream index at
`C548h`, and wraps it to one at the stored length. One character consumes four
visual frames and history shifts exactly two pixels every frame. This is a
pipelined scroller: publish the old rasterized state, insert the next slice,
then expose it after the next shift/copy.

Over one complete four-frame character cadence, the seven row shifts read and
rewrite `4 * 2,226 = 8,904` history bytes, edge shading performs 840 probes,
and publication reads 8,400 normal-memory bytes and writes 8,400 VGA bytes.
The glyph path makes 56 font-bit probes and up to 56 conditional colour-`20h`
writes; its phase-zero frame scans all 40 character-map entries, and its fourth
frame performs the eight-byte spacing clear. The output advances exactly eight
pixels in those four frames: seven authored columns plus one blank column.

## Four Music-Driven Palette Pulses

The red/blue side blocks in the capture are not sprites or per-frame rectangle
fills. Their masks are pixels already present in the packed static picture with
indexes `0Ch..0Fh`; setup initially makes those entries black. Routine `024Dh`
turns them into four music-driven palette pulses.

For slot `i=0..3`, player work segment `[F1A8h]` contains a `22h`-byte channel
record. The visual path reads bytes at `4108h + 22h*i` and
`4109h + 22h*i`. Those are also written by the player's note/volume event paths
at `10A6h`, `10EBh`, and `114Fh`. The recovered update is:

```text
if countdown[i] > 0:
    countdown[i]--

value = player[4108h + 22h*i]
token = player[4109h + 22h*i]
if value != 0 or token != cached_token[i]:
    remembered_value[i] = value
    countdown[i] = value >> 2
    cached_token[i] = token
    player[4108h + 22h*i] = 0

DAC index = 0Ch + i
component = 3 * countdown[i]
i 0..1: RGB = (component,0,0)
i 2..3: RGB = (0,0,component)
```

The program therefore consumes the channel event byte as a visual latch, then
lets the corresponding block decay by three DAC units per refresh until the
next event reloads it. With the player's normal `0..40h` value range,
`value>>2` is at most 16 and the brightest component reaches 48, safely below
the VGA DAC maximum 63. Four slots mean exactly four DAC-index writes and
twelve component writes per visible iteration:

```asm
032B  color index = slot + 0Ch
032E  out 03C8h,al
0338  if slot < 2: write red ramp, green=0, blue=0
0353  if slot > 1: write red=0, green=0, blue ramp
037E  source pointer += 22h; next contiguous state slot
```

This is why blocks appear to alternate around the title while their geometry
never moves. The static image owns the pixel masks, the four-channel player
provides triggers, and the active-display loop owns palette intensity.

## Sound Device Selection

The selected sound device is passed to `12F2h`:

```asm
0A15  [F1B6h] = 022Ch       ; default: Sound Blaster DSP port
0A23  cmp selected_key,'1'
0A2A  if key == '1': [F1B6h] = 0000h
...
0C42  push [F1B0h]          ; timing/rate argument, set to 2EE0h
0C46  push [F1B6h]          ; selected output device
0C4A  call 12F2h
```

`12F2h` saves the caller's data segment, unmasks IRQ0 in the PIC mask, stores
the device selector, and calls `1331h` to prepare the concrete output routine.

The selector branches in `1331h` are:

```text
AX == 022Ch        Sound Blaster DSP write path
AH == 00h          PC speaker PIT channel 2 path
AH has sign bit    parallel-port/Covox-style path, latent in this code
```

### Sound Blaster Path

For `022Ch`, the code resets the DSP at `0226h`, waits, writes `D1h` to `022Ch`
to enable speaker output, and installs a short output shim that waits for the
DSP write buffer before sending each mixed sample:

```asm
1346  dx = 0226h
134E  out dx,01h
1353  out dx,00h
1359  dx = 022Ch
135C  al = D1h
135E  out dx,al

0E7B  dx = 022Ch
0E7E  in al,dx
0E81  js 0E7Eh             ; wait until DSP can accept a byte
0E83  al = 10h
0E85  out dx,al            ; DSP direct DAC command
0E89  wait again
0E8E  sample = [CS:17FDh] >> 2
0E96  out dx,al
```

### PC Speaker Path

For option `1`, `AX` is zero. The code programs PIT channel 2 and enables the
speaker gate through port `61h`:

```asm
1376  al = B0h
1378  out 43h,al           ; PIT channel 2, mode/control
137A  out 42h,al
137E  out 42h,00h
1380  al = 90h
1382  out 43h,al
1384  in  al,61h
1386  or  al,03h
1388  out 61h,al
```

The IRQ output side takes the current mixed sample, shifts it down, offsets it,
and writes the divisor byte to PIT channel 2:

```asm
0EBD  pusha
0EBE  ax = [CS:17FDh]
0EC2  ax >>= 4
0EC5  al += 3
0EC7  out 42h,al
```

This is crude but cheap: the sample value modulates the square-wave period
instead of feeding a true DAC.

### Parallel-Port Path

The code also contains a latent output shim at `0E9Dh` that writes two bytes to
`03BCh`/`03BEh`, with the base patched from a signed selector:

```asm
0E9D  ax = [CS:17FDh]
0EA2  ror ax,2
0EA5  xchg al,ah
0EA7  dx = 03BCh
0EAA  out dx,al
0EAB  dx = 03BEh
0EAE  al = 08h
0EB0  out dx,al
0EB1  dx = 03BCh
0EB4  al = ah
0EB6  out dx,al
0EB7  dx = 03BEh
0EBA  al = 02h
0EBC  out dx,al
```

The public menu does not expose this path, but the general-purpose player code
still has it.

## Module Loader And Mixer Core

The sound system is more serious than the one-screen visuals suggest. After
sound initialization, `14AEh` opens `mod`, reads its tables with DOS `int 21h`
functions `3Dh`, `3Fh`, `42h`, and `3Eh`, and builds runtime tables in a
separate segment:

```text
4200h  order/pattern index table
4280h  sample data segment/pointer table
4300h  per-sample volume/default values
4380h  loop-start table
4400h  loop-end table
4480h  period/frequency lookup material
44A0h  pitch table used by effect commands
54A0h  note-to-period pointer table
```

Startup also builds a `41h * 100h = 16,640`-byte signed-sample/volume table.
Its outer index is volume `00h..40h`; its inner index is every possible sample
byte `00h..FFh`. The compiler-generated arithmetic treats the sample as signed,
scales it by the volume, clamps the result to `-128..127`, and stores one byte.
The IRQ can consequently apply volume with one table read instead of a multiply.

The IRQ handler is built around four channels. The channel state stride is
`22h`, and `163Eh` clears four slots:

```asm
1648  si = 0
164F  cx = 4
1652  clear CS:[0F24h+si], CS:[0F28h+si]
1663  channel[si+4100h] = FFFFh
1672  channel[si+410Ch] = 10EAh      ; default command handler = ret
167A  si += 22h
167D  loop
```

The hot part of the interrupt routine starts around `0F0Eh`. It saves `ES` and
`DS`, points `DS` at the player segment, then for each active channel:

```asm
0F1C  load current sample pointer
0F20  add fixed-point step to channel phase
0F26  carry into sample offset
0F2A  read sample byte through ES:DI
0F2D  translate signed byte through table at BX-0100h
0F3C  add translated value into DX
```

The same 34-byte kernel is unrolled four times for records at `4100h`, `4122h`,
`4144h`, and `4166h`. More unusually, the player patches each kernel's machine
code when a note or volume changes:

| Patched code field | Per-channel meaning |
| --- | --- |
| `0F1Ch + 22h*i` | `LES DI,[record+2]`, or a short jump over an inactive channel |
| `0F24h + 22h*i` | low 16 bits added to the fractional phase word |
| `0F28h + 22h*i` | carry/high-byte step added to the sample offset |
| `0F30h + 22h*i` | high byte of the volume-table displacement, selecting one 256-byte page |
| `0F33h + 22h*i` | immediate sample/loop-end comparison |

Initialization writes `EB 20` over the first two bytes of an inactive kernel;
a note event restores `C4 3E`, the `LES` opcode, at `10B0h`. Note decode also
patches the split pitch step, volume page, and loop end. The common IRQ path
therefore reads no pitch, volume, or end fields for an in-range sample. It only
updates the fractional accumulator, advances the far sample offset by carry,
reads one sample byte, performs one volume-table lookup, stores the new offset,
and adds the signed result. Reaching the end takes a side branch to load the
loop start; a non-looping sample selects volume page zero so it contributes
silence.

The mixer starts `DX` at `0200h`, a 512-unit bias, before adding up to four
clamped `-128..127` channel values. Its exact four-channel numeric range is
therefore `0..1020`. The sum lands in `CS:17FDh`:

```asm
0FA4  mov [CS:17FDh],dx
```

Then the selected output shim consumes that sample and sends the IRQ EOI to the
master PIC:

```asm
0FB6  mov al,20h
0FB8  out 20h,al
0FBA  popa
0FBB  iret
```

That range explains the output conversions. Sound Blaster direct-DAC output
uses `sum >> 2`, exactly `0..255`; the PC-speaker path uses `(sum >> 4) + 3`,
or divisors `3..66`. Device setup copies a small output shim immediately before
the shared mixer. The PC-speaker and parallel-port shims output the previous
`[17FDh]` value before calculating the next one, so they have one IRQ of
latency. The Sound Blaster prefix issues command `10h`, lets the shared kernel
mix, and its patched tail then sends the newly calculated byte in the same IRQ.

## IRQ Rate, Tracker Cadence, And Shutdown

The requested mixer rate is `2EE0h = 12,000`. Setup divides the integer PIT
clock constant 1,193,181 by that request and then decrements the quotient, so
the programmed channel-0 divisor is 98 rather than 99. The resulting IRQ0 rate
is about 12,175.316 Hz. Every PC-speaker IRQ therefore performs one port-`42h`
sample/divisor write, up to four channel sample/lookup pairs, and one PIC EOI.

Pattern work is gated by a separate 16-bit accumulator patched into the
immediate operand at `0FB0h`. Its initial value is `0110h = 272`, generated from
the source timing value 798. At the initial setting, carry occurs at about
`12,175.316 * 272 / 65,536 = 50.532` ticks per second. The state byte at
`180Fh` divides that into six ticks per pattern row: one carry decodes four new
four-byte channel events, and the next five call the four installed effect
handlers. A 64-row pattern order therefore lasts about 7.599 seconds initially.
Effect command `10F9h` can select a different accumulator increment, so these
figures describe the startup tempo rather than an immutable whole-file rate.

Pattern progression is decoupled from raw sample output. After each decoded
row, the row counter at `17F7h` advances; when it reaches `40h`, `1121h`
advances the pattern/order index. Routine `1034h..10C0h` processes four pattern
events per decoded row, one per channel:

```asm
1024  add [CS:1812h],10h       ; advance pattern row/event pointer
102C  cx = 4
1034  decode one 4-byte event from ES:DI
104A  load pitch from 44A0h table
107E  load sample pointer/loop metadata
10C0  dispatch effect command through CS:17D3h[command]
10C5  next event, next channel
```

Effect command examples:

```text
10EB  set channel volume/default byte
10F9  select base timing/period from 4480h
110B  jump/set pattern offset from a 6-bit argument
114F  slide volume up/down with clamping to 00h..40h
11D6  install upward pitch-slide handler
11E4  install downward pitch-slide handler
1237  install smooth slide-toward-target handler
1287  install vibrato/randomized pitch-offset handler
```

So the file called `mod` is best described as custom tracker-like data for this
player: four channels, pattern events, sample tables, pitch tables, loop points,
and effect command dispatch. It is not just a raw sample blob.

The replacement INT `08h` never chains the saved BIOS handler, so DOS's BIOS
time-of-day ticks stop while the intro runs. Exit disables the selected output,
restores the saved vector, and programs PIT channel 0 to divisor `FFFFh`; it
does not restore the exact pre-intro counter value. This closes the player
lifecycle but leaves a one-count difference from the conventional zero-encoded
65,536 divisor.

## Text Payloads

The `text` file is a 236-byte printable payload. The `drunk` file is the same
kind of material encoded/high-bit transformed; it has 235 high-bit bytes and no
plain printable run. Both relate to the private bottom-scroller/contact advert
content, so this article intentionally does not reproduce them.

The important technical relationship is:

```text
text/drunk payloads   small contact/ad text assets
runtime scroller      uses its own string/glyph tables inside DRUNK.EXE
public screenshots    mask the bottom rail where that content scrolls
```

## What Each Part Does

The production divides cleanly:

```text
packed MZ wrapper     keeps the main Borland executable small
UNP-restored program  real intro logic and player
embedded 7D00h image  4-bit packed logo/slogan/title screen
mode 13h setup        320x200 chained VGA, direct A000 copy
DAC setup             small palette table plus generated black/red ranges
frame loop            wait through retrace, update during active display,
                      then poll port 60h
bottom strip          2,226-byte shift, edge recolour, 2,100-byte VGA publish,
                      then two next-frame glyph columns
side markers          four static pixel masks, music-event pulse countdowns,
                      four active-display DAC uploads
mod loader            custom tracker/sample loader, not ProTracker MOD
IRQ0 player           12.175 kHz, four self-modifying unrolled channel kernels,
                      16,640-byte volume table, PC speaker/SB/latent LPT outputs
text payloads         private contact/ad data, omitted from public reproduction
```

It is fancy mostly in polish-per-byte terms, not in visual variety. The screen
looks static at first glance, but the implementation combines a full-screen
packed logo picture, a small live scroller renderer, palette/block animation,
and a real interrupt-driven four-channel player. Its important economy is
ownership: the full-screen picture owns the logo, slogan, rail, and block
masks; normal memory owns scroller history and the next glyph slice; the player
owns four trigger records; and the steady-state loop publishes only four DAC
entries plus a 300x7 VGA window. For 1991 PC board-intro scale, that is a
reasonably ambitious package.
