Analysis model: gpt-5.5 xhigh, sol high
Last edited: 2026-08-25
Revolt by Shadow Productions - Technical Dissection
Revolt is a 1991 MS-DOS EGA/VGA intro by Shadow Productions. The Hornet
1991 index lists it as revolt.zip 8309 * Revolt by Shadow Productions.
Release year: 1991
This is a small but unusually hardware-facing production. The packed file is
only 8191 bytes, but the restored program sets BIOS graphics mode 0Eh
(640x200, 16-color planar graphics), installs timer and keyboard handlers,
streams DAC color data from the timer interrupt, uses the attribute controller
for color-select changes, and draws its moving bands with hand-unrolled planar
copy loops.

The image above is a DOSBox-X runtime frame from capture timestamp 00:04.000.
DOSBox-X records the mode as 640x400 with a 5:6 sample aspect ratio; visually
this is the vertically doubled display of the demo's 640x200 mode 0Eh
output.
The front-page card uses this frame directly. I did not make a GIF because only one public runtime frame is published for this pass.
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/revolt.zip
- Scene.org file page: https://files.scene.org/view/mirrors/hornet/demos/1991/revolt.zip
Archive
The examined archive is revolt.zip from the Hornet mirror:
revolt.zip 8309 bytes
REVOLT.EXE 8191 bytes 1991-05-24 17:53
Hashes:
2c22648488ee40616d9d1283dd2c7525df189feb54a745f96d3efbdb5dede573 revolt.zip
70674ca3bb50021810cc64e42b7bb9b5225aa11c18cf04d5b5797589e94c3e9c REVOLT.EXE
30d8188f6d886c85a1535ef63080063ef69c491a3ff0ed826a51230123a5509e revolt-unpacked.exe
Runtime Capture
The runtime still comes from an 8-second DOSBox-X 2026.01.02 capture of the
original packed REVOLT.EXE.
Capture setup:
DOSBox-X version 2026.01.02
CPU core normal
cycles 6000
capture format mpegts-h264
video stream 640x400, 70.09 fps, SAR 5:6
run length 00:08.000
exit method delayed Esc keypress through autotype
selected still 00:04.000
Observed short-loop timeline:
00:00.000 program enters mode 0Eh and starts filling planar screen data
00:00.500 red dot rows, green band, and SHADOW logo are already visible
00:02.000 horizontal bands and dot rows have shifted; logo is low left
00:04.000 multi-color bands and SHADOW logo are both clearly visible
00:06.000 same cyclic band/logo effect continues with shifted phase
00:08.000 delayed Esc exits through the keyboard interrupt path
The visible demo is a compact looping effect rather than a multipart timeline. Most frame-to-frame change comes from the timer-driven DAC stream, the moving VRAM band blit, and the copied logo block.
Runtime-To-Code Concordance
The published 00:04.000 frame is a single runtime still, but it lands in the
steady loop where all of the intro's visible machinery is active. It is not a
generic screenshot; it can be tied to the restored executable's mode setup,
timer stream, logo copy, and band blitter.
The frame is in BIOS mode 0Eh, reached by the restored entry at raw 0200h.
The visible 640x200 planar surface follows the setup path: 0943h performs the
video sanity check, 020D..0210h selects mode 0Eh, 090Fh uploads the DAC
and attribute defaults, and the static red-dot/band field comes from the
map-mask stampers at 08C9h and 03B1h.
The changing color bands in the still are driven by two cooperating paths. The
main loop at 027Eh waits for retrace, resets attribute color-select register
14h, points [323Eh] at the stream buffer 01EE:3240h, and calls 074Dh.
That builder clears the 378-byte stream and stamps seven 21-byte RGB bursts
into positions selected by the 179 active word entries at 30D4h..3238h. The
timer handler
installed from 07E7h and entered at raw 0832h then feeds one RGB triplet
per tick to DAC color 0 through ports 03C8h/03C9h until it sets [3450h].
The yellow SHADOW logo visible in the frame is the VRAM-to-VRAM block copy at
036Ah. It uses source A000:4E20h, selects planes 0..2 with sequencer
map-mask 07h, combines row/base offset [30CEh] with byte/phase offset
[30D2h], and copies a 17-byte by 26-row block into the current planar
position.
The broad moving horizontal band is the unrolled planar blitter at 04A5h.
Its current destination base comes from [2BC8h], its source and phase from
[2BC4h] and [2BC6h], and its exact row arithmetic is 4-BP edge bytes,
19*4 middle bytes, and BP trailing bytes for an 80-byte mode-0Eh scanline.
That maps directly to the full-width 25-row band family visible in the capture.
The bounded conclusion is: the still proves the steady-state loop rather than a startup-only frame. The code explains the mode, static field, DAC stream, logo motion, band motion, and any-key IRQ1 exit path; no GIF is published because only one trusted runtime frame exists for this pass.
MZ Layout And Unpacking
The distributed executable is a PKLITE-packed MZ:
packed file size 8191 bytes
MZ header 160 bytes
MZ reported size 8191 bytes
load image 8031 bytes
relocations 1
min alloc 04ACh paragraphs
max alloc FFFFh paragraphs
entry FFF0:0100
entry raw 0100h inside the packed loader area
stack 0200:0200
relocation table 0052h
UNP restores a normal real-mode MZ:
unpacked file size 22358 bytes
MZ header 512 bytes
MZ reported size 22358 bytes
load image 21846 bytes
relocations 12
min alloc 0041h paragraphs
max alloc FFFFh paragraphs
entry 0000:0000
entry raw 0200h
stack 0556:0400
relocation table 003Eh
The restored program is not a decompression study after this point. The useful code is the direct planar graphics and interrupt machinery.
Address Convention
Offsets in this article are raw offsets in the UNP-restored executable unless
otherwise noted. Since the restored MZ header is 0200h bytes, code at runtime
CS:0000 appears at raw 0200h.
Data addressing needs an additional segment calculation. The program commonly uses two relocated data segments:
DS = 0079h raw file base 0990h
DS = 01EEh raw file base 20E0h
So memory 01EE:3240h, for example, is raw file offset 20E0h + 3240h = 5320h.
The central code map is:
| Function | Runtime address | Raw file offset |
|---|---|---|
| main frame loop | CS:007Eh |
027Eh |
| moving logo latch copy | CS:016Ah |
036Ah |
| secondary static staging | CS:01B1h |
03B1h |
| moving-band blitter | CS:02A5h |
04A5h |
| DAC-stream builder | CS:054Dh |
074Dh |
| hook installation | CS:05E7h |
07E7h |
| timer ISR | CS:0632h |
0832h |
| keyboard ISR | CS:069Ah |
089Ah |
| upper tile staging | CS:06C9h |
08C9h |
Startup And Hardware Probes
The restored entry begins at raw 0200h:
0200: mov ax,0079h
0203: mov ds,ax
0205: mov ax,A000h
0208: mov es,ax
020A: call 0943h ; hardware/video sanity check
020D: mov ax,000Eh
0210: int 10h ; 640x200 16-color graphics
0212: call 0970h ; checksum-like data check
0225: call 090Fh ; DAC and attribute setup
Raw 0943h is a conservative environment probe. It reads BIOS data area
0040:000Ah, rejects unsupported display states, sets text mode 03h, and
checks VGA CRTC register 0 through ports 03D4h/03D5h.
Raw 0970h XORs signed bytes from DS:0000 through DS:3671h and compares
the result with FFFDh. If the check fails, it stores a nonzero flag at
3674h. This is small integrity/packing fallout rather than a visible effect.
After mode setup, raw 090Fh initializes DAC colors and VGA attribute
registers:
090F: mov si,036Ch
0912: mov dx,03C7h
0915: mov al,01h
0917: out dx,al ; DAC read index
0918: inc dx ; 03C8h
0919: out dx,al ; DAC write index
091A: inc dx ; 03C9h
091B: mov cx,005Dh
091E: rep outsb ; 93 bytes = 31 RGB triplets
0920: mov cx,000Fh
0923: mov dx,03DAh
0926: in al,dx ; reset attribute flip-flop
0927: mov dx,03C0h
092A: mov al,cl
092C: out dx,al
092D: out dx,al ; attribute entry n = n
It also sets attribute controller register 10h and color-select register
14h. Later code writes 34h to port 03C0h, which is register 14h with
the display-enable bit set.
Static Screen Staging
The first visible picture is built through planar copies, not through a single
chunky framebuffer. Raw 08C9h is the repeated tile/stamp helper used during
startup:
08C9: mov word [0368h],0
08CF: push si
08D0: mov di,[0368h]
08D4: add di,[036Ah]
08D8: mov dx,03C4h
08DB: mov al,02h
08DD: out dx,al ; sequencer map-mask index
08DE: inc dx
08DF: mov al,02h ; first plane mask
08E2: mov ah,03h ; three plane passes
08E4: mov bp,0012h ; 18 rows
08E7: mov cx,0004h
08EA: rep movsb
08EC: add di,004Ch ; 4 + 4Ch = 50h = one 640-pixel row
08F2: shl al,1
08F4: out dx,al ; next plane mask
0901: add word [0368h],4
0907: cmp word [0368h],0050h
090C: jb 08CFh
The helper copies one 4-byte-wide, 18-row tile every four bytes across an
80-byte scanline. Each tile resource contains three consecutive 72-byte plane
payloads; the map mask advances through 02h, 04h, and 08h, so startup
owns planes 1, 2, and 3 while leaving plane 0 available for the moving band.
Startup calls it seven times with four source offsets and successive 18-row
destination bases:
SI=0008h destination 0000h and 21C0h
SI=00E0h destination 05A0h and 1C20h
SI=01B8h destination 0B40h and 1680h
SI=0290h destination 10E0h
Those destinations are rows 0, 18, 36, 54, 72, 90, and 108, covering rows
0..125. The four source groups occupy 0079:0008h..0367h, or raw file
0998h..0CF7h. This explains the repeated red-dot and band structure in the
screenshot. The screen is a planar tiled field before the per-frame moving
parts start.
Raw 03B1h performs additional setup copies. It uses map masks 1, 2, 4,
and 8, but it builds two distinct resources. Its first three passes consume
0079:03C9h..074Ch (raw 0D59h..10DCh) and assemble a compact three-plane
logo at A000:4E20h. That source is 17x26 bytes with a 15x20 visible interior
at 4E54h: one blank byte on each side and three blank rows above and below.
After plane 2, the map mask advances to 08h; the remaining setup pieces are
lower-screen static artwork written only to plane 3. The moving logo can
therefore alter planes 0..2 without destroying that static layer.
Timer, DAC Stream, And Frame Handshake
Raw 07E7h installs the timer and keyboard hooks:
07E7: mov al,34h
07E9: out 43h,al ; PIT channel 0 setup
07EF: out 40h,al
07F3: out 40h,al
07FB: mov ax,3508h
07FE: int 21h ; save old INT 08h
0808: mov ax,3509h
080B: int 21h ; save old INT 09h
081C: mov ax,2508h
0821: mov dx,0632h
0824: int 21h ; new timer handler, raw 0832h
0826: mov ax,2509h
082B: mov dx,069Ah
082E: int 21h ; new keyboard handler, raw 089Ah
The offsets passed to DOS are runtime offsets. With the 0200h header added,
the actual raw file handlers are 0832h and 089Ah.
The timer handler at raw 0832h is the heart of the color effect. Every timer
tick outputs one RGB triplet to DAC color 0:
0837: mov ax,01EEh
083A: mov ds,ax
083C: mov si,[323Eh]
0840: mov dx,03C8h
0843: xor al,al
0845: out dx,al ; DAC color index 0
0846: mov cx,0003h
0849: mov dx,03DAh
084C: in al,dx
084D: and al,01h
084F: je 084Ch ; wait for display-enable state
0851: mov dx,03C9h
0854: rep outsb ; write RGB triplet
0856: mov [323Eh],si
The installation first programs PIT channel 0 with control 34h and count
0000h: mode 2, low/high byte access, where zero means 65,536, or about
18.2065 Hz. The steady loop later replaces that with control 14h and
low-byte count 4Ah, a mode-2 divisor of 74, or 16,124.08 Hz from the PC's
1.193182 MHz PIT clock. The visual loop does not read this clock; it waits on
the ISR's completion byte.
The nominal stream buffer is 3240h..33B9h, exactly 378 bytes or 126 RGB
triplets. There is a deliberate post-increment boundary detail: the ISR tests
SI > 33BAh only after sending a triplet. It therefore emits 127 writes:
ticks 0..125 starts 3240h..33B7h, covering the 378-byte buffer
tick 126 starts 33BAh and emits the three zero bytes before 33BDh
At divisor 74, 127 interrupts take a nominal minimum of about 7.876 ms. The
real pass can be longer because every ISR waits for the selected port 03DAh
display state before writing the DAC and an overlong handler cannot nest
another IRQ0 invocation.
The final black triplet is followed by a pointer reset to 3240h, completion
value 14h in [3450h], PIT control 14h with low-byte count zero (the
low-byte-only representation of divisor 256, about 4,660.87 Hz), and Attribute
Controller color-select register 14h = 1. The timer therefore does not stop
after the raster pass. The main loop later resets that register to zero and
arms the next 74-count stream. Thus the handoff is not merely “126 colors per
frame”; it is 126 prepared triplets, one explicit black terminator, a hardware
color-select transition, and a continuing slower interrupt interval between
fast passes.
Palette-Stream Builder At 074Dh
The main loop rebuilds the byte stream consumed by the timer handler. Raw
074Dh clears 01EE:3240h and stamps seven 21-byte bursts from
01EE:33BDh into offsets selected by a ring table:
074D: push es
074E: mov ax,01EEh
0751: mov es,ax
0753: mov di,3240h
0756: xor ax,ax
0758: mov cx,00BDh
075B: rep stosw ; clear 378 bytes = 126 RGB triplets
075D: mov bp,0015h ; 21 bytes per stamp
0760: mov si,33BDh
0763: mov bx,[323Ch]
0767: mov di,[bx]
0769: mov cx,bp
076B: rep movsb
076D: sub bx,00AEh
0771: cmp bx,30D4h
0777: add bx,0166h ; wrap ring table
The seven rep movsb blocks do not reuse one source stamp: SI keeps advancing.
The 147 source bytes are seven consecutive symmetric seven-triplet ramps:
red 30,40,50,60,50,40,30
green 30,40,50,60,50,40,30
blue 32,42,52,62,52,42,32
yellow 30,40,50,60,50,40,30
cyan 30,40,50,60,50,40,30
magenta 30,40,50,60,50,40,30
white 30,40,50,60,50,40,30
Each row above means the named channel combination; all other components are
zero. The destination ring has 179 word entries whose starts run from 30D4h
through 3238h (byte range through 3239h; 323Ah is excluded). Successive
bursts use ring entries 87 positions apart (BX -= AEh bytes), wrapping by
166h; the frame pointer [323Ch] itself advances effectively one word per
frame. Every 21-byte write stays inside 3240h..33B9h. If two bursts overlap,
the later rep movsb overwrites the earlier bytes; there is no blend. The
captured bands are therefore a zero-filled color-0 stream with seven
differently colored, seven-triplet ramps moving on a 179-frame placement cycle.
The builder's steady-state traffic is also fixed. The clear is 189 word stores, or 378 destination bytes. The seven stamps add 147 source-byte reads and 147 destination-byte writes, and their seven destination lookups read 14 bytes from the ring table. Thus one call reads 161 bytes of effect data and writes 525 stream bytes before bookkeeping; the 525-byte write total includes bytes that may be written once by the clear and again by an overlapping stamp.
Main Loop
The main visible loop begins after setup at raw 027Eh:
027E: mov dx,03DAh
0281: in al,dx
0282: and al,08h
0284: je 0281h ; wait vertical retrace
0286: mov dx,03DAh
0289: in al,dx ; reset attribute flip-flop
028A: mov dx,03C0h
028D: mov al,34h
028F: out dx,al
0290: xor al,al
0292: out dx,al ; color-select register 14h = 0
0298: mov word [323Eh],3240h
029E: call 074Dh ; rebuild DAC stream
It then advances five independent ring pointers. The subtract-and-wrap constants
look like large backwards jumps, but each pair differs by exactly one table
entry, so every update is effectively index = index + 1 mod count:
| Pointer | Table | Entries | Update constants | Consumer |
|---|---|---|---|---|
[323Ch] |
30D4h..3239h words |
179 | -164h, wrap +166h |
seven color-0 burst destinations |
[2BC2h] |
288Eh..2BBFh words |
409 | -330h, wrap +332h |
moving-band destination base |
[30CCh] |
2BCAh..2EA5h words |
366 | -2DAh, wrap +2DCh |
logo row/base motion |
[30D0h] |
2EA6h..30CBh bytes |
550 | -225h, wrap +226h |
logo byte/phase motion |
[3672h] |
3451h..366Fh RGBs |
181 | -21Ch, wrap +21Fh |
synchronous DAC color 24 |
The current values loaded from those rings become:
[2BC8h] current moving-band base offset
[30CEh] current logo row/base offset
[30D2h] current logo byte/phase offset
The fifth path was missing from the earlier frame summary. Raw 02F9h..0318h
sets both DAC read and write index to 18h (color 24), advances [3672h], and
outputs one RGB triplet from its 181-entry table. This palette lane is updated
synchronously once per main frame; it is separate from the timer's color-0
raster stream. At the port level this is two index writes (03C7h and 03C8h)
plus three component writes to 03C9h, with three table bytes consumed.
Finally the loop waits for a display-state transition, arms PIT channel 0 with
a short divisor, draws the logo block, waits until the timer handler sets
[3450h], draws the moving band, and loops:
031A: mov dx,03DAh
031D: in al,dx
031E: and al,01h
0320: jne 031Dh
0322: mov al,14h
0324: out 43h,al
0326: mov al,4Ah
0328: out 40h,al ; fast timer divisor byte
032A: call 036Ah ; moving logo block
032D: mov bx,3450h
0330: mov al,[bx]
0334: je 0330h ; wait for timer stream completion
0336: call 04A5h ; moving planar band blitter
0339: jmp 027Eh
This handshake gives the main loop a frame boundary, but the exact ownership is worth spelling out:
wait for vertical retrace
set Attribute Controller color-select 14h to zero
clear completion and reset ISR source to 3240h
clear/rebuild the 378-byte color-0 stream
advance the 179/409/366/550/181-entry motion rings
write the new synchronous DAC color-24 triplet
wait for the selected display-enable state
program PIT divisor 74
copy the moving 17x26 logo
wait until the ISR emits 127 color-0 triplets and sets completion
draw the phase-split 80x25 moving band
repeat
There is one visible page, not a backbuffer flip. The interrupt and main thread
cooperate on palette timing while the logo and band are written directly into
the displayed A000h surface.
Moving Logo Block At 036Ah
Raw 036Ah copies a 17-byte by 26-row block from A000h source 4E20h into a
moving destination. It selects planes 0..2 through the sequencer map mask and
uses the graphics controller mode register around the copy:
036A: mov dx,03CEh
036D: mov al,05h
036F: out dx,al
0371: in al,dx
0372: and al,FCh
0374: or al,01h
0376: out dx,al
0377: mov dx,03C4h
037A: mov al,02h
037C: out dx,al
037E: mov al,07h
0380: out dx,al ; planes 0,1,2
0382: mov di,[30CEh]
0386: add di,[30D2h]
038A: sub di,00A0h
038E: mov ax,A000h
0391: mov ds,ax
0393: mov si,4E20h
0396: mov bp,001Ah ; 26 rows
0399: mov cx,0011h ; 17 bytes per row
039C: rep movsb
039E: add di,003Fh ; 17 + 63 = 80 bytes per row
At 8 pixels per byte, 17 bytes is up to 136 pixels wide. In the capture this is
the moving yellow SHADOW logo. The source is already resident in A000h from
the setup copies. Setting Graphics Controller register 5 low bits to 01h
selects write mode 1: each movsb reads source VRAM to load the VGA latches,
then the destination write transfers those latched plane bits. Sequencer map
mask 07h carries planes zero through two while leaving plane three untouched.
This is therefore a latch copy inside the planar screen, not a CPU-side
three-plane decode. The 366-entry row table and 550-entry byte table constrain
the destination; the routine itself has no clipping branch.
The nested-loop cost is exact: 26 rows times 17 movsb iterations gives 442
source-VRAM reads and 442 destination-VRAM writes per frame. Each destination
write publishes the three selected latch planes, so those 442 CPU-addressed
bytes become 1,326 plane-byte writes. Entering write mode 1 and selecting map
mask 07h, then restoring write mode 0, costs six VGA index/data port writes;
there is no per-row mode or mask change.
The source's blank border is also the cleanup mechanism. The horizontal table uses byte positions 0..63 and changes by at most one byte per frame, exactly the one-byte blank margin on each side. The vertical table supplies rows 127..179; after the routine's two-row subtraction, the copied rectangle starts at rows 125..177 and changes by at most three rows, exactly the three blank rows at the top and bottom. Any strip exposed by the next position was therefore already blanked by the preceding padded copy. Width 17 at X byte 0..63 never crosses the 80-byte scanline; at the lowest positions the bottom reaches row 202 and is simply written below the visible 200-row page. There is no separate old-logo erase pass.
Moving Band Blitter At 04A5h
Raw 04A5h is the classic inner loop in this intro. It draws an 80-byte-wide,
25-row planar band with horizontal phase handling, using unrolled copies rather
than a counted row loop.
The routine starts by selecting plane 0 and clearing two guard regions:
04A6: mov dx,03C4h
04A9: mov al,02h
04AB: out dx,al
04AD: mov al,01h
04AF: out dx,al ; map mask = plane 0
04B0: mov dx,[2BC8h]
04B4: mov di,dx
04B6: sub di,0140h
04BA: mov cx,00A0h
04BD: xor ax,ax
04BF: rep stosw ; clear 320 bytes
04C1: add di,07D0h
04C5: mov cx,00A0h
04C8: rep stosw ; clear another 320 bytes
Those 320-byte writes are exact four-scanline strips. The first starts at
band_base - 0140h and ends immediately before the band. After the first clear,
DI equals band_base; adding 07D0h reaches band_base + 25*80, so the
second clear removes four rows immediately after the 25-row write area. At a
table value near zero the subtraction wraps within the 64 KiB A000 segment;
there is no screen-edge clip, but the write remains planar VRAM rather than host
memory. The 409-entry vertical ring ranges from rows 0..100 and changes by at
most four rows per frame, so these guards exactly erase whichever old band rows
the new position exposes. They are bounded old-position cleanup, not arbitrary
decorative clears.
The source side is not one 2,000-byte bitmap. 01EE:0000h..0A8Bh contains 27
tiles of exactly 4 bytes * 25 rows = 100 bytes; tile 0A28h is blank. At
01EE:0A8Ch begins a 3,756-word authored pointer stream. The 1D58h-byte
cursor cycle therefore contains 3,756 words: the pointer advances by one word
every fourth frame while the phase advances through 0..3 every frame,
producing an eight-pixel-per-frame horizontal scroll. The complete
cursor-plus-phase state repeats after 3,756 * 4 = 15,024 main frames.
The routine updates that cyclic pointer cursor and byte phase as follows:
04CA: mov si,[2BC4h]
04CE: sub si,1D56h
04D4: add si,1D58h ; wrap source table
04D8: mov bp,[2BC6h]
04DC: sub bp,3
04E1: sub si,2
04E4: add bp,4 ; phase wraps through 0..3
04EE: mov [2BC6h],bp
04F2: mov [2BC4h],si
The geometry is exact:
one mode-0Eh scanline 80 bytes
band height 25 rows
target band width 80 bytes per row
phase BP 0..3 byte alignment
The first unrolled block dereferences the first tile pointer and copies
4 - BP bytes per row for 25 rows. After each row it skips 4Ch + BP bytes,
so copied bytes plus skip equal one 80-byte scanline:
04FD: mov bx,004Ch
0500: add bx,bp
0502: mov cx,0004h
0505: sub cx,bp
0507: mov al,cl
0509: add si,bp
050B: rep movsb
050F: add di,bx
0511: add si,bp
That row body is manually repeated 25 times from 050Bh through 05CBh.
The middle section draws 19 full 4-byte tile columns. For each column it reads
the next source pointer, copies 25 rows of two words, and advances by 4Ch,
again making each row total 80 bytes:
05CD: mov bl,13h ; 19 columns
05CF: pop si
05D0: lodsw
05D1: xchg ax,si
05D3: mov di,dx
05D5: add dx,4
05D8: mov ax,004Ch
05DB: mov cx,0002h
05E0: rep movsw ; 4 bytes
05E2: add di,ax ; next row
...
0672: dec bl
0676: jmp 05CFh
The trailing section at 0679h..074Ch dereferences one final tile and copies
BP bytes per row, filling the remaining edge. Thus a phase-split viewport
consumes 21 authored tile pointers to fill 20 four-byte screen slots. The width
arithmetic is exact:
left edge 4 - BP bytes
middle 19 * 4 bytes
right edge BP bytes
total 80 bytes
So the routine redraws a complete 640-pixel-wide planar row band, but with a
byte-phase scroll that avoids per-pixel shifting. It is a very 1991-friendly
approach: table-driven source selection, no multiplications in the row body,
and row copies expanded into straight-line rep movs* sequences. Map mask
01h remains selected for the entire path, so the moving band and its guard
clears own plane zero only. There is no page flip, background restore, or
per-pixel transparency test in this hot path.
One invocation dereferences 21 source pointers, reading 42 pointer-table bytes.
The phase split does not change the payload volume: its two edge blocks move
25 * ((4-BP) + BP) = 100 bytes, while the 19 middle columns move
19 * 25 * 4 = 1,900 bytes. The authored tiles therefore supply exactly 2,000
source bytes and the blitter writes exactly 2,000 plane-0 bytes. The two guard
clears add 320 stosw iterations, or another 640 plane-0 bytes, for 2,640 VGA
bytes written by the band routine every frame. Its only conditional hot-path
state branch chooses whether the phase wrap also advances the pointer cursor.
The 19-column middle loop still branches once per column, but each column's 25
row copies and both edge blocks remain straight-line code.
One Completed Frame And Fast-IRQ Ledger
The fixed work can now be separated from timing-dependent polling. For one main-loop iteration that reaches the band draw:
| Owner | Reads | Writes / output |
|---|---|---|
| stream builder | 147 ramp bytes + 14 destination-table bytes | 378 clear bytes + 147 stamp bytes |
| synchronous DAC 24 lane | 3 RGB bytes | 2 DAC-index writes + 3 component writes |
| logo latch copy | 442 source-VRAM bytes | 442 destination-VRAM bytes, affecting 1,326 selected-plane bytes |
| moving band | 42 pointer bytes + 2,000 tile bytes | 640 guard bytes + 2,000 band bytes to plane 0 |
| 127 fast IRQ0 calls | 381 stream bytes | 127 DAC-index writes + 381 component writes + 127 PIC EOIs |
Across the two graphics routines, the CPU addresses 442 VGA reads and 3,082
VGA write bytes. Plane expansion in the write-mode-1 logo makes the hardware
write footprint 3,966 plane bytes: 442 * 3 for the logo plus 2,640 bytes on
plane zero for the moving band. Across the fast timer pass, the DAC receives
508 port writes, of which 381 are RGB components. The terminal IRQ additionally
writes the PIT control/count pair and the Attribute Controller index/value
pair; the main thread separately writes the PIT control/count pair when it arms
divisor 74.
These are lower-level transfer counts, not a cycle timing claim. Every IRQ can
read port 03DAh an unbounded number of times while waiting for display state,
the main loop has its own retrace and display-state polls, and interrupt entry,
register saves, address arithmetic, and ring bookkeeping remain outside the
table. Those variable waits are exactly why the nominal 7.876 ms fast-pass time
is only a lower bound.
Interrupt/Main-Loop Ownership
The frame loop and INT 08h share only a few deliberately small fields:
[323Eh] ISR's next RGB source pointer
[3450h] completion byte written only after the black terminator
3240h..33B9h main-built stream, ISR-consumed in three-byte units
The ISR saves and restores AX, CX, DX, SI, and DS, switches to data
segment 01EEh, writes exactly one triplet, sends PIC EOI, and returns. The
saved old INT 08h handler is never chained, so the BIOS time-of-day count loses
all ticks while the intro owns IRQ0.
The main code does not wrap stream rebuilding or VGA index/data pairs in
cli/sti. The possible interleavings are concrete:
- an IRQ0 can consume a triplet while the main code is still clearing and rebuilding the stream;
- the continuing divisor-256 IRQ0 can advance
[323Eh]after the main resets it but before divisor 74 is armed; and - an IRQ0 can interrupt the main thread's DAC-color-24 or Attribute Controller index/data sequence and touch the same VGA ports.
The explicit completion byte prevents the logo/band tail from running before a
fast stream has ended, and the main cannot observe 14h until the terminal ISR
returns. It is not a general producer/consumer or VGA-register lock. Correct
output therefore depends on instruction speed, interrupt timing, and tolerant
hardware behavior as well as on the otherwise deterministic ring tables.
Keyboard Exit
The replacement keyboard handler at raw 089Ah treats any IRQ1 as an exit. It
programs PIT control 34h and count 0000h, forcing the conventional
65,536-count mode-2 period rather than recovering the machine's prior PIT
configuration, then deliberately pops the interrupted IP, CS, and flags
instead of returning to the frame loop. It restores the saved INT 09h vector,
invokes that original handler once through software INT 09h, sends another
EOI of its own, and jumps directly to raw 033Ch. A normal BIOS keyboard
handler already acknowledges the PIC, making that second EOI redundant.
The common exit path restores the saved INT 08h vector, re-enables interrupts,
selects DAC index zero and writes three zero components, sets BIOS text mode
03h, and terminates through DOS INT 21h AH=4Ch with status zero. Mode 3
resets the display-side sequencer/graphics/attribute state; there are no DOS
allocations to release and no back pages to dispose of.
Summary
Revolt is small, but its core is precise:
PKLITE shell 8191-byte packed MZ, restored to 22358 bytes
mode BIOS mode 0Eh, planar 640x200 graphics
static setup map-mask plane stamps through 08C9h and 03B1h
timer ISR one RGB triplet to DAC color 0 per tick
palette builder 378-byte DAC stream with seven moving bursts
main motion five independent 179/409/366/550/181-entry rings
main handshake 127 IRQ0 writes, then completion through [3450h]
logo block 17x26-byte A000-to-A000 planar copy
band blitter 80-byte by 25-row phase-aligned unrolled copy
exit any IRQ1; vectors, fixed PIT period, BIOS mode 3
The trick is that the animation is split between two time scales. The timer interrupt changes color 0 rapidly enough to behave like a raster color stream, while the main loop only has to update the next palette stream, the SHADOW logo position, and one full-width 25-row planar band.