Hardware Platforms - slviajero/tinybasic GitHub Wiki

A word on hardware platforms

The BASIC code is in basic.c with basic.h being the header file for most of the interpreter variables. On Arduinos this file is called IotBasic.ino but otherwise identical.

Hardware dependent functions are mostly (but not completely) in runtime.cpp and runtime.h. As the different target platforms have different cores and different libraries, precautions are needed. An SD file system library on Arduino 8bit and ESP8266 is different in some aspects. The hardware layer of the interpreter deals with these differences. This part of the code is complex with a lot of heuristics in it. Currently 16 different cores are supported.

Main platforms are

  • Mac
  • Arduino AVR
  • Arduino 32 bit SAM(D) and Mbed
  • Arduino R4 with NRENESA chipset
  • Arduino GIGA (new 02/2025)
  • ESP8266
  • ESP32

Platforms I occasionally use and test against are

  • Mighty core AVR
  • Mega core AVR
  • ESP32 VGA Fablib systems

Platforms that work but that I test only in major release

  • Linux
  • Raspberry PI OS variants with wiring and screen buffer support
  • Windows
  • DOS
  • Seeed Studio Mbed
  • Raspberry PI Pico
  • XMC1100
  • STM32F4FAVE

Platforms I tested but don't use no more

  • STM32F103xxx (128kB flash variants recommended)
  • STM32 black pill and blue pill and the like (Reason: too many problems with drivers and the clones, not a problem of STM but of the pirates)

Arduino

Most genuine Arduino board and their clones are supported. I admire the solid work the Arduino engineers have done to build and integrate these boards with the software.

Diecimila 168 (EEPROM): Runs a real tiny BASIC.

Diecimila 168 - real small

The first Arduino board I owned. It has only 1kB of RAM and 512 bytes of EEPROM. It is my test board for real frugal code. Picoserial is used to safe buffer space. This code in integrated in BASIC right now and no addition library is needed. On a 168 the BASIC program will be placed in the EEPROM and the rest of the memory will be used for variables.

Uno with 328P (EEPROM and LCD Shield), Nano

Systems with roughly 1KB of BASIC memory and EEPROM as program storage. Floating point support fits into the flash.

Arduino UNO and a LCD Shield

Default setting in BASIC 2.0 is to put the BASIC program in the EEPROM and have 500 bytes of RAM for variables.

For the LCD shield the standard Arduino Liquidcrystal library is used. (https://www.arduino.cc/en/Reference/LiquidCrystal). See the projects page (https://github.com/slviajero/tinybasic/wiki/Peripherals:-Display-LCDs,-TFTs,-and-VGA) for more.

Larduino with a LTG8F328P Chip aka WEMOS XI aka other names: These boards have no real EEPROM. They use a flash EEPROM emulation. Supported now as well, PICOSERIAL does not work on them. They have a slightly smaller flash which limits the use with peripherals. Please use the newest cores from https://github.com/LGTMCU/Larduino_HSP for this.

The same is true for the Arduino PRO boards. The interpreter fits in but not much more.

Nano Clone

All the UNO and Nano based board work really well and are fun to use with BASIC.

Nano Every

Has 4 kB of BASIC memory free and can drive a lot of peripherals.

The Every (https://docs.arduino.cc/hardware/nano-every) has received little love in the community but for running BASIC it is a great system. With its 6 kB of memory and 48 kB of flash, a lot of features can be added to the BASIC interpreter and you still have a computer with 4kB RAM. It is the ideal system for small wearables and applications.

Nano Every

Mega 2560 (EEPROM):

For a system with 6-7 kB BASIC memory, ideal for a standalone 8bit system.

Arduino Mega256

The MEGA256 is ideal for standalone systems with a small display. It has enough program memory for the PS2 keyboard library (https://github.com/slviajero/PS2Keyboard) and the I2C Liquidcrystal libraries (https://github.com/slviajero/LiquidCrystal_I2C). Look at the project page https://github.com/slviajero/tinybasic/wiki/Projects:-How-to-use-BASIC-on-Arduinos for more.

MKR 1010 Wifi

28 kB BASIC memory, Wifi and MQTT supported. Built-in real time clock is also supported.

Arduino MKR1010

This board required the Arduino SAMD board extension in the board manager menu. Wifi and MQTT is fully supported just as well as sleep modes. This board is the basis of an IoT display board I build. Built-in RTC is supported for time keeping but not for alarms. This is in preparation.

For SAMD boards, the RTCZero and LowPower library has to be installed from the Arduino library manager before compiling BASIC.

Arduino DUE, 64 kb BASIC memory

Arduino DUE

The first 32 bit workhorse of the Arduinos. Ideal for TFT based standalone systems. See https://github.com/slviajero/tinybasic/wiki/Projects:-How-to-use-BASIC-on-Arduinos for an example of a TFT screen. This board requires the Arduino SAM board extension from board manager.

Arduino RP2040 aka Raspberry PI Pico, generic Arduino model with 64 kb BASIC memory.

Arduino rp2040

This board is ideal for a small standalone computer.

Supports LittleFS now for an internal filesystem with BASIC. Wifi and MQTT supported. No EEPROM emulation support yet but external I2C EEPROM of course fully supported.

Arduino R4 MINIMA and Wifi

The best small platform for BASIC from Arduino. Fully compatible with the UNO boards and shields. There is approximately 26 kB of BASIC memory available with the full floating point BASIC installed. Great for all kind of applications.

The real time clock is supported by BASIC by default. MCUFRIED type parallel display shields are tested successfully (with my patched MCUFRIEND library). Will test more shields and applications for it in the future.

R4 boards

Wifi is fully supported to send MQTT messages.

Arduino GIGA R1

Another superb platform for BASIC. Supported so far is USB storage, the real time clock and all core functions of BASIC. Memory is loaded correctly, and of course SPI and displays work. Wifi runs and can sent MQTT messages.

This is another great board for BASIC. Here, 64bit arithmetic makes sense. The board has a build in FPU and is very fast with 64bit objects.

ESP8266 and ESP32

Fast, low cost. Sometimes tricky to use but with a lot of possibilities. Endless hardware variants available. On all ESP boards SPIFFs and Wifi are fully supported. SLEEP works as well. They are ideal to build sensor devices or small standalone computers.

ESP8266 NodeMCU

ESP8266 Module

These boards are very popular and only cost a few Euros. They can be mounted on breadboards or other prototype boards.

Wemos D1 R1

These boards with a UNO form factor are also really cheap and very useful. They are not really compatible with UNOs and can't be used with many shields.

Wemos D1 board

Read this tutorial to see what can be done with BASIC and one of these boards: https://create.arduino.cc/projecthub/sl001/the-10-euro-iot-computer-with-esp-8266-e93681

More info on the board, in particular, the pinout https://cyaninfinite.com/getting-started-with-the-wemos-d1-esp8266-wifi-board/

ESP32 Wroom and C3, S3

ESP32 Dev Board

most variants of ESP32 modules are supported. In addition to this, the interpreter also runs on Espduino modules which are similar to UNOs again.

ESP01

ESP01

Depending on the memory of the board and the features activated up to 64 kB of memory is possible. I tested on ESP01 in the 8266 and ESP32 variant as sensor boards.

TTGO ESP32 with VGA and PS/2

TTGO

16 color VGA including graphics with PS2 keyboard and SD card running supported. Wifi also supported.

Please use the new FABLib versionhttps://github.com/slviajero/FabGL with the newest ESP32 core, version 2.0.2 and above.

48kB of BASIC memory without Wifi and a screen of 640x480 with 16 bit VGA are supported.

With Wifi the system cannot be stably powered any more from a standard USB port. It will crash periodically through the brownout detection mechanism. Use a sufficiently powerful external power source instead.

Wifi works now (again), depending on the memory reserved for the screen.

VGA ESP32 system

Seeed Studio hardware

Seeeduino Xiao 24 kB of BASIC memory

Seeeduino

A super cheap, super small but powerful board. Fully supported with BASIC. Internal flash is usable as EEPROM emulation. This is a build in component of the interpreter.

https://wiki.seeedstudio.com/Seeeduino-XIAO/

Raspberry PI Pico

The genuine Raspberry PI Pico is a great and powerful board for standalone computers.

Raspberry Pi Pico

It has a lot of memory, is fast and many I/O pins. Fully supported with BASIC with the genuine Raspberry PI Pico core.

Non Arduino AVR systems

A few of the very useful AVR controllers never made it into Arduino board. One has to build ones own board for them. A 644 is a great chip as it has 64kB flash and 4kB of RAM. Ideal for BASIC.

Low energy board can be build with it:

AVR do it yourself board

BASIC supports AVR644 and AVR1284 with these boards.

Bare bone board with AVR128 are ideal for BASIC. Many pins and enough memory.

AVR bare bone board

Use the Mighty core (https://github.com/MCUdude/MightyCore) and Mega core (https://github.com/MCUdude/MegaCore) with these systems

Infineon XMC system

A support for the XMC1100 has been added to the code. These microcontrollers are SAMD based, have 32kB or 64KB of flash. Wiring and I2C tested so far and working.

XMC1100 with external EEPROM

I build an EEPROM emulation and integrated it to BASIC. See https://github.com/slviajero/XMCEEPROMLib. (Thanks to Florian for inspiring this work and giving me the right hints). EEPROM is now build in to the interpreter.

STM32F4VE and other STM32 based boards

The STM32F4VE boards with the SD card slot are ideal as a basis for BASIC computer. They are probably very fast, just like the Arduino GIGA.

STM32F4VE

Powerful boards, see docs here https://www.st.com/en/microcontrollers-microprocessors/stm32f407ve.html#overview or here https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/shortlog/ or here https://stm32-base.org/boards/STM32F407VET6-STM32-F4VE-V2.0

OS information in this repo https://github.com/stm32duino/Arduino_Core_STM32

BASIC supports the board now, including the EEPROM feature. It has 16 kB of buffered EEPROM emulation. Memory size 64KB by default. Bigger is possible. The SD card slot with SDIO interface is supported with the STM32SD library. Built-in real time clock is supported. The STM32RTC and STM32LowPower libraries are both needed.

With release 2.0 I also ported for the STM32F103 blue pill boards. 20 kB memory and 128 kB flash variants are tested. 1kB EEPROM emulation, real time clock works. Deep sleep code compiles, automatic memory detection also works. BASIC runs with 12.7 kB memory on these boards, as I reserve a lot for stack, in case USB is used. Fake blue pill boards have serious issues with the USB serial code. I only ported and tested the UART serial as my boards are broken.

EPaper with ESP32

EPaper

A small board with Wifi and an Epaper display. Great device for digital signage. First version of code prepared but very raw. Not meant for production. Necessary font file not yet checked in. Do not activate or use at this time. Major change coming here.

Raspberry PI with Linux

Framebuffer graphics now supported and Wiring.

Supported Arduino / ESP peripherals

The runtime environment runtime.cpp has become as big as the BASIC interpreter itself in the meantime. It contains a number of predefined drivers for hardware components. There is (almost) no Arduino library code any more in the basic interpreter basic.c or ÌotBasic.ino. The hardware code includes displays, keyboards and keypads, sensors, networking, filesystems, and other peripherals.

Displays

Small text based LCD displays with and without I2C interface can be connected.

The LCD shield is supported including the keypad. The standard Arduino parallel LCD library is used for this.

Shield

LCD I2C is also supported for any display size.

LCD

SSD1306 based OLEDS are very common. The are supported using the u8g2 drivers. Almost all common monochrome displays can be connected with this and accessed through BASIC by changing the constructor lines in the code.

SSD1306

Larger TFT displays based on the SSD1963 are supported with full graphics.

TFT

SPI based displays like the Nokia 5110 and small ILI9488 can be used. They are really low cost and offer graphics.

Nokia5110

For the Nokia display there is a page mode in the graphics code. It allows drawing and printing into a page buffer and then transfer the data to the display.

ILI9488

The SPI based ILI948x displays are very common. A project with a display like this was published in arduino.cc.

Parallel ILI9886 displays are also supported in the meantime. They are ideal with Arduino Mega256 controllers are they need a lot of pins.

ILI9486

Real Time Clocks

Arduino I2C Real Time clocks with a DC3231, DC3232 or DC1307 are supported. If the clocks have an EEPROM they can be integrated as a small file system using the EFS library. Internal clocks of many boards are supported by default. All boards also can be used with a clock emulation using the millis() function.

Input devices

PS2 keyboards and the keypad of the LCD shield are supported. ZX81 keyboards can be used with my ZX81Keyboard library. USB Keyboards are supported on a DUE with a German keymap. This is experimental. No keymap yet for the GIGA USB keyboard.

Networking and Radio

ESP Wifi, WifiNINA and Arduino Ethernet are supported as network protocols with MQTT messages.

RF2401 Radio modules are implemented, they can be used are slaves and masters.

Sensors

A generic WIRE access library exists for all kind of I2C devices. Slave mode wire is implemented in BASIC 1.4.

A small number of sensors are integrated, this is active work. Currently DHT11, DHT22, AHT10, SHT3, BMP280, BME280 are supported. In addition to this the LSM6D sensor of the MKR and the MQ2 air quality sensor is integrated into the BASIC code.

Memory and EEPROM

EEPROMS with 4k and 32k size are autodetected on I2C. EEPROMS can be used as direct program storage and programs can run from them. SPI RAM chips are also supported as primary program storage.

Unix

MacOS X with gcc and Xcode

Raspberry PI / raspbian with gcc - Wiring implemented to support I/O pins.

Raspberry PI

Windows

Download MINGW (https://sourceforge.net/projects/mingw/) and set the MINGW macro.

MSDOS

Borland's Turbo C Compiler 2.01 is freely available for MSDOS (see here https://vetusware.com/download/Borland%20Turbo%20C%202.01/?id=168 or here - megapack - https://archive.org/details/msdos_borland_turbo_c_2.01). Use the program dosify in my repo to remove C++ style comments and add the obligatory CR characters at the end of each line. basic.c compiles nicely in DOSBOX including the file IO code. Catalog doesn't work as I didn't take the time to dive into MSDOS header files.

MSDOS / Dosbox

Standalone system

Smallness

A LCD shield / UNO based standalone computer.

Shielded UNO

AIM65 lookalike

A standalone computer with a 4x20 display and a thermo printer based on a MEGA 265.

Rockwell AIM65

The TFT/DUE machine

A standalone computer with a TFT screen based on an Arduino DUE.

TFT Based system

VGA based computer

The FabGL library makes it possible to build real VGA system based on an ESP32 CPU.

VGA ESP32 system

The 10 Euro IoT computer

A system build on the old Wemos D1 UNO lookalike boards integrated with a low cost SD and clock shield.

Wemos Based computer

Speed and performance

Dr. Dobbs method

In one of the old Dr. Dobbs journals the tiny program

10 FOR I=1 TO 10000 : A=5 : NEXT

is called the canonical benchmark. These were simpler times. The benchmark is still good to compare different boards. Results can be downloaded here: https://github.com/slviajero/tinybasic/blob/main/examples/11stefans/bench.txt

All this is timed with millis(). Timing also depends on the language features added and other factors.

Run times quotes in the old Dr. Dobbs were between 2.5 minutes and 10 seconds for old 8080 based BASIC interpreters under CP/M with floating point arithmetic. My Apple I clone with a 1 MHz 6502 and Applesoft (floating point) BASIC needs 26 seconds.

An Arduino MEGA runs the benchmark in 2000 ms with floating point arithmetic. Scaled with the CPU frequency this means that it would run at about 30 seconds with 1 MHz clock frequency. This shows that the BASIC interpreter would have been competitive back then in terms of speed.

The timetester and other benchmarks

Please have a look at the example section of the repo. In chapter 11 there is a number of classical BASIC benchmark and the respective results.

Libraries

Board extension URLs for the Arduino IDE