Analysis model: gpt-5.5 xhigh, sol high

Last edited: 2026-08-25

Black Glass - Renaissance

Subject

Black Glass is a 1992 MS-DOS VGA vector demo by Renaissance. The bundled documentation names it:

"Black Glass" Vector Demo - Renaissance 4/09/92

Credits from the non-contact part of the release text:

The release expects a 386 or better, VGA, and real DOS. Sound Blaster or Sound Blaster Pro is optional. The documentation warns against QEMM, EMM386, 386^MAX, HIMEM, Windows, OS/2, or any other memory manager that has already put the CPU under a V86/protected-mode supervisor. The binary backs that warning up: it checks CR0/virtual mode itself and installs its own small 386 protected-mode environment.

Old BBS/site/contact tables from ren-92.nfo are deliberately omitted here.

Runtime Capture

Black Glass runtime contact sheet

Capture details:

The capture was stopped by an external 180 second DOSBox-X time limit. The visible run had already covered the title, credits, main scroller/text sequence, news text, and 386 protected-mode explanation. Timestamps below are capture stream timestamps, not decoded in-demo counters.

The sequence GIF below is assembled from representative full-frame captures in the same run. It compresses the point-sprite grammar into one view: title reveal, compact ball cluster, credit overlays, helix/chain objects, and the later protected-mode explanatory text pages using the same renderer.

Black Glass runtime sequence GIF showing point-sprite objects and text pages

Timestamp Frame What is happening
00:00:05.000 Black Glass title text at 00:00:05.000 The static star/nebula background is up and the title text begins appearing. The vector object list is not yet dense; this is a text/palette reveal phase.
00:00:10.000 Black Glass opening object at 00:00:10.000 First compact ball cluster. The object is made from sorted 7-byte transformed sprite records, not from filled polygons.
00:00:15.000 Black Glass music credit at 00:00:15.000 Credit text and a small moving object share the same background. The lower mirrored/inverted band is produced by the same Mode X pages and palette/object pass, not by a second DOS text screen.
00:00:22.000 Black Glass code credit object at 00:00:22.000 Credit text with a denser ball object. The object appears as red/cyan/purple balls because each transformed point carries one sprite/color index.
00:00:25.000 Black Glass Tran credit at 00:00:25.000 A diagonal snake/helix enters. This is still the same point-sprite engine with a different scene definition and motion script.
00:00:35.000 Black Glass Renaissance text at 00:00:35.000 The main explanatory text stream is active. A long green/white chain is drawn over the text while the current draw page's old dirty strips are restored from its prior use.
00:00:50.000 Black Glass 386 text at 00:00:50.000 The text explicitly talks about 386 protected mode. This matches the binary's real-mode preflight and CR0 switch.
00:01:10.000 Black Glass OS/2 and Windows text at 00:01:10.000 A multi-ball cluster moves while the text warns against protected/V86 supervisors. This is the user-visible version of the smsw/V86 failure branch.
00:01:30.000 Black Glass Renaissance news text at 00:01:30.000 News/announcement phase with a compact red/purple object. The renderer keeps the background stable by erasing only the previous sprite spans.
00:01:50.000 Black Glass registration text at 00:01:50.000 The text stream continues while the object shape changes again. Private historical contact details are not reproduced in the analysis.
00:02:20.000 Black Glass protected mode question at 00:02:20.000 The demo asks why it is in 386 protected mode. The runtime answer is practical: flat 32-bit addressing, direct VGA memory access, and bigger tables/buffers.
00:02:45.000 Black Glass 386 instruction set text at 00:02:45.000 Late captured phase with a red curve/chain object and text about the 386 instruction set. This corresponds to the inner loops' heavy use of 32-bit registers and scaled integer math.

Read as a sequence, the first four frames show the demo's visible grammar: 00:00:05.000 is a title/palette reveal, 00:00:10.000 is the first object cluster, 00:00:15.000 and 00:00:22.000 are the same point-sprite engine carrying credit text, and 00:00:25.000 is just another scene definition in that same engine. The later text-heavy frames are not a separate intro; they are the explanatory part of the same renderer.

The existing runtime frames, contact sheet, and GIF were not regenerated, cropped, padded, resized, or touched in this concordance pass.

Runtime-To-Code Concordance

The captured sequence is useful because the demo is visually repetitive in the right way: almost every screen combines the same star/background page, a text state, and one point-sprite object. That lets the runtime frames be tied to a small set of exact protected-mode routines rather than treated as unrelated screenshots.

runtime evidence                         code evidence
00:00:05 title/palette reveal            0x12ac DAC upload, 0x4b49d vblank/page path
00:00:10 first compact ball cluster      0x4ce51 scene load, 0x4cbbf transform
00:00:15/00:00:22 credit overlays        0x4cf14 main loop plus text callback
00:00:25 diagonal helix/snake            0x4d03d script interpreter updates motion
00:00:35 long chain over text            0x4cd2f dirty-strip restore before redraw
00:00:50 protected-mode explanation      0x03a2 preflight, 0x0471 CR0 switch
00:01:10 V86/Windows warning screen      0x0348 SMSW protected/V86 failure check
00:01:30/00:01:50 news and text pages    0x4cf14 scene/text/object loop
00:02:20 protected-mode question         0x06c0 real-mode bridge, flat A000 bias
00:02:45 386 instruction-set text        32-bit transform/sort/projection loops

The first bridge is the mode setup. Every captured frame has the same stable nebula/text surface and moving balls, which matches the Mode X initialization at 0x4b143 and page state built around 0x49cea, 0x49cf2, and 0x49cf6. The frame-to-frame stability is not a full-screen redraw trick: the code keeps a clean background page and flips/display-starts through 0x4b49d.

The ball objects in 00:00:10, 00:00:22, 00:00:25, and the later chain screens come from the same point pipeline. Scene descriptor loader 0x4ce51 selects the active vertex list and motion state. The interpreter at 0x4d03d changes angular velocities, translation bounds, waits, and scene completion. Transform loop 0x4cbbf rotates each 7-byte point record through 512-phase sine/cosine tables, then insertion-sorts the transformed records into the depth list at 0x4b9b8.

Projection and drawing are the visible reason the objects read as glossy vector balls rather than polygon meshes. 0x4cdb6 projects each sorted point around the screen center constants 0xA0 and 0x64, derives the clipped vertical range, and calls the planar sprite blitter at 0x4cb2f. Inside that blitter, y * 0x50, x >> 2, and x & 3 convert logical coordinates into unchained VGA memory and plane phase. The out 03C5h,al / movsb inner loop is the runtime source of the small colored ball pixels visible in the GIF.

The dirty-restore loop explains why the background and text remain stable while the balls move. Blitter 0x4cb2f records each damaged span through [4ba56h]/[4ba57h]; restore routine 0x4cd2f selects all planes and copies 6-byte-wide strips from the clean page, advancing by 0x4A so each restored row lands on the next 80-byte planar scanline. Its two lists follow the two draw pages, so it repairs damage left when that same page was used two outer-loop iterations earlier. The visible result is the clean text under the moving chain at 00:00:35 and the later protected-mode text pages.

The protected-mode text is not just narrative. The 00:00:50, 00:01:10, 00:02:20, and 00:02:45 frames correspond directly to the bootstrap design: real-mode preflight at 0x03a2, VGA/386/V86/memory checks at 0x0309..0x0355, CR0 transition at 0x0471, interrupt bridge state around 0x06c0, and the extensive 32-bit fixed-point math in the runtime. The demo is describing the same 386 dependency that the binary enforces before entering its renderer.

Files And Hashes

Archive: rbgdemo1.zip

31aee272757d50ea3808d8dda626eba98a1bfe3bc0da0d3f9e3e7347e1963ea4  rbgdemo1.zip
ae4377ea5ad7ace3149992f111f8384a81a71b1d658cd2fe453291ab14b26d6f  demosite.com
ac06e808e17ce534b833144835da2f15f6fe6b4e76bcfbafc7bfa9db12bfbb29  rbgdemo.doc
5d0d57d657c418746a66f18c4d8d8b3fa1631664d8c23b8f373806b61e29e97d  rbgdemo.exe
a5c7579b8ba0d51325e09d9b00a0eff8d4eb918a8165827c096edb8bc909ad07  ren-92.nfo

UNP-expanded analysis copy of rbgdemo.exe:

bdf55762ad41599552938fe913d7a392745411ec6d632aa50690c95e6d1aff8e  RBGDEMO.EXE

The archive contains only a packed demo executable, a short doc, a Renaissance NFO, and demosite.com. Unlike Black Glass ][, this first release has no external .670 music files; the music data and player are inside rbgdemo.exe.

Packed EXE Shape

The distributed rbgdemo.exe is a PKLITE-packed MZ executable:

file size:          217875 bytes
MZ declared size:   217875 bytes
header paragraphs:  10
load image:         217715 bytes
relocations:        1
min extra:          6571 paragraphs
max extra:          65535 paragraphs
entry CS:IP:        fff0:0100
stack SS:SP:        3532:0200
overlay:            0

The high CS=FFF0h entry is a common packed-executable trick: DOS loads the image normally, but execution starts near the top of the packed load area inside the decompression stub. strings on the packed file shows the PKLITE copyright line and only a few real program messages:

You must have VGA to run this program!!!
You must have a 386 or better to run this program!!!
This system is already in V86 mode!!!
Not enough low memory to run this program!!!
Not enough extended memory to run this program!!!

After running UNP under DOSBox-X, the expanded executable is much clearer:

file size:          318020 bytes
MZ declared size:   318020 bytes
header paragraphs:  32
load image:         317508 bytes
relocations:        8
min extra:          1 paragraph
max extra:          65535 paragraphs
entry CS:IP:        0000:03a2
stack SS:SP:        0000:0574
overlay:            0

That expanded image is what the static offsets below refer to.

Real-Mode Preflight

The expanded entry starts at load offset 0x03a2:

03a2: cli
03a3: cld
03a4: mov ax,cs
03a6: mov ds,ax
03a8: mov ss,ax
03aa: mov sp,0200h
03ad: call 0309h     ; VGA check
03b0: call 0327h     ; 386 check
03b3: call 0348h     ; protected/V86 check
03b6: call 0355h     ; memory sizing

The checks are small and direct:

The memory code requires at least 0x280 KiB conventional memory:

0355: int 12h
0357: cmp ax,0280h
035a: jb  low_memory_error

Then it turns the conventional-memory count into a byte limit, calls BIOS extended-memory function AH=88h, shifts the returned KiB count by 10, and adds 0x100000. This gives the protected-mode allocator an upper extended-memory address:

0376: mov ah,88h
0378: int 15h
0385: shl eax,0ah
0389: add eax,00100000h
038f: mov [0c71h],eax

So the demo does not rely on XMS. It wants BIOS-reported extended memory and then manages it itself.

Protected-Mode Switch

The switch code saves a real-mode interrupt vector, patches selector bases, and loads a tiny GDT:

0471: cli
0472: lgdt [0210h]
0477: mov eax,cr0
047a: or  al,01h
047c: mov cr0,eax
047f: jmp 0008h:0937h

Do not read 0008:0937 as a simple file offset. Before this jump, the loader has patched descriptor bases at offsets such as 0x098a, 0x0992, 0x09a2, and 0x09aa. In the raw file, 0x0937 sits inside descriptor/data padding; after descriptor-base patching, selector 8 maps the protected-mode entry into the gateway/runtime block.

The protected-mode runtime then installs:

The fatal trap at 0x0e25 is intentionally brutal:

0e25: in  al,61h
0e27: or  al,03h
0e29: out 61h,al
0e2b: jmp 0e2bh

It turns on the PC speaker gate and loops forever. That is the extender's "something impossible happened" path.

The return path at 0x0f22 restores flags, PIC masks, real-mode selectors, and then far-jumps back through the real-mode transition code. The demo uses this on normal exit after restoring text mode.

Real-Mode Interrupt Bridge

The protected-mode code cannot call BIOS int 10h directly in 32-bit protected mode. It uses a small interrupt bridge. The public API shape is visible in helpers like the video mode routines:

1287: mov word [06c0h],0013h
1293: mov al,10h
1295: int 30h
1297: ret

129a: mov word [06c0h],0003h
12a5: mov al,10h
12a7: int 30h
12a9: ret

The bridge stores real-mode register values in a fixed communication area around 0x06c0, triggers protected interrupt 30h, temporarily exits to a real-mode call gate, executes the requested interrupt, and returns to protected mode. That is why the VGA mode functions are tiny even though the program is in protected mode for the heavy work.

The same bridge is used for int 10h services and other BIOS/DOS transitions. The renderer itself does not need BIOS once Mode X is established.

Video Mode: Unchained Planar VGA

The mode setup starts with BIOS mode 13h, then reprograms VGA into an unchained 320-wide planar layout. The key setup routine is around 0x4b143:

4b143: call 1287h          ; BIOS mode 13h through the bridge

; Sequencer Memory Mode register
4b148: mov dx,03c4h
4b14b: mov al,04h
4b14e: out dx,al
4b14f: inc dx
4b150: in  al,dx
4b151: and al,0f7h
4b153: or  al,04h
4b155: out dx,al

; Sequencer Map Mask = plane 1 initially
4b157: dec dx
4b157: mov al,01h
4b159: out dx,al

; Graphics Controller Mode/Misc tweaks
4b160: mov dx,03ceh
4b163: mov al,05h
...
4b174: mov dx,03d4h
4b178: mov al,14h
...
4b181: mov al,17h

The important consequences:

After the mode is unchained, the routine clears the first page through A0000h:

4b189: mov edi,000a0000h
4b18e: sub edi,[06ddh]     ; convert physical to protected linear
4b194: mov ecx,1000h
4b199: xor eax,eax
4b19b: rep stosd

The subtraction by [06ddh] is the extender's physical-to-linear bias. The program stores physical addresses like A0000h and then subtracts this base so they are usable under its protected-mode data selector.

Palette And VBlank Timing

There is a generic palette upload helper at 0x12ac:

12ac: pushfw
12ae: cli
12b6: mov dx,03c8h
12ba: out dx,al        ; starting DAC index
12bb: inc dx           ; 03c9h DAC data
12bd: movzx ecx,cx
12c0: lea ecx,[ecx+ecx*2]
12c3: lodsb
12c4: out dx,al
12c5: loop 12c3h
12ce: ret

Inputs are:

The helper multiplies the entry count by 3 and streams all bytes to 03C9h. This is a raw DAC upload, not a BIOS palette call.

VBlank wait is the classic 03DAh status-register loop:

4b21c: mov dx,03dah
4b220: in  al,dx
4b221: test al,08h
4b223: jne 4b220h      ; wait until outside vblank
4b225: in  al,dx
4b226: test al,08h
4b228: je  4b225h      ; wait for vblank start
4b22a: ret

The per-frame display routine at 0x4b49d uses that timing window to switch pages and touch the DAC:

4b49d: mov dx,03dah
4b4a1: in  al,dx
4b4a2: test al,08h
4b4a4: jne 4b4a1h

4b4a6: mov dx,03d4h
4b4aa: mov ah,[49cfah]
4b4b0: mov al,0ch
4b4b2: out dx,ax       ; CRTC start address high byte
4b4b4: xor ah,40h
4b4b7: mov [49cfah],ah

4b4bd: mov eax,[49cf6h]
4b4c2: xor [49ceah],eax

[49cea] is the current front page address and [49cf2] is the other page. The XOR with [49cf6] toggles between the two page bases. Later in the same routine it waits for a music/timer tick counter, writes a selected DAC index to 03C8h, and emits two three-byte RGB entries. That gives the demo its small palette sparkle/cycle without a full 768-byte palette upload every frame.

Background Pages

The star/nebula background is not generated every frame. Initialization at 0x4b7a9 sets the page addresses, decodes the encrypted background data, builds four planar copies, and installs the initial palette:

4b7ba: mov eax,000a0000h
4b7bf: sub eax,[06ddh]
4b7c5: mov [49ceah],eax     ; front page
4b7ca: mov [49ceeh],eax
4b7cf: lea ebx,[eax+4000h]
4b7d5: xor eax,ebx
4b7d7: mov [49cf6h],eax     ; page toggle mask
4b7dc: add ebx,4000h
4b7e2: mov [49cf2h],ebx     ; background/restore page

The small encrypted data block at 0x4a090 is decoded with XOR 0x66:

4b810: mov ebx,4a090h
4b815: mov ecx,0b33h
4b81a: xor byte [ebx],66h
4b81d: inc ebx
4b81e: loop 4b81ah

This is not copy protection. It is a cheap way to keep the background/control data from appearing as obvious bytes in the packed image.

The background conversion routine walks source bytes and writes them into VGA planes by repeatedly changing the Map Mask at 03C5h. That is why the runtime can restore only sprite-damaged rectangles later instead of redrawing the whole nebula.

Vector Object Data Model

The main visible objects are not polygons. They are 3D point lists rendered as small planar ball sprites.

The active scene loader at 0x4ce51 copies fields from a scene descriptor into global state:

4ce51: mov ebx,[4bb57h]     ; next descriptor pointer
4ce57: mov ebp,[ebx]
...
4ce6d: mov eax,[ebp+00h]    ; vertex/object list pointer
4ce70: mov [4b9abh],eax
4ce75: mov al,[ebp+04h]     ; object count
4ce78: mov [4b9afh],al
...
4ce8d: lea esi,[ebp+11h]    ; initial motion/angle state
4ce90: mov edi,4b96fh
4cea0: movsd
4cea1: movsd
4cea2: movsd
4cea3: movsd
4cea4: movsw

The copied state at 0x4b96f includes:

The bytecode interpreter starting at 0x4d03d reads one command byte at a time from the current scene script pointer and dispatches through a table. Commands set angular velocities, translation velocities, min/max bounds, waits, and scene-end conditions. A wait command stores a countdown in [4bba3]; until it reaches zero, the interpreter only advances the existing motion state.

The descriptor ring at 0x4bb5f contains 15 non-null entries and then a zero sentinel. In authored order their point counts are:

scene slot:   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14
point count: 20 11  6 18 16 18 19 16 12 18 21 16 14 19 16

This is a concrete bound on the renderer, not an estimate from the pictures: the smallest object has 6 point records, the largest has 21, and the complete ring references 240 point instances. The records' final bytes use only sprite classes 0, 1, and 2. Projection adds 3 for the lower half, selecting the second half of the six prebuilt sprite banks.

Transform And Depth-Sort Inner Loop

The central transform loop is 0x4cbbf. It begins each frame by loading sine and cosine values from two 512-phase tables:

4cbc6: movzx ebx,word [4b96fh]
4cbcd: movsx eax,word [4b2b0h+ebx]
4cbd4: mov [4b993h],eax
4cbd9: movsx eax,word [4b3b0h+ebx]
4cbe0: mov [4b99fh],eax
...
4cbf8: mov [4b9a3h],eax
...
4cc1e: mov [4b9a7h],eax

Angles are masked with 0x03fe, so table entries are word-aligned and wrap at 512 phases:

4cfbd: mov ax,[4b96fh]
4cfc3: add ax,[4b97bh]
4cfca: and ax,03feh
4cfce: mov [4b96fh],ax

Each source vertex is a packed 7-byte record. The descriptor counts, 7-byte source stride, 7-byte destination stride, and sprite-class bytes all agree on the layout:

word x
word y
word z
byte sprite_or_colour

For each point the loop performs three fixed-point 2D rotations. The code uses 32-bit signed multiplies and shifts by 9, so the tables are effectively scaled by 512:

; x/y rotation family
4cc30: movsx ecx,word [esi]       ; x
4cc35: imul eax,[4b9a7h]
4cc3c: sar  eax,09h
4cc3f: movsx edx,word [esi+2]     ; y
4cc45: imul ebx,[4b99bh]
4cc4c: sar  ebx,09h
4cc4f: sub  eax,ebx

4cc51: imul ecx,[4b99bh]
4cc58: sar  ecx,09h
4cc5b: imul edx,[4b9a7h]
4cc62: sar  edx,09h
4cc65: add  ecx,edx

The same pattern repeats with the remaining axes:

tmp0 = a * table0 - b * table1
tmp1 = a * table1 + b * table0

After rotation, the loop adds the current translation:

4cccb: add ax,[4b975h]
4ccd2: add bx,[4b977h]
4ccd9: add dx,[4b979h]

Then it inserts the transformed point into a small sorted list at 0x4b9b8. The list count is a byte at 0x4b9b7; each sorted output record is also 7 bytes:

4cce0: movzx ecx,byte [4b9b7h]
4cce8: mov edi,4b9b8h
4ccef: cmp dx,[edi+04h]       ; compare depth against existing point
4ccf5: add edi,07h
4ccf8: loop 4ccefh

; make room by copying records backward
4ccfa: std
4ccfb: imul ecx,ecx,07h
4ccfe: lea esi,[edi+ecx-1]
4cd02: lea edi,[edi+ecx+6]
4cd06: rep movsb
4cd08: cld

; store transformed point
4cd0d: mov [edi+00h],ax
4cd10: mov [edi+02h],bx
4cd14: mov [edi+04h],dx
4cd18: mov al,[esi+06h]
4cd1b: mov [edi+06h],al
4cd1e: inc byte [4b9b7h]

That backward rep movsb is the whole depth sort. There is no general-purpose sort routine: as each point is transformed, it is inserted into its depth slot. For the small ball counts in the demo this is cheaper than a separate sort pass.

The comparison is unsigned JA, not signed JG. A new point is inserted before the first existing point with a smaller unsigned Z, producing descending unsigned depth order. Equal depths pass through the scan and retain source order, so ties are stable. This also exposes the scene-data contract: transformed Z must remain in the intended non-wrapping range because a negative word would otherwise look very large to the unsigned comparison.

The loop's cost can be stated exactly for an object of N points:

At the largest authored count, N=21, that is 252 rotation multiplies, 252 matching shifts, 21 record-size multiplies, 20..210 depth comparisons, and at most 1,470 bytes shifted by the backward REP MOVSB. The sorted buffer spans exactly 21 seven-byte records (0x4b9b8..0x4ba4a), matching that largest scene.

Perspective Projection

The draw loop starts at 0x4cdb6. It walks the sorted point list and projects each point with a simple depth scale:

4cdb6: mov ebp,4b9b8h
4cdbb: movsx edi,word [ebp+04h]   ; z
4cdbf: sub edi,0200h
4cdc5: neg edi

4cdc7: mov esi,46h
4cdcc: imul esi,edi
4cdcf: sar esi,09h
4cdd2: add esi,64h                ; projected radius/height basis

4cdd5: movsx edx,word [ebp+02h]   ; y
4cdd9: imul edx,edi
4cddc: sar edx,09h
4cddf: add edx,64h                ; screen y

4cdf3: movsx ebx,word [ebp+00h]   ; x
4cdf7: imul ebx,edi
4cdfa: sar ebx,09h
4cdfd: add ebx,0a0h               ; screen x

The projection constants tell the story:

The result is not a triangle rasterizer. It computes a screen position and a vertical slice range for a prebuilt ball sprite, then calls the planar sprite blitter.

The draw loop clips top and bottom by calculating how many lines of the sprite are visible:

4cde2: lea eax,[esi+08h]
4cde5: sub eax,edx
4cde7: jbe skip_point
4cde9: mov ch,0fh
4cdeb: cmp ax,000fh
4cdef: jae full_height
4cdf1: mov ch,al

CH becomes the number of sprite rows to draw. Each point can make two blitter calls: at most 15 rows from the upper bank, then at most 15 rows from sprite index AL+3 for the lower bank. CL carries the skipped top-row count and the blitter turns the packed interval into CH-CL actual rows. A fully visible point therefore draws 30 rows; clipping can shorten either half or skip the point entirely.

Projection itself has no divide. Its depth, Y, and X calculations add exactly three signed multiplies and three shifts per point. Together with transform and insertion scaling, the fixed arithmetic is 16 IMUL instructions per point, or 96..336 across the authored 6..21-point scenes, before any blitter work.

Planar Ball Blitter

The classic inner loop is 0x4cb2f. It receives a projected screen coordinate, a sprite/color index, and a clipped row count. It maps chunky (x,y) logic to Mode X planar memory:

4cb30: sub edx,07h            ; sprite top relative to projected centre
4cb36: sub ch,cl              ; clipped interval -> actual row count
4cb3e: imul edi,edx,50h      ; y * 80 bytes per plane
4cb41: movzx edx,bl          ; original x low bits
4cb44: shr ebx,02h           ; x / 4 byte offset
4cb47: add edi,ebx
4cb64: add edi,[49ceah]      ; current page base
4cb6a: and dl,03h            ; x & 3 = starting plane phase

It also appends a small dirty-span record:

4cb49: inc byte [4ba56h]     ; dirty span count
4cb4f: mov esi,[4ba57h]      ; dirty span write pointer
4cb55: mov [esi],di          ; offset
4cb58: mov [esi+2],ch        ; row count
4cb5b: add esi,3
4cb5e: mov [4ba57h],esi

The initialization tables make the loop dimensions exact. Routine 0x4b748 builds 6 sprite banks by 4 X phases, each from 15 rows of 19 source pixels. The phase-width bytes at 0x4b810 are 5, 5, 6, 6: a 19-pixel row occupies five planar byte addresses when X begins in phase 0 or 1 and six when it begins in phase 2 or 3. The four mask streams begin at 0x4b824, 0x4b86f, 0x4b8ba, and 0x4b914; their 75, 75, 90, and 90 byte lengths are exactly 15 * phase_width.

The actual per-row VGA write is short and very hardware-specific:

4cb8f: mov dx,03ceh
4cb93: mov ax,4105h
4cb97: out dx,ax             ; graphics controller mode/write mode setup

4cb99: mov dx,03c5h          ; sequencer data port
row:
4cb9d: mov ecx,ebp           ; bytes in this sprite row
pixel_group:
4cb9f: mov al,[ebx]          ; next map-mask byte
4cba1: inc ebx
4cba2: out dx,al             ; select plane(s)
4cba3: movsb                 ; write one sprite byte to A000 page
4cba4: loop pixel_group
4cba6: sub edi,ebp
4cba8: add edi,50h           ; next screen row
4cbab: dec byte [4b96eh]
4cbb1: jne row

4cbb3: mov dx,03ceh
4cbb7: mov ax,4005h
4cbbb: out dx,ax             ; restore normal graphics controller state

That out 03C5h,al inside the inner loop is the tell. The sprite format is prearranged for VGA planes: each byte copied by movsb lands in the plane(s) selected by the matching map-mask byte. This avoids per-pixel bit twiddling in the hot path. The expensive chunky-to-planar decision was moved into tables at initialization time.

The row stride 0x50 is exactly 80 bytes, which confirms the unchained 320-wide Mode X layout.

For a call drawing R=CH-CL rows in phase width W, the hot loop performs exactly R*W sprite-byte reads, R*W mask-byte reads, R*W CPU writes to VGA, and R*W byte OUT instructions to the sequencer map-mask register. It also adds one 3-byte dirty record and makes two graphics-controller setup/restore word OUT instructions. At the 21-point authored maximum, projection can issue at most 42 calls and 630 rows. The worst X phases (W=6) therefore bound one draw pass at 3,780 sprite reads, 3,780 mask reads, 3,780 VGA writes, 3,780 inner-loop map-mask OUTs, and 126 dirty-list bytes. These are clipping bounds; the actual total falls whenever a ball crosses an edge or uses a five-byte phase. The two dirty buffers are each exactly 126 bytes (0x4ba5b..0x4bad8 and 0x4bad9..0x4bb56), so their 42-record capacities independently confirm the 2 * 21 maximum call count.

Dirty Restore Loop

The demo does not redraw the whole nebula and text background after every ball. It restores only the dirty strips recorded by the blitter. The restore loop at 0x4cd2f selects all planes, saves the just-completed dirty count into one phase list, flips the list index with XOR 1, and repairs the other phase from a clean page:

4cd2f: mov dx,03c5h
4cd33: mov al,0fh
4cd35: out dx,al              ; all planes

4cd40: movzx ebx,byte [4ba4bh]
4cd47: mov al,[4ba56h]
4cd4c: mov [4ba4c+ebx],al     ; save dirty-count for this page phase
4cd52: xor bl,01h              ; select the other page/list phase
4cd55: mov [4ba4b],bl
...
4cd64: mov ebp,[4ba4e+ebx*4]  ; dirty-list pointer
4cd6b: movzx edi,word [ebp]   ; span offset
4cd71: add edi,[49ceah]       ; destination page
4cd77: add esi,[49cf2h]       ; clean source page
4cd7d: mov ah,[ebp+02h]       ; row count

span_rows:
4cd83: mov ecx,6
4cd88: rep movsb
4cd8a: add esi,4ah
4cd8d: add edi,4ah
4cd90: dec ah
4cd92: jne span_rows

Each dirty row copies only 6 bytes, then advances by 0x4A; 6 + 0x4A = 0x50 bytes per scanline. That means the restore area is a narrow 24-pixel-wide planar rectangle around each ball/sprite, not a full scanline.

The age of that list matters. 0x4b49d alternates the draw page before this routine runs, while 0x4cd2f alternates the dirty-list phase. The selected list therefore belongs to the same page's prior use, two main-loop iterations old, not generically to the immediately previous frame. After repair, its pointer is reused for the current page's new dirty records.

For dirty records with a total of T rows, cleanup performs exactly 6T CPU reads from the clean VGA page and 6T CPU writes to the draw page. Graphics controller write mode 1 and map mask 0x0F copy the four latched planes, so those writes restore 24T plane bytes. The 21-point, 630-row draw bound becomes 3,780 CPU reads, 3,780 CPU writes, and 15,120 restored plane bytes when that page is selected again. The fixed six-byte repair deliberately covers the worst 19-pixel alignment even though phases 0 and 1 drew only five address bytes.

This is one of the reasons the demo can keep moving a lot of glossy balls on a 386 while also maintaining text/background and page flips.

Text And Object Timeline Engine

The visible demo is one long scripted presentation. The text is not a DOS text mode overlay. It is part of the VGA page/background system. The script changes which text/object page is active, then the main loop keeps doing:

wait/retrace and page state
transform active 3D point list
restore the selected page's prior-use dirty spans
update the current text/background state
draw sorted point sprites
run the current motion/script/completion callback
load the next scene only when that callback signals completion
check keyboard/exit state

The high-level main loop at 0x4cf14 is:

4cf14: call 4ce51h          ; load/advance active scene descriptor
4cf19: call 4b49dh          ; vblank/page/palette update
4cf1e: call 4cbbfh          ; transform and depth sort points
4cf23: call 4cd2fh          ; restore previous dirty spans
4cf28: call [49d2ah]        ; current text/background update callback
4cf2e: call 4cdb6h          ; project and draw point sprites
4cf33: call [4bb5bh]        ; current scene completion/test callback
4cf39: jb   4cf14h          ; carry set means next scene

Keyboard exit is handled separately. The code tests bit 3 in the keyboard state byte at 0x0af8, calls the key-fetch helper at 0x1256, and compares the returned scan/ASCII value with 0x0e. In the local capture no key was sent; the run stopped by DOSBox-X timeout.

Sound And Timer Path

The capture used no sound, but the static code shows the intended music path. Initialization starts at 0x4c87. The timer case programs PIT channel 0:

4ca9: mov al,36h
4cab: out 43h,al
4cad: mov al,0aeh
4caf: out 40h,al
4cb1: mov al,4dh
4cb3: out 40h,al

The divisor is 0x4dae (19886 decimal), roughly a 60 Hz interrupt rate from the 1.19318 MHz PIT clock. Other branches configure Sound Blaster-style DMA and DSP state:

4d41: mov al,09h
4d43: out 83h,al      ; DMA page/register family
4d45: xor al,al
4d47: out 0ch,al      ; DMA flip-flop
4d49: mov al,49h
4d4b: out 0bh,al      ; DMA mode
...
4d54: mov al,0d1h
4d56: call 37c8h      ; write DSP command
4d5b: mov al,0f2h
4d5d: call 37c8h

The embedded music data begins around 0x16c98. Loader 0x4e8d parses the header, converts relative offsets into absolute pointers, and initializes pattern/sample state:

4ea3: lea esi,[edx+06h]
4ea6: mov [318bh],esi
4eac: movzx ebx,byte [edx+02h]
4eb6: lea ebp,[esi+ebx]
4ebf: movzx ebx,byte [edx+03h]
4ec3: lea edi,[ebp+ebx*2]
4ecd: movzx ecx,byte [edx+01h]
4edc: movzx ebx,word [edx+04h]
4ee0: add ebx,edx
...
4efb: movzx eax,byte [esi]
4efe: movzx eax,word [ebp+eax*2]
4f03: add eax,[3197h]
4f09: mov [319bh],eax

That is a compact embedded tracker/player format, not an external MOD in the archive. The public text credits the music to C.C.Catch; the runtime text also mentions contemporary 669 tracker support/news, but this first Black Glass archive does not ship a standalone .669 or .670 song file.

Relationship To Black Glass ][

This first Black Glass and Black Glass ][ are related but not the same binary architecture:

Why This Was Fancy In April 1992

The captured screen can look simple if judged by later 1993-1995 productions: background, text, and balls. The implementation is more interesting than that:

The result is an early PC demo whose visible identity is "vector balls over a space/text presentation", but whose actual engine is a compact 386/VGA protected-mode runtime built around the constraints of planar VGA.