Analysis model: gpt-5.5 xhigh

Weird by $PA/$PC - Technical Dissection

Weird is a 1994 MS-DOS intro by $PA/$PC, shown at Wired 1994 in Mons, Belgium. The official Wired 1994 result file lists it third in the PC Intro competition, behind Cult by ISCH Crew and Once by DSL.

Release year: 1994

Released: 30 October 1994 is the Demozoo release date. The bundled distribution text also carries an 11/12/94 date line, so I treat 1994 as firm and the exact distribution date as less useful than the party placement.

Sources

Old personal contact listings from the bundled text files are deliberately omitted.

Competition Identity

The result file's PC Intro section is:

1  ISCH Crew  Cult   203
2  DSL        Once   180
3  $PA        Weird  151

The bundled WEIRD.NFO calls the intro the third $PA/$PC demo release and says it was presented at Wired 1994. It gives the visible credit split as:

Coding: HALL9000, Binary Slave

The text also says the authors tried to make the intro more design-oriented than their previous release. That matches the binary: this is not a tiny single-effect assembler stunt. It is a compressed DOS executable with a Borland/Turbo-style runtime, HSC/AdLib playback, generated work pages, palette scenes, prebuilt masks, and several 3D span-fill paths.

Archive Identity

weird.zip contains the production body:

FILE_ID.DIZ    583 bytes
SYN.PAR        815 bytes
WEIRD.EXE    65916 bytes
WEIRD.NFO     5251 bytes

Hashes used for this pass:

9a4cf87e3bfff92ca5c251e0b45faf34f1397548e7d457dd5a7f8dca1fed65ff  weird.zip
ceed09def9cf95e7d09fa072b1d0e410ea66002867e2d33668eca6007b33da9b  FILE_ID.DIZ
1713d1facb008384bfc1aeca9d2898624cc30080567a53321c4017d576dd6cbc  SYN.PAR
7e6fecdaf346f3cf17b4dbae6e9dcfaf8ce8db5f4be3559eafbe82d022340371  WEIRD.EXE
f31a279f4de7f3ae35cf418b93c9356183612b642b56cd46e2916827f1d88bb6  WEIRD.NFO

There is also a wrdbug.zip in the same party directory. Its executable and text identify an Antares Wired invitation bugfix, not the $PA/$PC Weird intro body. I did not use it as Weird code.

Packed And Unpacked Layout

The distributed WEIRD.EXE is a PKLITE-packed DOS MZ executable:

file size:        65916 bytes
MZ image size:    65916 bytes
header bytes:        96 bytes
load bytes:       65820 bytes
relocations:          1
initial CS:IP:    fff0:0100
initial SS:SP:    1018:0200
overlay tail:         0 bytes

After UNP expansion, the executable becomes much larger:

unpacked size:   168704 bytes
header bytes:      5184 bytes
load bytes:      163520 bytes
relocations:       1288
initial CS:IP:   0000:e6cb
initial SS:SP:   2cc1:4000

The stripped load image used for static offsets is 163,520 bytes:

621a19ef714603e0e3bc5b6740d8a19800eb36e4a7b62abfc93dfab83ca8b631  unpacked WEIRD.EXE
6b74abf5c76413d94d95d5e3248134416d234c78407bfb94540a3be8361c21ff  stripped load image

The important mapping rule is simple:

load offset = segment * 16 + offset

For example, far pointer 19f9:005f maps to load offset 0x19fef. That helper is the general fast copy routine used by many scenes.

Runtime Shape

The unpacked binary still has a large compiled-language skeleton. Strings in the image include:

Timer Service v1.5 - (C) 1993,1994 Otto Chrons
HSCOBJ 1.4 (C)93/94 by Chicken/ECR
No Adlib compatible card found!, Playing without sound ...

The repeated int 34h through int 3fh calls are not DOS calls and not demo interrupt effects. They are Borland/Turbo floating-point emulator entry points. That matters, because several geometry routines look like assembly-heavy math at first glance but are really compiler output around runtime real arithmetic.

There are custom inner loops too, especially for VGA copies, RLE expansion, palette fades, and horizontal span filling. The fair read is:

Entry Path

Execution starts at load offset 0xe6cb. The entry path performs runtime initialization, saves the PIC mask from port 0x21, masks IRQ bit 1, then initializes the music path.

The AdLib/HSC probe has a clean fallback:

; if the card probe returns no compatible AdLib
mov  dx,0xe68f      ; "No Adlib compatible card found!, Playing without sound ..."
call print_string
call delay

; otherwise
mov  byte [ds:002e],1
call 195e:001d     ; HSC playback start

Then the program enters VGA mode 13h, calls the show body at 0xe66c, stops music if it had been enabled, restores text mode 3, writes final text to B800h, and restores the saved IRQ mask.

The show call list is compact and useful:

e66c: push bp
e66d: mov  bp,sp
e66f: call 0xe577  ; setup, allocations, tables
e672: call 0x651c
e675: call 0xc3d1
e678: call 0x6903
e67b: call 0x7ffc
e67e: call 0x8e75
e681: call 0x9292
e684: call 0xa4c8
e687: call 0xd96b
e68a: call 0xceda

So the intro is a linear sequence of scene routines, not a script interpreter. Each part builds or reuses large work pages and then presents a finished screen-sized effect.

Memory Setup At 0xe577

The setup routine requests several large blocks and stores their segment pointers in the data segment:

ds:02a2 / ds:02a4  screen-sized work pages
ds:02aa / ds:02ac  mask/source work pages
ds:0296 / ds:0298  object/state block
ds:029a / ds:029c  object/state block
ds:029e / ds:02a0  object/state block

It also builds trigonometric tables using the Borland real runtime. The table area begins around 0xfe98; derived 3-word real values are stored around 0x35e8 and 0x3e5e. Those tables are later used by the object transform passes.

Two counters at ds:49f6 and ds:49f8 are initialized here. Scene code uses them as shared timing/state values rather than carrying all state on the stack.

Shared VGA And Memory Helpers

VBlank Wait At 0x19f90

The vertical retrace wait polls VGA status port 0x3da:

mov dx,03dah

wait_display_clear:
    in   al,dx
    test al,1
    jne  wait_display_clear

wait_retrace_high:
    in   al,dx
    test al,8
    je   wait_retrace_high

retf

This first waits until display-enable bit 0 clears, then waits for vertical retrace bit 3. Palette changes and some scene swaps use this helper to avoid tearing.

DAC Upload At 0x19f9e

The palette upload helper writes 768 bytes to the VGA DAC:

les  di,[bp+6]
mov  si,di
xor  al,al
mov  cx,0300h
mov  dx,03c8h
out  dx,al        ; first DAC index = 0
inc  dx           ; 03c9h
rep  outsb        ; DS:SI -> DAC data
retf

This assumes DS:SI points at the palette data. Callers are responsible for making that true before passing the near palette offset.

Fast Fill At 0x19fbd

The far fill routine is a classic 386-aware byte fill:

; input includes far destination pointer, byte value, and count
mov  al,[bp+byte_value]
mov  ah,al
mov  bx,ax
shl  eax,16
mov  ax,bx        ; EAX = byte repeated four times

; align
test di,1
jz   word_aligned
stosb
dec  cx

; handle a word if needed, then dwords
test di,2
jz   dword_aligned
stosw
sub  cx,2

dword_aligned:
shr  cx,2
rep  stosd

The real code handles the edge counts around this skeleton, but the intent is clear: pay small alignment costs once, then fill mostly with rep stosd.

Fast Copy At 0x19fef

The matching copy helper aligns the pointers and then uses rep movsd:

; DS:SI source, ES:DI destination
test di,1
jz   maybe_word
movsb
dec  cx

maybe_word:
test di,2
jz   dwords
movsw
sub  cx,2

dwords:
shr  cx,2
rep  movsd

Scene routines use this for rectangular strip reveals and full-page staging.

Palette Scene Builders

Bootstrap Flash At 0x1a01c

This helper copies a target palette, clears a second 768-byte palette, then builds a blue ramp:

for i = 1..255:
    red   = 0
    green = 0
    blue  = i / 4

entry 4 = (63, 63, 63)
wait for retrace
upload palette

The visible effect is a cold initial flash/ramp with one forced white entry.

Fade Out At 0x1a099

The fade-out loop runs 63 frames. Each frame walks all 256 RGB triples and decrements nonzero components:

for frame = 0..62:
    for entry = 0..255:
        if r > 0: r--
        if g > 0: g--
        if b > 0: b--
    wait for retrace
    upload 768 bytes

clear A000h
upload final palette

It is deliberately component-linear, not a table lookup. The cost is tiny compared with a full frame render, and it gives a smooth decay at VGA DAC precision.

Fade In And Blue Ramp At 0x1a177

This routine clears current and target palettes, fills entries 0..0x3f with a descending blue ramp, copies a 3-byte color triple from entry 0x3f into entries 0x40..0xff, then moves the live palette one component at a time toward the target:

repeat:
    changed = false
    for each of 768 components:
        if current < target:
            current++
            changed = true
        else if current > target:
            current--
            changed = true
    wait for retrace
    upload current palette
until changed == false

This is a useful detail: the palette timing is driven by convergence, not by a fixed frame count.

RLE-Style Mask Expansion

Several routines at 0x61c8, 0x624d, 0x62d2, 0x6357, and 0x63dc share the same decompression shape. They differ mainly in table pointer and loop count.

The pattern is:

clear work page ds:02aa to 0xff
set byte_a and byte_b, usually 0 and 4
out = start of work buffer

for each word run length in the table:
    fill run_length bytes at out with byte_a
    out += run_length
    swap byte_a and byte_b

The loop counts seen in the binary are:

0x61c8: 0x0580 runs from table 19f9:498c
0x624d: 0x12c6 runs from table 11f5:368c
0x62d2: 0x0874 runs from table 11f5:0000
0x6357: 0x07c0 runs from table 11f5:2708
0x63dc: 0x0b0c runs from table 11f5:10ec

This is storage-efficient for masks and simple pictures: a long flat region costs one word, and the visual data alternates between two bytes. The result is not a final frame by itself; later routines OR it with a texture/source page or copy it into visible VGA memory.

Mode 13h And Planar VGA Variant

Most of the intro presents through mode 13h-style linear A000 writes, but it also has a tweaked planar helper around 0x11c58.

The routine enters BIOS mode 13h, then changes sequencer and CRTC registers:

mov ax,0013h
int 10h

; sequencer map mask = all planes
mov dx,03c4h
mov ax,0f02h
out dx,ax

; clear A000h while all planes are enabled
mov ax,0a000h
mov es,ax
xor di,di
xor ax,ax
mov cx,8000h
rep stosw

; CRTC index 14h: clear doubleword mode bit
; CRTC index 17h: set byte/linear bit

The paired copy loop near 0x11bf4 writes one chunky byte at a time into successive VGA planes:

plane_mask = 1
repeat for a group of four pixels:
    out 03c4h:02h, plane_mask
    lodsb
    mov es:[di],al
    plane_mask <<= 1
    if plane_mask == 16:
        plane_mask = 1
        di++

That is a standard chunky-to-unchained-VGA copy shape. It is not the main renderer for every scene, but it explains why some parts use plane-mask writes instead of only flat 64,000-byte page copies.

Object And Geometry State

The object machinery uses large allocated blocks pointed to by ds:0292/0294 and related segment fields. The code often indexes with negative offsets because DI points inside the middle of a Borland-allocated structure.

Point records are 0x24 bytes each. The initializer at 0x1d2b seeds records at block offsets:

0x0208
0x022c
0x0250
0x0274
...

Each record holds several 3-word real values, usually triplets for original, rotated, and projected coordinates. Scene routines load scalar fields before calling the generic transform/draw functions. Examples:

0x651c: counts 8 / 12 / 6, scale-ish value 0x04ba, far-ish value 0x010e
0x6903: counts 8 / 12 / 4, depth-ish value 0x7530
0x7ffc: counts 0x4b / 0x48 / 0x28, screen center 0x00a0 / 0x0064
0x8e75: counts 0x34 / 0x2e / 0x18, offsets 0x0046 / 0xff9c
0x9292: counts 0x4b / 0x48 / 0x28, offsets 0x0190 / 0x012c

I am calling some fields "scale-ish" or "depth-ish" because the surrounding code proves how they are used in projection, while the original field names are not recoverable from the stripped executable.

Transform Loop At 0x23dc

The transform routine loops over point records from index 1 up to the active count. It reads 3-word real values from each point, combines them with sine and cosine tables, and writes transformed triplets back into the record.

At a high level:

for point = 1..point_count-1:
    x, y, z = record[point].base_triplet

    rx = real_math(x, y, z, sin_a, cos_a)
    ry = real_math(x, y, z, sin_b, cos_b)
    rz = real_math(x, y, z, sin_c, cos_c)

    record[point].rotated_triplet = rx, ry, rz
    record[point].screen_triplet  = projected(rx, ry, rz)

The important inner-loop detail is what this is not. It is not a tight hand-written fixed-point rotation loop. The disassembly repeatedly drops into Borland real arithmetic through interrupt vectors such as int 3ah, int 3ch, and int 37h. That means the intro trades CPU time for smaller and simpler high-level geometry code. On a 486DX, that is viable for the object counts used here, especially with the final fill loops still being direct memory emitters.

The runtime does include 386 fixed helpers. At 0x273bf, when the CPU type byte indicates 386-or-newer, a fixed multiply uses 32-bit registers:

shl  eax,16
shrd eax,edx,16
shl  ecx,16
shrd ecx,ebx,16
imul ecx
shld edx,eax,16
retf

The paired fixed divide at 0x273fc uses shrd, idiv ecx, and shld. Those are runtime helpers rather than a sign that every object loop is custom fixed-point assembly.

Edge Setup At 0x2697

This is one of the core 3D raster routines. It takes two projected vertices, orders them by Y, clips to the screen, then writes one X value per scanline into an edge table.

In plain form:

if y0 > y1:
    swap endpoints

dy = y1 - y0
dx = x1 - x0

if dy == 0:
    return

y_start = clamp(y0, 0, 199)
y_end   = clamp(y1, 0, 199)

for y = y_start..y_end:
    x = x0 + ((y - y0) * dx) / dy
    x = clamp(x, 0, 319)
    edge_table[object_index * 0x194 + y * 2 + 0x0bb8] = x

The routine also stores per-face minimum and maximum Y values near +0x0bb4/+0x0bb6. Later span routines use those limits so they do not scan all 200 rows unnecessarily.

Quad And Triangle Dispatch

The quad helper at 0x2967 clears two 200-row span arrays:

left[y]  = 320
right[y] = 0

Then it calls the edge setup routine for four edges, merges the face Y range, and dispatches by material:

material 0 -> solid span fill at 0x101a
material 1 -> OR span fill at 0x0f88

The triangle helper at 0x2e2b does the same thing with three edges:

material 0 -> solid span fill at 0x101a
material 2 -> heavier 3-vertex path at 0x09e6

Another triangle/strip helper at 0x38d7 feeds a similar path used by 0x3c08. Higher-level routines such as 0x2a9e, 0x3c08, and 0x3082 build many faces by passing immediate vertex indices and material selectors into these helpers.

Solid Span Emitter At 0x101a

The solid filler draws into a work page, usually the segment held at ds:02a2. The color byte is derived from the material value plus 0x11.

The loop shape is:

for y = face_min_y..face_max_y:
    left  = span_left[y]
    right = span_right[y]
    count = right - left
    if count <= 0:
        continue

    ES = work_page_segment
    DI = y * 320 + left

    if DI is odd:
        store one byte
        count--

    if DI is word-aligned but not dword-aligned:
        store one word
        count -= 2

    store count / 4 dwords with REP STOSD
    store remaining tail bytes

This is the same alignment idea as the shared fill helper, but specialized for horizontal spans. It is the part that lets the slower high-level geometry still end in a respectable VGA write path.

OR Span Emitter At 0x0f88

The OR filler is used for additive-looking or mask-combine surfaces. Instead of replacing pixels, it ORs a material byte into the existing work page:

for y = face_min_y..face_max_y:
    left  = span_left[y]
    right = span_right[y]
    count = right - left
    BX = y * 320 + left

    if count is odd:
        page[BX] |= material
        BX++
        count--

    while count >= 2:
        word page[BX] |= material | (material << 8)
        BX += 2
        count -= 2

This is visibly different from alpha blending: it accumulates bitplanes. If a surface passes over an already nonzero area, the new material toggles in extra bits and the palette does the perceptual work.

Heavy Triangle Path At 0x09e6

The 0x09e6 path pulls three projected vertex records, pushes real values through a helper around 0xe86:0xe45, and then feeds the same span machinery. The code shape is longer because it appears to calculate per-face geometry values before drawing:

load vertex A triplet
load vertex B triplet
load vertex C triplet
call real helper for vector differences / surface terms
call edge setup
call selected span emitter

The point for analysis is that the expensive math happens once per face, not once per pixel. The pixel loop still reduces to left/right scanline spans.

Two-Buffer Scaler And Mask Blit At 0xe7d1

One of the best small inner loops in the intro is the scaler/mask combiner used by the 0xc3d1 scene. It uses one segment as a mask page through FS, another as the sampled page through DS, and writes directly to A000.

Reduced structure:

xor di,di
mov fs,[ds:02aa]      ; mask page
mov es,0a000h
xor edx,edx
mov ebx,[bp+8]        ; horizontal 8.8 step
mov cx,[ds:02a6]      ; output width
mov ds,[ds:02ac]      ; sampled page

row_loop:
    push edx
    cx = width

pixel_pair_loop:
    edx += ebx
    esi = edx >> 8
    al = [si] | fs:[di]

    edx += ebx
    esi = edx >> 8
    ah = [si] | fs:[di+1]

    stosw             ; two output pixels to A000
    loop pixel_pair_loop

    di += line_skip
    pop edx
    edx += y_step
    height--
    jne row_loop

The elegant part is the register economy. EDX is the fixed-point sample position, EBX is the X step, FS is a full-screen mask plane, DS is the texture/source page, and ES:DI is the visible VGA page. Two pixels are generated per loop with AL/AH and emitted as one word.

Small Stencil Blitter At 0x1a602

The stencil helper draws a 56 by 36 mask:

for y = 0..35:
    for x = 1..55:
        mask = source_page[y * 320 + x + 0xc2c4]
        if mask != 0:
            A000[(base_y + y) * 320 + base_x + x] = color

This is almost certainly used for small text/logo masks. It is intentionally simple: branch on nonzero mask byte, then stamp a uniform color.

Mirrored Wipes And Copies

The block around 0xad8a..0xae46 performs a mirrored wipe:

for x = 1..320:
    for y = 1..200:
        p = y * 320 + x
        if x is even:
            A000[p] = 0
        else:
            A000[0xfa00 - p] = 0

    every five columns:
        call tick/sound helper

This explains the asymmetric wipe feel: odd and even columns erase from opposite ends of the 64,000-byte screen.

Several later routines, including 0xd96b, 0xdd30, 0xdfb1, and 0xe232, share a flipped-copy shape:

for col = 1..320:
    for row = 0..199:
        source_index = 0xfa00 - (row * 320 + col)
        target_index = row * 320 - col
        A000[target_index] = work_page[source_index]

The exact starting offsets vary by caller, but the visual intent is a mirror or reverse reveal using the 64,000-byte page boundary as the anchor.

Rectangular Reveals

The blocks around 0x9e80..0xa02e and 0xceda..0xcff4 use the generic fast copy helper to reveal rectangular strips from a work page into A000. The observed copy widths include:

80-byte strips from early rows
0xa5-byte strips starting near x = 0x96
0xb4-byte strips starting near x = 0x28
0xdc-byte strips starting near x = 0x1e

The scene code interleaves these copies with calls to the VBlank delay helper at 0x1a50b, so the reveal timing is frame-paced rather than one instant copy.

What Each Show Part Appears To Do

The exact visual labels are not recoverable from symbols, but the routine order and helper use give a reasonable part map:

0xe577  allocate memory, build math tables, initialize shared state
0x651c  object scene using low point counts and span fills
0xc3d1  large stack scene, work-page setup, two-buffer mask/scaler blit
0x6903  second object scene with a different depth/scale setup
0x7ffc  larger object scene centered at 160,100
0x8e75  offset object scene with smaller center/depth values
0x9292  another large object setup with shifted center values
0xa4c8  transition/wipe block leading into later page copies
0xd96b  mirrored/reverse copy family
0xceda  final rectangular reveal/copy sequence

The strongest certainty is at the loop level: page allocation, palette animation, mask expansion, edge-table setup, span filling, masked scaling, and strip reveals are all visible in the code. Naming the exact on-screen motif of each scene without a synchronized capture would be less reliable.

Why It Feels Different From Many 64K Intros

Weird is not built like the smallest hand-packed intros where every byte is a bespoke machine-code trick. It leans on a real-mode compiled runtime and pays for floating-point convenience. But it also uses PKLITE, direct VGA ports, large generated pages, simple data compression, and enough custom fill/blit loops to stay demo-like rather than application-like.

The best inner loops are not the transform loops. They are:

That makes Weird a good example of a mid-1990s DOS intro sitting between two worlds: still close enough to hardware to use VGA timing and port writes, but already comfortable letting a C/Pascal-style runtime handle a lot of scene setup and real-number geometry.