Analysis model: gpt-5.5 xhigh, sol high

Last edited: 2026-08-25

VGA by Scoopex - Technical Dissection

Scope

This is a binary-level pass over VGA by Scoopex, released for MS-DOS in 1991. The Hornet 1991 demo index lists scx_vga.zip as *** under the title VGA by Scoopex. The executable timestamp in the archive is 1991-09-10.

Useful public references:

The visible scroller text contains period greetings and contact text. Those details are intentionally not reproduced here; the technical point is how the text stream is converted into glyph/script data and drawn.

The interesting shape is very compact:

This is a small intro, but it is not simple BIOS drawing. Almost everything after setup is direct VGA register and VRAM work.

Archive And Expanded Executable

The examined archive:

9808591297174ef15a7c70500d5a6c889331f87d9222b94735b1b002cabacb6f  scx_vga.zip

Archive contents:

scx_vga.exe   22103  1991-09-10 23:18

The original SCX_VGA.EXE is PKLITE-packed:

size=22103  mzsize=22103  header=96  load=22007  relocs=1
entry=fff0:0100  stack=0566:0200  min=11c7  max=ffff

After expansion with UNP, the working executable is:

a047e926d88f58f5718ce96faf09743edfd064340275b6c08651ba761580f374  SCX_VGA.EXE
size=90061  mzsize=90061  header=64  load=89997  relocs=6
entry=0000:0000  stack=15f9:0100  min=012e  max=ffff

The restored 89,997-byte load image itself hashes to:

c0cc130569286d8eade3bd67e43a4fd9e750ad714f8153b65256b8448eeb3a3d  load image

The expanded relocation table patches six words:

0000:0001
0000:002a
0000:0535
0000:060f
0000:067c
0000:0777

The addresses below are offsets in the expanded load image after the 64-byte MZ header, with the load segment normalized to zero. The code uses three important segment bases after relocation:

CS = 0000h
DS = 084fh    ; main data/script segment
SS = 008ah    ; temporary asset segment used while expanding packed data

That means a literal such as DS:B630h is not file/load offset B630h; it maps to load offset 084F0h + B630h = 13B20h. Likewise SS:648Ch maps to 008A0h + 648Ch = 06D2Ch.

This segment split is important. Without it the apparent data tables look like nonsense.

Entry And Requirement Checks

The unpacked entry starts by setting DS to the relocated data segment and testing CPU FLAGS behavior:

0000  mov  ax, 084fh
0003  mov  ds, ax
0005  xor  ax, ax
0007  push ax
0008  popf
0009  pushf
000a  pop  ax
000b  and  ax, f000h
000e  cmp  ax, f000h
0011  jne  0018h
0013  mov  dx, c9b2h       ; XT-class error text
0016  jmp  0052h

0018  mov  ax, 7000h
001b  push ax
001c  popf
001d  pushf
001e  pop  ax
001f  and  ax, 7000h
0022  jne  0029h
0024  mov  dx, c9d1h       ; 386 requirement text
0027  jmp  0052h

This is not decorative. The inner loops later use 386-only pieces: FS, 32-bit operand-size prefixes, and SHR r16, imm8. The intro really does need a 386 class machine.

It then saves a temporary segment value, shrinks its DOS allocation, and asks the BIOS whether VGA support exists:

0029  mov  ax, 008ah
002c  mov  [b562h], ax     ; relative asset segment
002f  mov  bx, ss
0031  mov  [b564h], bx     ; original stack segment
...
0041  mov  ah, 4ah
0043  int  21h             ; resize current allocation
0046  cld
0047  mov  ax, 1a00h
004a  int  10h             ; VGA display-combination query
004c  cmp  al, 1ah
004e  je   0059h
0050  mov  dx, c982h       ; VGA required text

The printable error strings live at DS:C982h, DS:C996h, DS:C9B2h, and DS:C9D1h, which map into the tail of the expanded image.

First Asset Expansion

After the checks, the program allocates 1458h paragraphs:

0059  call 0880h           ; map scroller text through a glyph table
005c  mov  ah, 48h
005e  mov  bx, 1458h
0061  int  21h             ; allocate 83,328 bytes
006a  mov  [b556h], ax
006d  mov  es, ax

That allocation receives expanded image/glyph data. The source is not addressed through DS; the code switches SS to the asset segment stored at B562h:

006f  mov  ss, [b562h]     ; SS = CS + 008Ah
0073  mov  si, 0000h
      mov  bp, si
0078  add  bp, 00eah
007c  xor  di, di

The core conversion loop combines two one-bit source streams into one byte per pixel-ish output slot:

0080  mov  bh, 2ch         ; 44 blocks
0083  mov  dx, 0027h       ; 39 rows
0086  mov  bl, 06h         ; 6 source bytes per row
0088  mov  cx, 0008h       ; 8 bits per source byte
008b  xor  al, al
008d  rol  byte ss:[si], 1
0090  rcr  al, 1
0092  rol  byte [bp+00h], 1
0095  rcr  al, 1
0097  shr  al, 2
009a  cmp  al, 10h
009c  jne  009fh
009e  mov  al, 1fh
009f  stosb
00a0  loop 008bh
00a2  inc  si
00a3  inc  bp
00a4  dec  bl
00a6  jne  0088h
00a8  sub  di, 000ah
00ab  dec  dx
00ac  jne  0086h
00ae  add  si, 00eah
00b2  add  bp, 00eah
00b6  dec  bh
00b8  jne  0080h

Per output bit:

take one rotated bit from SS:SI
take one rotated bit from SS:BP
pack them through AL with RCR
shift into the high-nibble range
map value 10h to 1Fh
store one byte

The dimensions are hard-coded:

44 blocks * 39 rows * 6 bytes * 8 bits = 82,368 stores

The sub di,000Ah after each row gives an effective row advance of 38 bytes after writing 48 bytes. That is a shaped asset expansion, not a generic depacker. The source data is treated as two interleaved bitplanes, rotated in place while being consumed.

The same loop shape runs a second time into the allocation plus 1000h paragraphs:

00b8  mov  di, es
00ba  add  di, 1000h
00be  mov  [b558h], di
00c2  mov  es, di
...
00c8  mov  bh, 0bh         ; 11 blocks this time

So the intro creates two expanded asset banks:

B556h = first expanded bank
B558h = second expanded bank, 64 KB after the first

Saving Video State And Allocating Plane Pages

The original stack segment is restored, then VGA state is saved through BIOS function 1Ch:

0100  mov  ss, [b564h]
0104  mov  ax, 1c00h
0107  mov  cx, 0007h
010a  int  10h             ; ask required save-state size
010c  shl  bx, 2
010f  mov  ah, 48h
0111  int  21h
0123  mov  es, ax
0125  mov  [b552h], ax
0128  mov  ax, 1c01h
012b  mov  cx, 0007h
012e  xor  bx, bx
0130  int  10h             ; save video state

Then it allocates 1F40h paragraphs, exactly 128,000 bytes:

0132  mov  ah, 48h
0134  mov  bx, 1f40h
0137  int  21h
0145  mov  [b55ah], ax
0148  mov  cs:[04d4h], ax
014c  add  ax, 07d0h
014f  mov  [b55ch], ax
0152  mov  cs:[04ech], ax
0156  add  ax, 07d0h
0159  mov  [b55eh], ax
015c  mov  cs:[0506h], ax
0160  add  ax, 07d0h
0163  mov  [b560h], ax
0166  mov  cs:[0520h], ax

07D0h paragraphs is 32,000 bytes. The block is split into four 32 KB pages, one per VGA plane:

B55A = plane buffer 0
B55C = plane buffer 1
B55E = plane buffer 2
B560 = plane buffer 3

The writes to CS:04D4, CS:04EC, CS:0506, and CS:0520 patch immediate operands inside later mov ax, imm16 instructions. This self-patching avoids looking up the page segments inside the hot compositor.

Unchained VGA Setup

Before switching modes, the program fades the current DAC:

016a  cli
016b  call 0830h
016e  sti

Then it enters BIOS mode 13h, asks VGA BIOS for a 400-line scan mode, uploads a palette, and disables chain-4:

016f  mov  ah, 00h
0171  mov  al, 13h
0173  int  10h
0175  mov  ax, 1201h
0178  mov  bl, 36h
017a  int  10h             ; VGA scan-line service
017c  mov  ax, 1012h
017f  xor  bx, bx
0181  mov  cx, [b630h]     ; 00ffh palette entries
0185  mov  dx, ds
0187  mov  es, dx
0189  mov  dx, b730h
018c  int  10h             ; set DAC block from DS:B730

The direct VGA register writes are the usual unchained-mode recipe:

018f  mov  al, 04h
0191  mov  dx, 03c4h
0194  out  dx, al
0195  inc  dl
0197  in   al, dx
0198  and  al, f7h         ; clear chain-4
019a  out  dx, al

019b  mov  al, 14h
019d  mov  dx, 03d4h
01a0  out  dx, al
01a1  inc  dl
01a3  in   al, dx
01a4  and  al, bfh
01a6  out  dx, al

01a7  mov  al, 17h
01a9  mov  dl, d4h
01ab  out  dx, al
01ac  inc  dl
01ae  in   al, dx
01af  or   al, 40h
01b1  out  dx, al

01bd  mov  dx, 03d4h
01c0  mov  al, 09h
01c2  out  dx, al
01c3  inc  dx
01c4  in   al, dx
01c5  and  al, bfh
01c7  out  dx, al
01c8  mov  dx, 03d4h
01cb  mov  ax, 8f18h       ; line-compare setup
01ce  out  dx, ax

From this point on, A000h is planar. The code chooses planes with Sequencer index 2 (03C4h/03C5h) and shifts the displayed page with CRTC start-address registers.

Initial Planar Splash Copy

The first visible picture is copied one plane at a time. During this pass SS is again the asset segment, so the four source offsets map to these load offsets:

SS:648C -> load 06D2C
SS:6A7C -> load 0731C
SS:706C -> load 0790C
SS:765C -> load 07EFC

Each plane copy is 02F8h words, or 1,520 bytes:

01cf  mov  ax, 0a000h
01d2  mov  es, ax
01d4  mov  ss, [b562h]
01d8  mov  si, 648ch
01db  mov  dx, 03c4h
01de  mov  ax, 0102h       ; map mask 1
01e1  out  dx, ax
01e2  xor  di, di
01e4  mov  cx, 02f8h
01e7  rep  movsw

01ea  inc  dx              ; 03C5h
01eb  xor  di, di
01ed  mov  al, 02h
01ef  out  dx, al
01f0  mov  si, 6a7ch
01f3  mov  cx, 02f8h
01f6  rep  movsw

01f9  xor  di, di
01fb  mov  al, 04h
01fd  out  dx, al
01fe  mov  si, 706ch
0201  mov  cx, 02f8h
0204  rep  movsw

0207  xor  di, di
0209  mov  al, 08h
020b  out  dx, al
020c  mov  si, 765ch
020f  mov  cx, 02f8h
0212  rep  movsw

This is small but decisive: it confirms the mode is planar and the art is stored already split by VGA plane.

Nibble Screen Expander

The next image path expands four 8,000-byte chunks from the DS data segment into four 16,000-byte planar regions in VRAM. DS is 084Fh, so the source chunks are:

DS:0000 -> load 084F0
DS:1F40 -> load 0A430
DS:3E80 -> load 0C370
DS:5DC0 -> load 0E2B0

The caller selects a plane, sets SI, and calls 02C2h:

0219  mov  ax, 0a05fh
021c  mov  es, ax
021e  mov  cl, 04h
0220  mov  dx, 03c4h
0223  mov  al, 02h
0225  out  dx, al
0226  inc  dx              ; map-mask data port
0227  mov  al, 01h
0229  out  dx, al
022a  xor  si, si
022c  call 02c2h
022f  mov  al, 02h
0231  out  dx, al
0232  mov  si, 1f40h
0235  call 02c2h
0238  mov  al, 04h
023a  out  dx, al
023b  mov  si, 3e80h
023e  call 02c2h
0241  mov  al, 08h
0243  out  dx, al
0244  mov  si, 5dc0h
0247  call 02c2h

The expander itself is tiny:

02c2  xor  di, di
02c4  mov  al, [si]
02c6  mov  ch, al
02c8  shr  al, cl          ; high nibble, because CL=4
02ca  mov  es:[di], al
02cd  inc  di
02ce  and  ch, 0fh
02d1  mov  es:[di], ch     ; low nibble
02d4  inc  di
02d5  inc  si
02d6  cmp  di, 3e80h
02da  jne  02c4h
02dc  ret

So each source byte becomes two bytes:

destination[2*n+0] = source[n] >> 4
destination[2*n+1] = source[n] & 0Fh

Because the caller repeats this for map masks 1, 2, 4, and 8, it builds a planar 4-bit screen from four nibble-coded streams.

The code then uses a deliberate overlapping copy inside VRAM:

0259  mov  ax, 0a05fh
025c  mov  es, ax
025e  mov  ds, ax
0260  xor  si, si
0262  mov  di, 3e80h
0265  mov  cx, bb80h
0268  rep  movsb

Source and destination are the same segment, with destination higher than source. This forward overlapping copy repeats the earlier expanded pattern through later VRAM. It is a compact way to seed several page regions from one expanded source.

Plane Buffers In DOS Memory

After VRAM is seeded, the intro reads each VGA plane back into one of the four 32 KB DOS buffers. It selects the VGA read map through Graphics register 4:

0272  mov  dx, 03ceh
0275  mov  al, 04h
0277  out  dx, al
0278  inc  dx              ; 03CFh data
0279  xor  al, al          ; read map 0
027b  out  dx, al
027c  xor  di, di
027e  xor  si, si
0280  mov  cx, 3e80h       ; 16,000 words = 32 KB
0283  rep  movsw

Then the same copy is repeated for read maps 1, 2, and 3, with ES changed to B55C, B55E, and B560.

The result is:

plane buffer 0 = full VGA read-map 0 snapshot
plane buffer 1 = full VGA read-map 1 snapshot
plane buffer 2 = full VGA read-map 2 snapshot
plane buffer 3 = full VGA read-map 3 snapshot

The later compositor can now combine these DOS-memory plane pages with live VRAM without decoding the original packed streams again.

The one-time setup traffic is therefore explicit. The planar splash reads and writes 6,080 bytes. The four nibble expanders read 32,000 source bytes and write 64,000 VGA bytes. The overlapping seed copies 48,000 VGA bytes onto later VGA addresses, and the four snapshots read 128,000 VGA bytes into 128,000 RAM bytes. Before the main loop, those paths account for 176,000 VGA reads, 118,080 VGA writes, 38,080 ordinary source reads, and 128,000 plane- buffer writes.

Main Loop And Self-Patched Segment Rotation

The main loop begins at 03ACh. It computes an address from the current page offset in BP, adds a word from a table at DS:B566h, and then patches several segment immediates:

03ac  mov  cx, bp
03ae  add  cx, 21c0h
03b2  mov  bx, b566h
03b5  add  word cs:[03b3h], 2
03bb  mov  ax, [bx]
03bd  cmp  ah, ffh
03c0  jne  03cbh
03c2  mov  word cs:[03b3h], b566h
03c9  jmp  03b2h
03cb  add  cx, ax
03cd  mov  bx, cx

The table at DS:B566h starts with descending-looking word offsets such as:

0550 0500 04b0 0460 0410 03c0 0370 0320 ...

The program then converts BX to segment-relative forms and patches them into the later mov ax, imm16 instructions:

03cf  mov  ax, 0000h       ; immediate patched at CS:03D0
03d2  mov  dx, ds
03d4  mov  cx, bx
03d6  shr  cx, 4
03d9  sub  dx, cx
03db  add  ax, dx
03dd  mov  fs, ax
...
03e4  push ax
03eb  mov  ax, 0000h       ; patched companion segment
03ee  add  ax, dx
03f0  push ax

The values patched at 03D0h, 03E0h, 03E6h, and 03ECh are rotated later:

064e  mov  cx, cs:[03d0h]
0653  mov  ax, cs:[03ech]
0657  mov  cs:[03d0h], ax
0666  mov  ax, cs:[03e6h]
066a  mov  cs:[03ech], ax
066e  mov  ax, cs:[03e0h]
0672  mov  cs:[03e6h], ax
0676  mov  cs:[03e0h], cx

That makes the compositor cycle four source phases without indexing through a runtime array in the hot loop. The indexing has already been paid for in the self-modified immediates.

Raster DAC Stream

At 03F1h the code enables all four plane writes and sets Graphics register 8 before it begins per-frame DAC streaming:

03f1  mov  dx, 03c4h
03f4  mov  ax, 0f02h
03f7  out  dx, ax          ; write all four planes
03f8  mov  dl, ceh
03fa  mov  ax, 0008h
03fd  out  dx, ax          ; Graphics bit mask index
03fe  mov  di, 0000h
0406  mov  si, bcfeh       ; raster palette stream
0409  mov  dx, 03c8h
040c  mov  cl, dah         ; used to swap DX to 03DAh

The loop interleaves DAC writes with status-port waits:

040e  outs dx, word [si]   ; DAC index plus first component pair
040f  inc  dl              ; 03C9h DAC data
0411  outs dx, byte [si]
0412  xchg dl, cl          ; DX becomes 03DAh
0414  in   al, dx
0415  test al, 01h
0417  je   0414h
0419  in   al, dx
041a  test al, 01h
041c  je   0419h
041e  xchg dl, cl          ; DX back to 03C9h
0420  outs dx, byte [si]
0421  test al, 08h
0423  jne  042fh
0425  dec  dl              ; 03C8h
0427  outs dx, word [si]
0428  inc  dl
042a  outs dx, byte [si]
042b  xchg dl, cl
042d  jmp  0419h

03DAh bit 0 is the display-enable status, and bit 3 is vertical retrace. The loop waits on display timing and pushes DAC bytes between those waits. This is a raster palette stream, not a normal once-per-frame palette upload.

There is also a slower palette command stream updated every other frame:

042f  mov  al, 00h
0431  not  byte cs:[0430h] ; flip embedded immediate
0436  cmp  al, 00h
0438  je   0467h
043a  mov  si, ba30h
043d  inc  word cs:[043bh]
0442  mov  al, [si]
0444  cmp  al, 00h
0446  je   0467h
0448  cmp  al, ffh
044a  jne  0455h
044c  mov  word cs:[043bh], bce0h
0453  jmp  043ah
0455  inc  si
0456  xor  ch, ch
0458  mov  cl, [si]        ; byte count
045a  inc  si
045b  dec  dl              ; 03C8h index
045d  out  dx, al
045e  inc  dl              ; 03C9h data
0460  rep  outs dx, byte [si]
0462  mov  cs:[043bh], si

The command format is:

00                 no update this frame
FF                 reset command pointer
index, count, data update DAC index with count bytes

This gives the intro both scanline-timed color changes and slower palette animation.

VRAM Band Motion

The block beginning at 0467h copies bands within VRAM using two segment views of the A000h aperture:

0467  mov  ax, 0a82fh
046a  mov  ds, ax
046c  mov  si, di
046e  mov  cx, 00a0h
0471  rep  movsb
0473  add  di, 0b40h
0477  mov  si, di
0479  mov  cl, 50h
047b  rep  movsb

The A82Fh and A05Fh segment aliases point at different physical offsets inside the same VGA memory range. The code is not copying a whole framebuffer; it is moving selected bands by changing segment bases and using short fixed lengths:

copy 160 bytes
skip/advance 0B40h
copy 80 bytes

Two self-patched row movers follow. One walks upward from zero in 80-byte steps until 0B40h:

0494  mov  ax, 0000h       ; patched by add at 04A7h
0497  cmp  ax, 0b40h
049a  je   04afh
049c  mov  di, 0000h
049f  add  di, ax
04a1  mov  si, di
04a3  mov  cl, 50h
04a5  rep  movsb
04a7  add  word cs:[0495h], 50h

The other walks from 4740h toward 5550h:

04af  mov  si, 4740h       ; patched by add at 04BEh
04b2  cmp  si, 5550h
04b6  je   04c4h
04b8  mov  di, si
04ba  mov  cl, 50h
04bc  rep  movsb
04be  add  word cs:[04b0h], 50h

The repeated 50h is the planar row width: 80 bytes. The movement is therefore row-granular in unchained VGA memory.

Four-Plane OR Compositor

The main image compositor writes four VGA planes. For plane 0:

04c4  mov  di, bx
04c6  mov  dx, 03cfh
04c9  mov  al, ffh
04cb  out  dx, al          ; bit mask = FFh
04cc  mov  dl, c4h
04ce  mov  ax, 0102h       ; map mask 1
04d1  out  dx, ax
04d2  inc  dx              ; 03C5h
04d3  mov  ax, 0000h       ; patched to plane buffer segment
04d6  mov  ds, ax
04d8  mov  cx, 030ch       ; 780 dwords = 3120 bytes
04db  mov  eax, [di]
04de  or   eax, fs:[di]
04e2  stosd
04e4  loop 04dbh

Planes 1, 2, and 3 repeat the same inner loop after selecting masks 02h, 04h, and 08h and popping the next FS phase:

04e6  mov  al, 02h
04e8  out  dx, al
04e9  mov  di, bx
04eb  mov  ax, 0000h       ; patched
04ee  mov  ds, ax
04f0  pop  fs
04f2  mov  cx, 030ch
04f5  mov  eax, [di]
04f8  or   eax, fs:[di]
04fc  stosd
04fe  loop 04f5h

The hot formula is:

for each VGA plane:
  select map mask
  for 780 dwords:
    VRAM[di] = plane_buffer[di] OR phase_buffer[di]

This is why the intro requires a 386. The compositor gets four pixels/bytes per iteration with EAX, and it can combine a second source through FS without changing DS on every dword.

The loops write only 3,120 bytes per plane per call. They are drawing a moving window/strip, not repainting a full 64 KB VGA aperture.

Alternating Strip Copy And OR Path

Another self-flipped embedded byte decides whether the frame takes a direct copy path or a compositing path:

0569  mov  al, ffh
056b  inc  al
056d  je   05adh
056f  mov  al, 01h
0571  out  dx, al
0572  mov  bx, bp
0574  add  bx, 0320h
0578  mov  di, bx
057a  mov  si, [b546h]
057e  mov  cx, 0384h       ; 900 dwords = 3600 bytes
0581  rep  movsd

The direct path repeats the same 0384h dword copy for all four planes:

plane mask 1: copy 3600 bytes
plane mask 2: copy 3600 bytes
plane mask 4: copy 3600 bytes
plane mask 8: copy 3600 bytes

The alternate path at 05ADh uses four OR blocks similar to the main compositor:

05ad  xor  di, di
05af  mov  dx, bp
05b1  shr  dx, 4
05b4  add  dx, 1000h
05b8  mov  fs, dx
05ba  mov  ax, 2000h
05bd  mov  es, ax
05bf  mov  ax, 3000h
05c2  mov  ds, ax
05c4  mov  cx, 0384h
05c7  mov  eax, [di]
05ca  or   eax, fs:[di]
05ce  stosd
05d0  loop 05c7h

Then DX is advanced by 06EFh between phases:

05d2  add  dx, 06efh
05d6  mov  fs, dx
...
05e6  add  dx, 06efh
...
05fa  add  dx, 06efh

This is another phase-combiner: one base stream from DS:3000h, one moving phase through FS, four chunks, all 32-bit. Because ES=2000h, this branch builds a 14,400-byte RAM staging image; unlike the direct branch, it does not write the VGA aperture at this point.

One-Column Text Shifter

After the image strip work, the code shifts a buffer and draws one new text column:

0618  mov  si, 0000h
061b  mov  di, si
061d  inc  si
061e  mov  ax, ds
0620  mov  es, ax
0622  mov  cx, 030ch
0625  rep  movsd

Because SI=1 and DI=0, this is a one-byte phase shift of a dword stream. It copies from offsets 1,5,9,... to 0,4,8,..., which is a cheap planar phase shift rather than a full byte-by-byte scroll.

Then it draws one vertical column, 39 rows high:

0628  mov  di, 0000h
062b  mov  si, 0000h
062e  add  si, [b544h]     ; column phase inside glyph
0632  mov  cx, 0027h       ; 39 rows
0635  mov  ds, [b554h]     ; selected glyph bank
0639  add  di, 004fh
063c  movsb
063d  add  si, 0025h
0640  loop 0639h

The row math is exact:

destination stride = 4Fh + one MOVSB = 50h bytes
source stride      = 25h + one MOVSB = 26h bytes
row count          = 27h = 39

So the text renderer inserts one 39-pixel-high column per frame into an 80-byte-wide planar row layout. The current column phase is B544h.

When the current glyph column has run long enough, a script pointer at B542h chooses the next character/shape:

0680  mov  bx, [b540h]
0684  mov  al, [bx-3608h]  ; width/duration table
0688  cmp  [b544h], al
068c  jne  06cah
068e  mov  word [b544h], 0000h
0694  inc  word [b542h]
0698  mov  si, [b542h]
069c  mov  al, [si]
069e  cmp  al, ffh
06a0  jne  06aah
06a2  mov  word [b542h], cb32h
06a8  jmp  0698h
06aa  mov  [b540h], al

The text stream at DS:CB32h starts as readable ASCII in the expanded file. At startup, routine 0880h maps it through a table at DS:CA32h:

0880  mov  di, cb32h
0883  mov  ax, ds
0885  mov  es, ax
0887  mov  bx, ca32h
088a  mov  al, [di]
088c  cmp  al, ffh
088e  je   0894h
0890  xlat                 ; AL = DS:[BX + AL]
0891  stosb
0892  jmp  088ah

That converts character bytes into the small glyph/script alphabet used by the column renderer.

CRTC Motion And Exit Key

The frame loop exits on the space-bar scan code read directly from port 60h:

06ca  in   al, 60h
06cc  cmp  al, 39h
06ce  jne  06d1h
06d0  ret

Otherwise it updates CRTC register 18h, the line-compare register, from a script at DS:B632h:

06d6  dec  word [b54eh]
06da  jne  0703h
06dc  mov  al, 18h
06de  mov  dx, 03d4h
06e1  out  dx, al
06e2  inc  dx
06e3  mov  al, [b632h]
06e6  cmp  al, ffh
06e8  jne  06f9h
06ea  mov  word cs:[06e4h], b632h
06f1  mov  ax, [b550h]
06f4  mov  [b54eh], ax
06f7  jmp  0703h
06f9  inc  word cs:[06e4h]
06fe  inc  word [b54eh]
0702  out  dx, al

Finally it writes the CRTC start address from BP:

0703  mov  dx, 03d4h
0706  mov  ax, bp
0708  mov  al, 0ch
070a  out  dx, ax          ; high start address
070b  mov  ax, bp
070d  mov  ah, al
070f  mov  al, 0dh
0711  out  dx, ax          ; low start address
0712  jmp  03ach

This is the main screen motion trick. The CPU updates strips and columns, while the CRTC shifts which part of the planar aperture is visible.

One Settled Two-Frame Workload

Three embedded bytes at 047Eh, 053Ah, and 056Ah are toggled with NOT. After the reveal handoff, their phases align into a stable pair:

direct frame
  copy the fixed 160+80-byte VGA bands
  advance BP by one 50h row
  copy four 3,600-byte strips directly to the four VGA planes
  consume 300 ES-prefixed VGA bytes as the direct-path delay

alternate frame
  copy the fixed bands plus the extra 80-byte band
  hold BP
  OR four 3,600-byte RAM chunks into the 14,400-byte staging block

Both frames first run the four-plane 030Ch compositor and then run the text shift/column insertion. Excluding the timing-dependent raster stream, the every-other-frame palette command, and the temporary row mover, exact memory traffic is:

path       RAM reads  RAM writes  VGA reads  VGA writes
direct         42519        3159        540       27120
alternate      56919       17559        320       12800
two-frame      99438       20718        860       39920

The common four-plane compositor owns 24,960 of each frame's RAM reads and 12,480 VGA writes: 3,120 dword iterations read one base and one FS dword, then publish one dword. The text path adds 3,120 overlapping RAM reads/writes for the one-byte phase shift and 39 glyph-byte reads/writes for the new column. The direct branch adds 14,400 RAM reads and VGA writes; the alternate branch adds 28,800 RAM reads and 14,400 staging writes.

Old-frame movement is bounded too. The first self-patched row mover copies 36 80-byte rows, then the second copies 45 rows: 81 conditional 80-byte VGA read/write calls after each reset. BP advances only on direct frames. From 05F0h to 4470h requires 200 such advances, so the settled page cycle is 400 frames; on wrap, 0548h..055Dh restores BP=05F0h and resets both row-mover immediates. The 100-word B566h phase table has its own FFFFh sentinel and wrap. This closes the lifecycle: composite, selectively move old rows, publish one of two strip paths, shift/insert text, rotate source segments, update CRTC, and eventually reset the page window without a whole-screen clear.

Initial Reveal Path

Before the loop settles into 03ACh, routine 0715h builds a composite image and copies it to all four planes:

0715  xor  di, di
0717  mov  dx, bp
0719  shr  dx, 4
071c  add  dx, 1000h
0720  mov  fs, dx
0722  mov  ax, 2000h
0725  mov  es, ax
0727  mov  ax, 3000h
072a  mov  ds, ax
072c  mov  cx, 0384h
072f  mov  eax, [di]
0732  or   eax, fs:[di]
0736  stosd
0738  loop 072fh

The loop repeats with FS += 06EFh three times, then clears four marker bytes and uploads the four planes:

0780  mov  byte [7d00h], 0
0785  mov  byte [8b10h], 0
078a  mov  byte [9920h], 0
078f  mov  byte [a730h], 0
0794  mov  ax, 0102h
0797  mov  dx, 03c4h
079a  out  dx, al
079b  inc  dx
079c  mov  bx, bp
079e  add  bx, 0320h
07a2  mov  di, bx
07a4  mov  si, 7d00h
07a7  mov  cx, 0384h
07aa  rep  movsd

Again the copy is repeated for map masks 1, 2, 4, and 8.

The reveal driver uses a table at DS:B6D4h, waits for vertical retrace, writes the CRTC start address, and computes:

0818  mov  ax, [si]
081a  inc  si
081b  mov  cl, 50h
081d  mul  cl
081f  add  ax, 05f0h
0822  mov  bp, ax
0824  cmp  bp, 4470h
0828  jne  07fch
082a  mov  bp, 3fc0h
082d  jmp  05adh

The formula is:

visible_start = 05F0h + table_byte * 50h

Again 50h is the 80-byte planar row width. The reveal is a table-driven CRTC start-address motion, not a full-screen redraw.

Live DAC Fade-To-Minimum

The fade routine at 0830h is called before the intro changes video mode. It waits for retrace-high, then reads and rewrites every RGB component of DAC entries 1..63. It repeats this for 64h (100) outer passes:

0830  mov  si, 0064h
0833  mov  dx, 03dah
0836  in   al, dx
0837  test al, 08h
0839  je   0836h
083b  mov  cx, 003fh
083e  call 085ch           ; read DAC entry CL
0841  dec  ah
0843  jne  0847h
0845  inc  ah
0847  dec  bl
0849  jne  084dh
084b  inc  bl
084d  dec  bh
084f  jne  0853h
0851  inc  bh
0853  call 086eh           ; write DAC entry CL
0856  loop 083eh
0858  dec  si
0859  jne  0833h
085b  ret

The read/write helpers are plain DAC port sequences:

085c  mov  dx, 03c7h
085f  mov  al, cl
0861  out  dx, al
0862  mov  dl, c9h
0864  in   al, dx          ; R
0865  mov  ah, al
0867  in   al, dx          ; G
0868  mov  bl, al
086a  in   al, dx          ; B
086b  mov  bh, al
086d  ret

086e  mov  dx, 03c8h
0871  mov  al, cl
0873  out  dx, al
0874  inc  dl
0876  mov  al, ah
0878  out  dx, al
0879  mov  al, bl
087b  out  dx, al
087c  mov  al, bh
087e  out  dx, al
087f  ret

The old “decrements each nonzero component” description missed the branch order. For each component the actual mapping is:

input 0   -> DEC wraps to FFh, JNE keeps FFh
input 1   -> DEC reaches 0, INC restores 1
input 2+  -> input - 1

The VGA DAC masks written components to its implemented width, so a zero first becomes the maximum six-bit value and then descends; one is the fixed floor. After 100 passes, entries 1..63 settle at (1,1,1), not (0,0,0), and entry 0 is never visited. “Fade-to-minimum” is therefore the instruction-accurate name. The routine uses the DAC itself as state and needs no RAM palette copy.

Its traffic is exact: 100 retrace-high waits, 6,300 DAC entry reads and writes, 18,900 component reads, 18,900 component writes, 6,300 read-index writes, and 6,300 write-index writes. It does not wait for a low-to-high retrace edge; if an outer pass begins while bit 3 is already high, it proceeds immediately.

Exit And Restore

When the main loop returns, the program restores the saved VGA state, frees its allocations, switches back to text mode, and exits through DOS:

0381  mov  ax, 1c02h
0384  mov  cx, 0111h
0387  mov  es, [b552h]
038b  xor  bx, bx
038d  int  10h             ; restore video state
038f  mov  ah, 49h
0391  int  21h             ; free save-state block
0393  mov  ah, 49h
0395  mov  es, [b556h]
0399  int  21h             ; free asset block
039b  mov  ah, 49h
039d  mov  es, [b55ah]
03a1  int  21h             ; free plane buffers
03a3  mov  ax, 0003h
03a6  int  10h
03a8  mov  ah, 4ch
03aa  int  21h

For a tiny 1991 intro, that is unusually tidy: video state is saved and restored rather than assuming the BIOS mode reset is enough.

Why It Matters

VGA by Scoopex is small, but it shows a clear 1991 PC/VGA style:

The key lesson is that the intro's visual density does not come from a large engine. It comes from a handful of exact planar primitives: nibble expansion, plane snapshots, fixed-size OR strips, one-column text insertion, and CRTC motion.