AVR microcontrollers can do pretty much anything nowadays. Blinking LEDs, handling sensor inputs, engine control modules, and now, thanks to [Dan], a small single chip BASIC computer with only ten parts (and four of them are capacitors).
[Dan]‘s homebrew computer has it all. The ATmega 1284P microcontroller outputs a composite video signal and handles inputs from a PS/2 keyboard. The microcontroller runs at 16 MHz, has 7 kB of memory for programs, and can use a separate EEPROM to store data. It also has an array of GPIO pins for interacting with the physical world.
For software, the microcontroller runs a version of BASIC called Tiny BASIC plus, which is a stripped-down language that can fit in 3 kB of memory. This is crucial if you’re in the 1970s or if you’re programming on an AVR microcontroller in the 21st century.
We’ve seen other Arduinos and AVR-type microcontrollers that can run BASIC, but this one has a great form factor and clean look. It’s also a great way to get familiar with homebrew computing and the BASIC programming language!
[Mike] sent in a project he’s been working on – a port of a BASIC interpreter that fits on an Arduino. The code is meant to be a faithful port of Tiny BASIC for the 68000, and true to Tiny BASIC form, it fits in the very limited RAM of the Arduino.
True to Tiny BASIC’s assembler roots, [Mike]‘s C port makes extensive use of the “infinitely-abusable” goto statement. Kernighan and Ritchie said themselves, “code involving a goto can alway be written without one” but [Mike] found that using goto left a lot more room available for BASIC code. The BASIC interpreter eats up around 600 bytes in the Arduino RAM, leaving about 1.4 kB for BASIC code. Not much, but more than the lowest-end BASIC Stamp.
[Mike] says he started this project to see how ‘old bearded ones’ conjured up so many impressive programs with a few kB of RAM. Tiny BASIC was originally conceived for the Altair 8800 that shipped with 256 bytes of RAM stock, so it seemed like a perfect fit. Right now, all we know is we’ll be spending the weekend digging through our copies of Dr. Dobb’s Journal.