Analysis model: gpt-5.5 xhigh
The Magic Circle by The European Technology - Technical Dissection
Scope
The Magic Circle is a 1994 MS-DOS 64K intro by The European Technology,
usually abbreviated as TET. It was released for Assembly 1994 and placed sixth
in the PC 64K Intro competition, behind AirFrame, Space Jam, Fyvush,
Placebo, and Psychic Flight.
Public references:
- Demozoo Assembly 1994 PC 64K Intro competition page: https://demozoo.org/competitions/677/
- Pouet production page: https://www.pouet.net/prod.php?which=3869
- Assembly Archive page: https://archive.assembly.org/1994/pc-64k-intro/the-magic-circle-by-tet
- Scene.org archive page: https://files.scene.org/view/parties/1994/assembly94/in64/magic.zip
- Assembly 1994 results: https://archive.scene.org/pub/parties/1994/assembly94/results.txt
The Assembly result file lists:
PC 64KB Intro Competition
1, AirFrame by Prime
2, Space Jam by Fascination
3, Fyvush by Jamm
4, Placebo by Complex
5, Psychic Flight by Spirit
6, The Magic Circle by TET
This writeup is based on the scene.org archive, the bundled information file,
static inspection of MAGIC.EXE, a DOSBox-X execution check, and disassembly of
the shipped loader/depacker. I did not recover a trustworthy full expanded
visual runtime image in this pass. The effect-level section therefore uses only
claims supported by the authorship notes and visible data islands; the detailed
inner-loop discussion is about the loader and executable wrapper, where the
code is directly readable.
Credits And Part List
The bundled MAGIC.NFO gives both a credit list and a per-part assignment:
Executioner - [ Jukka Uljas ] ........... Music
Olppa - [ Olli Tervo ] .................. Code
Radical - [ Thomas Carlsson ] ........... Code / Font
Royal - [ Kim Salo ] .................... Code / Organizing
O'hara - (freelancer) ................... GFX
The same note assigns the visible sections:
Music ................................... Executioner
Introduction part ....................... Royal
Tubescroller ............................ Olppa
Circles ................................. Olppa
40-hires-vectors ........................ Olppa
Filled Vectortunnel ..................... Radical
Plasma .................................. Radical
2D Layered Texture ...................... Radical
Multi facet-vector ...................... Olppa
Wobbling Endscroller + Font ............. Radical
Overall intro package + frontend coding.. Royal
S3M Player/Compressor ................... Radical
Those labels are useful, but they are not a substitute for recovered code. I use them as a map of intended sections, not as proof of the implementation details inside each visual part.
Old private contact material from the text files is intentionally omitted.
Examined Files
Archive:
2a0a9d57fe2a97d24a14984fa7dece3b170ca0f13a24de71f467b12937031754 magic.zip
Archive contents:
FILE_ID.DIZ 546 bytes
MAGIC.EXE 62000 bytes
MAGIC.NFO 9041 bytes
Extracted file hashes:
98dc41700c100be68c2f5454c9dbda10748e5cc32721e87935a6b3d818c92cb3 FILE_ID.DIZ
1103d30b72efc88121f5dba3833b0f98a3051231f0a9ef5310c1f068e12bbdc3 MAGIC.EXE
425707cbaf9c3d70526ce7e14927046da389bc7284c525d8f44c0d3fd66fbb7e MAGIC.NFO
FILE_ID.DIZ identifies it as TET's Assembly 1994 64K intro entry. The info
file says the program requires a 386, a compatible VGA, 578 KB of conventional
memory, and supports only Gravis UltraSound for sound. Without GUS, it can run
without sound.
MZ Header And File Layout
MAGIC.EXE is a 62,000-byte MZ executable with a very small header:
MZ signature: 5a4d
header paragraphs: 2
relocations: 0
minalloc/maxalloc: 0x0070 / 0xffff paragraphs
initial SS:SP: 0x0055:0x0080
entry CS:IP: 0x0000:0xf1cb
relocation table: 0x001c
The entry maps to file offset 0xf1eb when the 32-byte header is included.
That location is in the last part of the physical file, where a mirrored copy
of the depacker also appears. A DOSBox-X execution check reached VGA graphics,
so the shipped executable is viable despite the slightly odd size bookkeeping.
The early load image contains a high-bit-marked error string and the executable name:
Error: The Magic Circle requires 578K (592032 bytes of free memory) - exiting!
MAGIC.EXE
The message text uses bytes with bit 7 set in several positions. Clearing bit 7 is enough to reveal much of the text, but those marked bytes are not a complete plain-text encoding of the whole executable. Most of the middle of the file is packed data.
Loader Overview
The active entry is tiny:
f1eb: nop
f1ec: nop
f1ed: nop
f1ee: mov ax,cs
f1f0: add ax,001fh
f1f3: push ax
f1f4: push 000eh
f1f6: lret
It does not start the real program directly. It changes CS by 0x1f
paragraphs and far-returns to offset 0x000e, which lands at load-image offset
0x01fe.
At that target, the first loader stage copies a compact second-stage depacker upward:
01fe: push es
01ff: push cs
0200: pop ds
0201: mov cx,[000ch] ; 0x015b bytes
0205: mov si,cx
0207: dec si
0208: mov di,si
020a: mov bx,ds
020c: add bx,[000ah] ; destination segment delta, 0x20
0210: mov es,bx
0212: std
0213: rep movsb
0215: push bx
0216: mov ax,002bh
0219: push ax
021a: lret
The copied block length, 0x015b, and destination delta, 0x20 paragraphs,
come from words just before the code. The copy runs backwards with STD, which
is a common packer habit: it allows a small loader to move itself or nearby data
without needing a second buffer.
The first instruction, push es, is not dead. The termination code later pops
that saved value, adds 0x10, and recovers the program's load segment from the
PSP segment that DOS supplied in ES.
Moving The Packed Prefix
The second stage begins at the copied offset 0x002b. It first moves the low
part of the packed image upward by 0x200 bytes:
022b: mov bp,cs:[0008h] ; 0x001f paragraphs to move
0230: mov dx,ds ; old lower segment
0232: mov ax,bp
0234: cmp ax,1000h
0237: jbe short chunk_ok
0239: mov ax,1000h
chunk_ok:
023c: sub bp,ax
023e: sub dx,ax
0240: sub bx,ax
0242: mov ds,dx
0244: mov es,bx
0246: mov cl,03h
0248: shl ax,cl ; paragraphs -> words / copy count setup
024a: mov cx,ax
024c: shl ax,1
024e: dec ax
024f: dec ax
0250: mov si,ax
0252: mov di,ax
0254: rep movsw
0256: or bp,bp
0258: jne 0232h
For this executable the paragraph count is only 0x1f, so the loop runs once.
The copy length is 0x0f8 words, or 0x1f0 bytes. The result is an input
window beginning at load-image offset 0x0200, while the depacker can write
the expanded stream back down at load-image offset 0x0000.
That is the first important design point: the packed stream overlaps the final output area, so the loader only has to move the vulnerable prefix. The rest of the packed bytes can be consumed in place before the output catches them.
Bit Reader
The bitstream is least-significant-bit first. The code keeps:
BPas the current 16-bit bit buffer,DXas the remaining-bit counter,DS:SIas the input stream,ES:DIas the output stream.
The bit fetch pattern appears several times:
0269: shr bp,1
026b: dec dx
026c: jne have_bit
026e: lodsw
026f: mov bp,ax
0271: mov dl,10h
have_bit:
0273: jae literal
SHR places the old low bit in carry. MOV does not change flags, so even when
the buffer is reloaded, the branch still tests the carry from the bit just
consumed. That is a small but important detail; a decoder that reloads and then
tests the new buffer will drift out of sync.
In pseudocode:
getbit:
carry = BP & 1
BP >>= 1
bit_count -= 1
if bit_count == 0:
BP = next_word()
bit_count = 16
return carry
Literal Path
When the first bit is clear, the depacker copies one literal byte:
0273: jae literal
...
literal:
0275: movsb
0276: jmp 0269h
This is the fast path for bytes that are not worth encoding as references.
Because MOVSB uses DS:SI and ES:DI, it also preserves the real-mode
segment behavior needed by the later normalizer.
Short Match Path
When the first bit is set and the next bit is clear, the depacker reads a short match:
0278: xor cx,cx
...
0296: rcl cx,1
...
02a2: rcl cx,1
02a4: inc cx
02a5: inc cx
02a6: lodsb
02a7: mov bh,0ffh
02a9: mov bl,al
02ab: jmp copy_match
The two RCL instructions shift two bits into CX. After the two increments,
the short length range is:
length = 2 + two_bit_value
So the short path copies 2, 3, 4, or 5 bytes.
The offset is 0xff00 | next_byte. That is not a normal flat negative pointer;
the copy source is ES:(DI+BX), with 16-bit offset wrap. Early references can
therefore read from the high end of the current 64K segment. A flat
output - distance model is not faithful for this wrapper.
Long Match Path
When the first two control bits are set, the depacker reads a 16-bit match descriptor:
02ae: lodsw
02af: mov bx,ax
02b1: mov cl,03h
02b3: shr bh,cl
02b5: or bh,0e0h
02b8: and ah,07h
02bb: je extended_length
02bd: mov cl,ah
02bf: inc cx
02c0: inc cx
The high five bits of the descriptor become a negative wrapped offset:
BX = 0xe000 | ((descriptor >> 11) << 8) | low_byte
The low three bits of the original high byte give a length of 3..9:
length = (descriptor_high & 7) + 2
If those three bits are zero, the depacker reads one more byte:
02c9: lodsb
02ca: or al,al
02cc: je end_stream
02ce: cmp al,01h
02d0: je normalize_segments
02d2: mov cl,al
02d4: inc cx
02d5: jmp copy_match
That extra byte has three meanings:
0x00: end of the compressed stream,0x01: normalize segment registers without changing linear input/output positions,- any other value: extended length
value + 1.
Match Copy Inner Loop
All match types share the same byte copy:
copy_match:
02b1: mov al,es:[bx+di]
02b4: stosb
02b5: loop copy_match
02b7: jmp 0269h
This is the classic overlapping LZ copy, but with real-mode offset wrapping.
If BX points back into bytes currently being written, the newly written bytes
become part of the source for the rest of the run. That turns a short seed into
a longer repeated pattern.
The wrapper's uncommon part is the segment behavior. Many simple unpacker reimplementations assume:
source = output - distance
Here the actual source is:
source = ES:((DI + BX) & 0xffff)
That distinction matters at the beginning of the stream and around the segment normalizer.
Segment Normalizer
The special extended byte 0x01 runs this block:
02d7: mov bx,di
02d9: and di,000fh
02dc: add di,2000h
02e0: mov cl,04h
02e2: shr bx,cl
02e4: mov ax,es
02e6: add ax,bx
02e8: sub ax,0200h
02eb: mov es,ax
02ed: mov bx,si
02ef: and si,000fh
02f2: shr bx,cl
02f4: mov ax,ds
02f6: add ax,bx
02f8: mov ds,ax
02fa: jmp 0269h
For the output pointer, the transformation is:
old_linear = ES * 16 + DI
new_DI = (DI & 0x000f) + 0x2000
new_ES = ES + (DI >> 4) - 0x0200
new_ES * 16 + new_DI == old_linear
That lets the depacker keep DI in a comfortable range while preserving the
same linear output position. The input side does the same kind of paragraph
folding without the 0x2000 offset bias.
Relocation Trailer
When the compressed stream ends, the depacker switches to a compact relocation trailer embedded in the copied stage:
030c: push cs
030d: pop ds
030e: mov si,0158h
0311: pop bx
0312: add bx,0010h ; PSP segment -> load segment
0315: mov dx,bx
0317: xor di,di
The saved ES from the first stage is popped here. DOS initially puts the PSP
segment in ES, so adding 0x10 recovers the load segment.
The trailer format is compact:
read one byte
if byte != 0:
DI += byte
add load_segment to word at current relocated position
continue
if byte == 0:
read word
if word == 0:
DX += 0x0fff
continue
if word == 1:
finish
DI += word
add load_segment to word at current relocated position
The relocation write is:
0320: add di,ax
0322: mov ax,di
0324: and di,000fh
0327: mov cl,04h
0329: shr ax,cl
032b: add dx,ax
032d: mov es,dx
032f: add es:[di],bx
So DI is stored as a compressed linear delta stream. The code folds it into
ES:DI only when applying a relocation.
The copied metadata indicates the final runtime handoff:
final CS:IP relative to load image: 0000:0128
final SS:SP relative to load image: 002d:0300
The final code patches the segment word at CS:0002, restores stack, points
DS and ES back at the PSP segment, and jumps through CS:0000.
Memory Contract
The error text says the intro needs 578 KB, or 592,032 bytes, free. That aligns with the wrapper design:
- the intro executable is near the 64K limit;
- the depacker needs room for an expanded runtime;
- the visual parts need working buffers for VGA pages, generated textures, vector state, and music data;
- the code uses DOS memory management rather than assuming the whole machine is free.
One readable code island near the "not enough memory" string includes DOS interrupt 21h service use for resizing and allocating memory. The disassembly there is mixed with packed data, so I am not treating every nearby byte as clean code, but the intent matches the visible memory-failure path.
Visible Data Islands
Several strings and tables are visible even without the full expanded runtime. After clearing high bits for readability, the tail contains fragments of the end text:
Thank you for watching
THE MAGIC CIRCLE by EUROPEAN TECHNOLOGY
Another nearby island contains title/credit fragments:
M A G I C
WRITTEN BY
GUYS OF EUROPEAN TECHNOLOGY
There are also symmetric byte ramps around the 0xe24x region. These look like
precomputed curve or palette data rather than code:
.02468:<>@ACEGIKLNPRSUWXZ[]^`acdeghiklmnopqrstuv
...
vutsrqponmlkihgedca`^][ZXWUSRPNLKIGECA@><:86420.+
That kind of ramp table fits the NFO's section list: plasma, circles, vector tunnel, and wobbling end scroller all benefit from small sinusoidal or brightness tables. I am not assigning those bytes to a specific effect without the expanded call graph.
What Can Be Said About The Visual Parts
The info file is unusually specific. It says the intro contains:
- a tubescroller,
- circles,
- 40 high-resolution vectors,
- a filled vector tunnel,
- plasma,
- a 2D layered texture part,
- a multi-facet vector part,
- a wobbling end scroller and custom font.
Those section names match normal 1994 PC 64K techniques:
- "tubescroller" usually means text mapped around a cylindrical coordinate table;
- "filled vector tunnel" implies projected rings or polygons with span filling;
- "2D layered texture" implies table-driven offset sampling or parallax layers;
- "multi facet-vector" implies a shaded or face-colored polygon object;
- "wobbling endscroller" implies a font blit with per-column or per-row sine displacement.
Those are informed labels, not recovered inner loops. The file does contain direct VGA and BIOS-video byte patterns, but in the packed image many such patterns are false positives. I therefore avoid claiming specific port-level effect code until the full runtime image is carved.
Execution Check
A short headless DOSBox-X run reached VGA graphics setup. The log showed the
mode switch into a 640x480 surface after MAGIC.EXE launched, which confirms
that the archive runs far enough to leave text startup and enter graphics on a
modern emulator. Sound was not required for this check.
Attempts to carve the live emulator memory through a process image were not usable on this host: direct process memory reads were denied, and debugger-based dumping did not produce a usable artifact in the allotted run. Those capture failures are why this article focuses on the shipped loader and verifiable metadata rather than pretending to have mapped the visual runtime.
Technical Character
The Magic Circle is a size-constrained 64K intro with a sophisticated wrapper
for its era:
- no normal relocation table in the MZ header;
- a tail entry that far-returns into a relocated depacker;
- a backwards self-copy for the depacker body;
- a small prefix move so compressed input can overlap output;
- LSB-first bitstream control;
- short and long LZ references;
- real-mode wrapped match sources;
- a segment-normalization marker;
- a compact relocation delta trailer;
- final handoff through a patched far pointer.
The wrapper is the strongest recovered code in this pass. It is also a useful reminder that 64K intro packers are not always interchangeable with named tools: the stream resembles familiar LZ executable packers, but its exact segment wrapping, normalizer marker, and relocation trailer are local to this binary.
The visual side is known from the authors' own part list and visible data
islands, but its inner loops remain the main missing piece. A future pass should
prioritize a real guest-RAM carve or an instruction-level emulator for the
wrapper with faithful pre-load memory, then disassemble from the recovered
0000:0128 runtime entry.