klBASIC is a BASIC interpreter written in C for AVR microcontrollers. [Karl Lunt] developed the project based on an assembly language BASIC interpreter for 68HC11 chips written by [Gordon Doughman]. The transition from assembly to C bulked up the code, so you’ll need a beefy AVR chip in order to store all of it.
The idea is that one AVR chip can run BASIC with just a serial monitor. But like this Arduino BASIC interpreter build, it would be a snap to run this with a keyboard and small LCD screen. We see binaries available for several different AVR devices including ATmega128, ATmega1284, and Xmega128. They range from 1.5k to 16k of program memory. We didn’t find a link to the source code (just these precompiled files) so we inquired with [Karl] to see if that is available. He’s reluctant to release the code because it’s “pretty much a mess” and doesn’t live up to his normal standards. If he codes for a living we can see how that may be embarrassing. If you’d like to lend a hand cleaning up the code, let him know by leaving a comment here and maybe he’ll release it for that purpose.
We find this interesting, but it’s tough to get excited about building one of our own. If this has inspired you, we’d love to hear some of your plans in the comments after the break. Perhaps we’d be prodded into another programming adventure based on your enthusiasm.
Is there any source code available for this?
I’ve written a Forth-like language for the Arduino as well. The development environment runs on the Arduino itself, and can be executed even on Atmega168 ‘duinos. Source: https://github.com/lpereira/finf
http://gcbasic.sourceforge.net/index.html
I dont know if its from coming here everyday and reading all the posts for the last 6 or 7 years, but I actually understood the function of the code as I read it. Hmmmmm
The language is called ‘basic’ after all 😉
I for one would love to see the source and play with it. I am working on building up a (mostly) solderless neuvo retro computer system with VGA, SD card, keyboard, mouse, and ethernet interfaces built from AVR chips and possibly an 8052 series chip for the fun of it. I have been looking for a basic interpreter to add into the system and one written in C that will fit on an atmega1284 would be perfect. Here’s hoping he releases the code soon!
I want to see the basic interpreter from the ZX Spectrum ported to AVR. Maybe can keep the tape loading interface? 🙂
I have, barely, started working on converting the commodore 64 basic to AVR…hoping to do the editor too.
Ray (and others),
I posted the source code for the KLBasic compiler/interpreter to my website. The post includes two file sets. One set contains the target-independent core files, the other set contains the source for the AVR ATmega ports, including the ‘mega1284p.
The release also includes a long document with tips for getting started on your own ports.
Ray, your C64 Basic port to AVR sounds cool. Please keep us posted.
Karl