lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hash: SHA1

John Hind wrote:
> It's always good to think outside the box, but does this make commercial
> sense?

Of course it doesn't. I don't want to sully my art with filthy lucre. I
do commercial stuff for my day job; for recreation, I want to do things
with hack value, and you don't get much better hack value than doing the
impossible, and you don't get much more impossible than running a
high-level, garbage collected language on a machine with double-digit
quantities of RAM.

Having had a cursory glance at the datasheets, the biggest issue is
probably the RAM interface. The PIC10 series don't have hardware UARTs
so you'd have to do pin twiddling yourself. Clocking in and out a byte
of memory from the serial RAM chip would take huge amounts of time
(three bytes of address + one of command + one of response + another of
padding = 6 bytes = 48 bits = 96 transitions = probably around 200 PIC
instructions at 1us each = about 20000 accesses a second). Going
upmarket to a higher-end device like a PIC12 or PIC16 with hardware
support for this would hugely improve matters; the extra RAM would be
handy, too, allowing more virtual registers and a memory cache. But that
does rather spoil the purity of the artistic vision.

In fact, this concept isn't nearly as silly as you might think. These
kind of low-end devices sell in huge, huge numbers. Reducing the cost by
even a small amount can produce huge savings. For devices for which
speed isn't an issue, you really can save a lot of space and money by
using this kind of interpreted system --- a PIC10+SRAM chip computer
would run for about 500 hours on a single AA battery, and *idle* for
about 4000 hours.

If you were going to do this properly, of course, rather than as a hack,
you'd write a custom Lua interpreter that ran in native code. For
example, PICBIT is a Scheme interpreter that runs on a PIC18, and claims
to get about 37000 bytecodes per second on a 40MHz device. NanoVM is a
Java VM that runs on the ATmega8, which claims about 20000 standard Java
bytecodes per second on an 8MHz part. So running Lua on one of these
things is certainly quite possible.

- --
David Given
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -