Fractals on the Master Boot Record
WeAlone contributor Keegan has adapted the video feedback method of rendering Julia sets to fit in 512 bytes of Intel machine code that runs from the master boot record. This program was created for the IO MBR demo competition.
When a computer starts up, a very small program begins the process of loading and booting up progressively more complex programs, until an entire modern operating system is loaded. With some cleverness and optimization, we were able to make a program that fits in this space, and rather than booting the machine, renders animated Julia set fractals.
The source code is written in assembly, and can be downloaded here. The compiled program image can be downloaded from here.
If you're running Linux, you can try this out yourself using the qemu machine emulator, which can be retrieved from the package manager ( menu → system → administration → synaptic package manager, search for and install 'qemu-kvm' ). Once installed, simply typing "qemu phosphene.mbr" in a terminal should suffice.
You can also create a USB thumb drive that can boot most Intel architecture machines into this fractal rendering mode. Once booted, it is possible to remove the USB stick and leave the machine in a fractal-rendering coma until it is power cycled. Be careful here, if you overwrite the MBR on your own machine, you will trash your partition table and leave your system only able to boot as a fractal.
Assuming your USB thumb drive is /dev/sdb, the following commands will create a bootable USB stick. For the love of humanity do not write to /dev/sda, since this is probably your system boot partition.
$: sudo dd if=phosphene.mbr of=/dev/sdb
$: sync
( wait until IO lights stop blinking and remove the drive )
In one instance, we found that writing to /dev/sdb1 worked while writing to /dev/sdb did not. I'm not sure if this was a fluke, but you can try this if it doesn't seem to work on the first try.
These programs are so small, they can be distributed as plaintext in base64.
with a more flickery, rapidly changing colorscheme :
McCO2I7AuOAHjtC8ABC4EwDNELsPALQOvpl9rM0QhMB1+R5oAKAfMfa/AJ65AArzpR8xwM0QuAFP
uQEBvwB+zRCwQDHS93UEULgCT7sBAc0QusgDMMDuQrkAAVDuiNjuiPjuWAQCgcMDBeLv2+PHBYUA
3wXGBbHfBb0AAWgAEA+hFh+M4IDEEI7AvgAgv8B4sRCs0OgmAAVH4veBxjABgcfwAYH/AJhy5zH2
Mf+M4ID0UI7AiSzfBNjy2cDZ/9nJ2ereydn/2ejYwNz63vnZ7d7puoABuQACYNnqiRTfBNj12OGJ
DN8E2PXY4t3S3MrZwdjI3uveydjA2MPZwt7C2ercwt7B2M3fHIsU2MvfHIscgOcBieiB+oABcxXR
4sDmBIzgAPSO6DD2weIIAdNligcmiAVhR+Kghf91B4zAgMQQjsBKdY9F3tmM4ID0UI7gjthoAKAH
MdLoNgAx9r9AeLuAAbkAAqSF/3UKNgIW/g9T6B0AW+LvgceAAEv2w391CYzYgMQQjtgx9oXbddXp
8P64BU8x280Qw0kDDQppbwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////
////////////////////////////////////////////////////////////////////////Vao=
A nice colorscheme with a black background :
McCO2I7AuOAHjtC8ABC4EwDNELsPALQOvp99rM0QhMB1+R5oAKAfMfa/AJ65AArzpR8xwM0QuAFP
uQEBvwB+zRCwQDHS93UEULgCT7sBAc0QusgDMMDuQrkAAVDuiNjuiPjuWAQCgcMDBeLv2+PHBYUA
3wXGBbHfBb0AAWgAEA+hFh+M4IDEEI7AvgAgv8B4sRCs0OgmAAVH4veBxjABgcfwAYH/AJhy5zH2
Mf+M4ID0UI7AiSzfBNjy2cDZ/9nJ2ereydn/2ejYwNz63vnZ7d7puoABuQACYNnqiRTfBNj12OGJ
DN8E2PXY4t3S3MrZwdjI3uveydjA2MPZwt7C2ercwt7B2M3fHIsU2MvfHIscgOcBMMCB+oABcxvR
4sDmBIzgAPSO6DD2weIIAdNligc8/3QC/sAmiAVhR+Kahf91B4zAgMQQjsBKdYlF3tmM4ID0UI7g
jthoAKAHMdLoNgAx9r9AeLuAAbkAAqSF/3UKNgIW/g9T6B0AW+LvgceAAEv2w391CYzYgMQQjtgx
9oXbddXp6v64BU8x280Qw0kDDQppbwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////
////////////////////////////////////////////////////////////////////////Vao=
To convert these strings into a usable program, in Linux, use the base64 command. Type "base64 -d > phosphene.mbr" in the terminal, and press enter. Then, paste one of the base 64 encoded programs in the terminal. Press enter, and then control+D ( end of file ). This will convert the text into the compiled machine code for phosphene.mbr. Run it as explained above using qemu or making a bootable USB drive.
$: base64 -d > foo.mbr
McCO2I7AuOAHjtC8ABC4EwDNELsPALQOvp99rM0QhMB1+R5oAKAfMfa/AJ65AArzpR8xwM0QuAFP
uQEBvwB+zRCwQDHS93UEULgCT7sBAc0QusgDMMDuQrkAAVDuiNjuiPjuWAQCgcMDBeLv2+PHBYUA
3wXGBbHfBb0AAWgAEA+hFh+M4IDEEI7AvgAgv8B4sRCs0OgmAAVH4veBxjABgcfwAYH/AJhy5zH2
Mf+M4ID0UI7AiSzfBNjy2cDZ/9nJ2ereydn/2ejYwNz63vnZ7d7puoABuQACYNnqiRTfBNj12OGJ
DN8E2PXY4t3S3MrZwdjI3uveydjA2MPZwt7C2ercwt7B2M3fHIsU2MvfHIscgOcBMMCB+oABcxvR
4sDmBIzgAPSO6DD2weIIAdNligc8/3QC/sAmiAVhR+Kahf91B4zAgMQQjsBKdYlF3tmM4ID0UI7g
jthoAKAHMdLoNgAx9r9AeLuAAbkAAqSF/3UKNgIW/g9T6B0AW+LvgceAAEv2w391CYzYgMQQjtgx
9oXbddXp6v64BU8x280Qw0kDDQppbwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////
////////////////////////////////////////////////////////////////////////Vao=
$: qemu foo.mbr
Thanks. Groovy Project. :>
ReplyDeletethe links are dead
ReplyDelete