Gary Sims' PiccoloBASIC Is a Minimalist Programming Language for the Raspberry Pi Pico, RP2040

Based on Adam Dunkels' uBASIC, piccoloBASIC includes some handy new features — and, controversially, does away with line numbering.

Gareth Halfacree
2 years agoRetro Tech

Developer and educator Gary Sims has put together a custom firmware for the Raspberry Pi Pico — and other RP2040-based microcontroller boards — which switches from the more common C/C++ or MicroPython programming languages to a staple of the home computing revolution: BASIC.

"A few weeks ago I had a bit of spare time, did one of my, kind of, side projects, which I'm sure all of us do. And the result of it was actually I came up with a BASIC interpreter," Sims explains. "You know, BASIC, that programming language from the 80s and 90s. And here's what I want: to tell you all about it and ask for your help. Because I want to know what should I do with this BASIC interpreter that I've now got?"

Gary Sims has created his own BASIC interpreter, as a fun side project — and ported it to the Raspberry Pi Pico. (📹: Gary Sims)

The Beginners' All-Purpose Symbolic Instruction Code (BASIC) programming language actually dates back to 1964 and the work of John Kemeny and Thomas Kurtz in the math department of Dartmouth College. Its accessibility saw BASIC interpreters created for a wide range of minicomputers, and when the home computing revolution kicked into gear in the late 1970s and early 1980s it was only logical that BASIC became the de-facto standard — albeit in a myriad of dialects and variants which prevented easy cross-compatibility between different machines of the era.

In Sims' case, this particular version of BASIC is tailored for the Raspberry Pi Pico and other devices based on the RP2040 microcontroller. It's a good fit: classic BASIC interpreters were designed to squeeze into double-digit kilobytes of ROM and run on systems with as little as 1kB of RAM, making the dual-core 133MHz 32-bit RP2040 with its 264kB of RAM seem like a supercomputer. It also provides a path to supporting external hardware through the RP2040's general-purpose input/output (GPIO) pins — though said support is, Sims admits, "rudimentary" in the current release.

The port to the Raspberry Pi Pico includes what Sims calls "rudimentary" support for GPIO handling. (📹: Gary Sims)

Sims' BASIC, dubbed piccoloBASIC, is a spin-off from Adam Dunkels' earlier uBASIC — a project originally created "in a couple of hours," Dunkel claims, with a view to running on resource-constrained hardware. In Sims' variant, the classic BASIC line numbering has been discarded — moving to labels for GOTO and GOSUB, rather than pointing them to line numbers — and there's support for floating point numbers, a randomization function, push and pop stacks for integers, new math functions, and support for file storage via Arm's LittleFS.

A compiled firmware for the Raspberry Pi Pico, along with the source code under the permissive BSD three-clause license, is available on Sims' GitHub repository for the project.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles