Using routers as dev boards has been a long and cherished tradition in the circles we frequent, and finally design houses in China are taking notice. There have been a few ‘Internet of Things’ boards in recent months that have taken the SoC found in low-end routers, packaged the on a board with USB, some GPIOs, and a fair bit of memory and called it a dev board. The ZERO Plus is not an exception to this trend, but it does include a very interesting feature when it comes to the development environment: this one uses Lisp as its native language.
The Zero Plus is pretty much what you would expect from a router SoC being transplanted to an Internet of Things board: it uses the Ralink RT5350 SoC, giving it 802.11b/g/n, has 32MB of RAM, 8 or 16 M of Flash, I2C, I2S, SPI, USB, two UARTs, and 14 GPIOs. There is support for a webcam, temperature and humidity sensor, displays, and Arduino via a breakout board that appears to contain a standard, DIP-sized ATMega328,
All of that could be found in dozens of other boards, though. What really sets this one apart is the Lisp development environment. Programming the Zero is exactly as elegant as you would expect, with a ‘toggle a LED according to what time it is’ program looking something like this:
(define LED_On (lambda ()(dev.gpio 11 “out” 1)))
(define LED_Off (lambda ()(dev.gpio 11 “out” 0)))
(define CurrentTime? (lambda ()
(int (time.strftime “%H” (time.localtime (time.time))))))
(> ( CurrentTime? ) 16) (< ( CurrentTime? ) 23)
(if (Night?) (LED_On) (LED_Off)
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.
Continue reading “The Apple IIe Becomes a Lisp Machine”
Ruin & Wesen are a two person shop creating specialized music gear. As part of their recent MIDI Command development, they got into case manufacturing. They purchased a mini CNC mill to cut the aluminum cases. Unhappy with the software options provide [Wesen] decided to write his own G-code generator. G-code is part of the numerical control used to command CNC machines. He implemented his interpreter using the language he’s most familiar with: Common Lisp (not surprising if you notice the website’s backend). The post covers the design philosophy used and some of the problems that came up. We look forward to future releases since the interpreter can generate milling code using processing.org sketches and cut PCBs directly from Eagle.
You may remember Ruin & Wesen from when they shared their Eagle layout videos.