This information pertains to the ESP8266-based "classic" BASIC Engine. Check the Next Generation page for information on the new and much more powerful BASIC Engine platform.

What is the BASIC Engine?

250
Figure 1. A BASIC Engine rev1

The BASIC Engine is a very low-cost single-board home computer with advanced 2D color graphics and sound capabilities, roughly comparable to late-1980s or early-1990s computers and video game consoles. It can be built at home without special skills or tools and using readily available components for under 10 Euros in parts, or mass-produced for even less.

What can it do?

Screenshots

screen boot
Figure 2. Boot screen
screen shmup
Figure 3. Shmup demo
screen zork
Figure 4. Text adventure game

Videos

Features

Hardware

  • ESP12-E/F module with ESP8266 SoC and 4 MB flash memory

  • VS23S010 video controller with 128k VRAM and composite video output in PAL or NTSC

  • 5-bit PCM sound from I2S controller

  • MicroSD card slot

  • PS/2 and PS/2-compatible USB keyboard interface

  • PlayStation controller port

  • PCF8575 I/O extender with 16 GPIO pins

  • I2C and SPI busses on I/O expansion connector

  • power supplied via Micro-USB socket or pin header

  • RCA connectors for video and audio

Software

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.

Graphics and sound

  • 256-color text and graphics at resolutions from 160x200 up to 460x224 (PAL: 508x240) pixels

  • Software sprites (up to 32 sprites sized up to 32x32 pixels).

  • Scrollable tiled background graphics engine with up to four layers.

  • Wavetable synthesizer and PLAY command that renders music in MML format.

  • Loading and saving of PCX image files to and from video memory.

  • Various text fonts built-in, including an ATI 6x8 font (for up to 76 (PAL: 84) characters per line) and PETSCII.

  • Direct manipulation of video memory and controller registers possible, permitting higher-color screen modes, custom resolutions and other video effects.

Special BASIC language features

  • Structured programming constructs (DO/LOOP, WHILE/WEND, IF/THEN/ELSE/ENDIF blocks).

  • 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 PRINT, similar to the control characters in Commodore BASIC.

  • Event handlers (sprite collision, end-of-music, errors, game controller input).

Development features

  • "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 LIST command.

  • Loading of programs with or without line numbers.

Hardware support

  • ESP8266 CPU core running at 160 MHz, ca. 63kB free memory for BASIC applications.

  • Files can be stored on FAT32 file systems with long file names on MicroSD card as well as the internal flash memory.

  • PlayStation controller support.

  • Support for PS/2 and PS/2-compatible USB keyboards (US, Japanese and German layouts supported).

  • Access to custom hardware add-ons via the 16-pin GPIO extender or I2C bus.

Network support

  • Separate build that provides networking capabilities (cannot be used with tiled BG/sprites and wavetable synthesizer due to resource constraints; both builds can, however, be installed in flash at the same time)

Other features

  • Z-code interpreter for playing interactive fiction games.

  • ASCII text editor.

  • Firmware update from SD card.

  • Customizable color scheme, start-up screen mode and font..

  • Switchable video luminance filter provides sharp high-contrast graphics on LCD screens when turned off and avoids color artifacts on old CRT screens when turned on.

  • Automated test suite adapted from Bywater BASIC.

How to build it

The BASIC Engine Hardware page explains how to build your BASIC Engine, including where to get parts, what tools you need, and how to install the firmware.

The BASIC Engine Shuttle page shows you how to build an experimental system that contains an ESP32 processor and does not require a separate graphics chip. Be sure to read the page in its entirety before building a Shuttle in order to understand its limitations and avoid disappointment!

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.

Reference Manual

Consult the Engine BASIC Reference Manual to find out how to make the most of the capabilities of Engine BASIC.

Cheat Sheets

The Engine BASIC cheat sheets provide a handy reference for beginners:

Cheat sheet #1: Handling BASIC Programs
Cheat sheet #2: Flow Control

Demos

BASIC demo programs can be found in the Engine BASIC demos repository.

How to contribute

Source code

Compiling the firmware

The project Makefile automatically downloads the required toolchains and libraries and builds the firmware. It currently only works on Debian-derived Linux distributions (such as Linux Mint and Ubuntu) on AMD64 and ARM64 systems.

To find out more, run make in the firmware source directory.

History

See the BASIC Engine History page for the whole story.

Contact

If you have any questions or suggestions related to the BASIC Engine, check the BASIC Engine Forum.