Language interpreter for uC-based systems

Public Chat
Similar projects worth following
Terminal-BASIC is an implementation of BASIC programming language, partially compliant to the standards ISO/IEC 6373:1984 and USSR/Russian ГОСТ 27787-88. It is a pure interpreter, running on the Arduino compatible boards and on linux PC, using API level emulation of the Arduino and TVOut libraries.

Download Terminal-BASIC

See also the companion projects of Terminal Basic:

Adobe Portable Document Format - 187.02 kB - 02/16/2020 at 23:17


text-flat-xml - 244.07 kB - 02/16/2020 at 23:17


  • "ANIMAL" game

    Andrey Skvortsov10/19/2021 at 07:49 0 comments

    Upcoming release TB-2.3-b2 will include fix of the DATA READ statements for string data and implementation of the VAL function. These changes allowed me to run one more game from the 101 BASIC Computer Games book - "ANIMAL".

    This and other games (some working in TB) are placed at

  • Github repository for arduino sketch

    Andrey Skvortsov03/19/2021 at 10:23 3 comments

    Main repository of TB always has complex structure of several Netbeans IDE projects, authoring scripts, etc.

    I created a github repository at where I will place all published versions of the sources in the form of Arduino IDE sketch. Happy cloning, pull-requesting and hacking!

  • 4 years and 4k downloads of Terminal-BASIC

    Andrey Skvortsov03/12/2021 at 07:57 0 comments

    At the begining of december 2020 Terminal-BASIC growned up to 4 years age. There were more then 4 000 downloads during these years.

    Here is a chart of downloads distribution among countries. I'm sorry, there is not enough space on image to place all 104 countries, downloads come from.

    Thanks to all TB users.

  • 240x320 il9341-based TFT screen as output device

    Andrey Skvortsov10/31/2020 at 10:33 0 comments

  • Experimental necromancy

    Andrey Skvortsov10/22/2020 at 14:27 0 comments

    Just published 2.3-a1 release for Win32. Almost useless, but still can be used as TB playground and development platform for BASIC programs for later usage on embedded devices.

    P.S. Should work on Win 2000 - 10, both 32/64 bit
    P.P.S. Linux version was always available.

  • Porting to ESPBoy

    Andrey Skvortsov10/20/2020 at 22:38 2 comments

    Terminal-BASIC 2.3 has stable work on esp8266.

    This is an early result from  porting process to little smart device of ESPBoy.

  • Upcoming first 2.3 alpha

    Andrey Skvortsov10/12/2020 at 14:26 0 comments

    First alpha of Terminal-BASIC Version 2.3 will be available soon.

    The reason for next version number is deeper transition to the usage of HAL library.

    It should make porting to another platforms less difficult and may be even MS Wind...ows port available...

    Among minor features it's worth to notice the implementation of double precision math. functions. Version 2.2 has only variables with '!' suffix and basic arithmetics for double precision (not for 8-bit avr based [...]duinos).:

  • ESP8266 and ESPBoy port progress

    Andrey Skvortsov03/10/2020 at 22:11 0 comments

    The upcoming version of Terminal-BASIC uses SPIFFS to implement NVRAM and file system commands on esp8266:

    • SAVE
    • LOAD
    • CHAIN
    • DSAVE
    • DLOAD
    • DCHAIN
    • HEADER

    I'v test it on ESPBoy device. There is no suuport of TFT screen, buttons, sound and LED for now, but the port is fully functional, using UART.

    Sketch with data folder for SPIFFS, containing some BASIC programs: terminal-basic-2.3-a1

    DIRECTORY command shows the files list. Unfortunately, the files, written using esp8266 SPIFFS uploader have names, starting with '/'. To start AMAZING maaze generator, for example, one needs to type the command DLOAD "/AMAZIN" without BAS file extension

  • Forgotten feature

    Andrey Skvortsov02/18/2020 at 21:14 1 comment

    Eons have passed since multidimentional arrays were implemented in Terminal-BASIC, but one important feature was forgotten: arrays of strings!..

    The upcoming version 2.2-rc2 fix this issue and able to run an outstanding game of "Oregon trail":

    The modifed source for terminal-BASIC will be published after release of TB-2.2-rc2 in few days. Many thanks to RomanS for the idea.

  • Documentation

    Andrey Skvortsov02/16/2020 at 23:04 0 comments

    Terminal-BASIC has a terrible documentation. It would be great If somebody with good English skill (may be a native speaker after all...) wish to improve it.

    The source is in "fodt" format and you need LibreOffice to work with it. THe source document is placed at the main terminal-basic mercurial repositiory at Sourceforge.

View all 30 project logs

Enjoy this project?



John wrote 04/13/2022 at 20:10 point

Tried to activate the BUZZER with:

#define HAL_BUZZER_ARDUINO HAL_BUZZER_ARDUINO_TONE in HAL_arduino.h and CONF_MODULE_ARDUINOIO  1  and CONF_MODULE_ARDUINOIO_TONE  1 and also: CONF_BEEP  1 in basic_config.hpp. When I try to compile I get a bunch of errors.

  Are you sure? yes | no

Andrey Skvortsov wrote 04/13/2022 at 20:59 point

In HAL_config.h:

#define HAL_GPIO 1

#define HAL_BUZZER 1

  Are you sure? yes | no

Manuchehr Usmonov wrote 05/19/2021 at 18:58 point

undefined reference to `Font6x8_cp866'

collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Mega or Mega 2560.

  Are you sure? yes | no

Andrey Skvortsov wrote 10/11/2021 at 14:36 point

Once again I'v missed question. I think hackaday notification system should be more load an noisy.

This error seems to be the result of enabling GFX functions in configuration files when TVOutEx library is not installed.

  Are you sure? yes | no

Randy Stadham wrote 03/07/2021 at 10:04 point

Love the project but having trouble uploading the Arduino code to my Mega 2560. I downloaded the files from sourceforg. Found the terminal-basic.ino file. When I try and upload to the Mega I get the following message:

HAL_avr8.cpp:27:10: fatal error: HAL_avr8.h: No such file or directory
 #include "HAL_avr8.h"
compilation terminated.
exit status 1
HAL_avr8.h: No such file or directory

Not sure if I have to run a make file and which one?


  Are you sure? yes | no

Andrey Skvortsov wrote 03/07/2021 at 12:08 point

Thank you for the interest in Terminal-BASIC.

First of all, I recomend you to begin usage of TB from the (relatively) stable version 2.2.1

Then, if you wish to try 2.3 alpha, please tell, what version have you downloaded?

  Are you sure? yes | no

Randy Stadham wrote 03/08/2021 at 11:50 point

Thanks works GREAT! Had to use Putty could not get terminal to work but what the heck Love it! Will Show my students.  I used the version 2.2.1.

  Are you sure? yes | no

Andrey Skvortsov wrote 03/09/2021 at 06:26 point

Glad you found it useful.

  Are you sure? yes | no

HannesBulk wrote 09/18/2020 at 19:06 point

Microchip has launched new chips, like AVRDA128 with 128 KByte Flash and 16 KByte SRAM. It would be nice to have a Basic Interpreter for these processors, with interfaces fot mutiple hardware serial ports, SPI/I2c support, Pin access (Read/Write and PWM output, Analog inputs) similair to arduino C programs. This processor has enough memory to hold the interpreter, a few user programs, etc. The Usersignature part can be used for startup configs (Define serial console port, baudrate, Clock settings, and optional the name of a program to load and start on startup, the EEprom part can be used to store user variables using Peek'Poke instructions.   

  Are you sure? yes | no

Andrey Skvortsov wrote 10/08/2020 at 08:38 point

Thank you for info, I will read more about that MCUs.

  Are you sure? yes | no

RomanS wrote 06/26/2020 at 04:47 point

still waiting for new release to play with )

  Are you sure? yes | no

ptrav wrote 01/15/2020 at 04:06 point

Could you also provide the code in BASIC for the retro games?

  Are you sure? yes | no

RomanS wrote 02/13/2020 at 14:23 point

excellent! probably the support of basic8 games soon )

  Are you sure? yes | no

ptrav wrote 01/15/2020 at 04:04 point

Good progress so far.

The code v 2.1.1. compiles and works fine on ESP32 with 2 major issues:

(1) The stuck is busted if using long reals (see Termina BASIC retro calc).

(2) The file system needs to be reworked - currently cannot compile with the SD option on.

  Are you sure? yes | no

Andrey Skvortsov wrote 02/13/2020 at 14:13 point

Branch 2.2 introduces the option CONF_USE_ALIGN, faces first issue.

The ongoing HAL library will allow use different external memory libraries for file system on different platforms.

  Are you sure? yes | no

John wrote 04/14/2019 at 13:34 point

This project looks great. I encounter difficulties to have it working properly, so here are some questions:

1. I tried to get Terminal Basic to communicate with Putty but no luck (same with Arduino IDE Serial Monitor). I get some random things when I connect the USB cable to the pc. Do I need to specify somewhere in the "config_arduino.hpp" or elsewhere the bps speed e.t.c.?

2. What values do i set in Putty for the serial communication?

3. My final aim is to make the "BASIC microcomputer" that uses Terminal-Basic (actually I put together the hardware part).  Do I need the "Ram expansion shield" or can I skip that for now?

  Are you sure? yes | no

Andrey Skvortsov wrote 04/18/2019 at 22:38 point

1 and 2: This issue looks like a baudrate mismatch of terminal and host. Please, look at the wiki page

By default TB uses USART0 on Arduino with 115200 kbps. This setting is controlled by the SERIAL_I_BR and SERIAL_O_BR parameters from config.hpp.

3. You can start without a SRAM expansion shield, using only Arduino MEGA, rca socket with 2 resistors and ps/2 connector, but you should decrease a screen resolution (TVOUT_HORIZ and TVOUT_VERT parameters from config.hpp) and memory ammount, available to BASIC programs (PROGRAMSIZE parameter in the #elif defined (__AVR_ATmega2560__) section of config_arduino.hpp).

  Are you sure? yes | no

John wrote 04/19/2019 at 18:00 point

Thanks for your advice. I managed to make it work with Arduino IDE Serial Monitor and also with Putty ! (Set to 115200bps and also followed Brian Decker's suggestion on setting: USE_TEXTATTRIBUTES 0).
I had no luck with tvout. I did set in config_arduino.hpp the USETVOUT 1 but doesn't compile. The "vt100.hpp: No such file or directory" error popped up. I have a screenshot here:
1. For my setup: a. RCA video output b. SD card board c. PS/2 keyboard input (no RAM card yet) where and what configuration values do I need to set? There are so many config files and parameters around. Could you pls provide the (configuration) files ready set for that?
2. Regarding the PROGRAMSIZE parameter, what value do I set and where?
3. What sketch do I upload to the smaller Arduino (I have a Nano) that acts as a ps/2 keyboard interface?
4. Where do I find documentation for the Terminal Basic language itself regarding, data types, commands, load, save for SD e.t.c.? Is there a manual available?

If this gets to work, it'll be a great computing experience "80's style" for my students at school. They tried TinyBasic and got hooked on BASIC so easily.

  Are you sure? yes | no

Andrey Skvortsov wrote 04/20/2019 at 14:25 point

1. File config.hpp contains 2 parameters SERIAL_I and SERIAL_O which control the input and output devices used by TB. Section " Input and output for single terminal mode" above them contains available values for these parameters and brief description ot them. To use TVOUT you should write TVOUT_O value to the parameter S_OUTPUT.

The yet unfinished Russian and English versions of reference manual are available at the TB bitbicket repository and I will publish them very soon.

A very brief manual can be found also at the sourceforge wiki

  Are you sure? yes | no

Andrey Skvortsov wrote 04/21/2019 at 06:14 point

> 3. . What sketch do I upload to the smaller Arduino (I have a Nano) that acts as a ps/2 keyboard controller?

My project of PS/2 keyboard reading library at contains an example, suitable to be used as ps2 keyboard reading for NANO/Pro mini module.

  Are you sure? yes | no

John wrote 04/24/2019 at 06:55 point

Hi there. Thanks for your support. Still trying to make this compile. Some more questions:
1. When you say "decrease a screen resolution (TVOUT_HORIZ and TVOUT_VERT parameters from config.hpp) ".......
is HORIZONTAL 120 and VERTICAL 96 small enough?
2. Also "and memory ammount, available to BASIC programs (PROGRAMSIZE parameter in the #elif defined (__AVR_ATmega2560__) section of config_arduino.hpp)." ........
there I'm not sure which "If...else..." option is valid in my setup. I did this:

#elif defined (__AVR_ATmega2560__)
#if (S_OUTPUT != TVOUT_O) && (!USE_EXTMEM) && (!USESD)
const uint16_t PROGRAMSIZE = 1024; // JOHN: was 6144;
#elif (!USE_EXTMEM) && (USESD)
const uint16_t PROGRAMSIZE = 1024; //JOHN: was other
const uint16_t PROGRAMSIZE = 900;

Is that ok?

3. I put the files in the "approprate" places but I seem to get errors (other than "not found" libraries) when trying to compile:

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s: Assembler messages:

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:280: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:336: Error: unknown opcode `delay1'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:338: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:341: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:344: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:347: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:350: Error: unknown opcode `delay2'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:353: Error: unknown opcode `delay1'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:358: Error: unknown opcode `delay1'

C:\Users\6E12~1\AppData\Local\Temp\cc07pr3A.s:361: Error: unknown opcode `delay3'

lto-wrapper.exe: fatal error: C:\Users\�������\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/users/�������/appdata/local/arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

I've been warned it's an issue of TVout library (by Brian) and also, I myself had encountered this in the past with TVout.

Thanks in advance.

  Are you sure? yes | no

Andrey Skvortsov wrote 04/24/2019 at 09:49 point

As for detailed RAM and other config parameters, I will make a working config on my own system without using of external RAM and write a short manual.

I think errors with TVOut compilation come out when I was upgrade Arduino IDE. What version do you have? But actually I use NetbeansIDE on Debian GNU/Linux, tuned for using ArduinoIDE toolchain.

  Are you sure? yes | no

Andrey Skvortsov wrote 04/25/2019 at 08:23 point

I use Netbeans to build TB and missed the problem with Arduino IDE.

I think I'v fixed build errors in 2.0.2 version, just released.

You need to replace TvOutEx library with the version, bundled with TB-2.0.2

Default config is ok, you only need to set TVOUT_O as output device.

RAM size should be decreased if, when enabling different features, Arduino IDE will say you use more then 90-92% of RAM.

Also you should disable -flto build flags in ArduinoIDE file hardware/arduino/avr/platform.txt.

In Netbeans IDE I only disable flto for TvOutEx library, but in ArduinoIDE itself it'not possible.

  Are you sure? yes | no

Brian Decker wrote 04/18/2019 at 23:58 point

One other configuration change that is helpful when using the Arduino IDE Serial Monitor is to navigate to the basic_config.h tab and set line 113 "#define USE_TEXTATTRIBUTES" to 0.  This turns off the VT100 text attributes and eliminates the formatting characters you are seeing.

  Are you sure? yes | no

John wrote 04/19/2019 at 18:02 point

Your suggestion was helpful. Thanks alot!

  Are you sure? yes | no

SirWolf wrote 03/15/2018 at 21:01 point

It would be very nice if the PS/2 keyboard could be used directly without other Arduino.

  Are you sure? yes | no

Andrey Skvortsov wrote 03/20/2018 at 13:46 point

I'v tested a configuration, based on the Dan's Atmega1284 single chip computer

Terminal-BASIC has necessary libraries and config options. This is my test video

  Are you sure? yes | no

SirWolf wrote 03/20/2018 at 15:07 point


  Are you sure? yes | no

SirWolf wrote 12/13/2017 at 12:50 point

I would like to try the Terminal-BASIC, which seems absolutely fantastic. But whatever I do, I'm getting the STATIC SEMANTIC ERROR:1.

Like this:
VERSION 1.1-rc1-144
10 print 1+1


I tried it on Arduino UNOR3 and on Arduino Mega 2560, the error is still the same.
Could it be something encoding-related?

I'm using PuTTY on WIndows 10 with local echo and local line editing disabled.

  Are you sure? yes | no

Andrey Skvortsov wrote 12/13/2017 at 20:59 point

The keywords are case-sensitive. String constants may include lower letters and single-byte encodings characters.

  Are you sure? yes | no

SirWolf wrote 03/20/2018 at 12:45 point

Thank you very much! I feel stupid :).
Are you planning to make it case insensitive in the future?
And ability to use PS/2 keyboard directly would be very nice too :).

  Are you sure? yes | no

Martian wrote 10/05/2017 at 19:19 point

This looks like a much nicer alternative than TinyBASIC, I'm going to see if I can get it running on my Arduino Due.

Great project, keep up the excellent work!

  Are you sure? yes | no

Andrey Skvortsov wrote 10/05/2017 at 21:02 point

Recently I'v spent some time to fix minor incompatabilities with Arduino DUE. Last versions should be runnable on DUE, but I'v not tested SD card support on it. Current SDCard module uses SD lib on Arduino and API level SD lib emulator on PC.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates