One file now works as a ZIP archive, a Multiboot operating system image, and a floppy disk that boots on a standard PC.
David Oberhollenzer, who goes by Goliath, built it and described the work in a blog post that covers the byte-level details. You can unpack the file like any other ZIP. You can also boot it with GRUB, QEMU, or any other loader that follows the Multiboot standard (a common way for bootloaders to hand off to an OS image), even if the file has been written to different media. Or you can write it to a floppy and boot it straight from the BIOS, the firmware that starts a PC, with no modification.
The trick starts with how ZIP is laid out. Unlike most file types, a ZIP keeps its directory at the end. Before that, each stored file begins with "PK", the bytes 03 04, some metadata, and then the contents. Any file can be stored uncompressed, and Goliath put the bootloader in the first one, ZIPHEAD.COM.
Multiboot was the easy part, Goliath said. An image needs the value 0x1BADB002 within its first 8 KiB, followed by some flags and a checksum. After that, the loader's job takes over.
The BIOS route took more work. A BIOS reads a disk's first 512 bytes, checks that they end in 0x55AA, and runs the code from the first byte. Placing that marker at position 510 was simple. The problem is that the first bytes of a ZIP are a header, not code. The first four happen to be instructions that only push a value onto the stack. Goliath then adjusted the metadata values after them so the modification time bytes act as a jump further into the data. Finding bytes that are safe instructions, do useful setup work, and still form a valid ZIP header is much harder than it sounds, according to the write-up.
The design holds together because each reader looks somewhere different. ZIP tools go to the end for the directory, Multiboot loaders scan the first 8 KiB, and the BIOS checks a single 512-byte sector. Only the opening bytes are claimed by both the BIOS and the ZIP format, and that is where the effort went.