Analysis model: gpt-5.5 xhigh

Sinus Scroll Demo by Brain Slayer - Technical Dissection

Scope

Sinus Scroll Demo is a small 1992 MS-DOS VGA intro by The Brain Slayer. The Hornet 1992 index lists sinus.zip as Sinus Scroll Demo by Brain Slayer, and Demozoo places it as a September 1992 MS-DOS 16K intro.

Release year: 1992. The runtime engine strings still say 1991 because the intro was built with Crack Rat's earlier THE-PC-INTRO-ENGINE.

Public references:

This is a binary and runtime pass over the released archive. Offsets written as packed-load+... refer to the original packed MZ load image after the 32-byte header. Offsets written as load+... refer to the UNP-restored executable load image after the 48-byte header. The restored program sets DS=00c8h, so data references such as ds:7a8e live at flat load+870e.

Runtime Capture

Sinus Scroll Demo runtime contact sheet

Capture environment:

Emulator: DOSBox-X 2026.01.02 SDL2
Machine: svga_s3
CPU core/cycles: normal, 30000 cycles
Sound: muted; this intro does not play music in the captured path
Command path: DOSBox-X video capture around SINUS.EXE
Capture stream: H.264 in MPEG-TS, 640x400 source, 28.906667 seconds
Exit method: injected Escape key after the useful loop had run
Timing zero: beginning of captured stream after the screen was cleared

The short clip below is sliced directly from the DOSBox-X capture at native 640x400. It is included because the moving yellow sine scroller is the visual proof of the mask-buffer, per-column displacement, and save-background renderer described later in the article.

Sinus Scroll Demo fast runtime GIF showing the yellow sine scroller over the Brain Slayer background

Time Frame What is visible Runtime meaning
00:02.000 images/sinus-scroll-runtime-00-02-000.png Static Brain Slayer background with the yellow sine scroller entering at lower right. Mode 13h setup, MAING resource load, full-screen A000 copy, palette upload, and first script characters are already active.
00:05.000 images/sinus-scroll-runtime-00-05-000.png The yellow text wave crosses the center of the lower half. The mask buffer and save-background renderer are running continuously.
00:10.000 images/sinus-scroll-runtime-00-10-000.png The text wave is near the top of its sine arc. The vertical offset table at ds:77f6 is driving column-by-column displacement.
00:15.000 images/sinus-scroll-runtime-00-15-000.png The wave moves down across the horizon strip. The script reader has advanced while the same background restore loop preserves the picture.
00:20.000 images/sinus-scroll-runtime-00-20-000.png A new text span wraps in from both sides. The 320-column phase counter has wrapped and the text-mask surface is being refilled.
00:25.000 images/sinus-scroll-runtime-00-25-000.png The scroller is lower and darker under the logo area. This shows the claimed "save background" effect: the text does not permanently damage the bitmap behind it.

The contact sheet is easiest to read as a progression through one engine rather than as six independent screenshots. 00:02.000 is the baseline state after the MAING resource load and palette upload; 00:10.000 and 00:20.000 show the phase tables wrapping and the text mask being refilled; and 00:25.000 demonstrates the central promise of the intro, that the sine text can move across the picture without chewing permanent holes in the background. That is exactly what the renderer does below: when the mask byte is zero, it restores one byte from the saved background; when the mask byte is nonzero, it writes a foreground pixel and skips the matching background cell.

Runtime-To-Code Concordance

The runtime media maps directly to the engine stages described later:

The current capture is visual evidence for the loader-to-background handoff, the mask refill, the sine displacement, and the save-background renderer. The outer MZ depacker and inner MAING inflater are code-evidence sections: their output is visible in the runtime frames, but the capture does not profile their internal bitstream timing.

Examined Files

The archive contains only the loader executable:

SINUS.EXE   15758 bytes   MS-DOS MZ executable with appended data

Hashes:

26f6198a42bda6f1e865591a328c1801426fe42222f4ac459aef158bb4c17239  sinus.zip
ba53dd5f0edc3ce385d37914551b1b2036a1435c5ca53595fd1d118d8b9a45c2  SINUS.EXE, released packed executable
3d6b665a5ec01c113c73f8013bda9dd9993ec9b0585f7fdc1b739ea272fb5c86  SINUS.EXE, UNP-restored executable

Original MZ header:

Original file size:       15758 bytes
Header-declared size:      6705 bytes
Header size:                 32 bytes
Load image size:           6673 bytes
Overlay/appended data:     9053 bytes
Relocations:                  0
Entry CS:IP:           018b:000e
Initial SS:SP:         093e:0080
Min/max allocation:    9661 / 9662 paragraphs

UNP-restored MZ header:

Restored file size:        46308 bytes
Header-declared size:      37255 bytes
Header size:                  48 bytes
Load image size:          37207 bytes
Overlay/appended data:     9053 bytes
Relocations:                  4
Entry CS:IP:           0000:023b
Initial SS:SP:         1916:e000
Min/max allocation:    7753 / 9662 paragraphs

The 9053-byte overlay is preserved by UNP. It begins with a MAING tag and is the image/resource payload used by the restored executable.

Outer Entry Depacker

The released executable is not PKLITE, LZEXE, or EXEPACK. It is a compact wrapped-entry LZ-family MZ. The MZ entry lands at packed-load+18be, near the end of the load image:

packed-load+18be  push es
packed-load+18bf  push cs
packed-load+18c0  pop  ds
packed-load+18c1  mov  cx,[000c]
packed-load+18c5  mov  si,cx
packed-load+18c7  dec  si
packed-load+18c8  mov  di,si
packed-load+18ca  mov  bx,ds
packed-load+18cc  add  bx,[000a]
packed-load+18d0  mov  es,bx
packed-load+18d2  std
packed-load+18d3  rep  movsb
packed-load+18d5  push bx
packed-load+18d6  mov  ax,002b
packed-load+18d9  push ax
packed-load+18da  retf

This copies the stub upward, backward, into a safe high segment and far-returns to the moved code. The second stage then copies the compressed body downward in 4K-ish slabs so source and destination can overlap safely:

packed-load+18db  mov  bp,cs:[0008]
packed-load+18e0  mov  dx,ds
packed-load+18e2  mov  ax,bp
packed-load+18e4  cmp  ax,1000
packed-load+18e9  mov  ax,1000       ; cap one pass at 4096 paragraphs
packed-load+18ec  sub  bp,ax
packed-load+18ee  sub  dx,ax
packed-load+18f0  sub  bx,ax
packed-load+18f2  mov  ds,dx
packed-load+18f4  mov  es,bx
packed-load+18f6  mov  cl,03
packed-load+18f8  shl  ax,cl         ; paragraphs -> words-ish copy count
packed-load+1900  mov  si,ax
packed-load+1902  mov  di,ax
packed-load+1904  rep  movsw
packed-load+1906  or   bp,bp
packed-load+1908  jne  18e2

The bit reservoir is BP, with DX counting remaining bits. A set carry after shr bp,1 means literal:

packed-load+190f  xor  si,si
packed-load+1911  xor  di,di
packed-load+1913  mov  dx,0010

packed-load+1916  lodsw              ; refill reservoir
packed-load+1917  mov  bp,ax

packed-load+1919  shr  bp,1
packed-load+191b  dec  dx
packed-load+191e  lodsw              ; refill when DX reaches zero
packed-load+1923  jae  1928          ; bit 0 -> match path
packed-load+1925  movsb              ; bit 1 -> literal byte
packed-load+1926  jmp  1919

There are two match forms:

; Short match: two length bits plus signed 8-bit backward distance.
packed-load+1928  xor  cx,cx
packed-load+1936  shr  bp,1
packed-load+1940  rcl  cx,1
packed-load+1942  shr  bp,1
packed-load+194c  rcl  cx,1
packed-load+194e  inc  cx
packed-load+194f  inc  cx
packed-load+1950  lodsb
packed-load+1951  mov  bh,ff
packed-load+1953  mov  bl,al

; Long match: packed distance/length word.
packed-load+1958  lodsw
packed-load+1959  mov  bx,ax
packed-load+195b  mov  cl,03
packed-load+195d  shr  bh,cl
packed-load+195f  or   bh,e0
packed-load+1962  and  ah,07
packed-load+1965  je   1973          ; extension / marker
packed-load+1967  mov  cl,ah
packed-load+1969  inc  cx
packed-load+196a  inc  cx

Both paths copy from already-expanded bytes in the destination window:

packed-load+196b  mov  al,es:[bx+di]
packed-load+196e  stosb
packed-load+196f  loop 196b
packed-load+1971  jmp  1919

The long form has two control markers:

packed-load+1973  lodsb
packed-load+1974  or   al,al
packed-load+1976  je   19ac          ; end of compressed stream
packed-load+1978  cmp  al,01
packed-load+197a  je   1981          ; segment-normalization marker
packed-load+197c  mov  cl,al         ; extended length = AL + 1
packed-load+197e  inc  cx
packed-load+197f  jmp  196b

The segment-normalization path folds large SI/DI offsets back into their segment registers, keeping the real-mode copy window valid:

packed-load+1981  mov  bx,di
packed-load+1983  and  di,000f
packed-load+1986  add  di,2000
packed-load+198a  mov  cl,04
packed-load+198c  shr  bx,cl
packed-load+198e  mov  ax,es
packed-load+1990  add  ax,bx
packed-load+1992  sub  ax,0200
packed-load+1995  mov  es,ax

packed-load+1997  mov  bx,si
packed-load+1999  and  si,000f
packed-load+199c  shr  bx,cl
packed-load+199e  mov  ax,ds
packed-load+19a0  add  ax,bx
packed-load+19a2  mov  ds,ax
packed-load+19a4  jmp  1919

After decompression it applies relocation words, restores SS:SP, and far-jumps through cs:[0000] into the restored MZ image.

Startup and Self-Opening Overlay Loader

The restored entry at load+023b immediately sets its stack and data segment:

load+023b  mov  sp,e000
load+023e  mov  ax,00c8
load+0241  mov  ds,ax
load+0243  mov  [0000],es
load+0247  mov  es,ax

That DS=00c8h base is important: the main data area begins at flat load+0c80. The code then calls load+0090, which scans the DOS environment for the executable path, opens itself, reads its own MZ header, and computes the header-declared end of the executable. That is how the program finds the appended MAING overlay:

load+0090  call 001e        ; find own executable name in environment
load+0093  mov  ax,3d00
load+0096  mov  dx,0008
load+0099  int  21          ; open own EXE
load+00a4  mov  ah,42
load+00a6  mov  cx,0000
load+00a9  mov  dx,0002
load+00ae  int  21          ; seek inside MZ header
load+00b2  mov  cx,0004
load+00b5  mov  dx,0004
load+00b8  mov  ah,3f
load+00be  int  21          ; read last-page and page-count words

The expression at load+00c2..00da computes:

overlay_start = (mz_pages - 1) * 512 + last_page_bytes

For the released file, that is 6705, exactly where the 9053-byte appended payload starts.

The resource reader takes a table record at ds:01dd:

4d 41 49 4e 47 00 ...     "MAING", target/load metadata

and copies the decoded image/palette/script bundle into the data segment. The runtime strings identify the engine:

THE BRAIN SLAYER
INTRO CREATED WITH THE-PC-INTRO-ENGINE!
WRITTEN BY CRACK RAT OF T.B.S 1991

VGA Setup and Main Loop

The startup checks VGA/MCGA with int 10h, AX=1A00h:

load+024f  xor  bx,bx
load+0251  mov  ax,1a00
load+0254  int  10
load+0258  cmp  al,1a
load+025a  je   0283

If no suitable display is found, it prints the embedded VGA/analog-monitor error messages and exits through DOS. Otherwise it saves the current video mode, switches to mode 13h, loads the MAING resource, uploads the screen, fades the palette, and enters the keyboard-polled frame loop:

load+0289  mov  word [01f0],0140
load+028f  call 0584        ; save current video mode
load+0292  mov  al,13
load+0294  call 058f        ; BIOS set mode 13h

load+02b8  call 0187        ; load MAING resource metadata/payload
load+02c7  mov  word [01f8],a000
load+02d3  call 0695        ; copy 64000 bytes into A000
load+02dc  call 0602        ; palette fade/build phase

load+02f3  call 0307        ; run frame loop
load+02f6  call 05c1        ; fade down
load+02fd  call 05a5        ; restore video mode

The A000 copy is a full 320x200 screen:

load+0695  mov  ax,[01f8]   ; destination segment
load+069b  mov  es,ax
load+069d  mov  di,[01f6]
load+06a1  mov  si,[01f2]
load+06a5  mov  ax,[01f4]   ; source segment
load+06a8  mov  ds,ax
load+06ab  mov  cx,7d00
load+06ae  rep  movsw       ; 0x7d00 words = 64000 bytes

The frame loop uses raw port 60h as its exit condition. It samples the scan code once, then runs until the port value changes:

load+0307  in   al,60
load+0309  mov  [01e7],al
load+030c  xor  bx,bx
load+030e  call 0320        ; initialize scroller tables/background copy

load+0311  call 000c        ; wait retrace high
load+0314  call 03ee        ; update and render one frame
load+0317  in   al,60
load+0319  cmp  al,[01e7]
load+031d  je   0311
load+031f  ret

The retrace helpers are minimal:

load+000c  mov  dx,03da
load+000f  in   al,dx
load+0010  and  al,08
load+0012  je   000f
load+0014  ret

load+0015  mov  dx,03da
load+0018  in   al,dx
load+0019  and  al,08
load+001b  jne  0018
load+001d  ret

Palette Paths

load+0678 writes an RGB triplet stream to the VGA DAC:

load+0678  mov  cx,[01e2]   ; color count, normally 0x100
load+067e  lea  si,[01fe]
load+0683  xor  ax,ax
load+0685  mov  dx,03c8
load+0688  out  dx,al       ; DAC start index 0
load+0689  inc  dx          ; 03c9
load+068a  lodsb
load+068b  out  dx,al       ; R
load+068c  lodsb
load+068d  out  dx,al       ; G
load+068e  lodsb
load+068f  out  dx,al       ; B
load+0690  loop 068a

The fade helpers operate in-place on the palette buffer at ds:01fe:

The result is a simple but effective 1991/1992 PC-engine palette transition: no VGA register trickery is needed beyond 3c8h/3c9h.

Script Decoder

Before rendering, the program decodes the script/control region:

load+06b4  mov  cx,8229
load+06b7  mov  si,7a8a
load+06ba  sub  cx,si
load+06bc  mov  di,si
load+06be  mov  bl,ae
load+06c1  lodsb
load+06c2  xor  al,bl
load+06c4  stosb
load+06c5  inc  bl
load+06c7  loop 06c1

Because DS=00c8h, this decodes flat load+870a..8ea9, not load+7a8a..8229. The decoded text contains the public title line, effect boasts, greets, and an old contact request. The old contact number is omitted here.

The most useful decoded claims are:

SINUS-SCROLL-DEMO
THE FIRST SIN-SCROLLER WITH SAVE BACKGROUND ROUTINE
LOOK'S LIKE A DUAL-PLAYFIELD

The control stream uses zero as an escape:

00 00        disable one text mode flag
00 01        enable that flag
00 02 xx     hold/pause for xx * 16 frames
00 03 xx     set scroll direction/mode byte

Those meanings come directly from the parser at load+0488..04e9.

Scroller Initialization

The scroller init starts at load+0320:

load+0320  mov  word [7a7c],7a8e    ; script pointer, DS-relative
load+032a  lea  si,[7894]
load+032e  lea  di,[7896]
load+0332  mov  cx,0050
load+0335  mov  ax,[si]
load+0337  mov  [di],ax
load+0339  add  di,0002
load+033c  sub  si,0002
load+033f  loop 0335

That first loop mirrors 80 words. The second loop builds another 160-word table by subtracting source values from 5000h:

load+0341  lea  si,[7934]
load+0345  lea  di,[7936]
load+0349  mov  cx,00a0
load+034c  mov  bx,5000
load+034f  mov  ax,[si]
load+0351  sub  bx,ax
load+0353  mov  [di],bx
load+0355  add  di,0002
load+0358  sub  si,0002
load+035b  loop 034c

Then it saves the background region that the scroller will disturb. Notice the segment swap: source is A000h, destination is the data segment.

load+035d  mov  ax,a000
load+0360  mov  ds,ax
load+0363  mov  si,8e80
load+0366  lea  di,[09ee]
load+036a  mov  cx,2f80
load+036d  rep  movsw

That copies 48,640 bytes from A000:8e80 into data memory. In mode 13h, 8e80h is around scanline 114, so this is the lower portion of the background where the sine text will pass.

Save-Background Sinus Render Loop

The main renderer at load+0372 is the heart of the production. It restores background pixels and overlays scroller pixels one column at a time:

load+0374  mov  ax,a000
load+0377  mov  es,ax
load+037a  mov  di,8e80       ; A000 destination region
load+037d  lea  si,[09ee]     ; saved background copy
load+0381  mov  bx,68ee       ; text-mask surface
load+0384  mov  bp,[7a78]     ; horizontal mask phase
load+0388  mov  dx,[7a76]     ; sine phase
load+038c  mov  cx,0140       ; 320 columns

For each column, the sine phase is advanced and converted through the word table at ds:77f6:

load+038f  inc  dx
load+0390  cmp  dx,0140
load+0396  xor  dx,dx         ; wrap at 320
load+039a  shl  dx,1
load+039e  mov  dx,[si+77f6]  ; vertical displacement for this column

The column renderer then offsets the source, destination, and mask by that sine value and draws 11 or 12 vertical pixels. The instruction at load+03ab is self-patched between 0b and 0c by the script-pause path.

load+03a7  add  si,dx
load+03a9  add  di,dx
load+03ab  mov  cx,000b       ; patched to 000c during a hold mode
load+03ae  add  bx,bp
load+03b0  xchg bx,si
load+03b2  lodsb              ; read mask byte from text surface
load+03b3  xchg bx,si
load+03b5  or   al,al
load+03b7  jne  03ca

If the mask byte is zero, it restores one background pixel:

load+03b9  movsb              ; A000 byte = saved background byte
load+03ba  add  si,013f
load+03be  add  bx,013f
load+03c2  add  di,013f
load+03c6  loop 03b0

If the mask byte is nonzero, it writes the colored scroller pixel and skips the corresponding background byte:

load+03ca  stosb              ; A000 byte = scroller color
load+03cb  add  si,0140       ; skip same background column row
load+03cf  add  bx,013f
load+03d3  add  di,013f
load+03d7  loop 03b0

This is why the effect looks more sophisticated than a destructive text draw. Every frame replays the saved background under the sine path and then draws only the active text pixels. The decoded text calls it a "save background routine"; that is an accurate description.

After each column:

load+03dd  inc  bp
load+03de  cmp  bp,0140
load+03e4  xor  bp,bp
load+03e6  inc  si
load+03e7  inc  di
load+03e9  loop 038f

So the output is a 320-column sine-displaced slice through a rolling text-mask surface, not a bitmap strip being shifted as one object.

Text Mask and Glyph Builder

load+03ee handles per-frame text state. It advances the scroll phase, handles script commands, and renders the next character column into the mask surface at ds:68ee.

Direction control is stored at ds:7a7a:

load+0412  mov  al,[7a7a]
load+0417  je   0431          ; mode 0: decrement phase
load+0419  cmp  al,01
load+041b  je   043d          ; mode 1: hold
load+041d  inc  word [7a76]   ; other modes: increment phase
load+0421  cmp  word [7a76],0140
load+0429  mov  word [7a76],0000

load+0431  dec  word [7a76]
load+0437  mov  word [7a76],013f

The script pointer ds:7a7c is advanced every eighth frame:

load+046b  dec  byte [7a7e]
load+046f  jns  0488
load+0471  inc  word [7a7c]
load+0475  cmp  word [7a7c],8228
load+047d  mov  word [7a7c],7a8e
load+0483  mov  byte [7a7e],07

When a printable byte is found, it is converted to a font index:

load+04ed  sub  al,20
load+04f0  lea  si,[07fe]     ; 8-byte font table
load+04f4  shl  ax,1
load+04f6  shl  ax,1
load+04f8  shl  ax,1          ; character * 8
load+04fa  add  si,ax
load+04fe  lea  di,[68ee]     ; text-mask target

The glyph-column renderer places blank rows above and below the 8-row font, then writes colored pixels where the selected bit is set:

load+0517  call 055b          ; blank row
load+051a  call 055b          ; blank row
load+051d  mov  cx,0008

load+0523  mov  cl,[7a7e]     ; selected bit-column within glyph byte
load+0529  lodsb
load+052a  shr  ax,cl
load+052c  and  ax,0001
load+052f  or   ax,ax
load+0531  je   053b

load+0533  mov  bl,dl
load+0535  mov  al,[bx+77ee]  ; yellow/orange color ramp
load+053f  stosb              ; write mask color
load+0540  call 0565          ; bounce color index
load+0543  add  di,013f       ; next scanline in 320-byte layout
load+0548  loop 0522

load+054a  call 055b          ; blank row
load+054d  call 055b          ; blank row

The color index bounces between 0 and 8:

load+0565  cmp  dh,01
load+0568  je   0578
load+056a  add  dl,01
load+056d  cmp  dl,08
load+0572  mov  dl,08
load+0574  xor  dh,01

load+0578  sub  dl,01
load+057b  cmp  dl,00
load+0580  mov  dl,00
load+0582  jmp  0574

That small routine is why the scroller is not one flat color. Each glyph column walks through the yellow/orange ramp while the sinus renderer bends it across the saved background.

Resource Inflater Boundary

The MAING payload is not a raw 64000-byte dump. The loader after load+06ca builds CRC and decode tables, then inflates resource chunks from the overlay into the target segment. The important high-level sequence is:

load+06ca  clear work area and set target pointers
load+0702  read resource header
load+07a2  build CRC table with polynomial constants
load+07cd  verify resource stream CRC
load+0920  build nibble/run decode tables
load+0ad4  inflate compressed payload into destination buffer
load+0c42  copy expanded bytes into final target

The inner inflater at load+0ad4 is a separate compressed-resource engine, not the outer MZ entry unpacker. It reads bit fields through load+0bb1, selects literal or back-reference tables, and copies overlapping matches with rep movsb:

load+0b45  mov  cl,01
load+0b47  call 0bb1          ; read one bit
load+0b4a  jb   0b26          ; literal-ish path
...
load+0b93  xchg cx,ax
load+0b94  push si
load+0b95  mov  si,di
load+0b97  sub  si,[5742]     ; distance
load+0b9b  dec  si
load+0b9c  rep  movsb         ; overlapping match copy
load+0b9e  xchg cx,ax
load+0b9f  pop  si

For this article, the useful boundary is that the inflater produces:

What the Demo Does

Sinus Scroll Demo is a concise demonstration of a particular PC trick: make a single text wave appear to pass over a detailed background without corrupting the picture. It does that with:

  1. A wrapped-entry executable unpacker.
  2. A self-opening MZ overlay reader.
  3. A MAING compressed resource payload.
  4. A mode-13h full-screen image upload.
  5. A 48,640-byte saved copy of the background region under the scroller.
  6. A text-mask surface at ds:68ee.
  7. A 320-column sine offset table at ds:77f6.
  8. A per-column render loop that restores background when mask is zero and writes yellow/orange text pixels when mask is nonzero.

That matches the decoded boast in the script. The effect is not a hardware dual-playfield; it is software compositing, timed to VGA retrace, with a saved background strip and a sine-displaced text mask.