The content of this website is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Australia (CC BY-NC-SA 3.0)

MMBasic Overview

MMBasic is a full featured interpreter for the BASIC language.  It's focus is on ease of use and rapid software development.  Commands and code fragments can be tested and quickly modified making for a productive development environment.

This page gives an overview of MMBasic and its capabilities.

Interpreter

Being an interpreter means that MMBasic will decode each statement as the program is running.  This is slower than a compiled program but it means that the language is self contained, you do not need a compiler, operating system or host computer... you just enter your program and run it.

When MMBasic commences running it will present a prompt as shown on the right.

One benefit of an interpreter is that it is possible to test a command at this prompt, without having to create a program. 

The example on the right shows the result of testing the print command and you can test most other commands in this way.

Creating Programs

The use of line numbers are optional and are not required.  Most versions include a colour coded full screen editor for entering and editing programs.  Programs can also be transferred from a desktop computer either streamed over a serial communications link or copied to an SD card and transferred via that.

Data Types and Variables

MMBasic supports three data types; floating point, 64-bit integers and strings.  These can be stored in variables and arrays and can be operated on using the normal BASIC syntax.  Floating point uses either single precision or double precision IEEE-754 floating-point format (selected at compile time).  Strings can contain characters of any value and have a maximum size of 255 characters.

Variable names can be up to 32 characters long.  Arrays can hold floating point, integers or strings and can have up to eight dimensions.  The size of an array is limited only by the amount of available memory.

Commands, functions and operators

The base implementation of MMBasic has 54 commands, 40 functions and 19 operators.  Extended versions like the Maximite version have added many more commands and functions to support additional features.

The commands include many that are used to control the program flow (IF...THEN, etc) and others to manage the interpreter (SAVE, LIST, etc) or input/output data (INPUT, PRINT, etc).  Functions include string and arithmetic functions like SIN(), EXP(), etc. 

MMBasic has a particularly rich selection of string functions and operators that allow programs to pull apart strings, compare them and manipulate them in various ways.

Program Constructs

MMBasic supports the traditional BASIC constructs:

and also a number of modern structured programming constructs:

Extended Features

The Maximite and Colour Maximite versions of MMBasic are intended as general purpose computers and support a range of extensions suitable for this.  The short list includes:

A more detailed description of these can be found at the official Maximite web page.

The Micromite versions are intended as embedded controllers and support a different range of extensions suitable for this.  The short list includes:

A more detailed description of these can be found at the official Micromite web page.

Internal Structure

When a program is loaded or entered at the prompt it is tokenised so that commands, functions and operators are converted to single byte tokens.  These save space but the main benefit is that the interpreter can run much faster because executing a command only requires the use of the token value to index a table to find the code that implements that particular function.  Line numbers (if used) are also converted into 16 bit integers when the program is stored in memory,

Other than this the program is maintained in memory in ASCII format.  When the program is saved or listed MMBasic will automatically decode the tokens and line numbers so that the user is unaware of the compressed memory format.

When the program is run MMBasic will build a table of pointers to any user defined subroutines, functions and labels in the program.  These are used to immediately jump to the correct position in program memory whenever one of these elements are used.

Memory allocation is automatically maintained by MMBasic.  Memory for the program, variables, arrays and general memory use (the heap) is allocated from a single memory pool which is dynamically managed as the program is run.

Standards

MMBasic was designed to mimic the original Microsoft BASIC (also known as MBASIC, BASICA or GW-BASIC) which was supplied with the Tandy TRS-80, Commodore 64 and the early IBM personal computers.

In addition MMBasic supports many modern structured programming constructs.  These constructs and most of the language substantially meets the specifications in the ANSI Standard for Full BASIC (X3.113-1987) or ISO/IEC 10279:1991.  

In most versions arithmetic operations comply with the IEEE-754 standard.