PicoMite Gives Your Pico A Deluxe BASIC

What makes developing a microcontroller project quick and easy? Tops on our list are an interactive shell and comprehensive libraries that handle all the low-level peripheral stuff. You think we’re talking MicroPython? Not today! MMBasic has just been ported to the Raspberry Pi Pico dev board, and it has all the batteries included.

Just to give you a taste, it has built-in support for SD cards, all sorts of displays, touch screens, real-time clocks, IR remotes, numerous sensors, and of course WS2812 LED strips. And because all of this is baked into the BASIC, writing code to use any of these peripherals is straightforward.

Now, there’s BASIC and there’s BASIC. This is a modern BASIC: it has loops, functions, arrays, floating point, and a built-in full-screen editor. You connect to the Pico via UART, and you’re off to the races. If you’ve got a Pico sitting around, flash it and give it a try. Or check out the GitHub repository if you want to poke around in the internals.

This is a port of the BASIC that’s used on the Maximite virtual retrocomputer platform, which means that there are many working examples out there for you to crib from, and even a forum. Add in the incredibly nice user manual and tutorial (PDF), and you’ve got the perfect weekend afternoon.

Think MicroPython killed BASIC? Think again. BASIC is small enough that it can run where Python can’t, but that’s of course a more minimal experience. In contrast, MMBasic looks like it’s got all the toppings. The whole enchilada. It’s like BASIC Deluxe.

44 thoughts on “PicoMite Gives Your Pico A Deluxe BASIC

        1. Perhaps. I took the question to mean “no (youtube) video (of behavior) out yet?

          The poster may well have meant what you say, but I don’t think HDMI will happen, and howevermuch it may be possible, I don’t think it’s the right chip for VGA or composite. In any case, those won’t happen with the Picomite MMBasic port.

          1. Ahem. Try “AdvancedHMI” before you make blanket statements like this.

            It’s a free, and infinitely more capable HMI replacement for the likes of TIA Portal, FactoryTalk, whatever.

            Comes as a Visual Basic source code project.

            My current project is controlling a robot that feeds a Mazak lathe for me.

        1. Osgeld says: That’s because I started with basic in the 80’s and said Fk this and ended up going into hardware design

          By the same token, do you believe that nothing has changed on the hardware side since the 80’s?

        2. If you mean Commodore BASIC then I’d probably agree. :) Things have moved on a lot since though. There’s not all that much similarity.

          You can write really bad code in any language. The stuff that’s impossible to follow, full of confusing junk (especially POKE commands!) and no comments. It doesn’t have to be BASIC.

        3. I started with BASIC to back in the late 70s early 80’s and of course moved on to better structured languages (Pascal, C, Fortran) in college where I acquired my CS degree. Come to think of it we used Basic a bit in electronics Lab on Commodore 64s back then to interface to hardware…. In my latest job, I spent a year removing all our Visual Basic code from one of systems replacing it with Python. Python is a lot more user friendly and stable. Rarely have to touch anything on that platform now or get called out to fix something on it. It was a good move.

          That said, BASIC isn’t horrible if used in the right places. It is simple and easy to program. This looks like a neat project. Thanks for bringing to our attention!!! I am going to download this and install on a PICO . Looks like fun. It will bring back memory’s of running BASIC on a VAX and Radio Shack computers back when … and may actually do something useful!

    1. Any language that is interpreted directly (ie: without being pre-processed) is yuk.

      Compiled BASIC is available, and not too bad. However, the coding style is where it’s at, as Mixtel90 says: any language can be used to create indecipherable code. And in that regard, BASIC is certainly not the worst.

      1. “Any language that is interpreted directly (ie: without being pre-processed) is yuk.”

        Truly, without context, that is a silly statement. If you need to have the greatest possible execution speed on your device of choice, then compiled is the way to go (assuming you are unwilling to hand assemble).

        If your device is fast enough for your interpreted language of choice, then you may appreciate a development system which is “instant on”, can execute a new line of code immediately, can go to an editor with a single keystroke, and can save and execute from the editor with another keystroke. You may be appreciate being able to develop without having a PC present–just an LCD and keyboard attached to your little device.

  1. They should use Java. All they need to do is add another 2 cores, increase the memory to 4Gb minimum, add a few GHZ of speed, add a few GB of disk space for useful helper libraries, add a keyboard, mouse, graphics ,etc. This should only add a few hundred dollars of cost, anyone can absorb that.

    Why use BASIC, or slow ASSembly, when you can use Java. Sure the boot time might be a few days, weeks, but it will be worth it!

    Hello world compiles and runs in just a few days!

  2. While I’m a Forth and not a Basic user, I can’t help but admire the fantastic job the Picomite people have done here, from outstanding documentation to device support, I give them a A+++. Outstanding job guys!

    Mecrisp-Stellaris also has a working (single core) version available at https://sourceforge.net/projects/mecrisp/files/mecrisp-stellaris-2.6.0.tar.gz

    I notice that the Pico second core isn’t mentioned in the Picomite doc. Tabemann has a Zeptoforth release with both cores working (to some degree) at https://github.com/tabemann/zeptoforth

    The designer of Tachyon Forth is also working on a rp2040 port, and finally there is a MicroPython designed especially for the Pico which also looks very polished.

    It seems everything but Java is available for the Pico ;-)

    1. Note that at the very moment, zeptoforth supports two cores only in the devel branch and not the main branch. Its multicore support does include supporting multitasking on both cores, but interrupt-drive serial IO must be disabled prior to starting the second core, and once the second core is started the user must power-cycle the RP2040 (not simply reboot it) before they may write to flash. I am putting together a beta release, 0.22.0b0, which will include this functionality at the very moment, which should be up shortly.

  3. It’s a pretty decent effort, supports a wide range of peripherals, and the manual’s well put together. BBC BASIC for the Pico is a shade quicker, and is a more familiar dialect for me. MicroPython’s still miles ahead of all the other languages, though.

    The forum that hosts the project’s a joke, though. Homebrew phpBB knock-off with no breadcrumbs, weak searching, a dire editor – and zero moderation. If you’ve come from other modern microcontroller languages, it’ll seem a hard fight getting started with mmbasic

    1. As a member of that forum, I’ve never heard you complain about it there. No, its not a phpBB knock off, it was written in a week from scratch, php & MySQL, and needed to use the database content from the previous forum, a Classic ASP based code with a MS Access db. Think you can do better, please do. And the self moderation works just fine, I only need to get involved occasionally when a few rogue members go way off topic.

      Dont worry, I wont kill your account, not yet anyway.

  4. I don’t know why BASIC is so disparaged by some. Watch the very interesting Youtube video ‘The Birth of BASIC’ and it shows how many people who knew nothing about computers learned to program, and be encouraged by the likes of John Kemeny to write games and generally enjoy the pasttime.

    I think part of the ‘genius’ (if you could say that) about BASIC was the provision of the immediate mode and program-writing mode, which we see in Python these days. No need to compile anything, and one line of code constitutes a valid working program. Add to that, the startup time of a 1970s/1980s microcomputer of just a couple of seconds from power-on and you were food to go.

    I learned BASIC in the late 70s and Boy did I wish I could run it on my first computer, a 1k RAM + 1k ROM development board which my brother and I built from a kit. A few years later I typed in twelve thousand-odd lines of hex digit pairs of the Tandy Level II BASIC (over a fortnight or so, saving to cassette tape) then hacked it to run with my S-100’s screen and keyboard.

    I was thinking MMBasic may have been overrated by Elliot’s superlatives above, and thought I’d check the manual as I was sure they’d not have commands that never made it into the microcomputer BASICs.

    To my incredible surprise and delight MMBasic did indeed have them, and in spades, way more than the original BASIC had.
    What were they? The Matrix manipulation commands.

    So well done, MMBasic team!

  5. MMBasic is a large subset of GWBASIC with additions. It’s closer to BBC BASIC, but with different hardware support. There are slight differences in MMBasic depending on whether you are looking at a computing platform (CMM2 etc) or embedded controller platform (Micromite, Armmite, PicoMite etc.), but the core commands are the same so there is quite a high degree of compatibility. The computer platforms are intended to drive a VGA monitor at various resolutions. The controller platforms are designed for LCD displays of various sorts, some with touch sensing (all handled in MMBasic). You can run a serial console as a separate screen from the LCD. Some LCDs will let you use them as a console too (but the text is small).

    I don’t think programmers used to Python or C would have such a hard time with MMBasic. It’s not the same by any means, but support for local variables, SUB/END SUB, FUNCTION/END FUNCTION can make it quite nicely OOP. The main difference is that (generally) you can’t rely on someone else’s libraries to do things – you have to program it yourself or do some code mods. MMBasic isn’t a “Lego” language (which is a good thing for beginners IMHO). On the other hand, handling touch screens, i2c, SPI, Serial comms, PWM and A-D is a doddle – it’s built in.

    MMBasic has quite a few configurable options, including being able to set the CPU speed to your balance between speed and power consumption. Most PicoMites are fine (and stable) from 48MHz up to 250MHz. :)

    At the moment the PicoMite only uses one core of the RP2040. That’s because MMBasic was never written to handle more than one and it doesn’t split well. At one point it was considered that the second core might be used as the video processor, but there is insufficient RAM in the RP2040 to do this sensibly. It might be something to look at again if a version with more on-chip RAM (not flash) appears.

    The PicoMite is actually a brand new addition to the existing MMBasic platforms, it uses a lot of the same code. Because of this, changes made on one platform are often ported over to the other platforms (if there are sufficient resources available).

    The opportunity has been taken to use the flash on the Pico to save up to 10 user programs. These can be chained (with or without preserved variables), so the overall program can be larger than the available memory. Additionally, prior to each RUN the current program is automatically saved to an 11th flash slot. It is automatically re-loaded into RAM on power-up ready for editing. An option can also be set to automatically load and run any of the programs in flash at power-up.

    1. “At one point it was considered that the second core might be used as the video processor, but there is insufficient RAM in the RP2040 to do this sensibly. It might be something to look at again if a version with more on-chip RAM (not flash) appears.”

      If they make a RP2040 with a couple of megs or 4, then the VGA should be possible (and using the second processor as video processor as you say), and actually we end up with a computer more powerful than the PC-AT, for a fraction of the price.

      Could really be cool.

  6. MMBasic in all its reincarnations is a very good and actually usable Basic, but the community behind it is less than impressive. In fact, it is almost entirely ran by a single “Tsar” with the alias matherp, who recently took over from the original tsar geoffg. The so called community is about 15 active members, mostly well into their 60s and 70s. Newcomers and/or criticism or suggestions are usually met with a cold response, or none at all. In my view, this will massively hinder any wider use of it.

    1. “Newcomers and/or criticism or suggestions are usually met with a cold response, or none at all”

      I’d really like to know of a forum which has more helpful responses than the Microcontroller and PC projects section of thebackshed.com, where MMBasic questions are usually asked, or where the present main firmware developer, matherp, is quicker to implement suggestions which he thinks feasible and desirable. I had one wish which was implemented in the firmware within 6 hours of my asking about it.

      Yes, the denizens are typically older–that means that questioners may have the benefit of decades of experience in matters not specifically related to MMBasic. There are hardware people and software people, and crossovers.

      It’s not for everyone, but it does provide a powerful, consistent, and easy-to-use language across now more than a dozen hardware platforms, from 28-pin chips (only one capacitor needed to make it work) up to (in development) Linux PCs.

      And really, “a cold response, or none at all”–I think you’d be hard pressed to find a new topic started which had no responses.

    2. I notice that you are hiding under a different name than that which you must have used on TBS forum as there are no current members called “Dudu”. Of course, your anonymity is your own business, but it doesn’t help your argument. The closest to that name was a newbie who made a single post, first apologizing for his poor English, and received a lot of help from forum members.

      Geoff wrote the original MMBasic and is the keeper and supporter (and copyright holder where applicable) of the MMbasic code and the manuals. matherp has not “taken over” from Geoff. He does most of the ports to other platforms and does the support for those ports (not the underlying MMBasic code). He is not involved, other than in a very superficial way, with the port to linux.

      MMBasic, in its original form, was intended to give the look and feel of a 1980’s home computer. If you assume that the first forum members got interested in home computing at the age of about 13 in 1980 then that would make the youngest about 54 now. It’s not that far off. :)

      Remember that the source code for MMBasic (on the PicoMite only) is open source, with a few minor restrictions. It’s available on Github (link on Geoff’s site). That probably makes it one of the most usable languages available for the Pico.

      1. Mixtel90, you don’t suppose one can read a forum and never register to post there?
        The Picomite and MMBasic are great, I already wrote that, but I stand by my word about the community – certainly room for improvements there

        1. About the backshed community–well, come one, come all. I don’t think most will find the experience negative.

          But speaking of “negative”, “Tsar” is a pretty remarkable way to characterize the main developers of MMBasic, goeffg and matherp. Most Tsars get to tell other people what to do. geoffg and matherp have chosen to donate massive amounts of their own time to produce a high-quality (free) product, and in addition they quite regularly donate even more of their time to fulfill the requests of forum posters.

          We would be lucky to have more such “Tsars”.

        2. If you’d had experience of posting on the forum and had been ignored or treated badly I could understand your point of view, but you haven’t. You may have *seen* what you *thought* was something like that but you had no experience of it. It seems rather unfair to generalize the forum community on that basis. From your “Tzar” comments it’s pretty obvious that you haven’t spent much time reading TBS anyway – or you’d have known how things actually work.

          We don’t bite. We don’t disparage those who are new to programming or hardware. We don’t even moan if you’d rather enthuse over an ESP8266 or a Propeller chip than something running MMBasic. :)

    3. Well, the source is mostly closed, and by any account matherp needs no help whatsoever making improvements to the system. However, you can apply for a copy of the source and dive right in there cowboy.

      Up to this point in time the only “unfixed” bug that I have found has been a memory bug that caused the program to jump from the middle of one line to the middle of a line several lines below that in a massively overloaded CMM (looking at you, Mauro). This was “fixed” by the creation of the CMM2. I’ll take that kind of fix any day.

      BTW, just so I’m not hiding behind a different handle, I’m “SimpleSafeName” on TBS (gizmo had issues with “rootboy” and suggested that I choose a “Simple safe name”. Which is what I did. :) )

      1. :D

        Apart from on the PicoMite, MMBasic is closed source. The source for PicoMite is available from https://github.com/UKTailwind/PicoMite

        The conditions are (quoted from the above):
        ==========================================================
        PicoMite MMBasic

        Geoff Graham, Peter Mather Copyright (c) 2021, All rights reserved.

        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

        Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        The name MMBasic be used when referring to the interpreter in any documentation and promotional material and the original copyright message be displayed on the console at startup (additional copyright messages may be added).
        All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Geoff Graham, Peter Mather.
        Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
        ===========================================================

        1. If you have a binary definition in regards to source code, being either “open” or “closed”, I would say the MMBASIC source is actually far closer to ‘open’ than it is to ‘closed’.

          Closed implies the only way to get it is through means such as industrial espionage.

  7. tried micropython on the Rp2040.

    the fibonacci series (23) took 6.0 SECONDS. averaged over 10 runs.

    I tried the same algorithm in MMBASIC/PicoBASIC, it took mSec, averaged over 10 runs, less than 1 sec for 10 iterations.

    Micropython while nice, easy, has managed to reach JAVA Speeds, that is to say, about as slow as frozen molasses.

    it has all the nice IO libraries, has functions, subs, etc. Much faster and easier to try some code in real time, than deal with Micropython.

    The C/C++ SDK is nice too, but sometimes you just need some quick code to have a proof of concept, this does nicely!

    1. I tested this with zeptoforth, using double-cell arithmetic. I tried timing calculating the 23rd Fibonacci number averaged over 10000 times, and got the following:

      23 10000 fibonacci-time f. 0,0000159498 ok

      I.e. it took roughly 16 microseconds to calculate the 23rd Fibonacci number using double-cell arithmetic.

      My source is at https://github.com/tabemann/zeptoforth/blob/devel/test/common/fibonacci.fs

      Something just has to be wrong with the MicroPython test here. For starters, one does not need bignums to represent the 23rd Fibonacci on a 32-bit system like the RP2040. Even if it is using bignums, it is shocking that it would be so horrifically slow to take 6 seconds to compute just the 23rd Fibonacci number.

    2. I tested fib(23) on MicroPython on a NumWorks calculator with a 216 MHz STM32F7 processor and it took 0.0001399 s averaged out over 10000 runs. Someone else who I know did the same test with MicroPython, except on a Casio Graph 90+E calculator (sold as a FX-9750giii in the US) with a 59 MHz SH4 processor and it took 0.00098 averaged out over 10000 runs.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.