Way back in 2013, when I started working with the STM32 ARM on a motion control project, I needed a simple serial connection so that I could control the fledgling product.
I settled for a very simple set of commands, each using a capital letter, and a single numerical parameter, so 100U would move the machine head 100mm up and 100D would move it down by the same amount.
As the project developed, more commands were added, again with capital letters, chosen for their mnemonic value.
About the same time, I read about the first Cambridge EDSAC which had an instruction set based on the 5 bit baudot code used by punched tape teleprinters, again using upper case letters for their mnemonic value.
So I pondered whether I could create a very lightweight programming language using single character ascii commands, chosen for their mnemonic value, brevity and human readability.
So I pottered along with some ideas and created a very simple interpreter, coded in C which allowed me to sequence a train of commands sent to the STM32 hardware. It provided basic interaction with the hardware from a serial terminal application running on a laptop.
Having had a little experience with Forth, my ideas converged on a Forth-like RPN language. But as a lazy programmer, I wondered if I could throw away 75% of Forth and still have something of value. So out went the dictionary and the multi-character parsing that went with it. The compile mode and 16 bit addressing were also ditched, leaving a very simple bytecode interpreter that used the printable ascii character set as it’s instruction set.
30 instructions, chosen from appropriate mathematical, logical and punctuation characters.
26 user routines identified by a single uppercase letter
26 user variables identified by a lowercase letter.
If this is starting to sound familiar, it is the Tiny BASIC equivalent of Forth. Unlike VTL that has features in common with BASIC, the MINT interpreter has a lot in common with RPN stack-based languages.
Minimalist languages have been around since the start of the electronic computing era. I was delighted to discover that way back around 1969, a lightweight character based interpreter called MUSYS was written for the PDP-8, by Peter Grogono, in order to simplify the task of electronic music composition. He later evolved this into MOUSE - a language for microcomputers around 1980. Having recently bought a copy of Grogono’s book to obtain the source code, I can see that MINT is very close to MOUSE in functionality, but about 20% smaller in terms of source code.
MINT is also quite similar in nature to desk calculator (dc).
MINT uses a look-up table that converts the 96 printable ascii characters into a jump address to a page of memory that contains the primitive routines, and the routines to handle numbers and variables.
The most commonly used routines (arithmetical and logical functions) are accessed on a single 256 byte page, less frequent routines have an intermediate jump to allow access to the next page. This method was chosen to provide the fastest means of accessing a routine on most 8-bit processors. Arithmetic is 16-bit integer and there are routines to accept numbers in both decimal and hexadecimal.
MINT is a very terse language with only 30 primitive instructions. These provide arithmetical and logical instructions, loops, arrays and conditional branching.
There is a data stack and a return stack, just like Forth. However, there are 26 user “registers” available, and after some months of using MINT, it became apparent that using these registers for temporary storage can save a lot of the stack juggling operations that are so common in Forth.
In 2021 I collaborated with John Hardy and Craig Jones, both from Melbourne Australia and we created the first fully documented version of MINT. Initially for the Z80, as John created the TEC-1 Z80 SBC, way back in 1983, and MINT provides an alternative means to program the TEC-1 from a serial terminal other than in Z80 hex codes.
We are hoping to port MINT to several of the classic 8-bit micros, including 6502, 1802, 6800/6809 as well as PIC and AVR and 8051. We are also looking at a cut-down version of MINT providing the bare minimum for a 16-bit VM in about 1Kbytes.
There is also a C simulator for the MINT interpreter which runs to about 80 lines of fairly dense code.
Looking forwards, we see MINT as being a very lightweight 16-bit virtual machine, which can be easily implemented on any resource limited cpu.
It’s bytecode instruction set is human readable and we see it as a means of passing small programs between systems that do not necessarily share the same CPU. Some might call this a security nightmare, but I look at it as an opportunity.
I have a colleague in Malaysia who deals with commercial greenhouse automation systems using distributed 8051 based control nodes. MINT can provide a command shell to update the system to provide a control environment that will respond to variations in temperature, lighting and mositure/humidity.
On github you can find MINT here: