6 ms·
Huh. I thought about doing this, figured it would be impossible / pointless, and that (apparently wrong) assumption led me on a year-long journey: The core pro
by randrews 10y ago
Huh. I thought about doing this, figured it would be impossible / pointless, and that (apparently wrong) assumption led me on a year-long journey:
The core problem, I thought, would be that AVRs have very very little memory. 316 Lisp cells sounds about right. I figured, well that's pointless. How can I do better?
I wasn't able to find a microcontroller that you can attach external memory to (without cheating and using something like an SPI RAM chip, although that's super easy). So I ended up figuring out how to build a real computer instead, around a Z80, with 64k total address space. The one I'm working on now has 32k RAM (still not great for Lisp) but you can divide up the address space between RAM and ROM however you want, so I'm planning for the next version to have the whole thing be RAM and use an AVR to "boot" it by loading code into RAM from an SD card.
- mikepavone 10y agoSome of the devices in the Mega AVR line support external memory. The ATmega640 is an example. Generally you'll only find it on higher pin-count devices which aren't available in DIP packages. If you need something that's a bit easier to work with, the Teensy 2.0++ is an option. As for your Z80 computer, another option would be to add some simple bank-switching hardware to allow you to boot from ROM. Probably more work and less flexible than just using an AVR for boot though.
- sitkack 10y agoOnce one starts getting into the high pin-count devices, just make the leap to ARM and using something like [0] which has 1MB of Data RAM. [0] http://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeySTM32F765VGT6 http://www.mouser.com/search/ProductDetail.aspx?R=0virtualke...
- randrews 10y agoI'm fine working with surface-mount stuff, I can solder it by hand, it's not actually as hard as it looks. Bank switching seems like a pain to manage though. I wish I had learned this stuff in school. I majored in CS, and we didn't go any lower level than C++.
- pjmlp 10y agoYou just had to think that IBM 704 had 18432 bytes.
- technomancy 10y agoIf you build a compiler without runtime eval, you can use all the AVR's memory for user data. Still tiny, but not as cramped as this interpreter: http://microscheme.org http://microscheme.org Then again, if it doesn't have runtime eval, is it really a lisp?
- qwertyuiop924 10y agoGood question. It's hard to say. As for microscheme, it looks cool. Although I am annoyed, because it implicitly claims to be Scheme (it's not), and it explicitly claims to be functional (scheme most definitely isn't). But those are just nitpicks.
- pherq 10y agoScheme fits the common definition of a functional language, even if it's not pure in the same way as Haskell. Especially since idiomatic Scheme uses pure functions and recursion (as opposed to idiomatic CL which is a lot more imperative).
- qwertyuiop924 10y agoTo the contrary, idiomatic Scheme also uses a lot of stateful data.
- technomancy 10y agoNope; it's absolutely clear right on the front page that it's a subset of Scheme.
- qwertyuiop924 10y agoWhat I meant was the name, although it's up for debate. The micro- would imply a subset, so it's much better than the many languages that call themselves Scheme, and really, really aren't.