Spork Code

Code. Randomness. Sporks.

Posts Tagged ‘Lisp

Run Your Own Virtual Lisp Machine

with 2 comments

I came across a really interesting project the other day (while browsing Hacker News) by a guy named Brad Parker. Basically, he is writing a specialized virtual machine for CADR (which was an OS for the now defunct Lisp Machines of the 80s). The project has plenty of bugs left for squashing, but in its current state it works quite well. Here’s how to set up your own virtual Lisp Machine.

As always, we have some tarballs to grab:

# this is the VM itself
wget http://www.unlambda.com/download/cadr/usim.tar.gz

# this is a disk image for the VM. If you prefer, you can
# build one of these yourself (there is some documentation on the website)
wget http://www.unlambda.com/download/cadr/disks/disk-with-state.tgz

Now let’s untar them:

tar -xvvf usim.tar.gz
tar -xvvf disk-with-state.tgz

We need to copy the resulting disk.img and usim.state into the /usim directory, because otherwise the ./usim executable we will be using complains about missing .bin files. The usim.state file contains the state of the disk.img; without it you wouldn’t be able to boot the image.

cp disk.img usim/disk.img
cp usim.state usim/usim.state

Ok, now all that is left is to boot up your virtual Lisp Machine:

cp usim/

# this command boots your Lisp Machine in a X window.
./usim -w

The VM should prompt you for the current time, which you can enter in plain English and it will parse for you. Unfortunately, It doesn’t seem as though the original creators of the OS thought that anyone would be using it in 2009, as when you enter 2009 as the year, it thinks you are living some time in the 19000th century. Yes, with 3 zeros. Be forwarned that there are some graphical glitches with the VM, but nothing that a ^C or two won’t fix.

If you are feeling particularly rebellious and you don’t want to use the default disk.img and supplied disk state, you can always make your own. Generating a new disk state is a simple ./usim -S away. Making a new disk is slightly more complicated, but still not particularly bad. you can find documentation on how to do so here.

If you are interested in reading up on CADR, here is the original paper on it (be forewarned, it is quite technical).

What Now?
So now you have your beautiful Lisp Machine up and running, its time to learn some LISP. The manual for programming this Lisp Machine can be found here.

Written by John Gunderman

July 12, 2009 at 3:02 pm

Posted in Uncategorized

Tagged with ,