Analysis model: gpt-5.5 xhigh, sol high

Last edited: 2026-08-25

JJ Demo by CodeBlasters - Technical Dissection

JJ Demo / jjdemo.zip is a 1991 MS-DOS VGA demo by CodeBlasters. The Hornet 1991 demo index lists the archive as JJ Demo by CodeBlasters and gives it a ** rating.

Release year: 1991

This is a useful companion piece to Xmas by The Code Blasters: it uses the same small TCB resource wrapper and the same style of RIX-picture depacker, but the runtime is a single real-mode MZ executable instead of a loader-driven multipart show. The interesting work is split between:

The executable and archive contain period private contact and sponsor details. Those strings are deliberately not reproduced here.

The first image below is decoded directly from the packed TCB/RIX resources. The second is a DOSBox-X runtime contact sheet from the captured run described later in this note.

JJ Demo decoded RIX contact sheet

JJ Demo DOSBox-X runtime contact sheet

JJ Demo sparse runtime sequence

Sources

Archive

The examined archive is jjdemo.zip from the Hornet mirror:

jjdemo.zip  187345 bytes

ZIP contents:

JJDEMO.001   45529 bytes  1991-09-29 07:20
JJDEMO.002   12816 bytes  1991-09-29 00:35
JJDEMO.003   59508 bytes  1991-09-29 11:38
JJDEMO.004    4096 bytes  1991-09-29 17:01
JJDEMO.005  183724 bytes  1991-09-29 03:31
JJDEMO.EXE   50857 bytes  1991-10-30 23:58

Hashes:

53a97caa7bd9c096044234e33e3af6b29cd3112ec39739a8a772d4bcae8ded5c  jjdemo.zip
961d6af3ca0e804642eb3f6867122251156977adcb57938bf8057126e7cbb257  JJDEMO.001
e7959415803a04376cee4d5c64bdde1ccb9822a5340327d29bf206c99447e246  JJDEMO.002
be763c48729c0ad56c11835f9ebd8dd44768f921193a83de6e9831c37c1327e5  JJDEMO.003
bd0139ac07f02909ac93b892117d3d3dcfd031128888532792c71bb503d70644  JJDEMO.004
6276b618b23a4587cd8dc27737b166df3434aba0e9f2f9296b6a5c56bc07dddb  JJDEMO.005
aafc661657ff868fa865331de35bd9c7c7ad617bcf2aff5324b2ad6992eaab5c  JJDEMO.EXE

The data files divide cleanly:

JJDEMO.001  TCB-wrapped RIX image, decoded to a floppy/loading still
JJDEMO.002  12816-byte table block, values in the 0..127 range
JJDEMO.003  TCB-wrapped RIX image, decoded to the cloudy main backdrop
JJDEMO.004  4096-byte font/table block, loaded into the EXE data segment
JJDEMO.005  4-channel ProTracker module, `M.K.` signature
JJDEMO.EXE  real-mode DOS executable and all display/player code

JJDEMO.005 is a normal 4-channel module. The title field is the experiment and the signature is M.K.. Several sample names are period sample-library labels, which confirms that the audio path is a module player path rather than a single raw sample streamer.

Capture And Timestamps

The runtime stills were captured with DOSBox-X:

DOSBox-X version       2026.01.02 Commit 59915c1
CPU core               normal
cycles                 9000
selected sound option  4, internal honker
capture format         MPEGTS H.264 + AAC
video stream           640x400, avg_frame_rate 7500/107, about 70.09 fps
capture duration       32.938667 seconds

Timing zero is the start of dx-capture /v JJDEMO.EXE. A delayed Esc was queued after startup, but the captured run reaches the exit path at about 00:32.939.

Observed frame points from that run:

00:00.500  main RIX backdrop, first centered title/sponsor text
00:04.000  same backdrop and centered text still held
00:10.000  the centered text has advanced to the next sponsor/title page
00:18.000  the centered text has advanced to a BBS/sponsor page
00:28.000  the centered text has advanced to a modem/sponsor line
00:32.939  capture ends after the demo reaches its exit path

The sparse GIF near the top of the article is assembled directly from those five 640x400 DOSBox-X runtime frames. It is a page-progression overview over the decoded backdrop, not a high-frame-rate effect clip.

This particular capture follows the internal-speaker menu path and does not exercise the Sound Blaster or LPT DAC setup branches, but the player code for those paths is present in the executable and is described below.

Runtime/Archive-To-Code Concordance

The captured GIF and stills show the early RIX-backed centered-text sequence. The decoded RIX contact sheet and later code sections explain the rest of the program, including the tweaked planar strip part that this bounded capture does not timestamp. The evidence is therefore split: runtime frames prove the menu choice and RIX text-page progression, while static code/resource analysis proves the later VGA and audio branches.

The first runtime frame at 00:00.500 appears after the menu path, sidecar file loads, JJDEMO.003 depack, player initialization, and RIX page upload. The loader path reads JJDEMO.003 into the first work block, depacks it through the TCB/RIX escape-RLE routine, and uploads the decoded palette and 320x200 page:

72d5  open "JJDemo.003"
72e6  read FDE8h bytes to [0FA8]:0000
7302  call 6EF6h             ; TCB/RIX depack [0FA8] -> [0FAA]
...
70d3  es = [0FAAh]
70d8  si = 000Ah             ; RIX palette
70f1  es = A000h
70fe  si = 030Ah             ; RIX pixels
7104  rep movsw              ; 64000 bytes to A000:0000

That maps directly to the cloudy backdrop visible in the runtime contact sheet and the decoded JJDEMO.003 image in the RIX contact sheet. The page is not being drawn by the text renderer; it is a decompressed RIX picture copied to mode 13h.

The 00:04.000, 00:10.000, 00:18.000, and 00:28.000 frames are the same backdrop with centered sponsor/title text changing over it. Those lines use the normal chunky mode-13h glyph path: JJDEMO.004 is loaded as a 16-byte-per- character font/table block, 6F5Ch stamps 8-pixel-wide, 14-row glyphs, and 708Ah draws each string twice, once as a dark offset shadow and once as a white foreground:

6f64  shl ax,4             ; char * 16
6f67  si = 5769h + ax
6f6b  cx = 000Eh           ; 14 rows
...
6f78  es:[di] = bl         ; draw color BL
6f7f  di += 0138h          ; 320 - 8

The hardcoded text offsets in the centered page path are normal mode-13h byte positions, such as 1920h, 2A88h, 3C08h, 4D88h, 7D18h, and 8E88h. With a 320-byte pitch, they place the text lines at fixed vertical bands over the decoded backdrop. That is exactly what the runtime GIF shows: page progression over a stable RIX image.

The internal-speaker capture path is also visible in the setup choices. Sound option 4 stores the internal-honker marker and forces [05EC] = 07h, so the captured run does not exercise the LPT or Sound Blaster handlers. Those handlers are still recovered in the binary: the LPT/Covox IRQ path writes [05E0h] to the selected port, and the Sound Blaster path waits for the DSP, sends direct DAC command 10h, then writes the mixed sample. The article's audio analysis therefore covers more hardware branches than this single capture proves at runtime.

The decoded RIX contact sheet also explains what is not in the runtime GIF. JJDEMO.001 is the floppy/loading still; JJDEMO.003 is the cloudy backdrop used by the captured centered-text sequence. The sparse GIF deliberately uses the runtime progression over JJDEMO.003, not the separate loading picture.

The later tweaked-VGA effect is code-backed but only bounded indirectly by this capture. Around raw 7399h, the program changes VGA CRTC and sequencer state into an 80-byte-row, plane-selected surface. The central strip helper at 7814h advances a narrow two-plane vertical strip using source data from JJDEMO.002:

7814  di = [53AEh]
7818  si = [50DDh]
781c  select map mask 01h
782a  lodsb
782b  es:[di] = al
782e  es:[di+0050h] = ch
7832  di += 00A0h
...
7838  select map mask 04h
7846  lodsb
7847  es:[di] = al

That section relies on the VGA memory model, CRTC address movement, and gradient block stampers rather than full-frame redraws. Because the current runtime capture ended at the exit path without separate timestamps for that section, the concordance treats it as static/code evidence, not as a claim about the visible GIF frames.

So the evidence chain is: TCB/RIX resources decode to the backdrop/loading images; the runtime frames prove the internal-speaker path and centered text sequence over the JJDEMO.003 RIX page; the glyph routines explain the shadowed text; the player code explains unexercised LPT/Sound Blaster branches; and the tweaked VGA code explains the later strip/gradient section still needing a more targeted capture.

MZ Layout And Address Convention

JJDEMO.EXE is not packed by PKLITE/LZEXE in this archive. It is a normal MZ:

file size       50857 bytes
MZ image size   50857 bytes
header size       512 bytes = 0200h
relocations        42
min alloc        004Fh paragraphs
max alloc        FFFFh paragraphs
entry            06CF:08CB
entry raw        77BBh
stack            0000:0200
reloc table      001Ch

Offsets below are raw file offsets in JJDEMO.EXE. Since the MZ header is 0200h, a load-image offset is:

load offset = raw offset - 0200h

There is one trap: many apparent segment immediates in the disassembly are MZ relocation targets. DOS adds the program load segment to those words at load time. So a literal-looking mov ds,0020h should be read as "program segment plus 0020h", not physical segment 0020h.

The file-name and text offsets show the same convention. For a relocated data segment value of 0020h, raw file offset is:

raw = 0200h + 0020h * 16 + data_offset

Examples:

raw 13ACh  "JJDemo.002"
raw 13B7h  "JJDemo.003"
raw 13C2h  "JJDemo.004"
raw 13CDh  "JJDemo.005"
raw 5553h  menu/version text block
raw 56A8h  speed menu text block
raw 57B0h  main scroller/contact text block, not quoted here
raw 6B69h  centered sponsor/name text block
raw 6D9Ah  phone-number text block, deliberately not quoted here
raw 6EBBh  DAC/table data immediately before the mode-set code

Entry Wrapper

The entry point at raw 77BBh is a cleanup-safe wrapper around the real setup routine:

77bb  ah = 4ah
77bd  bx = 1000h
77c0  int 21h                 ; shrink DOS memory block

77c2  ax = b800h
77c5  es = ax
77c7  ds = program data segment
77cc  si = 0000h
77cf  di = 0000h
77d2  cx = 07d0h
77d5  rep movsw               ; save 80x25 text page from B800h

77d7  ah = 03h
77d9  bh = 00h
77db  int 10h                 ; read cursor position
77dd  save dl/dh to data slots

77e4  call 71BEh              ; menu, loading, graphics, player

77e7  ax = 0003h
77ea  int 10h                 ; text mode restore
77ec  copy saved text page back to B800h
780d  restore cursor
7812  int 21h ax=4c00h        ; exit

The wrapper explains why the program leaves DOS reasonably clean even though the middle of the show manipulates the PIT/PIC, VGA CRTC, sequencer, DAC, and video memory directly.

Sound Menu And Speed Menu

The main setup routine starts at raw 71BEh. It first prints a text-mode sound menu with DOS int 21h/AH=09h, then waits for a BIOS key with int 16h. The four sound options map to different output backends:

key 1  LPT1/Covox-style output, port read from BDA 0040:0008
key 2  LPT2/Covox-style output, port read from BDA 0040:000A
key 3  Sound Blaster path, temporary marker value 0001h
key 4  internal honker path, marker value 0002h, speed value 07h

For keys 1, 2, and 3, the code prints a separate speed menu and maps six keys to a timing byte:

speed key 1  [05EC] = 08h
speed key 2  [05EC] = 0Ah
speed key 3  [05EC] = 0Eh
speed key 4  [05EC] = 10h
speed key 5  [05EC] = 14h
speed key 6  [05EC] = 19h

The internal-honker option skips that menu and forces [05EC] = 07h. That is why the captured run starts directly after the first menu key.

The important detail is that [05EA] is not a generic "sound enabled" flag. It becomes either an LPT port number, a Sound Blaster marker before probing, or the internal speaker marker. Later player routines interpret it according to the branch already taken.

Loader Sequence

After menu selection, the code opens and reads the sidecar files with plain DOS file calls:

728a  open "JJDemo.004"
729e  read 1000h bytes to data offset 5769h
72a8  close

72ad  allocate 1770h paragraphs
72b6  [0FA8] = first block segment
72c1  allocate 1770h paragraphs
72ca  [0FAA] = second block segment

72d5  open "JJDemo.003"
72e6  read FDE8h bytes to [0FA8]:0000
72fb  close
7302  call 6EF6h             ; TCB/RIX depack [0FA8] -> [0FAA]
7306  free [0FA8]

730f  open "JJDemo.002"
...   read 4000h bytes to data offset 10DDh
...   close

...   set video mode 13h
...   initialize player through far calls into the player block
...   call 70D3h             ; upload RIX palette and page

The loader never parses an archive format. It depends on fixed file names and fixed buffer sizes. The two allocated 1770h-paragraph blocks are big enough for a packed RIX input and a full decoded RIX output.

TCB/RIX Depacker

JJDEMO.001 and JJDEMO.003 use the same TCB wrapper format seen in the CodeBlasters Christmas demo:

54 43 42 1a 01 ff
T  C  B  ^Z 01 FF

The payload starts at byte 6; byte 5 is the escape byte and is FFh here. The normal RIX target size is 0FD0Ah bytes:

0000h..0009h  RIX header, 10 bytes
000Ah..0309h  256-color DAC palette, 768 bytes
030Ah..FD09h  320x200 chunky pixels, 64000 bytes

The depacker at raw 6EF6h is intentionally tiny:

6ef6  cld
6ef7  si = 0006h
6efa  di = 0000h
6efd  es = [0FAAh]       ; output block
6f02  ds = [0FA8h]       ; packed input block

next_byte:
6f07  lodsb              ; AL = packed byte
6f08  cmp al,ffh
6f0a  je  run
6f0c  stosb              ; literal byte
6f0d  cmp di,0FD0Ah
6f11  jne next_byte
6f13  jmp done

run:
6f15  lodsb
6f16  mov cl,al          ; repeat count, 1..255
6f18  lodsb              ; repeated value
6f19  rep stosb
6f1b  cmp di,0FD0Ah
6f1f  jne next_byte

done:
6f21  ds = program data segment
6f27  ret

That is a byte-oriented escape RLE. There is no bit reader, no entropy stage, and no back-reference dictionary. The only compression decisions are:

if byte != FFh:
    emit byte
else:
    read count
    read value
    emit value count times

The decoder trusts the input. It stops when DI == 0FD0Ah, not when the packed file ends. A malformed stream could underfill or overrun the intended RIX target, but the shipped files match the fixed size.

There is also a nearby shorter variant at raw 6F29h that stops at 7D3Ah bytes. That looks like the same TCB escape-RLE engine reused for a smaller planar/resource payload rather than a full RIX page.

RIX Palette And Chunky Page Upload

The full RIX upload routine is raw 70D3h. It consumes the decoded block at [0FAA]:

70d3  es = [0FAAh]
70d8  si = 000Ah
70db  bl = 00h
70dd  cx = 0100h

palette_loop:
70e0  dx = 03C8h
70e3  al = bl
70e5  out dx,al          ; select DAC index
70e6  inc dx             ; 03C9h
70e7  movsb/out          ; red   from decoded RIX
70e9  movsb/out          ; green from decoded RIX
70eb  movsb/out          ; blue  from decoded RIX
70ed  inc bl
70ef  loop palette_loop

70f1  es = A000h
70f6  ds = [0FAAh]
70fb  di = 0000h
70fe  si = 030Ah
7101  cx = 7D00h
7104  rep movsw          ; 64000 bytes to A000:0000
7106  ds = program data segment
710c  ret

So a decoded RIX image is effectively:

write 256 DAC triplets from offset 000Ah
copy 320*200 pixel bytes from offset 030Ah to A000h

The routine uses rep movsw for the page copy, so the screen upload is 32000 word stores. It does not wait for retrace during the copy. Retrace timing is used in later fades and display-control loops instead.

Planar Page Copy Variant

Raw 710Fh is a different image copier. It assumes an 80-byte-row planar VGA surface and writes one 320-pixel row as four 40-byte planes:

710f  es = A000h
7114  ds = [0FAAh]
7119  di = 0000h
711c  si = 003Ah
711f  cx = 00C8h             ; 200 rows

row:
7122  select map mask 01h
712b  copy 14h words          ; 40 bytes
7134  di -= 0028h

7139  select map mask 02h
7142  copy 14h words
714b  di -= 0028h

7150  select map mask 04h
7159  copy 14h words
7162  di -= 0028h

7167  select map mask 08h
7170  copy 14h words
7179  loop row

Each plane copy advances DI by 40 bytes. The DI -= 28h between planes pulls the destination back to the start of the same scanline before selecting the next plane. After the fourth plane, DI has advanced by 40 bytes, which is one logical row in 80-byte-row mode when only every other byte or page lane is being used by the effect. The result is a chunky-looking 320-wide source being spread across four VGA planes.

Retrace Wait

The retrace helper at raw 7170h is the classic VGA status-port poll:

7170  dx = 03DAh

wait_for_retrace:
7173  in  al,dx
7174  test al,08h
7176  je wait_for_retrace

wait_for_end:
7178  in  al,dx
7179  test al,08h
717b  jne wait_for_end
717d  ret

That waits for bit 3 to become set, then waits for it to clear. In other words, callers resume just after a vertical retrace interval. The routine is used by fades and timed DAC updates, not by every raw blit.

Font And Text Inner Loops

JJDEMO.004 is loaded to data offset 5769h. The small glyph renderer at raw 6F5Ch treats it as a 16-byte-per-character bitmap source but draws only 14 rows:

6f5c  push registers
6f60  al = character
6f62  ah = 00h
6f64  shl ax,4             ; char * 16
6f67  si = 5769h + ax
6f6b  cx = 000Eh           ; 14 rows

row:
6f6e  al = [si]
6f70  si++
6f71  bp = 0008h           ; 8 bits

pixel:
6f74  rcl al,1             ; next font bit into carry
6f76  jnc skip
6f78  es:[di] = bl         ; draw color BL
skip:
6f7b  di++
6f7c  dec bp
6f7d  jne pixel
6f7f  di += 0138h          ; 320 - 8, next mode-13h row
6f83  loop row
6f85  pop registers
6f86  ret

This is a mode 13h glyph stamp:

source row width  1 byte = 8 pixels
drawn height      14 rows
destination pitch 320 bytes
foreground color  BL
transparent bits  untouched

The string helper at raw 708Ah draws a shadow plus foreground:

708a  while [si] != 00h:
          char = [si++]
          draw char at di-0141h with color 08h
          draw char at di       with color 0Fh
          di += 8
      ret

The -0141h offset means the shadow is one row and one column up-left in a 320-byte pitch surface. The foreground pass then overwrites the intended position in white.

There is also a planar/80-byte-row glyph renderer at raw 6F85h:

for row in 0..13:
    bits = font[char * 16 + row]
    for bit in 0..7:
        if high bit set:
            ES:[DI] = BL
        DI += 1
    DI += 0048h            ; 80 - 8

It is structurally the same as the mode 13h renderer but uses an 80-byte row pitch. This is used after the CRTC/sequencer setup switches the drawing model to a planar/tweaked surface.

Raw 6FADh and 6FFCh are still more specialized bit writers. They select VGA sequencer map masks through ports 03C4h/03C5h and draw into one plane at a time:

select map mask 01h
test glyph bits and write selected pixels
select map mask 02h
test glyph bits and write selected pixels
select map mask 04h
test glyph bits and write selected pixels
select map mask 08h
test glyph bits and write selected pixels

Those routines are combined by raw 704Dh into a wider/shadowed planar text stamp. Raw 70ABh and 70BFh are zero-terminated string walkers around those lower-level glyph routines. The important split is:

708Ah  centered/text-screen strings on normal 320-byte chunky pages
70ABh  small planar text on 80-byte-row VGA pages
70BFh  plane-mask text variant with tighter destination stepping

Tweaked VGA Setup

The most interesting display section begins around raw 7399h. It moves away from a plain RIX page and configures VGA registers for an unchained/planar-ish 80-byte row surface:

7399  call timing/setup helper
739c  int 10h ax=0012h       ; briefly mode 12h
73a1  int 10h ax=0013h       ; then mode 13h

73a6  bx = 0140h
73a9  bx >>= 3               ; 40 decimal, used as CRTC offset
73ac  cx = 0140h
73af  cx >>= 2
73b2  cx--                   ; 79 decimal, horizontal display value

73b5  unlock CRTC register 11h
73c2  CRTC register 01h = CL ; horizontal display end = 4Fh
73cc  CRTC register 13h = BL ; offset = 28h

73d5  sequencer register 04h &= F6h
73e1  CRTC register 14h &= BFh
73ea  CRTC register 17h = E3h

The setup is doing three related things:

1. keep the screen visually 320 pixels wide;
2. make the CRTC pitch 40 bytes per plane row;
3. disable normal chain-style addressing so selected planes matter again.

That is why the later routines write small byte/word strips while constantly changing the sequencer map mask. A single CPU address can map to different VGA planes depending on the last 03C4h/index 02h write.

DAC Ramp

Immediately after the register setup, raw 73EFh..7405h builds a short DAC ramp:

bx = 3F00h
cx = 0040h

loop:
    select DAC index CL
    out 03C9h, BH
    out 03C9h, 00h
    out 03C9h, BL
    inc BH
    dec BL
    loop

Because CX starts at 0040h, the loop writes indices 40h down to 01h. BL decreases from 3Fh and BH increases from 00h, producing a red/blue or red/green-looking 64-entry ramp depending on how the later plane colors are interpreted. The point is not a full 256-color palette; it is a compact lookup range for gradient block writers and the scroller strip.

Another 30-byte DAC table is copied from raw 6EBBh to DAC index 70h, which gives the later text/strip pass a small fixed highlight palette.

CRTC Address Helper

Raw 7862h takes a value in BX and updates several CRTC high-bit fields:

CRTC 18h  gets a high address component
CRTC 07h  overflow bit 4 is patched from the input
CRTC 09h  max-scanline bit 6 is patched from the input

The callers use values such as 0040h and 0150h. This is not a pixel plotter; it is a display-window/page helper. It extends the visible start/line position that cannot be represented by the low CRTC start-address registers alone.

Main Strip/Scroller Loop

The central loop uses four data fields as a small state machine:

[50DD]  source pointer into the 12816-byte table loaded from JJDEMO.002
[53AE]  current destination position in A000h
[5766]  pointer into the zero-terminated scroller/contact text
[5768]  modulo-8 counter for when to fetch the next character

The loop at raw 7439h..7504h closes the frame order exactly:

increment the modulo-8 strip counter
if the counter reached 8:
    read next text byte from [5766]
    if byte == 00h:
        wrap [5766] back to start of the text
        substitute a blank block for this fetch
    if byte == space:
        byte = 40h
    byte -= 40h
    [50DD] = 0FDDh + byte * 0100h
    reset the strip counter to 0
    advance the text pointer

call 7814h to draw the next vertical strip
program CRTC start = newly advanced [53AE] - 004Fh
restore sequencer map mask 0Fh
decrement each nonzero gradient countdown once
stamp four gradient blocks through 776Dh
if player state [0452] == 22h, leave this section
otherwise wait for one complete retrace interval through 7170h
poll keyboard port 60h for Esc, then repeat

The character mapping explains the odd 40h adjustment. The table file is not a conventional ASCII font. Offset 0FDDh..10DCh is a built-in 256-byte blank record; JJDEMO.002 is loaded immediately after it at 10DDh, supplying the nonblank 256-byte records. Normalized character value C therefore selects 0FDDh + C*0100h. The embedded stream has 949 nonzero bytes and uses classes 0..48 without reproducing its period contact text here. After the initial fetch, its stable wrap path consumes 949 glyph fetches, or exactly 7,592 strip frames at eight frames per record.

The loop does not redraw a whole screen. It advances a narrow strip and relies on CRTC start-address movement plus VGA planes to turn that strip into motion.

Vertical Strip Helper

Raw 7814h is the core strip drawer:

7814  di = [53AEh]
7818  si = [50DDh]
781c  select map mask 01h
7825  bx = di
7827  cx = 0010h

plane1_loop:
782a  lodsb
782b  es:[di] = al
782e  es:[di+0050h] = ch
7832  di += 00A0h
7836  loop plane1_loop

7838  select map mask 04h
7841  di = bx
7843  cx = 0010h

plane4_loop:
7846  lodsb
7847  es:[di] = al
784a  es:[di+0050h] = ch
784e  di += 00A0h
7852  loop plane4_loop

7854  di = bx + 1
7858  [50DDh] = si
785c  [53AEh] = di
7860  ret

The exact drawing pattern is:

plane mask 01h:
    for 16 rows:
        write one source byte at DI
        write zero-ish CH at DI+50h
        DI += A0h

plane mask 04h:
    repeat the same 16-row write from the next source bytes

next call:
    start at old DI + 1

50h is 80 decimal and A0h is 160 decimal. In the 80-byte CPU-address pitch, the source byte lands on rows 0, 2, 4, ... 30 and the zero in CH clears the interleaved rows 1, 3, 5, ... 31. Plane masks 01h and 04h select logical pixel residues 0 and 2 inside each four-pixel address group; planes 1 and 3 are left to the prior page contents and the other routines.

One call is therefore exact: 32 source reads, 32 colored VGA byte stores, 32 zero VGA byte stores, and four byte OUT instructions for the two sequencer index/mask selections. It consumes 32 bytes of the selected 256-byte character record and increments [53AE] by one address. Eight calls consume the whole record, advance the insertion/display position by eight addresses, and trigger the next text fetch. There is no per-row multiplication, clipping, or source branch in this kernel.

This is the "classic inner loop" of the demo: very little CPU work per frame, heavy reliance on the VGA memory model, and state carried forward by [50DD] and [53AE].

Gradient Block Writers

Raw 776Dh writes a vertical 8-byte-wide thresholded gradient:

776d  cx = 003Fh

loop:
    if cx <= bx:
        al = cl + 1
        ah = al
        es:[di+0] = ax
        es:[di+2] = ax
        es:[di+4] = ax
        es:[di+6] = ax
    else:
        es:[di+0] = 0000h
        es:[di+2] = 0000h
        es:[di+4] = 0000h
        es:[di+6] = 0000h
    di += 0050h
    loop

That gives 63 rows of either zero or a duplicated palette index. By changing BX, the caller changes where the gradient begins. The four word stores cover eight CPU addresses. The caller has restored map mask 0Fh, so every address writes all four planes: each band is 32 logical pixels wide, not eight. The four frame-loop destinations are all on row 100 at CPU-address X positions 6, 26, 46, and 66, producing logical X ranges 24..55, 104..135, 184..215, and 264..295 through row 162.

The threshold changes colors but not traffic. One call always makes 63 comparisons and 252 word stores, or 504 CPU VGA byte writes. Four calls per frame make 252 comparisons, 1,008 word stores, and 2,016 CPU VGA byte writes. With all four planes selected those become 8,064 plane-byte/pixel writes. If a countdown is B in 1..63, exactly the lower B rows are colored and the other 63-B rows are explicitly zeroed; a zero countdown clears all 63 rows.

Raw 7793h is a diagonal/edge variant:

start DI += 3Eh
for CX from 3Fh down:
    if CX <= BX:
        color = CL + 1
    else:
        color = 0
    write color at DI+0003h
    write color at DI+0052h
    write color at DI+00A1h
    write color at DI+00F0h
    DI--

The four writes are separated by about one scanline each, and DI moves backward after every step. That stamps a shallow diagonal edge instead of a vertical rectangular band.

Combining the steady strip and four rectangular gradients gives a fixed per-frame floor of 32 table reads and 2,080 CPU VGA byte stores. In plane terms that is 64 writes from the two one-plane strip passes plus 8,064 writes from the four all-plane gradients, or 8,128 affected plane bytes. Register traffic adds six byte OUT instructions (four strip selections and the all-plane restore) plus two word OUT instructions for CRTC start registers 0Ch/0Dh. The subsequent retrace poll has variable IN counts, but normal frames execute exactly one complete set-then-clear wait; only player state 22h bypasses that wait and transfers to the next section.

Centered Text Page And Fade

The later path at raw 750Ah..75DEh returns to a normal mode 13h page:

set mode 13h
zero about 02FDh DAC entries
copy decoded RIX pixels from [0FAA]:030A to A000:0000
upload a palette range from [0FAA]:003A to DAC index 10h
set DAC index 0Fh to white
draw several centered strings with the 708Ah shadowed text renderer
wait for a music/state byte or Esc
fade palette entries back down

The text positions are hardcoded A000h offsets:

1920h
2A88h
3C08h
4D88h
7D18h
8E88h

With a 320-byte pitch, those are normal centered lines at different vertical positions. Each line uses the 708Ah helper, so it is white text with a dark shadow over the RIX backdrop.

The fade path writes DAC entries in a retrace-paced loop. It does not compute a full per-channel interpolation table. Instead it repeatedly selects a DAC index range and pushes zero triplets or descending values, with 7170h used as the frame boundary.

Second Planar Text Section

Raw 75DEh..7716h re-enters the tweaked planar setup. It differs from the earlier strip section in the initial palette and fill:

call the tweaked VGA setup again
call CRTC helper with BX = 0150h
set DAC 64h to a blue-ish value
set DAC 65h to a yellow-ish value
fill A000h from DI=0A00h with AX=6464h for 14A0h words
draw strings through 70ABh and 70BFh at several 80-byte-row offsets
stamp diagonal/gradient blocks with 7793h
poll timing state and Esc
fade final palette entries

The fill uses AX=6464h, so it writes palette index 64h into both bytes of each word. That matches the palette setup immediately before it. Text then uses color 65h, so the section is effectively a two-color planar composition with block effects layered around it.

Player And Audio Output

The player code begins around raw 7F3Fh. It is larger than the video helper code, but the high-level shape is clear:

7F3Fh  allocate memory with DOS AH=48h, store segment in [045A]
7F58h  free the allocated module/pattern block
7F6Ah  free up to 31 sample blocks from table [04AA] when loaded
7F96h  open/read module file, check the `M.K.` signature, load pattern data
       and sample blocks, convert sample bytes by adding 80h
8269h  LPT/Covox-style IRQ output handler
8280h  Sound Blaster DSP output handler
82A8h  Sound Blaster base-port detection/reset helper

The module loader uses the order list to compute the highest pattern number, then builds four tables:

04E8h  sample/period or channel table area
0526h  companion channel table area
0564h  companion channel table area
05A2h  companion channel table area

The signed-to-unsigned sample conversion is visible after sample reads:

for each loaded sample byte:
    sample[i] = sample[i] + 80h

That conversion is required by simple unsigned DAC output. A ProTracker module stores signed-ish 8-bit sample data around zero; the LPT DAC and many Sound Blaster direct-output paths want 80h as the center value.

The LPT/Covox interrupt output handler at raw 8269h is minimal:

8269  dx = [05EAh]       ; selected LPT port
826d  al = [05E0h]       ; current mixed sample
8270  out dx,al
8271  call 8316h         ; advance mixer/player state
8274  iret

The Sound Blaster direct-output handler at raw 8280h waits for the DSP write port and then emits the current sample:

8280  dx = [05EAh]
8284  al = in dx
8285  test al,80h
8287  jne 8280h          ; wait while DSP not ready
8289  al = 10h
828b  out dx,al          ; DSP direct DAC command
828c  call 8316h         ; advance mixer/player state
8290  wait for DSP ready again
8299  al = [05E0h]
829c  out dx,al          ; output mixed sample
829d  iret

The Sound Blaster probe at raw 82A8h walks common base ports from 0220h to 0250h, toggles DSP reset, waits for AAh, and sends command D1h if the DSP is found. If no Sound Blaster is detected on the requested path, the routine exits instead of silently falling back to another device.

The internal-honker path used for the capture shares the same menu/setup state but uses the program's speaker output route rather than the LPT or DSP IRQ handlers.

What Each Visible Part Does

The pieces fit together as follows:

1. Text menu
   Saves the existing DOS text page, prints the sound-device menu, and stores
   the selected audio backend/timing byte.

2. Resource load
   Reads `JJDEMO.004` as the font/table block, allocates two large work
   buffers, reads `JJDEMO.003`, depacks it from TCB/RIX RLE, reads
   `JJDEMO.002`, initializes the player, and uploads the decoded RIX backdrop.

3. RIX text screen
   Uses the cloudy decoded RIX backdrop and the 8x14 shadowed text renderer to
   show centered sponsor/title pages. The captured timestamps in this article
   are from this part.

4. Tweaked VGA scroller/effect
   Reprograms CRTC and sequencer state, builds a small DAC ramp, uses
   table-derived strip data from `JJDEMO.002`, advances a narrow two-plane
   vertical strip through `7814h`, and uses CRTC movement plus gradient block
   stamps for motion.

5. Centered text/fade intermission
   Returns to chunky mode `13h`, redraws the RIX picture, renders several
   shadowed text lines, waits on player/timing state, and fades the palette.

6. Final planar text/block section
   Re-enters the 80-byte-row planar setup, fills a colored area, renders text
   through plane-aware glyph routines, stamps diagonal/vertical gradient blocks,
   fades out, restores text mode, restores the saved text page, and exits.

The main lesson is that JJ Demo is not just a picture show with a music player. Even though its visible capture here is dominated by centered text over a RIX backdrop, the executable contains a compact early-1991 VGA trick section: small strip writes, map-mask changes, CRTC address motion, and table-driven text/gradient helpers doing most of the visual work without redrawing a full 320x200 frame every tick.

Remaining Work

This pass used static disassembly plus one bounded internal-speaker DOSBox-X capture. Static code now closes the tweaked strip frame, its 8-frame record cadence, 7,592-frame stable text cycle, CRTC handoff, gradient geometry, VGA traffic, retrace gate, and player-state exit. A follow-up direct run through this later section should still capture the LPT and Sound Blaster branches and correlate player state [0452] with visible transition timestamps. That is a runtime-timing boundary, not a missing inner-loop boundary.