Language interpreter for uC-based systems

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. See also the companion projects of Terminal Basic:
SBC by Brian Decker
Arduino-MEGA 32kb composit video SBC
Programmable calculator, based on Arduino DUE

  • Basic support of ESP32

    Andrey Skvortsov10/14/2019 at 22:35 0 comments

    Release 2.1.1 adds support of ESP32 platform.

    Use Arduino IDE and toolchain from

    Some configuration changes to start playing:

    1. config.hpp

    // Arduino IO module
    #define CONF_MODULE_ARDUINOIO     0
    // Input select
    #define S_INPUT SERIAL_I
    // Output select
    #define S_OUTPUT SERIAL_O

     2. config.h

     * SAVE, LOAD and CHAIN commands support
    #define USE_SAVE_LOAD        0

  • More old text games

    Andrey Skvortsov08/13/2019 at 08:25 0 comments

    Changes in upcoming 2.1 release allowed to run some text games from classic BASIC computer games book.

  • Downloads milestone

    Andrey Skvortsov06/14/2019 at 21:01 0 comments

    Just a little note.

    Last week Terminal-BASIC achieved 2000 file downloads on Sourceforge.

    Congratulations and thanks to all its users and contributors!

  • New datatypes

    Andrey Skvortsov04/30/2019 at 20:57 0 comments

    Upcoming Terminal-BASIC 2.1 introduce double precision floating point datatype on 32+ -bit platforms (Arduino DUE and PC) and changes other datatype conventions for naming the variables and arrays.

    Default type is single precision float, ! suffix - double precision float, % - 2-byte integer, %! - 4-byte integer, @ - logical, $ string:

  • Does it make sense to localize BASIC keywords?

    Andrey Skvortsov04/10/2019 at 22:03 3 comments

    As I wrote earlier, TB 2.0 (rc1 for now) has the ability to use different keyword sets in any single-byte encoding. If you are a TB user and if you consider useful some alternative keyword set in your native language, it can be included in future release of Terminal-BASIC. Now there was created a Russian keyword set, based on such, used in BASIC-6 system for БЭСМ-6 mainframe.





























    LEFT$ ЛЕВ$








    MID$ СРЕД$



























    STR$ СТР$







  • Terminal-BASIC programmable calculator

    Andrey Skvortsov03/26/2019 at 07:39 2 comments

    I think about Terminal-BASIC based programmable calculator, like MK-90

    I am planning to use Arduino DUE, TFT screen schield and custom matrix keyboard of40-64 keys.
    Does anybody know, if this shield is compatible with arduino DUE?

    Actually, I'v just tried it on my risk. Screen itself works well with UTFT library with the same C++ code as for Arduino MEGA, but SD card doesn't. On MEGA both screen and SD card slot do work. And what about slot for a small FLASH chip?

  • Latest news from the Terminal-BASIC development

    Andrey Skvortsov02/15/2019 at 23:14 0 comments

    New 1.2 release adds well-known command POKE and function PEEK. On AVR mcus these features allow to work with peripheral control registers directly.

    This release will be LTS, receiving minor updates (stability and standard compliant) for many months.

    Now I'm preparing the 2.0 release, which has completely rewritten in pure C lexical analyzer. New lexer can be configured to use single byte encoding national languages keywords and identifiers. Here you can see the russian lexical variant, close to lexems, used by the Soviet language РАПИРА (rapier):

  • Upcoming refactoring

    Andrey Skvortsov01/02/2019 at 22:32 3 comments

    Some OpenSource/DIY software projects, containing legacy C code have been rewritten into C++. There is no any reasons to stay on C if C++ available on target platform. It has everything that C has and many "free" features, which cost 0 extra bytes and 0 extra instructions.

    But I think Terminal-BASIC must  go through a reverse transformation. I'm rewriting core components in pure C.

    The 8-bit AVR microcontrollers were primary target at the project starting point. G++ supports this architecture, as well as 32-bit ARM versions of Arduino DUE, etc.

    But many interesting architextures do not support C++.  I think about running Terminal-BASIC on Z80 with SDCC, PIC uCs and... SEGA Genesis consoles (MC68000 has G++ port, but  the popular SDK SGEN does not support C++).

  • One-line user defined functions

    Andrey Skvortsov11/27/2018 at 15:25 0 comments

    Terminal-BASIC 1.2rc1 finally acquires an important feature of one-line user defined functions with arbitrary number of arguments.

    This is a short example:

  • Double DUE

    Andrey Skvortsov08/24/2018 at 12:02 0 comments

    This example uses 2 arduino DUE as h/w platform for TB.

    First arduino board with SD card reader (host) runs TB with 64kb available BASIC memory.

    Second one makes VGA output using modified DUE VGA library, implementing part of the ANSI terminal control protocol and custom graphics binary protocol.

    It suffers from minor bugs and incompatabilities, but Terminal-BASIC TETRIS from SD card runs much more acceptable.

View all 18 project logs

Enjoy this project?



ptrav wrote 5 days ago point

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

  Are you sure? yes | no

ptrav wrote 5 days ago 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

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