Introduction
A version 8 formula is a Mandelbulb 3D formula file with .Version = 8, the highest number
in the files examined. Six of the 714 files have it, three different formulas each with a copy:
_sphereinv, ATetraVS2 and TrifoxComplexAngles. With so few
files, what is said here describes those three and may not hold for others.
The file is Windows text, lines ending in CR LF, and the code is 32-bit x87 machine code written as hexadecimal digits.
Layout
| Part | Starts with | Holds |
|---|---|---|
| Options | [OPTIONS] | One line for each setting or option. The first is .Version = 8. |
| Constants | [CONSTANTS] | Optional; two of the six files (one formula) have it. |
| 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
| Line | In version 8 files |
|---|---|
.Version = 8 | All 6. |
.DEoption = n | 4 files: 1 in two, 11 in two. The other two have none. |
.DEscale, .SIpower, .RStop | 4, 2 and 2 files. |
.Double, .Integer, .Single | 4, 4 and 2 files. |
.DRecipro, .DReci2 | 4 and 2 files: a double with its reciprocal (and square) kept, such as .DRecipro Radius = 1 and .DReci2 Rad2 = -1. |
.Boxscale | 2 files. |
No version 8 file has an .SSE2 or .SSE3 flag, or an angle option.
Machine code
The code is x87. In _sphereinv it begins 55 8B EC 56 57 53 8B 75 08 89 C3 8B 7E 30
(push ebp; mov ebp, esp; push esi; push edi; push ebx; mov esi, [ebp+8]; mov ebx, eax;
mov edi, [esi+0x30]), the same frame as the earlier versions. The listing in the explorer
ends at a jmp back into the code (EB D4), so the procedure’s
returns are inside it. This is read off the disassembly of the sample files.
A worked example
_sphereinv.m3f is 1,714 bytes: a sphere inversion with a centre, a radius and a fold
mode. It has six options and 146 bytes of code.
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 38 0D 0A 2E 44 45 73 63 61 6C ion = 8 .DEscal
00000020 65 20 3D 20 30 2E 32 0D 0A 2E 44 45 6F 70 74 69 e = 0.2 .DEopti
00000030 6F 6E 20 3D 20 31 0D 0A 2E 44 6F 75 62 6C 65 20 on = 1 .Double
00000040 58 20 63 65 6E 74 65 72 20 3D 20 30 0D 0A 2E 44 X center = 0 .D
_sphereinv.m3f: .DEscale before .DEoption, then the optionsThe option lines are .Double X center, Y center, Z center (all 0),
.DRecipro Radius = 1, .DReci2 Rad2 = -1 and
.Integer FoldMode (1 or 2) = 1; the code starts at offset 0xCB after
[CODE]. The description explains the fold mode: mode 1 inverts inside a sphere.
Quirks
- A byte is never split across two hex lines; the last hex line is shorter.
- An option label may contain brackets and spaces (
FoldMode (1 or 2)); the label ends at the equals sign. - Text in the description may use Windows-1252 characters.
Not described
What this page and the explorer leave out or only infer for version 8 files.
- Reference: only three different formulas (six files) have this version, so what is said of it may not hold for others; what the number changes from version 6 is not known, and the
.DEoptionvalues 1 and 11 seen here have no stated meaning in the source. - Reference: the code of
_sphereinvends in a jump, and where its procedure returns was not worked out. - 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