KLBasic for Atmel AVR MCUs

Like many of you, I have fond memories of BASIC, a nifty acronym for Beginner’s All-purpose Symbolic Instruction Code. Back in the early 90’s I wrote a couple of RPG fantasy text games in the language on my (286) PC, complete with color changes (on a black background) and rudimentary speaker beeps. Ah, those were certainly the good old days, well, at least for me.

But I digress. Yes, BASIC has been around for a long time and doesn’t appear to be going anywhere due to its rather obvious nostalgia factor. Recent versions (and there are many) include QB64, Bywater BASIC, Gambas, FreeBASIC, PureBasic, Power BASIC, RealBasic, True BASIC, Quite BASIC, Small Basic, RFO BASIC and Mintoris Basic.

Unsurprisingly, there is even an iteration of the wildly popular language – dubbed KLBasic and written in C – for Atmel AVR microcontrollers.

“My BASIC is a C rewrite of Gordon Doughman’s assembly language program. When I started work on KLBasic, I was trying to solve what I saw as a long-standing problem. I did not have a target-resident tool for working with MCUs that provided immediate feedback and interaction with the low-level parts of the device,” explained KLBASIC creator Karl Lunt.

“There are variants of Forth, of course, and I have done some work with amforth for the AVRs. Very much low-level, but I also wanted a tool that was friendly for beginners, and Forth can have a steep learning curve. Frankly, I have very fond memories of tools from decades ago, such as TinyBasic, Radio Shack’s TRS-80 Model 100, and QuickBasic. Those tools started my interest in microcontrollers, which has not slackened yet. Perhaps KLBasic or some variant of it will inspire a new generation of kids to get started with MCUs.”

According to Lunt, the goal of KLBASIC is to hand the community the source code for a working, target-resident interpreter/compiler for a simple language. Lunt also said he hopes others will build on his work, taking the design in new directions and adding new features along with improvements.

Interested? You can find the source files for the core (target-independent) routines here and the source files for AVR target implementation here.

Oh, and yes, you may also want to check out this Arduino-BASIC interpreter created by Usmar A. Padow, which includes an LCD, (PS/2) keyboard and SD card.

1 thought on “KLBasic for Atmel AVR MCUs

  1. Pingback: Getting back to basics with Atmel and the Maker movement | Bits & Pieces from the Embedded Design World

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s