LWN.net Logo

Garrett: Implementing UEFI Boot to Zork

Matthew Garrett has finally implemented what we all really wanted in the first place: direct boot into the Zork game from UEFI. "But despite having a set of functionality that makes it look much more like an OS than a boot environment, UEFI doesn't actually expose a standard C library. The EFI Application Development Kit solves this particular design decision."
(Log in to post comments)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 23, 2013 18:03 UTC (Mon) by yokem_55 (subscriber, #10498) [Link]

Oh dear. Now my bios can be eaten by a grue.

Garrett: Implementing UEFI Boot to Zork

Posted Sep 23, 2013 22:18 UTC (Mon) by lynxlynxlynx (guest, #90121) [Link]

Nice idea! I've done something similar in the past, but it was a bit more intricate. If you picked the right/wrong smgl install iso, you'd get the magic version, which would drop you into a proof-of-concept rpg on boot. Common escape paths were blocked, so you had to win the game to proceed with the installation. <:)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 30, 2013 18:59 UTC (Mon) by Baylink (subscriber, #755) [Link]

That is so full of win there isn't room left on this page for me to post this comm

Garrett: Implementing UEFI Boot to Zork

Posted Oct 1, 2013 17:25 UTC (Tue) by nix (subscriber, #2304) [Link]

Isn't that called 'OpenPROM'? :P :P

(You may be eaten by a FORTH.)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 23, 2013 22:22 UTC (Mon) by atai (subscriber, #10977) [Link]

How about directly boot into a Commodore 64. Runs just like an 8-bit machine

Garrett: Implementing UEFI Boot to Zork

Posted Sep 24, 2013 5:17 UTC (Tue) by eru (subscriber, #2753) [Link]

How about directly boot into a Commodore 64. Runs just like an 8-bit machine

Or perhaps what the Commodore 64 (or similar machines of that era) would have looked like with a 64-bit processor and gigabytes of memory, but still with a BASIC interpreter hand-coded in assembler? (A computer from an alternate reality, where programming languages and operating systems remained undeveloped). Would attain an awesome score in the old David Ahl's Creative Computing BASIC benchmark...

Garrett: Implementing UEFI Boot to Zork

Posted Sep 24, 2013 18:02 UTC (Tue) by branden (subscriber, #7029) [Link]

You'd need to add support for (at least) wider integral data types. Otherwise you'd still only have 64kB of RAM. Those old interpreted BASICs all figured they knew where the top of RAM was ($7FFF, $BFFF, or $FFFF).

Plus there would be the obvious problems with attempting to PEEK or POKE areas above the 64kB "barrier", and PRINT MEM itself would either report the same old low value (I still remember that it was 48340 on Radio Shack Level II BASIC on the TRS-80 Model I...), or, if it were somehow aware of all those gigs of RAM, performing this operation would result in an integer overflow. :)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 25, 2013 0:21 UTC (Wed) by davidstrauss (subscriber, #85867) [Link]

> You'd need to add support for (at least) wider integral data types. Otherwise you'd still only have 64kB of RAM.

Or use multi-level bank-switching.

Garrett: Implementing UEFI Boot to Zork

Posted Sep 25, 2013 5:16 UTC (Wed) by dlang (✭ supporter ✭, #313) [Link]

and remember that the c64 already supported bank switching so that you could have either the ROM or RAM at a particular location (and it ran MUCH faster if you copied ROM to RAM and switched to the all RAM config)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 26, 2013 18:18 UTC (Thu) by nix (subscriber, #2304) [Link]

It supported multi-level bank switching, no less: $D000-$DFFF could not only hold RAM and the "character ROM" which held images of the glyphs, but also the I/O area where the 6510's I/O ports were exposed.

To add even more confusion, the VIC chip always saw the character ROM at this position (you could copy the glyphs elsewhere and modify them, then ask it to look elsewhere in memory: elsewhere, as I recall, it always saw RAM). Meanwhile, the 6510 by default saw the I/O ports, though you could change that in the usual way. So the shape of the memory map varied depending on what chip you were talking about.

The C64 was a *fun* architecture... it's just a shame that everyone's first program had to be to write an assembler in raw machine language or in that horrific crippled dialect of MS BASIC. As a previous Sinclair ZX81 user, I was not tempted by the BASIC route at all! I'd seen a *real* BASIC, after all (and in the end Sinclair gave us SuperBASIC, which was very nearly a real language).

Garrett: Implementing UEFI Boot to Zork

Posted Sep 25, 2013 4:00 UTC (Wed) by eru (subscriber, #2753) [Link]

Naturally the alternate-reality ROM BASIC would have a wider integer type, since it would be running on a 64-bit CPU! The 1970's originals had 16-bit integers only because supporting wider ones would have meant more CPU and memory usage. The 6502 family (in Apple II, the 8-bit Commodore computers and many others) actually had only 8-bit arithmetic operations, but 8-bit integers would have been a bit too limiting even then...

The alternate-reality coder could also generously widen other types, like make floating-point variables 8 bytes, instead of 4 or 6 that were typical, and allow strings longer than 256 characters. He might even support more than 2 significant characters in identifiers. I wonder if a BASIC like this would still fit into 16Kb? x86_86 code is not as compact as 6502, but on the other hand, the ROM would not have to contain software floating-point routines any more.

Garrett: Implementing UEFI Boot to Zork

Posted Sep 26, 2013 2:06 UTC (Thu) by zlynx (subscriber, #2285) [Link]

It is funny but Microsoft Research has developed almost this system, called Singularity.

Okay, okay, it is actually an operating system implemented in .NET but I could easily see it running a Visual Basic shell.

Garrett: Implementing UEFI Boot to Zork

Posted Oct 7, 2013 12:35 UTC (Mon) by basdebakker (guest, #60977) [Link]

Don't assume that hand coded assembly means fast. I don't know about the Commodore 64, but I did own a ZX Spectrum. The BASIC interpreter would do linear searches to find the line to GOTO or the variable to use. Every time it needed them. You could actually improve performance by moving frequently used code to the beginning of the program.

Completeness

Posted Sep 23, 2013 23:26 UTC (Mon) by ncm (subscriber, #165) [Link]

The traditional exercise is to generate a list of prime numbers.

Garrett: Implementing UEFI Boot to Zork

Posted Sep 30, 2013 19:08 UTC (Mon) by Baylink (subscriber, #755) [Link]

This actually seems like one of those vanishingly rare occasions when it's actually on-topic for me to post one of my favorite sagas. I'll keep it short.

Lo, in the year nineteen hundred and eighty-four, I was at the College for Juniors in St Petersburg, Florida, and I was helping the wizards there -- some of whom had the appropriate facial hair -- to work on our recently acquired AT&T 3b2/500 computers.

We were trying to reinstall All The Good Bits on one machine which had crashed unceremoniously to the ground, and we realized that at a specific point in the (floppy-based) install, we needed to drop to a shell, and we couldn't.

So we called the AT&T TAC. They were hirsute men on the other end of that phone line, as well, and had given us much good advice in the past, and we were in hopes that this habit would continue.

And verily did we tell the wizard of our plight, and did he walk us through the floppy boot procedure, until again, we reached the prompt:

[1 2 3 help quit]:

"Type 'MAGIC MODE'", spake the wizard.

Once we had picked ourselves up off the floor, dusted ourselves off, and stopped laughing (in that order), we typed what the wizard had instructed us, and hit ENTER.

[1 2 3 help shell quit]: shell
#

"Sonuvabitch", saith we all.

In an amusedly self-important voice, the wizard asked if we'd be needing anything else, and we all agreed that no, we were pretty sure we could carry on from there.

I eventually dug through the bootscripts on the floppy to the point where that happened, and there was a smartass comment there too, but it was 29 years ago, and I don't remember it anymore. I almost certainly posted on Usenet about it, so unless DejaGoo has melted all the way into slag, you could look it up. :-)

Garrett: Implementing UEFI Boot to Zork

Posted Sep 30, 2013 20:05 UTC (Mon) by khim (subscriber, #9252) [Link]

I almost certainly posted on Usenet about it, so unless DejaGoo has melted all the way into slag, you could look it up. :-)

I'm not sure it'll be easy to do: back then it could have been obscure piece of information, but today you can find hundred of messages and pages which mention “magic mode”. It's even in the FAQ!

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds