Introduction
A version 3 formula is a Mandelbulb 3D formula file whose first option line is
.Version = 3. Twelve of the 714 files examined have it (six different files, the rest
copies): Makin3D-1, Makin3D-2, Makin3D-3-4,
GenIntPower, _IntPowRotateC and _AmazingBoxSSE2. The Makin3D
files carry David Makin’s name in their description. Four files have a .SSE3 line, a
flag found in no other version; two have .SSE2.
The file is Windows text, lines ending in CR LF, and the code is 32-bit x86 written as hexadecimal digits.
Layout
| Part | Starts with | Holds |
|---|---|---|
| Options | [OPTIONS] | One line for each setting or option. The first is .Version = 3. |
| Constants | [CONSTANTS] | Optional; 6 of the 12 files have it. Lines Double = 0.5 or INT64 = $…. |
| Code | [CODE] | The machine code as hexadecimal digits, 64 digits (32 bytes) to a line. |
| End | [END] | Ends the code. |
| Description | a blank line, then Description: | Free text to the end of the file. |
Option lines
Every option line starts with a dot. A setting is read by name; an option, written
.<kind> <label> = <default>, is a value the user can change.
| Line | In version 3 files |
|---|---|
.Version = 3 | All 12. |
.DEoption = n | 6 files: -1 in two, 0 in two, 11 in two. The other six have none. |
.DEscale = x, .SIpower = n | 8 files each (the files with no .DEoption have both). |
.RStop = x | 2 files. |
.SSE2, .SSE3 | 2 files and 4 files: flags with no value. |
.Double … | 8 files. |
.Integer … | 6 files. |
.Boxscale … | 2 files (the Amazing Box’s values). |
No version 3 file has a 2Doubles, an angle, or a Single option.
Machine code
As in the other versions the code is a procedure: it starts 55 8B EC
(push ebp; mov ebp, esp), loads [ebp+8], takes the pointer at offset
0x30 of what that points to for its option values, and works on x, y and z through
eax, edx and ecx (in Makin3D-1 it copies
eax to ebx first and ends with mov eax, ebx). The code of
Makin3D-1 has D9 D0, an x87 fnop, between its steps. Most
of the twelve files end with C2 08 00 (ret 8), some with a plain
C3. This is read off the disassembly of the sample files.
A worked example
Makin3D-1.m3f is 409 bytes. Its description says it comes from David Makin’s
MMFwip3D.ufm, and gives x' = x*x - y*y - z*z + Cx. It has no .DEoption.
00000000 5B 4F 50 54 49 4F 4E 53 5D 0D 0A 2E 56 65 72 73 [OPTIONS] .Vers
00000010 69 6F 6E 20 3D 20 33 0D 0A 2E 44 45 73 63 61 6C ion = 3 .DEscal
00000020 65 20 3D 20 31 0D 0A 2E 53 49 70 6F 77 65 72 20 e = 1 .SIpower
00000030 3D 20 32 0D 0A 5B 43 4F 44 45 5D 0D 0A 35 35 38 = 2 [CODE] 558
00000040 42 45 43 35 33 35 36 35 37 38 42 37 35 30 38 38 BEC5356578B75088
Makin3D-1.m3f: three setting lines, then the code from offset 0x3DThe code begins 55 8B EC 53 56 57 8B 75 08 8B 7E 30 8B D8 DD 03 D8 C8:
push ebp; mov ebp, esp; push ebx; push esi; push edi; mov esi,[ebp+8]; mov edi,[esi+0x30];
mov ebx, eax; fld qword ptr [ebx]; fmul st, st(0), which starts squaring x.
Quirks
- A byte is never split across two hex lines; the last hex line is shorter.
- The description starts after a blank line;
Makin3D-1has two blank lines after[END]. - Text in the description may use Windows-1252 characters.
Not described
What this page and the explorer leave out or only infer for version 3 files.
- Reference: only six different files (twelve with copies) have this version, so what is said of it may not hold for others; what the number changes from version 2 is not known.
- Reference: the
.DEoptionvalues 0 and 11 seen here have no stated meaning in the source; the SSE2 and SSE3 flags are described from the loader, not from what the code does with them; the code’s register use is read off the disassembly of sample files. - Viewer: the machine code is a linear disassembly (no jump following, no data/code separation, constants not shown beside the code); options are not linked to the code that reads them.
Variants
- Version 2 – the commonest: x87 code with a push ebp prologue, many add-ons
- Version 3 – twelve files, among them David Makin’s formulas, with SSE2 and SSE3 flags
- Version 4 – twenty-eight files, the reciprocal add-ons and Amazing Box variants
- Version 5 – sixty-one files, mostly four-dimensional formulas
- Version 6 – one hundred and ninety files, mostly the dIFS formulas
- Version 8 – six files, the newest number seen
Links
Software
- Mandelbulb 3D – the Windows program that loads these formulas (Windows)
Reference
- M3P file format – the parameter files that name the formulas in use