How to fit a large program into a small machine (1980)
mud.co.uk
mud.co.uk
2004. Good times.
that’s also how they managed to fit all the software of the Apollo guidance computer into it.
> “The AGC had a sophisticated software interpreter, developed by the MIT Instrumentation Laboratory, that implemented a virtual machine with more complex and capable pseudo-instructions than the native AGC.” (https://en.wikipedia.org/wiki/Apollo_Guidance_Computer#softw...)
Wrote about it here:
https://thechipletter.substack.com/p/bytecode-and-the-busico...
[1] https://thechipletter.substack.com/p/the-strangeness-of-the-...
https://archive.org/stream/creativecomputing-1980-07/Creativ...
git clone https://jxself.org/git/inform
git clone https://jxself.org/git/informlib
cd inform ; cc -o inform src/*.c
sudo cp inform /usr/local/bin ; cd ..
Spiritwrak:
git clone --recursive https://jxself.org/git/spiritwrak
cd spiritwrak; sh build.sh ; cd ..
Snowed In (incomplete):
git clone --recursive https://jxself.org/git/snowed-in
cd snowed-in; sh build.sh; cd ..
Homeland: (complete, small)
git clone --recursive https://jxself.org/git/homeland
cd homeland; sh build.sh ; cd ..
In order to play the z5/z8 games, you'll need Frotz/Fizmo or any compatible interpreter.
The games at jxself's repo are GPL licensed, so, please, comply with the license if you create derivated games.
"In practice the text compression factor is not really very good: for instance, 155000 characters of text squashes into 99000 bytes. (Text usually accounts for about 75% of a story file.) Encoding does at least encrypt the text so that casual browsers can't read it. Well-chosen abbreviations will reduce total story file size by 10% or so."
I'm curious about other schemes like this with higher density. Obviously, it's a trade-off between text density and more code in the VM.
https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bi...
2 hours to boot to a shell :)
How to Fit a Large Program into a Small Machine (1999) - https://news.ycombinator.com/item?id=17839651 - Aug 2018 (35 comments)
How to Fit a Large Program Into a Small Machine - https://news.ycombinator.com/item?id=1032408 - Jan 2010 (3 comments)
Dwarf does this as one of the size optimisation tricks. I used to know another example but it isn't coming to mind.
As opposed to containing implementations of various interpreters, VMs etc, as described here (and functions that 100s of other programs implemented as well).
Or even better: a selection of languages, letting programmers pick or even mix & match for various parts of the program.
Even today "big ROM, small RAM" is common (eg. in uC's). With flash offering extra flexibility for the 'ROM' part.
But the limitations of the day made many (system) ROMs little more than a glorified boatloader + some low level I/O code. If you were lucky, with an easy to learn but slow language like (interpreted!) BASIC.
Where hardcoded ROMs do exist in designs now, it's usually still as a glorified stage 1 bootloader, albeit now usually with signature checking as well.
I have encountered brief discussions of the technique in a few places though. Jon Bentley wrote a column called Programming Pearls, collected in a couple of compilation books, and one of those was called Squeezing Space which talked about this a bit. I think that Peter Norvig had a chapter on it in Paradigms of Artificial Intelligence Programming but couldn't swear to it. I've also read that KDB+ uses this technique, and I seem to remember that one of the few columns that discussed implementation (it's proprietary technology, so there's not much on it) talked about stuff like this.
The general idea was also briefly discussed in Dynamic Languages Wizards Series - Panel on Runtime (from 2001), though they didn't go into methods, just trade-offs [1]
Another paper that comes to mind is Anton Ertl's on his vmgen system. The Smalltalk-80 bytecode design is worth a look too.
It uses a simple stack machine. I am on the market for a book on small register based interpreters.
https://people.inf.ethz.ch/wirth/CompilerConstruction/index....
https://people.inf.ethz.ch/wirth/CompilerConstruction/index....