SkillAgentSearch skills...

Mmb4l

Port of Geoff Graham's MMBasic interpreter to the Linux platform and its derivatives.

Install / Use

/learn @thwill1000/Mmb4l
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MMBasic for Linux (MMB4L)

  1. Introduction
  2. How do I install it ?
  3. How do I run it ?
  4. How do I use it ?
  5. The EDITor
  6. Predefined Read Only Variables
  7. Options
  8. Commands
  9. Functions
  10. Miscellaneous differences from MMBasic 6.0 for the PicoMite + PicoMite VGA
  11. How do I build MMB4L from source ?
  12. Credits
  13. FAQ

1. Introduction

MMB4L is a port of Geoff Graham's MMBasic interpreter to the Linux platform (and its derivatives).

It was originally derived with permission from:

But also incorporates code and ideas from several other MMBasic ports:

  • MMBasic for the PicoMite and PicoMite VGA
    • Copyright 2011-2025 Geoff Graham
    • Copyright 2016-2025 Peter Mather
    • https://github.com/UKTailwind/PicoMiteAllVersions
  • MMBasic for the Colour Maximite 2
    • Copyright 2011-2025 Geoff Graham
    • Copyright 2016-2025 Peter Mather
  • MMBasic for Windows
    • Copyright 2011-2025 Geoff Graham
    • Copyright 2016-2025 Peter Mather
    • https://github.com/UKTailwind/MMB4W
  • Mothballed Pi-cromite project by Peter Mather.

What little MMB4L specific code there is, is Copyright 2021-2025 Thomas Hugo Williams.

MMB4L is an open-source project distributed under a modified 4-clause BSD license, see the LICENSE.MMBasic file for details.

2. How do I install it ?

MMB4L is "alpha release" software so there are no fancy installer packages yet:

  1. Download the .tgz for the desired platform from the latest release:

    • For 64-bit Linux running on Intel/AMD use the 'x86_64' build.
    • For 64-bit Linux Debian/Raspbian 11 "bullseye" running on ARM, e.g. Raspberry Pi 4 & 5, use the 'aarch64' build.
    • For 32-bit Linux Debian/Raspbian 11 "bullseye" running on ARM, e.g. Raspberry Pi Zero, 1, 2 & 3, use the 'armv6l' build.
      • Note that graphics and audio performance on the original Raspberry Pi Zero is very poor, I have not tested on a 1 or 2.
  2. Extract the archive into a temporary location:

    • mkdir -p ~/tmp && tar -xf mmb4l-<version>.tgz --directory ~/tmp
  3. Copy the "mmbasic" executable to "/usr/local/bin":

    • sudo cp ~/tmp/mmb4l-<version>/mmbasic /usr/local/bin
    • or copy it where you like and create a symbolic link from "/usr/local/bin/mmbasic"
  4. The .tgz also contains resource files for configuring the nano editor for use within MMB4L.

Audio configuration on the Raspberry Pi

On Raspberry Pi devices I have had better results using the legacy "alsa" driver for audio rather than the default "pulseaudio" driver.

To configure this you need to set the SDL_AUDIODRIVER environment variable, e.g. by adding this to your .bashrc file:

export SDL_AUDIODRIVER=alsa

3. How do I run it ?

  • Type mmbasic at the Linux shell and it should show the start banner and display a BASIC command prompt:

    MMBasic prompt

  • To have MMB4L immediately run a program ...

    • ... and exit when the program ends or reports an error:
      • mmbasic myprogram.bas arg1 arg2 arg3
    • ... and return to the BASIC command prompt when the program ends or reports an error use the -i, --interactive command-line option:
      • mmbasic -i myprogram.bas arg1 arg2 arg3
    • any command-line arguments to the BASIC program are retrievable using MM.CMDLINE$.
  • To start MMB4L in a specific directory:

    • either use the -d, --directory command-line option:
      • mmbasic -d ~/mmbasic-workspace
    • or set the MMDIR environment variable:
      • export MMDIR=~/mmbasic-workspace
  • To see other MMB4L command-line options use the -h, --help command-line option:

    • mmbasic -h
  • Use the QUIT command to exit from MMB4L

    • Ctrl-C does not exit MMB4L; it instead interrupts the currently running BASIC program and returns control to the BASIC prompt.

Where are the games ?

Under latest release there is a gamepack-<version>.tgz file. Once downloaded and extracted it contains an executable menu program which should launch a menu of curated games for MMB4L.

  • This can be executed at the Linux terminal, you do not need to run it from MMB4L.
  • For this to work you must create /usr/local/bin/mmbasic as described in 2.3 above.

Start with a shebang #!

Just like the Game★Pack menu program above you can use MMB4L to write executable scripts by starting them with a #! and the path to the mmbasic executable, e.g.

Write "hello-world.bas":

#!/usr/local/bin/mmbasic
Do
  Print "Hello World"
Loop

Make it executable:

chmod 755 "hello-world.bas"

And run it from the Linux shell:

./hello-world.bas

IMPORTANT! The .bas file must have UNIX style line-endings, i.e. just LF (\n), not CRLF (\r\n). If it does not then you will get this error: bash: ./hello-world.bas: cannot execute: required file not found

4. How do I use it ?

Perhaps one day there will be a user manual specific to MMB4L, until then you are directed to:

  • PicoMite User Manual
  • This README which (hopefully) documents all significant differences between the behaviour of MMB4L and that of MMBasic on the PicoMite & PicoMite VGA.

5. The EDITor

Unlike other MMBasic platforms the EDIT command for MMB4L does not use a bespoke editor but instead relies on a third-party editor being installed. By default this is GNU nano, but this can be changed using the the OPTION EDITOR command.

Configuring GNU nano

  1. Check you have nano installed, and determine the version:

    • nano --version
    • If nano is not installed then install it.
  2. The "mmb4l-<version>.tgz" file contains resource files to configure nano to behave similarly to the PicoMite's integrated editor:

    • If you are running nano 4.8+:

      • mkdir -p ~/.mmbasic
        cp ~/tmp/mmb4l-<version>/mmbasic.nanorc ~/.mmbasic
        cp ~/tmp/mmb4l-<version>/mmbasic.syntax.nanorc ~/.mmbasic
        
    • If you have an earlier version and do not need to use nano for anything else:

      • mkdir -p ~/.nano
        cp ~/tmp/mmb4l-<version>/mmbasic.syntax.nanorc ~/.nano
        cp ~/tmp/mmb4l-<version>/mmbasic.nanorc ~/.nanorc
        
      • Edit "~/.nanorc" and change last line to: include ~/.nano/mmbasic.syntax.nanorc
    • If you have an earlier version and are an existing nano user:

      • mkdir -p ~/.nano
        cp ~/tmp/mmb4l-<version>/mmbasic.syntax.nanorc ~/.nano
        
      • Edit "~/.nanorc" and append the line: include ~/.nano/mmbasic.syntax.nanorc
      • If desired incorporate settings/bindings from "~/tmp/mmb4l-<version>/mmbasic.nanorc" into your existing "~/.nanorc" file.

Using GNU nano

The editor is started by typing EDIT "myfile.bas" at the BASIC prompt.

When using the default MMB4L nano resource files the following keyboard bindings are enabled:

Ctrl+A              Display the nano help text
Ctrl+O or F7        Insert a file into current one
Ctrl+Q or F1        Exit the editor
Ctrl+S or F2        Save the current file

Ctrl+P              Goto the previous word
Ctrl+N              Goto the next word
Ctrl+B              Goto the first line
Ctrl+E              Goto the last line
Ctrl+L              Display the position of the cursor
Ctrl+J              Goto line

Ctrl+K              Delete current line / selection
Ctrl+C              Copy marked test
Ctrl+V              Paste the copy buffer
Ctrl+X              Cut marked text

Ctrl+Space or F4    Turn the mark on/off
View on GitHub
GitHub Stars32
CategoryDevelopment
Updated1mo ago
Forks3

Languages

C

Security Score

80/100

Audited on Feb 12, 2026

No findings