Analysis model: gpt-5.5 xhigh
Obsession by Black Rain - Technical Dissection
Scope
This is a static technical dissection of Obsession by Black Rain, released
for MS-DOS after Assembly 1993. The Assembly 1993 results file places Black
Rain's Obsession eighth in the PC demo competition, directly above Alpha
Force Productions' Phenomenon.
Public references:
- Scene.org party archive: https://archive.scene.org/pub/parties/1993/assembly93/demo/obsess.zip
- Scene.org file description: https://archive.scene.org/pub/parties/1993/assembly93/demo/obsess.diz
- Assembly 1993 results: https://archive.scene.org/pub/parties/1993/assembly93/info/results.txt
The examined archive is obsess.zip, which contains the final release dated
6 September 1993. The included NFO says an unfinished version escaped during
Assembly 1993, while this final has additional parts and Sound Blaster support.
I intentionally do not reproduce the member contact information from the NFO.
Offsets below use two coordinate systems:
exe+0xNNNNmeans offset inside the MZ load image after the 32-byte header.unpacked+0xNNNNmeans offset inside the runtime image recovered after the DIET/DLZ unpacker finishes.
The unpacked program also runs with CS=1000h and DS=13dch in my emulation.
Therefore a data reference such as DS:0x0fcb maps to unpacked+0x4d8b, not
to unpacked+0x0fcb.
Examined Files
Archive hashes:
ecf2ddfde33bb3d27207e97a0c17edff3e957d71b80fb05c6b31a03a64488624 obsess.zip
94e8b146fc0d42be83a094abe102493ff55cf95b6b1a27883489112caf9e49c2 obsess.diz
b9fed2e36d7ee73cbc8b0fbd22f6b600cb1f11d73034b9c37518b390cec7940c results.txt
Main extracted files:
OBSESS.EXE 32788 bytes MZ executable, DIET/DLZ compressed
OBSESS.NFO 3792 bytes release notes
FILE_ID.DIZ 231 bytes short description
FF.ME 938 bytes distribution text
DATA01.TBR 35356 bytes
DATA02.TBR 121440 bytes
DATA03.TBR 179792 bytes
DATA04.TBR 26401 bytes
DATA05.TBR 2555 bytes
DATA06.TBR 16217 bytes
DATA07.TBR 26173 bytes
DATA08.TBR 132224 bytes
DATA09.TBR 29866 bytes
DATA10.TBR 15873 bytes
DATA11.TBR 7376 bytes
DATA12.TBR 6034 bytes
DATA13.TBR 1940 bytes
DATA14.TBR 1610 bytes
DATA15.TBR 1617 bytes
DATA16.TBR 1610 bytes
DATA17.TBR 1617 bytes
DATA18.TBR 3065 bytes
DATA19.TBR 6991 bytes
DATA20.TBR 45597 bytes
DATA21.TBR 13900 bytes
DATA22.TBR 7753 bytes
DATA23.TBR 14641 bytes
DATA24.TBR 10479 bytes
DATA25.TBR 9741 bytes
DATA26.TBR 29231 bytes
DATA27.TBR 20107 bytes
DATA28.TBR 19196 bytes
DATA29.TBR 7200 bytes
DATA30.TBR 25008 bytes
DATA31.TBR 24446 bytes
DATA32.TBR 19770 bytes
DATA33.TBR 29084 bytes
DATA34.TBR 4000 bytes
The final release notes say the target machine is a 386 or better with register-compatible VGA and at least 614 KB of free conventional memory. They recommend a 486, a fast VGA card, and a Sound Blaster-compatible card.
Top-Level Layout
OBSESS.EXE has a small MZ header and one packed real-mode image:
MZ header size: 32 bytes
MZ image size: 32,788 bytes
load image size: 32,756 bytes
overlay size: 0 bytes
minalloc: 0x16a3 paragraphs
initial CS:IP: 0000:0000
initial SS:SP: 1e9b:0080
relocations: 0
The first load bytes are the unpacker stub. The marker at exe+0x004b is
dlz0, which matches DIET's DLZ family. The unpacked image recovered from the
final far jump is about 320 KB in the captured DOS memory window.
DIET/DLZ Startup Stub
The beginning of the packed image saves registers, moves the compressed high stub upward, and jumps to the copied depacker:
0000: f9 stc
0001: 9c pushf
0002: eb 09 jmp 000d
000d: 06 push es
000e: 1e push ds
000f: 57 push di
0010: 56 push si
0011: 52 push dx
0012: 51 push cx
0013: 53 push bx
0014: 50 push ax
0015: 0e push cs
0016: fc cld
0017: 8c c8 mov ax,cs
0019: 01 06 49 00 add [0049],ax
001e: ba 06 08 mov dx,0806
0021: 03 c2 add ax,dx
0023: 8b d8 mov bx,ax
0025: 05 95 16 add ax,1695
0028: 8e db mov ds,bx
002a: 8e c0 mov es,ax
002c: 33 f6 xor si,si
002e: 33 ff xor di,di
0030: b9 08 00 mov cx,0008
0033: f3 a5 rep movsw
0035: 4b dec bx
0036: 48 dec ax
0037: 4a dec dx
0038: 79 ee jns 0028
003e: be 66 00 mov si,0066
0041: ad lodsw
0042: 8b e8 mov bp,ax
0044: b2 10 mov dl,10
0046: ea 2d 07 18 1e jmp far 1e18:072d
The far jump segment is patched by adding the runtime load segment to the word
at 0049. In the captured run the first high jump is from 1000:0046 to
2e18:072d.
The important copy loop is paragraph based:
source paragraph starts at CS + 0x0806
destination paragraph starts at source + 0x1695
copy 16 bytes per paragraph
then source--, destination--, counter--
This copies the high depacker stub downward-safe into its final high location.
The far target in that copied high image corresponds to original load offset
0x7f5d, not to 0x0806+0x072d. The segment arithmetic is:
(0x1e18 - 0x1695) * 16 + 0x072d = 0x7f5d
DLZ Bitstream Inner Loop
The depacker's bit reader at exe+0x7ee4 keeps a 16-bit bit bucket in BP
and a countdown in DL:
7ee4: d1 ed shr bp,1
7ee6: fe ca dec dl
7ee8: 75 05 jne 7eef
7eea: ad lodsw
7eeb: 8b e8 mov bp,ax
7eed: b2 10 mov dl,10h
7eef: c3 ret
Each call shifts one bit into the carry flag. When the 16-bit bucket is empty,
the reader pulls another word from DS:SI.
The main decode loop at exe+0x7f5d is a classic LZ-style literal/copy
dispatcher:
7f5d: e8 84 ff call 7ee4
7f60: 73 03 jae 7f65
7f62: a4 movsb
7f63: eb f8 jmp 7f5d
7f65: e8 7c ff call 7ee4
7f68: ac lodsb
7f69: b7 ff mov bh,0ffh
7f6b: 8a d8 mov bl,al
7f6d: 72 81 jb 7ef0
If the bit is clear, one literal byte is copied from the packed stream to the output. If the bit is set, the next stream byte becomes the low byte of a negative back-reference. Later branches add length coding, choose short or long forms, and execute the final copy loop:
7f57: 26 8a 01 mov al,es:[bx+di]
7f5a: aa stosb
7f5b: e2 fa loop 7f57
The source address is relative to the current destination index, so this is a sliding-window copy inside the already-expanded output.
The depacker also supports moving the output and input segment windows:
7f7d: b1 04 mov cl,04
7f7f: 57 push di
7f80: d3 ef shr di,cl
7f82: 8c c0 mov ax,es
7f84: 03 c7 add ax,di
7f86: 80 ec 02 sub ah,02
7f89: 8e c0 mov es,ax
7f8b: 5f pop di
7f8c: 83 e7 0f and di,000f
7f90: 81 c7 00 20 add di,2000
...
7f94: 56 push si
7f95: d3 ee shr si,cl
7f97: 8c d8 mov ax,ds
7f99: 03 c6 add ax,si
7f9b: 8e d8 mov ds,ax
7f9d: 5e pop si
7f9e: 83 e6 0f and si,000f
That is the reason the packed EXE can expand beyond one 64 KB segment while still using 16-bit real-mode registers.
At the end, the depacker applies 52 relocation entries and jumps back to the real program entry. In my emulation the final transfer was:
from 2e18:07b9 to 1000:0000
instructions before final jump: 1,104,143
Runtime Startup
The unpacked entry at unpacked+0x0000 first resizes its DOS memory block,
then asks DOS for an impossibly large allocation:
0000: b8 dc 13 mov ax,13dch
0003: 8e d8 mov ds,ax
0005: b4 4a mov ah,4ah
0007: bb 84 1e mov bx,1e84h
000a: cd 21 int 21h
000c: b4 48 mov ah,48h
000e: bb ff ff mov bx,0ffffh
0011: cd 21 int 21h
0013: 81 fb 6a 77 cmp bx,776ah
0017: 77 0e ja 0027
001b: b4 09 mov ah,09h
001d: ba c2 91 mov dx,91c2h
0020: cd 21 int 21h
0022: b8 00 4c mov ax,4c00h
0025: cd 21 int 21h
For DOS function AH=48h, a failed allocation returns the largest available
block in BX. The program compares that to 0x776a paragraphs, roughly the
advertised 614 KB free-memory requirement.
Then it calls a resident far-code block at 2710h, stores several control
values in that segment, fades a palette, and checks the machine status word:
005e: 0f 01 e0 smsw ax
0061: a8 01 test al,1
0063: 74 6a je 00cf
If the protected-mode enable bit is clear, execution continues to the normal
main path. If it is set, the program displays a VGA warning/splash screen and
waits for Y/y before continuing.
Data Segment and Filename Table
The code starts with DS=13dch, so the string table begins at
unpacked+0x3dc0.
DS:0000 data34.tbr
DS:000d data33.tbr
DS:0018 data30.tbr
DS:0023 data31.tbr
DS:002e data32.tbr
DS:0053 data01.tbr
DS:0fb5 data02.tbr
DS:0fc0 data03.tbr
DS:0fcb data04.tbr
DS:0fd6 data05.tbr
DS:0fe1 data06.tbr
DS:0fec data07.tbr
DS:0ff7 data08.tbr
DS:2b12 data09.tbr
DS:2b1d data10.tbr
DS:8a72 data11.tbr
DS:8a7d data12.tbr
DS:8f7a data13.tbr
DS:8f85 data14.tbr
DS:8f90 data15.tbr
DS:8f9b data16.tbr
DS:8fa6 data17.tbr
DS:8fb1 data18.tbr
DS:901a data19.tbr
DS:90f8 data20.tbr
DS:9106 data21.tbr
DS:9111 data22.tbr
DS:911c data23.tbr
DS:9127 data24.tbr
DS:9132 data25.tbr
DS:9146 data26.tbr
DS:9151 data27.tbr
DS:915c data28.tbr
DS:9173 data29.tbr
The first batch loaded by the normal startup path is:
data30.tbr 172 x 178
data31.tbr 172 x 178
data32.tbr 320 x 200
Those are drawn into off-screen VGA pages and then revealed through the menu wipes described below.
TBR Packed Image Format
Most DATAxx.TBR files begin with the ASCII signature TBR Packed. The files
that do not are raw payloads:
packed: DATA01, DATA04-DATA07, DATA09-DATA28, DATA30-DATA33
raw: DATA02, DATA03, DATA08, DATA29, DATA34
The image loader at unpacked+0x329e has this calling convention:
AX = palette destination offset in DS
BX = image height
CX = image width
DX = filename offset in DS
return CX = allocated output segment
The loader rejects dimensions outside 320x200:
329e: 81 fb c8 00 cmp bx,00c8h
32a2: 76 16 jbe 32ba
32ba: 81 f9 40 01 cmp cx,0140h
32be: 77 e6 ja 32a6
Then it opens DS:DX, reads and verifies the ten-byte signature, reads a
768-byte VGA palette to the caller's DS:AX, allocates an output block sized
for width * height, seeks to offset 0x30a, and reads the remaining payload
to a temporary segment. 0x30a is:
10-byte signature + 768-byte DAC palette = 778 bytes = 0x30a
The decode loop is byte RLE with 0xff as an escape:
33a0: 8e de mov ds,si ; compressed block
33a5: 8e c7 mov es,di ; output image
33aa: b3 01 mov bl,01h
33ac: 8a 04 mov al,[si]
33ae: 3c ff cmp al,0ffh
33b0: 75 0a jne 33bc
33b4: 46 inc si
33b5: 8a 1c mov bl,[si] ; repeat count
33b7: 46 inc si
33b8: 8a 04 mov al,[si] ; repeated byte
33ba: 49 dec cx
33bb: 49 dec cx
33bc: 26 88 05 mov es:[di],al
33bf: 47 inc di
33c0: fe cb dec bl
33c2: 75 f8 jne 33bc
33c4: 46 inc si
33c5: e2 e3 loop 33aa
Literal bytes write once. An escape triple ff count value writes value
count times. The loop count tracks compressed input bytes, not output pixels.
The output size safety comes from the caller's expected width and height and
from the file being trusted.
DATA34.TBR is a direct raw text-mode block. A protected-mode warning branch
opens DS:0000, reads exactly 4000 bytes, and copies them to B800:0000.
DATA29.TBR is another direct raw block of 7200 bytes used later in the demo.
VGA Mode Setup
The main VGA initializer at unpacked+0x16b2 starts with BIOS mode 13h, then
turns the VGA into a Mode-X-like unchained planar mode:
16b2: b8 13 00 mov ax,0013h
16b5: cd 10 int 10h
16b7: ba c4 03 mov dx,03c4h
16ba: b8 04 06 mov ax,0604h
16bd: ef out dx,ax ; sequencer memory mode
16be: b8 02 0f mov ax,0f02h
16c1: ef out dx,ax ; map mask: all planes
16c2: ba 00 a0 mov dx,0a000h
16c5: 8e c2 mov es,dx
16c7: 33 ff xor di,di
16c9: 33 c0 xor ax,ax
16cb: b9 00 80 mov cx,8000h
16ce: f3 ab rep stosw ; clear all planes
16d0: ba d4 03 mov dx,03d4h
16d3: b8 14 00 mov ax,0014h
16d6: ef out dx,ax
16d7: b8 17 e3 mov ax,e317h
16da: ef out dx,ax
16db: c3 ret
With chain-4 disabled, one displayed scan line is 80 bytes per plane rather than 320 linear bytes. That is why the pixel routines use:
byte offset = y * 0x50 + x / 4
plane mask = 1 << (x & 3)
The code also uses segment aliases for the four VGA pages:
A000:0000 visible/page base 0
A3E8:0000 A000 + 0x3e80
A7D0:0000 A000 + 0x7d00
ABB8:0000 A000 + 0xbb80
Matching CRTC helpers write registers 0x0c and 0x0d to switch the visible
start address:
unpacked+0x1752 start = 0x0000
unpacked+0x1769 start = 0x3e80
unpacked+0x177d start = 0x7d00
unpacked+0x1794 start = 0xbb80
Pixel Read and Write Primitives
The write-pixel primitive at unpacked+0x1700 is the basic chunky-to-planar
bridge:
1700: b8 50 00 mov ax,0050h
1703: f7 26 b2 0f mul word [0fb2h] ; y
1707: 8b 1e b0 0f mov bx,[0fb0h] ; x
170b: d1 eb shr bx,1
170d: d1 eb shr bx,1
170f: 03 d8 add bx,ax ; y*80 + x/4
1711: 8b 16 b0 0f mov dx,[0fb0h]
1715: 83 e2 03 and dx,0003h
1718: 8a ca mov cl,dl
171a: b8 02 01 mov ax,0102h
171d: d2 e4 shl ah,cl ; plane mask
171f: ba c4 03 mov dx,03c4h
1722: ef out dx,ax
1723: a0 b4 0f mov al,[0fb4h] ; color
1726: 26 88 07 mov es:[bx],al
1729: c3 ret
unpacked+0x16dc is the matching read-pixel primitive. It computes the same
offset, selects the VGA read map through Graphics Controller index 4, and
loads ES:[BX].
These primitives are too slow for every frame, but they are acceptable for
loading or staging images. Several routines decode a chunky TBR image to
conventional memory, then walk every source pixel and call 0x1700 to scatter
it into the correct VGA plane.
For example, the initial menu setup loads data32.tbr as a 320x200 image and
plots it twice into separate VGA pages:
0125: ba 40 01 mov dx,0140h ; width counter
0128: b9 c8 00 mov cx,00c8h ; height counter
0137: 8e 26 3d 00 mov fs,[003d] ; decoded image
013b: be 00 00 mov si,0000h
013e: 64 8a 04 mov al,fs:[si]
0141: a2 b4 0f mov [0fb4h],al
0144: 52 push dx
0145: 51 push cx
0146: e8 b7 15 call 1700h
0149: 59 pop cx
014a: 5a pop dx
014b: ff 06 b0 0f inc word [0fb0h] ; x++
014f: 46 inc si
0150: 4a dec dx
0151: 75 eb jne 013eh
0153: ff 06 b2 0f inc word [0fb2h] ; y++
0157: c7 06 b0 0f 00 00 mov word [0fb0h],0
015d: ba 40 01 mov dx,0140h
0160: e2 dc loop 013eh
The same pattern appears for smaller panels, logos, and image strips. It is not elegant, but it is simple and reliable: all complicated VGA plane math is localized to one primitive.
Retrace Wait
Every visible palette change and most page reveals synchronize to vertical
retrace through unpacked+0x0695:
0695: ba da 03 mov dx,03dah
0698: ec in al,dx
0699: a8 08 test al,08h
069b: 75 fb jne 0698
069d: ec in al,dx
069e: a8 08 test al,08h
06a0: 74 fb je 069d
06a2: c3 ret
It first waits for the current retrace to end, then waits for the next retrace
to begin. The delay helper at unpacked+0x0c29 is just CX repetitions of
that call:
0c29: e8 69 fa call 0695h
0c2c: e2 fb loop 0c29h
0c2e: c3 ret
Palette Fades
Palette upload is direct DAC I/O: write start index to 0x3c8, then stream
RGB triplets to 0x3c9.
The startup fade at unpacked+0x0225 increments one palette table toward
another:
0225: ba c8 03 mov dx,03c8h
0228: b0 00 mov al,0
022a: ee out dx,al
022b: 42 inc dx ; 03c9h
022c: bb 40 00 mov bx,0040h ; 64 frames
022f: b9 00 03 mov cx,0300h ; 768 DAC bytes
0232: bf 00 00 mov di,0
0235: 8a 85 93 47 mov al,[di+4793h]
0239: 38 85 93 44 cmp [di+4493h],al
023d: 7d 06 jge 0245
0241: fe 85 93 44 inc byte [di+4493h]
0245: 47 inc di
0246: e2 ed loop 0235
0248: 60 pusha
0249: e8 49 04 call 0695h
024c: e8 46 04 call 0695h
024f: e8 43 04 call 0695h
0252: 61 popa
0253: be 93 44 mov si,4493h
0256: b9 00 03 mov cx,0300h
0259: f3 6e rep outsb
025b: 4b dec bx
025c: 75 d1 jne 022fh
This loop is asymmetric: it only increments entries in the current table.
Other fade paths decrement entries toward black. For example,
unpacked+0x05b0 loops 64 frames, decrements any nonzero palette byte in
DS:4493, waits for retrace three times, and uploads the full 768-byte DAC
table.
The palette code is intentionally coarse. Each step touches all 768 DAC bytes and then waits multiple retraces. The visual result is slow and stable on period hardware.
Menu Page Wipes
The first major visible inner loop is the expanding wipe at unpacked+0x0275.
Before entering it, the program enables all sequencer write planes and clears
the Graphics Controller bit mask:
0266: ba ce 03 mov dx,03ceh
0269: b4 00 mov ah,00h
026b: b0 08 mov al,08h
026d: ef out dx,ax ; GC bit mask = 0
026e: ba c4 03 mov dx,03c4h
0271: b8 02 0f mov ax,0f02h
0274: ef out dx,ax ; write all planes
Then it aliases both DS and ES to A000 and copies short spans within VGA
memory:
027d: bb 00 00 mov bx,0
0280: bf 40 1f mov di,1f40h
0283: be 00 7d mov si,7d00h
0286: 83 c6 2b add si,002bh
0289: 2b f3 sub si,bx
028b: ba 57 00 mov dx,0057h
028e: 8b cb mov cx,bx
0290: f3 a4 rep movsb
0292: 83 c7 50 add di,0050h
0295: 2b fb sub di,bx
0297: 83 c6 50 add si,0050h
029a: 2b f3 sub si,bx
029c: 4a dec dx
029d: 75 ef jne 028eh
029f: e8 f3 03 call 0695h
02a2: 43 inc bx
02a3: 83 fb 2b cmp bx,002bh
02a6: 7e d8 jle 0280h
Per frame:
BX = current reveal width, from 0 to 43 bytes
DX = 87 rows
DI = destination row start, initially 0x1f40
SI = source page start + 43 - BX
copy BX bytes
advance one VGA row by adding 0x50, then subtract BX because REP MOVSB already advanced
wait one retrace
Because each row is 80 bytes per plane, 0x50 is one full scan line in the
unchained VGA memory layout. The visible effect is a growing rectangular slice
copied from an off-screen page into the active page.
The matching retract loop at unpacked+0x0305 starts at 43 bytes and shrinks
to zero:
02ff: bb 2b 00 mov bx,002bh
0305: bf 40 1f mov di,1f40h
0308: be 00 7d mov si,7d00h
030b: 83 c6 2b add si,002bh
030e: 2b f3 sub si,bx
0310: ba 57 00 mov dx,0057h
0313: 8b cb mov cx,bx
0315: f3 a4 rep movsb
0317: 56 push si
0318: be 80 3e mov si,3e80h
031b: 03 f7 add si,di
031d: b9 01 00 mov cx,1
0320: f3 a4 rep movsb
0322: 5e pop si
0323: 83 c7 4f add di,004fh
0326: 2b fb sub di,bx
0328: 83 c6 50 add si,0050h
032b: 2b f3 sub si,bx
032d: 4a dec dx
032e: 75 e3 jne 0313h
0330: e8 62 03 call 0695h
0333: 4b dec bx
0334: 83 fb 00 cmp bx,0
0337: 7d cc jge 0305h
The one-byte copy from 0x3e80+DI fills the newly exposed edge from another
page, so the wipe does not leave a ragged trail. The same two-loop pair is
repeated with source bases 0x98d0, 0xbb80, and 0xd750 for later menu
panels. The code is duplicated rather than abstracted, presumably because this
is 1993 demo glue code and every byte of control-flow risk mattered less than
getting the part assembled.
Panel and Logo Plotting
The code uses several TBR image dimensions:
data04.tbr 320 x 105
data05.tbr 320 x 25
data06.tbr 305 x 66
data07.tbr 320 x 200
data09.tbr 288 x 200
data10.tbr 320 x 200
data11.tbr 150 x 150
data12.tbr 150 x 150
data13-18 150 x 150 each
data20.tbr 320 x 200
data21.tbr 200 x 200
data22.tbr 116 x 200
data23-25 160 x 175 each
data26-28 320 x 200 each
The image loader returns conventional memory segments. For most images the next step is either:
- Plot every chunky pixel through
unpacked+0x1700. - Copy a prepared rectangular region between VGA pages with
rep movsb. - Feed the image to a higher-level line/sprite routine.
For example, unpacked+0x0cd8 treats data05.tbr as a 320x25 mask or strip.
It scans its pixels and only draws nonzero values. For each nonzero source
byte:
0cee: b8 40 01 mov ax,0140h
0cf1: f7 26 b2 0f mul word [0fb2h]
0cf5: 8b f0 mov si,ax
0cf7: 03 36 b0 0f add si,[0fb0h]
0cfb: 65 8a 04 mov al,gs:[si]
0cfe: 3c 00 cmp al,0
0d00: 75 20 jne 0d22h
...
0d22: ff 36 b0 0f push word [0fb0h]
0d26: ff 36 b2 0f push word [0fb2h]
0d2a: 83 06 b0 0f 07 add word [0fb0h],7
0d2f: 83 06 b2 0f 78 add word [0fb2h],78h
0d34: e8 a5 09 call 16dch ; read destination pixel
0d37: a2 b4 0f mov [0fb4h],al
0d3a: 80 06 b4 0f 30 add byte [0fb4h],30h
0d3f: e8 be 09 call 1700h ; write brightened pixel
This is not a normal sprite blit. The source acts as a mask, the destination
pixel is sampled, brightened by 0x30, and written back at an offset. That is
a small highlight/glow compositor built on the planar pixel primitives.
Page Copy Helpers
The routines at unpacked+0x0c4e and unpacked+0x0c7d copy rectangular slabs
inside VGA memory. The first copies 4000 bytes from 0x3e80+0x2328 to
0x2328:
0c4e: b8 08 00 mov ax,0008h
0c51: ba ce 03 mov dx,03ceh
0c54: ef out dx,ax
0c55: b8 02 0f mov ax,0f02h
0c58: ba c4 03 mov dx,03c4h
0c5b: ef out dx,ax
0c5c: be 28 23 mov si,2328h
0c5f: 81 c6 80 3e add si,3e80h
0c63: bf 28 23 mov di,2328h
0c66: b8 00 a0 mov ax,0a000h
0c69: 8e c0 mov es,ax
0c6c: 8e d8 mov ds,ax
0c6e: b9 a0 0f mov cx,0fa0h
0c71: f3 a4 rep movsb
Because all four planes are enabled, this byte copy updates the same byte
offset in every plane. The second helper copies 6000 bytes from the page at
0x7d00.
Hardware Horizontal/Vertical Motion
unpacked+0x13d6 and its surrounding loop use CRTC start-address changes as a
hardware scroll/page-motion effect. The outer loop starts with an address in
AX, writes it to CRTC registers 0x0c/0x0d, draws or updates a strip, waits
for retrace, then adds 0x50:
1373: b8 50 00 mov ax,0050h
1376: b9 90 01 mov cx,0190h
137f: 50 push ax
1380: e8 66 00 call 13e9h
1383: 8a d8 mov bl,al
1385: 8a fc mov bh,ah
1387: ba d4 03 mov dx,03d4h
138a: b0 0c mov al,0ch
138c: 8a e7 mov ah,bh
138e: ef out dx,ax
138f: b0 0d mov al,0dh
1391: 8a e3 mov ah,bl
1393: ef out dx,ax
1394: e8 a1 03 call 1738h
1397: e8 3c 00 call 13d6h
13b6: e8 dc f2 call 0695h
13ba: 05 50 00 add ax,0050h
13bd: e2 c0 loop 137fh
The 0x50 increment is again one planar scan line. This lets the effect move
the display window through a prepared off-screen surface without copying a full
frame every tick.
Line Renderer With Plane Masking
The line routine at unpacked+0x33d3 is the most interesting general drawing
loop in this pass. It starts by converting the start coordinate to a planar
VGA byte offset and map mask:
33e3: b8 40 01 mov ax,0140h
33e6: f7 26 b4 58 mul word [58b4h] ; y0 * 320
33ea: 03 06 b0 58 add ax,[58b0h] ; + x0
33ee: 8b f0 mov si,ax
33f0: 25 03 00 and ax,0003h
33f3: 8a c8 mov cl,al
33f5: b8 02 01 mov ax,0102h
33f8: ba c4 03 mov dx,03c4h
33fb: d2 e4 shl ah,cl
33fd: ef out dx,ax
33fe: a3 8d 3e mov [3e8dh],ax
3401: 8b c6 mov ax,si
3403: d1 ee shr si,1
3405: d1 ee shr si,1
Then it computes Bresenham-style state:
[58b0], [58b4] = x0, y0
[58b2], [58b6] = x1, y1
[58a4] = x step (+1 or -1)
[58a6] = y byte step (+320 or -320 in this 320-based variant)
[58a8] = abs(dx)
[58aa] = abs(dy)
[58ac] = major-axis length
[58a0]/[58a2] = half-error accumulators
The hot loop at unpacked+0x3490 advances the major axis, conditionally steps
the minor axis, updates the VGA plane mask when x crosses a four-pixel group,
clips the byte offset, optionally tests the current destination plane, and
writes the pixel:
3490: 8b c3 mov ax,bx
3492: 03 06 aa 58 add ax,[58aah] ; error += dy
3496: 8b d8 mov bx,ax
3498: 3b df cmp bx,di
349a: 7f 08 jg 34a4h
349e: 3b c7 cmp ax,di
34a0: 7c 08 jl 34aah
34a4: 2b df sub bx,di
34a6: 03 36 a6 58 add si,[58a6h] ; y step
34aa: 8b c2 mov ax,dx
34ac: 03 06 a8 58 add ax,[58a8h] ; other error += dx
34b0: 8b d0 mov dx,ax
34b2: 3b d7 cmp dx,di
34b4: 7f 08 jg 34beh
34b8: 3b c7 cmp ax,di
34ba: 7c 46 jl 3502h
34be: 2b d7 sub dx,di
34c0: 03 36 a4 58 add si,[58a4h] ; x step
The plane-mask update handles moving across pixel phases:
34c4: a1 8d 3e mov ax,[3e8dh]
34c7: 83 3e a4 58 01 cmp word [58a4h],1
34d0: fe 06 96 58 inc byte [5896h]
34d4: d0 e4 shl ah,1
34d6: 80 fc 10 cmp ah,10h
34dd: c6 06 96 58 00 mov byte [5896h],0
34e3: b4 01 mov ah,1
...
34ea: fe 0e 96 58 dec byte [5896h]
34ee: d0 ec shr ah,1
34f7: c6 06 96 58 03 mov byte [5896h],3
34fd: b4 08 mov ah,8
34ff: a3 8d 3e mov [3e8dh],ax
The draw/test/write part:
3502: a1 8d 3e mov ax,[3e8dh]
3506: ba c4 03 mov dx,03c4h
3509: ef out dx,ax ; select write plane
350a: 89 36 97 58 mov [5897h],si
350e: d1 ee shr si,1
3510: d1 ee shr si,1 ; byte index
3512: 3b 36 85 83 cmp si,[8385h] ; low clip
3516: 7c 31 jl 3549h
351a: 3b 36 83 83 cmp si,[8383h] ; high clip
351e: 77 29 ja 3549h
3522: a0 ee 82 mov al,[82eeh] ; draw color
3525: 80 3e 9b 58 01 cmp byte [589bh],1
352a: 74 1a je 3546h
352e: 8a 26 96 58 mov ah,[5896h]
3532: b0 04 mov al,04h
3534: ba ce 03 mov dx,03ceh
3537: ef out dx,ax ; select read plane
3538: 26 8a 04 mov al,es:[si]
353b: 3a 06 9b 58 cmp al,[589bh]
353f: 75 08 jne 3549h
3543: 65 8a 04 mov al,gs:[si]
3546: 26 88 04 mov es:[si],al
3549: 8b 36 97 58 mov si,[5897h]
354d: 5a pop dx
354e: 49 dec cx
354f: 74 05 je 3556h
3553: e9 3a ff jmp 3490h
There are two useful modes here:
- If
[589b] == 1, the line writes the current draw color directly. - Otherwise it reads the destination plane, compares the old pixel with
[589b], and only then copies a byte fromGS:[SI]toES:[SI].
That second path makes the line routine a conditional mask/restore compositor, not only a wireframe drawer. It can reveal a prepared image through line-shaped paths or draw over only pixels of a certain color.
A sibling routine at unpacked+0x3557 performs the same Bresenham walk using
a 0x50 row step instead of a 320-based coordinate conversion. That version is
already in planar byte coordinates and is better suited for page-local effects.
Sound and Far Runtime Calls
The program uses a far code/data segment at 2710h throughout the run. The
top-level code calls offsets such as 2710:0c5a, 2710:0b95, 2710:0c75,
2710:0e65, 2710:0e71, and 2710:0e7d.
The clearest file handoff is:
320f: ba b5 0f mov dx,0fb5h ; DS:0fb5 = data02.tbr
3212: 9a 95 0b 10 27 lcall 2710h:0b95h
DATA02.TBR, DATA03.TBR, and DATA08.TBR are large raw files rather than
TBR Packed images. Given the NFO's Sound Blaster emphasis and the way the
main code gates several 2710h calls on the sound-disabled flag at [0047],
the best interpretation is that this far runtime owns the audio path and some
timeline synchronization. I did not reverse that far-code module deeply enough
in this pass to claim the exact sample/module format.
Structure of the Demo
The unpacked runtime is not a single monolithic effect. It is a sequence of small real-mode parts tied together by shared VGA helpers:
- Startup/memory check and optional protected-mode warning.
TBRimage loading and palette staging.- Menu-like image pages revealed with expanding and retracting VGA copies.
- Several prepared image/logo parts plotted through the planar pixel primitive.
- Masked highlight and page-copy compositors.
- Line and reveal routines built around VGA plane selection.
- Far-called sound/runtime services in the
2710hsegment. - Text and greeting pages stored as ordinary byte tables in the data segment.
The recurring design is pragmatic: decode assets into conventional memory, scatter or copy them into one of four VGA pages, flip or scroll by CRTC start address, and use the DAC for slow, stable fades. Compared with later protected-mode demos, the code is blunt. Compared with many 1993 real-mode demos, it is ambitious because it layers several page, palette, and mask techniques on top of unchained VGA while staying in a compact MZ executable.
Verified Details
Key static checks from this pass:
OBSESS.EXE is MZ + DIET/DLZ, no overlay.
The unpacker reaches final program entry at 1000:0000.
The runtime uses DS=13dch for data and filename tables.
The main image loader at unpacked+0x329e handles TBR Packed image files.
The packed image payload starts at file offset 0x30a.
The TBR image compression is byte RLE with 0xff count value escapes.
The VGA setup disables chain-4 and uses 80-byte planar scan lines.
The retrace wait polls port 0x3da bit 3.
The pixel primitive writes through Sequencer Map Mask index 2.
The line renderer updates VGA plane masks as x crosses four-pixel groups.
Open uncertainties:
The far runtime at segment 2710h needs a separate deeper pass.
The exact semantic roles of DATA02, DATA03, and DATA08 are inferred only partly.
The visual names of every part were not assigned from screenshots in this pass.