As I was working on my project--a complete rewrite where before I allowed a Legacy BIOS boot, to now requiring UEFI--I had the thought, "what happens if I boot via Legacy BIOS?"
Well, of course I could write a little bit of code to place in the (P)MBR of the GPT formatted media that would simply state "This requires UEFI, please adjust your settings and try again."
But that really isn't any fun, so I thought, what else can I put in those first 446 bytes?
A while back, 25 years now, I was a part of the
Hugi Size Coding competition, and compo #13 was a Sokoban competition. Create the smallest executable that allows an arbitrary amount of levels as input and allow the user to attempt to solve each puzzle, one after another. (On a side note, Sokoban was created in the early 1980s (I was just a kid then) by Hiroyuki Imabayashi, the president of Thinking Rabbit, a company in Japan. It was submitted to a coding contest and won first place.
Here is some more information.)
Anyway, I thought if someone booted my disk image via Legacy boot, whether is was on purpose or not, display the usual text string *and* why not let the user attempt to solve one of the original puzzles submitted by the creator back in 1980?
So, here is a screen shot of my image being booted via a Legacy boot:
The user can use the arrow keys to push the boxes around, placing them on to the dock (cyan color).
But that isn't all:
- it turns off the blinking cursor.
- it has an (almost) unlimited undo, using the backspace key, where you can undo all the way back to the beginning if needed. It uses a 64k minus 512 byte stack for this undo feature, not allowing you to over do it, displaying a string stating "too many moves" if needed.
- You can press the Escape key to start over.
- It also has error checking, ignoring any unused key strokes
- It also checks for and indicates with a text string that you have completed the puzzle, if and when you do.
- It does not rely on the puzzle's layout, only that a puzzle will not be any larger than 14x12 in size.
- It places the "FYSOSv3" signature under the puzzle.
The challenge here was to do all of that and store the 14x12 puzzle (currently 84 bytes in itself) in the 446 bytes available in the (P)MBR, preserving the four partition entries and the 0xAA55 signature. I still have a whopping 14 bytes at the end of the code to do something else if desired. :-)
I do not have a bootable image uploaded anywhere yet to show it in action, but if someone absolutely has to try it out, I could easily do so. (I currently have a bug somewhere in the kernel or one of the apps that freezes the system an average of 1 out of every 25 startups. Luckily it is almost exactly in the same place each time, which helps narrow it down.)
Just thinking outside of the box, keeping it fun and interesting.
- Ben
https://www.fysnet.net/fysos.htm