The Apple IIe Becomes a Lisp Machine

lambda

Way back in the late 1970s and early 1980s, a few very awesome people around MIT were working on Lisp machines. These computers were designed specifically to run Lisp as their main programming language. Around the same time, a few [Steves] in California were working on the Apple II, which would soon become one of the most popular computers of all time. The Apple II ran BASIC as its main programming language, fine for the time, but surely not as elegant as Lisp. It took more than 30 years, but [Alex] and [Martin] figured out a way to turn the lowly Apple IIe into a Lisp machine.

Developing Lisp for the Apple IIe was surprisingly easy for these guys – they simply wrote a Lisp interpreter in C and used a 6502 compiler to generate some machine code. The main problem of porting Lisp to an Apple II was simply getting the code onto the Apple. We’re assuming this would have been easier had the same project been attempted in the 80s.

To get their interpreter onto the Apple, they used the very awesome ADTPro library that allows data to be loaded onto an Apple II via the cassette port and a modern computer’s microphone and speaker jack. After a solid minute of loading analog data onto this digital dinosaur, [Alex] and [Martin] had a Lisp interpreter running on ancient yet elegant hardware.

The source for the 6502 Lisp interpreter can be found on the GitHub along with all the necessary tools to load it via a modern computer. That’ll give you all the ancient lambdas and parens you could ever want. One warning, though: backspace doesn’t exactly work, so be prepared for a lot of frustration.

You can check out the demo video below.

33 thoughts on “The Apple IIe Becomes a Lisp Machine

  1. This is really cool. Lisp is an amazing language (especially modern dialects like Common Lisp)
    Many of the built in features are only now being ported to other languages.

  2. II’m impressed. Very impressed. The Apple ][e ran Pascal and used the USCD P-System as its file system. However the DUO drive set isn’t supposed to be used like that, the weight of the monitor can damage those floppy disk drives. So I certainly hope it wasn’t used like that.

    By the way what does First Comment go for these days?

    1. I’ve heard that BS claim on HAD comments before. They are designed to be stacked like that. Apple even recommended it, and shows them that way in the old ads.

    2. Umm, the Apple ][e ran Applesoft basic and it could run ProDOS or Apple DOS. Most Apple ][s that I used ran Apple DOS 3.3. ProDOS disks were pretty rare in my experience.

      Now, you could run Pascal but it cost extra to purchase.

    3. Hi, I wrote the original with my friend Martin.

      The monitor is *much* lighter than it looks — maybe 2 or 3 pounds. I very seriously doubt that it would damage the disk drives.

    1. ‘Cause the Apple ][ (any) didn't have a serial port. Adding one as a plug-in card was somewhat common for use of printers, modems and such though I never had one on my highly modified 192k RAM ][+ (custom character set, type-ahead buffer in hardware, 80 column card with custom firmware, etc.).

      1. Actually there was one Apple II that did have a built-in serial port: Apple IIc. I used to use it to transfer floppy images, so I was also a bit surprised to see them using cassette interface. But thanks for the explanation, maybe they just didn’t have a serial card available.

      2. I am surprised that they didn’t have one. I thought they were very common in the day, Looks like you can still get them on ebay for about $30.

    2. Hi I wrote the original post with my friend Martin.

      Because if we took the easy way out, then it wouldn’t have been a hack! Also we didn’t have such modern conveniences as a “serial port” and a “modem”.

    1. There was at least one other LISP available for the Apple II, along with Logo, a couple of versions of Forth, USCD Pascal, Fortran IV (using the basis of the Pascal operating system), and several other languages and development platforms. If you added one of the three Z-80 processor cards you could run anything available for CPM too.

      The Apple II was truly amazing for the wide variety of programming languages available.

  3. I was part of the MIT AI Lab, the Logo group, and we wrote Logo for the Apple II. I completed the project. Logo by the way is very Lisp-like internally and use assembled it on the PDP-10 and transferred the resulting HEX file over serial link. We used a switch box to transfer over RS232. You typed the command to download the hex file, and then flipped the switch and had the downloader ready on the apple II with its plug-in serial card. I think I still have one of these in the garage.

    The first actual Lisp I saw on the “personal computer” was Z80, muLisp from Hawaii. We joked it was about the same speed on the AI / LCS computers when they were heavily loaded during the day.

      1. No, that would be stupid. But if you’re going to do useless hack, the least you can do is make a bit more interesting. Writing a mini LISP interpreter in C is not very interesting. Then using already existing tools to compile it to 6502 code and run it on the Apple are also not very interesting. People already had LISP running in the 80′s, on home computers that were even older and more limited than the Apple IIe.

  4. Lol I find this highly entertaining.

    Article says something wasn’t possible. Commenter notes that it was. Some other commenter says something wasn’t possible and is corrected.

    No-one knows anything! Or everyone from that era became senile :P

    1. Hi, I wrote the original post with my friend Martin.

      If there is disagreement about the article, I’ve found that in practice it’s usually because something was underspecified — when someone asks why we didn’t do X, it’s usually either the case that we forgot to tell them about some aspect of our situation that made X impossible, or it’s the case that the documentation about our setup was so bad that we couldn’t figure our how to do X.

      Believe me — writing the software to transmit the data via audio jack was really goddamn hard, and if we could have avoided it, we definitely would have.

    1. Hi, I wrote the original article with my friend Martin.

      Thanks for the tip! We are actually aware that there are text editors and assemblers for the Apple //e. What we hoped was clear from the article is that neither exist on this version of ProDOS. Furthermore, as the article suggests, we would have no way of transmitting such programs to the Apple //e, since we had no extra auxiliary storage, and in particular no disks. We wrote the lisp using an assembler and a text editor on our laptops, and the program to perform the audio transport — so this ultimately would not have helped us significantly.

  5. ADTpro is pretty slick I admit, but also far from the only way these days.
    As someone who still maintains a functional Apple//e on the network, I highly recommend a device called the CFFA 3000.
    (Not affiliated, just a proud owner of one)

    It plugs in a slot and emulates a 5.25″ disk controller in slot 6 and a scsi controller in slot 5. It has a CF flash slot and a USB connector for media, plus a front control panel.

    You load your USB stick with disk images, use an onscreen menu to load up images in each virtual disk drive, and use the buttons on the control pad to swap disks.

    It’s a great way both to backup your old basic disks, as well as run backed up software on the real thing without needing blank 5.25″ floppies as ADTpro needs, nor waiting for 15 minutes to transfer a .wav just to find out the volume was too high.

    1. Hi, I wrote the original article with my friend Martin.

      Actually, that’s really cool! Thanks very much for the tip!

      FTR though we didn’t do this because it’s the *only* way, we did it this way because it was the only way we could do it using the technology we had lying around. We of course could have just bought more equipment.

  6. When I ported Kalawaum from the Atari ST to the Commodore PET series, I created a .wav File from the emulator, put this on an audio cassette (AFTER aligning the tape heads to those from the PETs drive), which took 5 minutes, and then another 5 minutes on the PET to see whether or not it worked (it took up to 4 tries to get it to work). Then copied it to disk, because the game does load level files from disk (which I had to re-create with the leveleditor, since I couldn’t copy data files this easily) and checked, if it worked (since sometimes I got a LOADING..READY message when in fact there WAS an error. I once wrote over a working version. That was frustrating.)
    (if you wanna see, enter Kalawaum on youtube)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s