DEV Community

Cover image for Announcing MiniBASIC
JoeStrout
JoeStrout

Posted on

Announcing MiniBASIC

I'm delighted to officially announce the release of MiniBASIC, a clean, powerful new implementation of the classic 1980s BASIC programming language.

MiniBASIC is available at itch.io to use online, or to download for Windows, Mac, or Linux. It's also completely open-source (hosted at GitHub).

Spirograph Demo

A New Way to Program Mini Micro

MiniBASIC runs within Mini Micro, a powerful neo-retro virtual computer. So there are now two languages you can use to write Mini Micro programs, its native MiniScript language, or the new MiniBASIC.

This might be of interest if you already know BASIC, and want to quickly bang out a game or utility. MiniBASIC provides a good set of high-resolution drawing commands, suitable for making plots, graphs, and diagrams. It also has access to all the data on the built-in /sys disk, including stock images, sounds, and a complete English word list! And, being completely cross-platform, Mini Micro (and so MiniBASIC) runs identically on any desktop computer (and soon mobile devices, too). So if BASIC is already in your wheelhouse, MiniBASIC offers a great way to take advantage of these Mini Micro features.

Spirograph demo code listing

An Extremely Compatible BASIC

MiniBASIC is the perfect way to recapture — or experience for the first time — the joy of programming in the world's first widely popular programming language. BASIC was the subject of a great many books for kids of all ages, like these beautiful Usborne BASIC programming books, or the influential books of BASIC Computer Games.

MiniBASIC was carefully designed to be widely compatible with resources such as these. Though BASIC was never fully standardized, MiniBASIC follows the most common conventions in loving detail. Code from these classic books will work in MiniBASIC with little or no alteration. For example, the 500-line program from Mystery of Silver Mountain required only two minor changes, in the lines that open a file. (This game is now one of the included demos).

The BASIC Platform We All Dreamt Of

While being very compatible with 1980s BASIC, MiniBASIC is far more pleasant to use than any actual 1980s computer (in emulation or reality). All the little bits of polish that didn't exist at the time are present: when typing you can hold Alt to move the cursor or delete by whole words; you can press control-A/E to move to the start/end of the line; you can use the up/down arrows to recall previous input from the history buffer.

MiniBASIC also includes a RENUMBER command, which takes most of the pain out of using line numbers by allowing you to easily move code around in your program; and an EDIT command, which lets you edit a line of code without having to retype it.

Demonstration of the EDIT command

MiniBASIC's feature set is just a bit beyond the best of the 1980s home computer in other ways, too. In terms of graphics, it features a full-color, high-resolution screen with a full set of drawing primitives including polygons and ellipses, both filled or outlined with variable pen size. It can even draw JPEG or PNG images from disk. And it supports a sophisticated sound synthesizer, similar to the Commodore 64, but with unlimited sound channels. All this makes MiniBASIC a delightfully powerful BASIC environment and a joy to hack around in.

Screen shot showing the standard color palette

Easily Extensible

The MiniBASIC interpreter is written in MiniScript, a clean, modern, high-level language. The code is neatly organized, with one function for each BASIC command. For example, here is the code underlying the RECT command:

Machine.cmd.RECT = function(tokens, startIdx, endIdx)
    if startIdx+1 >= endIdx then return printErr("incomplete RECT statement")
    args = getDrawingArgs(tokens, startIdx+1)
    if args == null then return printErr("syntax error in RECT")
    if args.len != 4 then return printErr("invalid arguments to RECT")
    x = [args[0], args[2]]; x.sort
    y = [args[1], args[3]]; y.sort
    if machine.fill then
        gfx.fillRect x[0], y[0], x[1] - x[0], y[1] - y[0]
    else
        gfx.drawRect x[0], y[0], x[1] - x[0], y[1] - y[0], gfx.color, machine.pen
    end if
    machine.plotPos = args[2:]
end function
Enter fullscreen mode Exit fullscreen mode

This means that if you are working on a BASIC program, and find a need to do something MiniBASIC can't already do, you can easily extend the MiniBASIC interpreter to add your own feature. You will find that MiniScript is a joy to program in, and the Mini Micro feature set is powerful and easy to use.

Code listing for colors demo

Try it now!

Why not give it a try? Head on over to MiniBASIC, run the project, and then at the > prompt, type in this classic program you might have found running on the demo machines at K-Mart back in the day:

10 PRINT CHR$(47 + 45 *(RND(1) > 0.5)); : GOTO 10
Enter fullscreen mode Exit fullscreen mode

Then, enter run to make it go. (MiniBASIC is not case sensitive, so it doesn't matter how you capitalize these commands.)

This classic display is an infinite loop, so press Control-C when you want to stop it.

Note that the web version of MiniBASIC does not support copy/paste; nor can you save files to disk. So you will probably want to download MiniBASIC to run on your local machine. You'll find download links towards the bottom of the web page.

MiniBASIC is 100% free. I do this because I grew up with BASIC; I loved it, and I still do, though I now do most of my coding in modern languages like MiniScript or C#. There is still a ton of value in those great old BASIC books, and I want others to have a chance to experience the delight as I did.

So, enjoy MiniBASIC, and share it with your friends. I hope it brings you joy!

Top comments (8)

Collapse
 
andypiper profile image
Andy Piper

This is great! Thanks for sharing here (and congrats on being a Top 7 contributor this week!).

I’m going to check this out. I’ve been playing with BASIC on an Agon Light, recently.

Those classic Usborne books are available to download, too…

Collapse
 
joestrout profile image
JoeStrout

Yeah! To be honest it was largely the release of those books that compelled me to make MiniBASIC. They are wonderful, and there is very little like them today (except, perhaps, amazon.com/dp/1736167618 — and my inspiration for that will not be hard to see!).

Collapse
 
raguay profile image
Richard Guay

The link to MiniMicro is dead.

Collapse
 
sebnozzi profile image
Sebastian Nozzi

You are right. I hope Joe sees this and fixes it.

Until then, here's the correct link: miniscript.org/MiniMicro/

Collapse
 
joestrout profile image
JoeStrout

Thank you! Not sure how I managed that (looks like I had two different URLs glommed together). It's fixed now.

Collapse
 
joestrout profile image
JoeStrout

I've just added a follow-up post explaining the demos included in the demo directory.

Collapse
 
heikokanzler profile image
Heiko Kanzler 🇪🇺

Image description

Time get this out of the „shelf“… (Basic was my first love..)

Collapse
 
carlg profile image
Carl Gundel • Edited

I love it. Looks like a fun way to learn and to play with coding in BASIC. It seems like so many people writing their own BASIC and I think it's great to see! Many people say there are too many versions of BASIC, but I think this is a very positive and unique aspect of the BASIC community.