This information pertains to the in-development next-generation BASIC Engine platform based on the Allwinner H3 SoC. Check the "classic" BASIC Engine page for information on the legacy ESP8266-based BASIC Engine platform.
The next-generation platform introduces a host of new and improved features over the classic BASIC Engine. To make it easier to spot the differences, they have been marked in blue.
What is the BASIC Engine NG?
The BASIC Engine NG (next generation) is a firmware for very low-cost single-board computers with advanced 2D color graphics and sound capabilities, roughly comparable to early to mid-1990s computers and video game consoles. It can be run on readily available and very low-cost Orange Pi single-board computers (as well as some other Allwinner H3-based devices) from an SD card.
What can it do?
Figure 1. Boot screen
Figure 2. Shmup demo
Figure 3. Online help in Japanese
Figure 4. Mandelbrot set explorer
The BASIC Engine NG supports most features of the H3 SoC and boards, including
four CPU cores
up to 2GB of RAM
HDMI, DVI and composite video output
16-bit PCM sound at 48 kHz, both analog stereo and audio over HDMI
full compatibility with all MicroSD cards
support for all USB keyboards, many game pads, mass storage devices and hubs
control of all GPIO pins as well as SPI and I2C controllers available on the expansion connector
wired network (Ethernet) support
(Note that not all H3-based boards have connectors for all interfaces.)
This firmware contains a basic operating system and BASIC interpreter ("Engine BASIC") that allows the BASIC Engine to be used as a stand-alone computer programmable in the BASIC language. It provides easy access to the hardware’s capabilities as well as numerous other features.
The firmware is not based on any existing operating system. It runs on the "bare metal" and does not impose any restrictions on the user.
Graphics and sound
True color text and graphics at 4:3 and widescreen resolutions from 160x200 up to 1920x1200 pixels
video modes hardware-scaled to a fixed output resolution for maximum compatibility with all TVs and computer monitors
Software sprites (up to 32 sprites sized up to 32x32 pixels).
Scrollable tiled background graphics engine with up to four layers.
Wavetable synthesizer and
PLAYcommand that renders music in MML format.
Loading and saving of most image file formats to and from video memory, including PNG and JPG
Custom text fonts specifically made for the BASIC Engine
Special BASIC language features
Structured programming constructs (
Labels and named procedures with local variables.
Numbers are double-precision floating point.
String and numeric list types (particularly useful for game programming).
Escape codes for
Event handlers (sprite collision, end-of-music, errors, game controller input).
"Screen editor" similar to Commodore BASIC, allowing direct manipulation of on-screen code and commands, while also permitting scrolling within the program in memory.
Syntax highlighting and automatic indentation in
Loading of programs with or without line numbers.
HELPcommand provides a built-in reference for all elements of the BASIC language
classic UTF-8 text editor (Atto) with BASIC syntax highlighting built-in
Engine BASIC is available in five languages (English, German, French, Spanish and Japanese), with all system messages and help texts translated. National keyboards layouts for all supported languages are available.
Unicode and UTF-8 are fully supported by BASIC. The built-in fonts support various alphabetic scripts as well as Japanese kana. Kanji fonts are loaded as required. A basic Japanese input method is available.
BASIC and system extensions
It is possible to extend the Engine BASIC system with custom modules loaded at run time. This provides nearly endless possibilities to augment the functionality of the Engine BASIC system: new BASIC commands, graphical capabilities, device drivers, utility programs, new output methods, ports of programs from other platforms etc.
An extensive API is provided for extension developers, consisting of standard library and Engine BASIC-specific functions. An on-board C compiler makes it possible to develop extensions (or any other programs) on the BASIC Engine itself.
The modules directory in the demos repository provides examples showing how to use the API and how to cross-compile modules.
The Lua language and the SAM speech synthesizer that were built into the firmware on the classic BASIC Engine platform are now provided as modules.
Z-code interpreter for playing interactive fiction games.
Customizable color scheme, start-up screen mode and font..
Switchable video filter provides a choice between crisp integral scaling and filtered output
Automated test suite adapted from Bywater BASIC.
How to install it
Nightly built SD card images that are ready to use and contain the firmware, all support files and demos can be downloaded from the git_builds directory for H3.
Once an SD card image has been unpacked and written to an SD card ("Balena Etcher" and "dd" have been succesfully used to do so, but any other tool will probably work as well) it can be placed into the SD card slot of a supported H3 board, and the device is ready to use.
How to use it
Introduction to BASIC Programming
If you have never programmed a computer in BASIC or any other programming language, you may want to start with the Introduction to BASIC Programming.
Consult the Engine BASIC NG Reference Manual to find out how to make the most of the capabilities of Engine BASIC.
The Engine BASIC cheat sheets provide a handy reference for beginners:
BASIC demo programs can be found in the Engine BASIC demos repository. Note that all of these demos are included on the nightly SD card image.
How to contribute
The firmware is maintained on Github in the BASIC Engine firmware repository, branch
Compiling the firmware
To compile the next-generation BASIC Engine firmware, it is required to build the Alwinner Bare Metal system first.
It uses the Ninja build system and requires a
toolchain built with crosstool-ng using the
crosstool-ng.config config file. Once the toolchain has been
ninja to build.
To build the firmware, run
H3_OSDIR=<path to allwinner-bare-metal> ./configure.sh
in the firmware source directory, then
ninja -f build.ninja.h3.
If you have any questions or suggestions related to the BASIC Engine, check the BASIC Engine Forum.