Analysis model: gpt-5.5 xhigh

Revision model: GPT-6 Astra (user-reported)

Last edited: 2026-09-19

4 Kings by Orange - Technical Dissection

4 Kings is Orange's MS-DOS/GUS 64K intro from Assembly 1994. Pouet lists it as a PC 64K entry, released in August 1994, ranked 10th in the Assembly 1994 PC 64K competition, with code by Hoplite and graphics by Der Piipo.

Release year: 1994

The original parent and child PKLITE unpackers now give a usable runtime image. The opening ORANGE word is six inverse-rotated letter cells, with the matrix arithmetic repeated for every output pixel. This corrects the earlier article's overly broad description of the opening as sprite copying. The PRESENTS stretch, pale-logo distortion and creature rectangle transitions are also verified below. The first spiral generator is now verified too: it maintains point counts and an address history, not a warped framebuffer.

Sources

Pouet metadata:

type:           64k
platform:       MS-Dos/gus
release date:   august 1994
release party:  Assembly 1994
compo:          pc 64k
ranked:         10th
credits:        Hoplite [Code], Der Piipo [Graphics]
popularity:     62%

The local archive FILE_ID.DIZ is minimal but matches the production identity:

 _____  ______ ____   __  __ ______ ______
|~ _  ||~ _  /|~ _ \ |~ \| ||~____/|~ ___/
|  |  ||  | /.|  |\ l| _ ~ || \__~||  |__
|  :  ||  |'~||  `~ ||  \_ ||  |  ||  __/
|  i  ||  |  ||  |' ||  || ||  |  ||  |___
|__~  ||__|  ||__|  ||__|| ||__`  ||__   /
===\__|=== \_|====\_|====|_|===\__|===\_/=
               Presents:
        4 Kings at Assembly '94

Examined Files

ede255200ce1fd205290b865dfd46b6572dafb7331bbb5cf142f3aa02e45c225  4kings.zip
9cda266823b32ee589e4cbfd4c1232c773f47ccb0d56a3bf30cb9a4e5504d6ed  4KINGS.EXE
d11b5e9b2653a35f5af1599923019574c1e321d5c2ae13d266b51f5a2971baaf  FILE_ID.DIZ
14bc4c113723b968520675452df3d7d83d98c63c41de54ee580a534fea200697  first depklite output
31dc48d17eab036cd0d48ef3dd6f9aa4f697c249b2130e487c01beabcd35480d  public MP4 reference

4KINGS.EXE is 57,694 bytes. The MZ header declares the same size:

e_cblp/e_cp:        350 / 113
relocations:        1
header paragraphs:  6
min/max alloc:      1385 / 65535 paragraphs
entry:              fff0:0100
stack:              0e16:0200
reloc table:        0052h
PKLITE marker:      file offset 001eh

The file command identifies the packed executable as an MZ self-extracting PKZIP-style executable. That classification is not enough by itself, but the PKLITE marker and depklite behavior make the packing boundary explicit.

Runtime And Visual Evidence

The public-video visual pass uses the public 480x360 H.264/AAC video linked from Pouet. The local assets below are direct full-canvas time slices from that video. They are not browser screenshots, lightbox screenshots, or viewport-corrected page captures.

The opening shows separate letters and creature sprites on a nearly black field. The Orange and presents text are drawn with a shaky green/gray hand-rendered look, and the characters move as separate sprite objects rather than as one static title bitmap.

4 Kings public-video sprite/title motion

The mid-section shifts to a pale horizontal logo band and drifting character sprites. This is the clearest sign that the intro is built from small graphic parts and blit layers rather than one continuous procedural renderer.

4 Kings public-video logo band motion

The strongest effect section is the dark spiral material. The motion is important: a still frame makes it look like faint gray ornamentation, while the video shows radial forms twisting, collapsing, and reappearing against a dark red-brown field.

4 Kings public-video spiral trail motion

The final card uses a pale blue illustration plate with the 4 Kings identity, hand-drawn figures, and a soft blob field. This is a graphic end card rather than a code-heavy 3D finale, but it matters because it matches the Der Piipo credit and the hand-drawn style used throughout the intro.

4 Kings public-video final illustrated card motion

Pouet's small public screenshot is also preserved as a source-side reference.

4 Kings public Pouet screenshot

Sequence Reading

The public video breaks into these visible families:

0:00-0:20   Orange/presents text, separate creature sprites, black field
0:20-0:45   repeated small sprites and pale horizontal 4 Kings logo band
0:45-1:40   dark spiral/radial trails and faint organic line forms
1:40-2:05   red cellular/ring texture field
2:05-2:30   pale blue final card and drawn character/title material
2:30-end    green soft blob fields and exit material

The first two parts show independently moving text, creatures and a logo strip. The recovered opening word routine below inverse-rotates six letter cells; copying small images alone does not explain it. The public video does not by itself establish their rendering mechanisms; the following recovered routines now distinguish the letters, PRESENTS, logo and creature rectangles.

The spiral part looks feedback-like, but the recovered first generator below uses an address history to remove old points while adding new ones. The previous suggestion of a polar lookup or warped previous frame was a visual inference and was wrong for this routine. The dark palette makes overlapping point trails look like a continuous soft surface.

The red cellular texture is a short graphic bridge. It looks like a repeated ring/cell pattern animated by palette or index displacement. It does not show the independent sprite compositing of the opening, and it does not have the deep radial center of the spiral section. Its role in the show is a texture plate: enough movement to transition from the dark spiral material into the final illustration.

The final card returns to picture material. It is built as a readable drawing with mild motion and soft green blob fields nearby. In the larger Orange arc, this is interesting because the later 1995-1996 Orange productions lean harder into full-screen image processing, PCX/RIX resources, and protected-mode data loaders. 4 Kings is earlier and rougher: its identity is small masks, handmade drawings, palette movement, and compact point-trail effects.

Music And GUS Boundary

The first depklite output contains an explicit Gravis Ultrasound I/O selector:

GUS I/O:

1) 210h
2) 220h
3) 230h
4) 240h
5) 250h
6) 260h

(if you don't have a GUS, please select some I/O with nothing in it)

That text is at raw offset 0x11179 in the first depklite output and at 0x9cc0 inside the nested MZ view. The wording is useful: the intro is presented as MS-DOS/GUS, but the user can choose an unused I/O base to run without a real GUS. That is not a general Sound Blaster fallback in the current evidence; no BLASTER or ULTRASND environment strings were found in the examined depklite images.

Near the same data region, the unpacked material contains ProTracker-family module signature probes:

M.K.  FLT4  6CHN  8CHN  OCTA

In the first depklite output these signatures begin at 0x10249; in the nested MZ view they begin at 0x8d90. This suggests a module-format detector or player compatibility table rather than a hard-coded one-format-only music path. It also fits the GUS-only presentation: a compact intro can include a small module/player path and ask only for the GUS base address.

Packing And Code-Recovery Boundary

The first unpacking pass expands the original MZ to a 77,090-byte raw output:

14bc4c113723b968520675452df3d7d83d98c63c41de54ee580a534fea200697

That output is not a clean flat code image. It contains another MZ header at raw offset 0x74b9, and that nested MZ has another PKLITE marker at nested offset 0x1e. Extracting from 0x74b9 gives a 47,209-byte MZ file with a declared 36,238-byte MZ size and the same GUS/module-signature strings at shifted offsets.

The earlier second depklite attempt produced a 374,867-byte file without a trustworthy final address map. That limitation is now superseded by executing the released unpacking instructions. The old raw offsets above describe the historical extraction only; addresses below use the recovered load image.

The parent reaches relative 0000:0092h. Its DOS file materializers expose these exact payloads (segments are relative to the parent load segment):

Routine File Source Bytes
0034h introch2.mod 0022:0000h 26,550
0062h rota.exe 069e:0000h 36,238
dbe9b28e1e8377cfe0176225bc4845e3c2d585e2051edb15aa28d767ac41010b  INTROCH2.MOD
bc831c22b35df4479598770be5fd054af6c57e60953bad5c940e68ebb244d6e9  ROTA.EXE

The module itself has title iMAT-kwww? and the four-channel M.K. signature at byte 1080. This establishes the embedded format more directly than the player's list of supported signature strings. ROTA.EXE contains the second PKLITE stage and reaches relative 0000:0000h after unpacking.

Both original unpackers were executed at load segments 1000h, 1200h and 1800h, applying their MZ relocations. At each load, the original DOS create/write/close routines produced the same filenames, complete payload bytes and lengths under intercepted successful DOS calls. Neither unpacker needed a DOS or BIOS interrupt. This verifies unpacking and materialization; it does not test disk errors, GUS playback or the complete parent/child run.

Opening Title: Six Inverse-Rotated Letter Cells

In the recovered child loaded at 1000h, the title uses DS=13adh for its tables, FS=1c21h for its 320-byte-stride art atlas, and ES=a000h for the mode-13h framebuffer. Code offsets in this section are relative to the child code segment. Drawing runs from 002fh through 030dh; the next-phase update ends immediately before the retrace wait at 03dah.

Six unrolled blocks each write a 24×24 cell. Letter i takes its source centre from (16+30*i,17) and writes at destination top-left (88+24*i,88) with the vertical-offset word DS:002eh at its initial zero value. The source letters are spaced farther apart than the destination cells.

The first pixel kernel is 005eh..00b4h. For local coordinates x,y from −12 through 11, it computes:

phase = (low16(letter_angle)) % 360
s = signed_byte(DS:02a4h + phase)
c = signed_byte(DS:02fdh + phase)
sx = 16 + 30*i + floor((x*c - y*s) / 128)
sy = 17        + floor((y*c + x*s) / 128)
colour = FS:[(sy*320 + sx) & 65535]

The division is arithmetic SAR 7, so negative values round downward. The coefficient addresses are separated by 89 bytes; the reconstruction uses the stored values rather than substituting an ideal sine/cosine pair. Phase reduction uses repeated unsigned subtraction of 360. The byte fetch is nearest neighbour sampling, with no interpolation or source clipping.

Each pixel repeats the phase reduction, both coefficient reads, four signed 16-bit coordinate multiplications and a fifth multiplication for sy*320. It also executes an inner PUSHA/restore pair. Across all six cells that is 3,456 pixel writes and 17,280 16-bit multiplications per iteration, before the phase generator. The code does not hoist a matrix per letter or increment source coordinates along a row. It writes background indices too: there is no transparent-zero branch in this sampler.

The six angle dwords live at DS:0ba0h. After drawing, the generator uses the 32-bit counter t at DS:002ah and wave index p at DS:0bb8h:

next_angle[i] = signed32(low32(t * (150 + signed_byte(DS:02a4h+p+20*i)))) >> 7
p = (p + 3) % 360
t = low32(t + 1)

The individual p+20*i reads are not explicitly reduced modulo 360; the actual following table bytes matter. All six angles, t and p start at zero. Thus the word is drawn with the previous angles, then the next iteration's angles are generated. These six 32-bit multiplications are separate from the pixel multiplication count above.

An integer reconstruction matches 300 consecutive original-code draw and update iterations, starting with the released atlas and zero state. Eight additional coordinate-pattern controls exercise distinct angles, including 65535, 360, 720 and 361. Each comparison checks the entire 65,536-byte screen segment, six angle dwords, counter and wave index; the source atlas remains unchanged and the stack balances. The vertical destination offset was held at zero. Retrace, the shared player flag and later scene calls lie outside this tested span.

4 Kings original-code opening letter rotation, cropped reconstruction

This reconstruction uses the released art and palette: a 160×40 crop enlarged 4× with nearest-neighbour scaling, showing every fifth iteration of the 300. Each GIF frame lasts an illustrative 80 ms and the loop resets after 4.8 s. It is not a DOSBox capture or a measurement of playback speed, and depicts the ORANGE letters only, not the separate creatures in the public-video GIF.

PRESENTS: Scanline Stretch From The Centre

The next routine, 041eh, renders the atlas's hand-drawn PRESENTS strip. Its draw/update span 0433h..059dh is independently checked against 240 consecutive original iterations and twelve coordinate-pattern controls.

The entrance copies one 320-byte source row per iteration, from atlas row 40 onward to row 70 onward, using eighty MOVSD operations. The byte counter's <=30 test actually permits 31 copies, although the renderer samples only 30 rows. The final copy reads row 70, which the first copy already overwrote, and writes it to row 100 outside the sampled strip. This is an overlapping in-place reveal, not a separate immutable source and destination bitmap.

The renderer writes screen rows 85–114. For each row it reads two signed wave bytes using arithmetic-halved phase indices, halves their values, and adds them to form w. The phase words advance by 10 and 13 per scanline. There is no per-row modulo reduction before those table reads.

right_step = low16(w + 256)
left_step  = low16(w + 2*bias)
right_acc  = low16(-right_step)
left_acc   = left_step

for j = 0..159:
    r = signed16(right_acc) >> 7
    l = low16(-(signed16(left_acc) >> 7))
    screen[160+j] = source[123+r] if unsigned16(r) < 123 else 0
    screen[160-j] = source[123+l] if unsigned16(l) > 0xff85 else 0
    right_acc = low16(right_acc + right_step)
    left_acc  = low16(left_acc + left_step)

Source addresses include the current atlas row and wrap at 16 bits. The instructions fetch before applying those unsigned clipping tests; the tests replace rejected samples with palette index zero. Arithmetic shifts and 16-bit accumulator overflow are part of the result. Treating these as unbounded real-valued coordinates produces a different sampler.

The two stores overwrite the centre pixel in order on the first iteration. Together they cover columns 1–319, leaving column 0 untouched: 9,600 stores but 9,570 distinct destination bytes across the thirty rows. Unlike the preceding rotating letters, the pixel loop 0504h..0549h uses additions, shifts and comparisons, with no multiplication.

The bias word starts at 128 and is reset to 128 after drawing, so the two step sizes are equal during the verified released-state sequence; their starting signs and clipping differ. Twelve controls also exercise unequal steps and signed overflow. The next frame receives the old base phases; those bases then advance by 4 and 5 and subtract 720 when necessary.

4 Kings PRESENTS scanline stretch, original-code reconstruction

Original art and palette, cropped to 320×40 and enlarged 2×. This shows every fourth iteration of 240 at an illustrative 80 ms per GIF frame. It is a controlled reconstruction with an initially zero screen, not timed playback. The checks compare the complete screen and atlas segments, the first 4 KiB of data/state, and stack balance. Retrace, shared music flags and the later row-erasure exit are outside this tested span.

4 Kings Logo: Two Wave Distortions Of An Atlas

The sampler at 0656h..06f4h, called at 08adh, distorts the pale 4 Kings logo. Its source is the second art atlas at FS=2bc1h in the checked load: the four creature illustrations occupy the upper part, and the logo sits below them. Recovering this source corrects the earlier description of the logo band as mere layer/position motion.

The output rectangle is 160×57, at screen (80,72) through (239,128). Each pixel combines a wave-controlled source-row lookup and a separate horizontal wave displacement. Let x=0..159, y=0..56, p and q be the two current phase words, and amp the signed amplitude:

wave(phase) = signed_byte(DS:0e32h + (signed16(phase) >> 1))
dy = signed16(low16(wave(p) * amp)) >> 9
row = low16(100 + y + dy)
row_base = word(DS:19f8h + low16(2*row))
source_offset = low16(row_base + (wave(q) >> 2) + x + 80)
colour = FS:[source_offset] if source_offset < 0xbe00 else 27

The machine fetches the source byte before the unsigned be00h comparison; rejected samples become palette index 27. This is an address cutoff, not independent x/y clipping. The signed multiply keeps only its low sixteen bits before SAR 9. There is one multiplication per pixel: 9,120 per draw. Even though the phase pattern repeats on every output row, the routine repeats the wave reads, multiply and row-offset lookup inside the pixel loop.

Within a row, p advances by 2. The horizontal phase q advances by signed16(DS:0bbch) >> 2; each phase subtracts 720 once when it reaches that threshold. Both restart from their frame-level values on the next row: q is explicitly saved and restored on the stack.

The ordinary update after the draw sets the next amplitude from a third wave phase, advances that phase by 6, advances the frame's p and q by 3 and 5, and reduces those phases at 720. The horizontal speed word starts at 256 and decrements toward 1. Its shifted step therefore eventually becomes zero; the frame-level q still advances, so horizontal distortion does not simply freeze. Amplitude and all three phases initially start at zero in this check.

The exact table contents matter. Twelve controls include an amplitude of 255, outside the normal signed-byte amplitude range. At that value, some row lookups reach adjacent mutable state, including the horizontal phase word. A model using a detached row-offset table fails those controls; reading the actual state at the time of each lookup matches. This is a tested out-of-range behaviour, not evidence of a fault during the normal animation.

4 Kings logo wave distortion, original-code reconstruction

This uses the released atlas and the palette loaded at 06f6h, cropping the 160×57 output and enlarging it 3×. It shows every fourth iteration of 240 at an illustrative 80 ms per frame. The preceding creature reveals, later palette transition, music flags and retrace are excluded; it is not a timed capture.

The integer model matches 240 consecutive original draw/update iterations and twelve additional controls. Checks cover the complete screen and source segments, the first 1c00h bytes of data/state, and stack balance. The ordinary sequence replaces 341,628 samples with index 27 across 2,188,800 pixel writes. The rectangular transitions use the independently checked blitter below; a continuous full-run capture is still needed for timing concordance.

Four Creatures: Opaque Rectangle Reveals And Exits

All eight creature transitions call 0624h. It loads the source offset from DS:1b8ah, destination from 1b96h, width from 1b94h and height from 1b98h, then switches DS to the second atlas at 2bc1h. Each row copies width bytes using REP MOVSB, then adjusts both pointers by 320-width. It restores the data segment before returning at 0655h. There is no transparent-pixel test, scaling, or per-pixel arithmetic in this blitter. Background pixels inside each rectangle are copied too.

The callers animate the rectangles as follows. Source and destination values are byte offsets; deltas apply after each call, and all offsets wrap at 16 bits.

Stage Calls First source First destination First width×height Change per call
Top-left entrance 44 002bh 0000h 1×40 source −1, width +1
Top-right entrance 55 44edh 010ah 53×1 source −320, height +1
Bottom-right entrance 46 0062h aeffh 1×60 destination −1, width +1
Bottom-left entrance 55 0091h f781h 40×1 destination −320, height +1
Top-left exit 44 0001h 0000h 43×40 source +1, width −1
Top-right exit 55 016dh 010ah 53×56 source +320, height −1
Bottom-right exit 47 0062h aed2h 46×60 destination +1, width −1
Bottom-left exit 54 0091h b401h 40×56 destination +320, height −1

This accounts for the four corner placements. The entrances use different combinations of moving crops and changing destination edges. The exits are not exact reversed call sequences: the top-left and bottom-right end with zero-width calls, while the last top-right and bottom-left calls still copy two and three rows respectively. A zero-width REP MOVSB writes nothing, but the outer height loop still runs. There is no separate clearing operation inside this routine, so the previous framebuffer and atlas background matter.

4 Kings creature rectangle transitions, original-code reconstruction

The reconstruction executes the four entrance loops followed directly by the four exit loops, omitting the intervening logo section and music waits. The screen initially contains zero indices; the released atlas and its palette supply the creatures. It shows every fourth call at an illustrative 60 ms per GIF frame, enlarged 2×. This is not a continuous runtime recording.

The original callers and blitter were checked across 400 calls and 498,635 pixel writes. At every entry, the four parameter words match an independent schedule; after every return, the complete 65,536-byte screen segment matches an independent row-copy model, the source remains unchanged, and DS is restored. The stack balances at all six tested caller-span boundaries. Reads from retrace port 3dah receive a synthetic alternating status to advance the wait loops; actual VGA timing and the shared music cues are not verified here.

Spiral Trails: Point Counts And Circular Address History

The first call to 11bch follows the creature/logo sequence. It clears a 32,000-byte workspace at FS=52d1h, clears the VGA segment, loads the palette at DS:2b3fh and enters the generator at 121fh. The core drawing and state update end at 142bh, before retrace and the shared music-cue test.

Each iteration generates 100 batches of ten points. Several signed-byte wave reads produce an angular phase and two amplitudes for a batch; the ten points advance the phase index by 36 each. The point kernel at 12ech..1373h uses the following integer operations:

x = 160 + (signed16(low16(signed_byte(table[phase]) * radius_x)) >> 8)
y = low16(100 + (signed16(low16(signed_byte(table[phase+89]) * radius_y)) >> 8))
if unsigned16(y) >= 200: y = 0
address = low16(y*320 + x)

The coefficient table starts at DS:30d9h; the second coefficient read is 89 bytes later. Products retain the low sixteen bits before arithmetic shifts. The y test sends rejected values to row zero, rather than skipping the point. There is no separate x clipping. Each point uses two amplitude multiplications and one row-stride multiplication: 3,000 multiplications per full draw.

The released first-call mode word DS:2b33h is 1. In that mode the code copies the second amplitude over the first before plotting, giving both axes the same amplitude. A later call uses a different mode after this routine resets the word; the full-generator test reported here covers the first-call mode.

The trails come from a circular array of 8,000 word-sized screen addresses, occupying the first 16,000 workspace bytes. The write and erase offsets live at FS:7d00h and FS:7d02h, initially 0 and 2. For each new point the code:

  1. Saves the current write offset, then advances both offsets by two, wrapping each at 16,000.
  2. Stores the new screen address at the saved write offset and increments that screen byte.
  3. Reads the address at the advanced erase offset and decrements that screen byte.

These are byte INC and DEC, with modulo-256 wraparound and no saturation. The new point is added before the old point is removed, including when their addresses coincide. Cleared history slots initially refer to address zero; the code really decrements that byte during startup. This mechanism preserves the contribution of overlapping live points without clearing the entire screen or warping its previous contents.

The generator's frame phases advance at different rates: the two amplitude phase pairs advance by (6,7) and (1,2), while three angular phases use the stored increments initially (1,2,3). Within each frame, the hundred batches advance their temporary phases again. Wave lookups use the actual following bytes where indices extend beyond a nominal period; an ideal mathematical sine substituted for those bytes is not an exact reconstruction.

An independent integer model matches 360 consecutive original iterations, 360,000 points, from the released initial state. Every iteration compares the complete 65,536-byte screen and history segments, the first 4000h bytes of data/state, and stack balance. A separate kernel test checks 12,000 points with controlled phases and amplitudes, including history wraparound, signed-product overflow and 1,405 rejected-y cases. These checks exclude VGA scanout, retrace, and the music-triggered transition to the later invocation.

4 Kings spiral trails at 65 seconds in the original DOSBox-X recording

Direct frame at 65.000 s of the child capture, recorded on 2026-09-19 with DOSBox-X 2024.03.01, normal CPU core, fixed 60,000 cycles, SVGA S3 and GUS base 240h (menu option 4). Host audio was disabled. This identifies the visible spiral family; an exact pixel/iteration match, including the programmed CRTC start address, remains to be established. The child's native capture is 142.895251 seconds long; the guest returned to DOS and wrote the return marker. An Escape was scheduled during the run, so this alone does not establish uninterrupted natural completion of every later section.

Video-To-Code Concordance

The public-video opening GIF includes letters and separate creature sprites. The ORANGE word, PRESENTS strip and four corner creatures now have separate recovered routines and original-code reconstructions above.

The pale logo has the atlas and wave sampler above; the creature entrances and exits have the eight verified rectangle schedules. The first spiral routine uses the verified point-count/history mechanism above; the broader public-video spiral interval still needs invocation-by-invocation matching. The final-card GIF documents the illustration and nearby soft fields, but does not establish their compositor or rule out geometry internally. These are visual observations rather than recovered mechanisms.

Technical Summary

The packing boundary is resolved sufficiently to analyze the child's code. The original materializers recover a 26,550-byte four-channel module and a 36,238-byte packed child. The opening word uses six independently phased 24×24 inverse samplers, recomputing the transform for every pixel. Its output and phase updates match an integer model across 300 sequential iterations and eight additional controls. The following PRESENTS strip uses two centre-out scanline accumulators, verified over 240 iterations and twelve controls. The pale logo uses a separate two-wave atlas sampler, also checked over 240 iterations and twelve controls. The four creatures share an opaque row-copy blitter with eight rectangle schedules, verified across 400 calls.

The first spiral generator also matches an independent model over 360,000 points. Its circular address history replaces the earlier feedback hypothesis. The next work is the later invocation and subsequent effects, plus exact runtime-to-iteration matching; those are not established by the current tests.