Close
0%
0%

Terminal-BASIC

Language interpreter for uC-based systems

Similar projects worth following

  • Some old games

    Andrey Skvortsov3 days ago 0 comments

    I'v implement the ON .. GOTO control structure and fixed FOR .. LOOP details, and Terminal-BASIC made one more step towards the ANSI Minimal BASIC standart.

    BTW last features allow to run many old games from "BASIC Computer games":

  • Terminal-BASIC time-sharing mainframe

    Andrey Skvortsov12/15/2017 at 13:23 0 comments

    If the hardware platform supports multiple UARTs, like Atmega 1284/128/2560, terminal-basic can function as simple time-sharing system.

    It doesn't use any OS, even FreeRTOS. The main interpreting context object is designed as finite state machine instead, which state-chart looks like this:

    The FSM has very short step method and main loop executes many interpreters in order, thus implementing primitive non-preemptive Round-Robin scheduling algorithm.

    This time-sharing mode can be enabled by the BASIC_MULTITERMINAL option in the config_arduino.hpp or config_linux.hpp, depending on the version, being built.

    Terminal-BASIC 1.1 (link) has working implementation of this mode.

  • Terminal-BASIC on Arduino DUE with SD card

    Andrey Skvortsov11/25/2017 at 13:54 0 comments

    It seems Terminal-BASIC is ready to be used on Arduino DUE with SPI SD Card interface.

    I'v decided to write a short HOWTO about that.

    1. Hardware.

    I use an Arduino DUE compatible board with SPI SD module and old 128M SD card:


    2. Firmware
    2.1 Let's download last version of Terminal-BASIC sketch and libraries from sorceforge.
    Go to "Files" page, select latest version and download the archive. Now I'am using https://sourceforge.net/projects/terminal-basic/files/r1.1/r1.1rc1/terminal-basic-1.1-rc1-937-arduino-sketch.tar.gz/download.
    2.2 Unpack the archive. We'll have some folders: terminal-basic-<VERSION> is a main project sketch directory, others are libraries. FOr now only libsdcard needs to be installed. It is slightly modified version of standard SD library. I removed the dependency of heap management functions. On 8-bit AVR this helps to save reasonable amount of flash. Let's copy libsdcard/SDCard to ~/Arduino/libraries.
    THen open sketch in Arduino IDE, select Arduino DUE Programming port board.

    2.3 Configuration

    Select "config.hpp" file. It contains a list of condition compilation flags of different terminal-basic features. To enable option set it's value to 1, to disable - define as 0.

    Default options set is targeted against small 8-bit boards and on DUE we can enable some extra abilities.

    I will enable next options:

    USE_MATRIX (Darthmouth BASIC-like matrix operations)

    SET_PRINTZNES (On ANSI compatible terminals it will set print zones width)

    USESD (SD card commands)

    Option USE_SAVE_LOAD (SAVE, LOAD CHAIN commands which use internal EEPROM on 8-bit AVR's) should be disabled on Arduino DUE.

    On ARduino DUE default BASIC memory size is 65535 bytes (it must be less then 65536). This size can be set in file "config_arduino.hpp" under the "__SAM3X8E__" ifdef branch.

    Compile and program the board. After some warnings it should takeoff.

    2.4 SD Card preparation.

    Here you can download ANSI minimal BASIC test programs and some others.

    Copy *.BAS files in root directory under FAT16/32 formatted card.

    Insert card and plug the board to PC using Programming port. Connect terminal emulator program, using 115200 baudrate, disable local echo and local line editing - terminal-basic do it for us.

    The terminal shopuld look like this upon success:

    Let's test it.

    Type in a simple program:

    10 FOR I%=1 TO 9 : FOR J%=1 TO 9
    20 PRINT I%;J%;I%*J%
    30 NEXT J%:NEXT I%
    40 END

     Input LIST to see it's source and RUN to test. Program can be saved using DSAVE "filename w/o extension" and loaded by DLOAD "filename w/o extension". SD contents list printed on DIRECTORY command. DCHAIN "filename w/o extendion" loads new program, saving old variables.

  • DATA,READ,RESTORE implemented

    Andrey Skvortsov11/21/2017 at 10:03 0 comments

    Terminal-BASIC solved a little challenge of DATA/READ/RESTORE commands.

    The MAT READ <name> construct from Darthmouth BASIC is also implemented.

  • Classic tetris game: milestone and epic fail

    Andrey Skvortsov09/04/2017 at 21:26 0 comments

    Terminal-BASIC becomes stable and functional enough to run the program like classic tetris game. It's quite compact and runnable not only on Arduino MEGA microcomputer but even on Single chip BASIC computer. But it simply is TOO slow!.. As shown on the videos below, SDL TVout emulation is ok, but on real device with TVoutEx output it's fail.

    Arduino MEGA with 32 Kb shield:

    SDL emulation:

    Very disappointing. I will try output through the dedicated VDC, such as NGT20. After all, TVout library forms interrupt overloaded environment.

  • TVoutEx library: SDL emulation

    Andrey Skvortsov08/24/2017 at 15:35 0 comments

    SDL-based emulator helps to debug non-interrupt and non-avr specific part of the TVoutEx library

  • Cyrillic alphabets in Terminal-BASIC output

    Andrey Skvortsov08/23/2017 at 11:13 0 comments

    My friend Dylan Brophy inspired me to investigate the ability to output the cyrillic text using different output devices, supported by Terminal-BASIC.

    1. Using symbols others then capital latin in identifiers not possible and unnecessary.

    2. USART output.

    The job is done by the terminal or (terminal emulator) as long as you use a 1-byte cyrillic encoding (CP-866, KOI8-R, KOI8-U, Windows-1251 ...);

    3. Output using TVoutEx, UTFT libraries and devices such as NGT20.

    The character set either raster or vector should be extended. The memory resources in this case is main restriction. I think the encodings, which were mentioned above, are not suitable for this case because they define full cyrillic letters set for only 1-2 language and doubles the letters with same llok as latine ones. There was interesting encoding Код УПП (punch card device code) which was used on БЭСМ-6 mainframes, defines single latin-cyrillic charset. But it has only capital letters and was incompatible with ASCII.

    So I decided to define the encoding, contains all cyrillic symbols without doubling the same-looking latin.

    I gather cyrillic letters from 8 alphabets (6 modern and 2 dead). The second part of ASCII will be formed from symbols, differs from latin, with the order ascending by the "points" of this letter in the following rating. This will allow to reduce the number of supported symbols, cutting the tail of the table.

    ...
    Symbol Early Cyrillic Modern russian Russian before 1917 Belorussian Ukrainian Serbian Bulgarian Macedonian All
    1 А 1 1 1 1 1 1 1 1 8
    2 Б 1 1 1 1 1 1 1 1 8
    3 В 1 1 1 1 1 1 1 1 8
    4 Г 1 1 1 1 1 1 1 1 8
    5 Ѓ 0 0 0 0 0 0 0 1 1
    6 Ґ 0 0 0 0 1 0 0 0 1
    7 Д 1 1 1 1 1 1 1 1 8
    8 Ђ 0 0 0 0 0 1 0 0 1
    9 Е 0 1 1 1 1 1 1 1 7
    10 Ё 0 1 0 1 0 0 0 0 2
    11 Є 1 0 0 0 1 0 0 0 2
    12 Ж 1 1 1 1 1 1 1 1 8
    13 З 1 1 1 1 1 1 1 1 8
    14 И 1 1 1 0 1 1 1 1 7
    15 Ї 1 0 0 0 1 0 0 0 2
    16 Й 0 1 1 1 1 0 1 0 5
    17 К 1 1 1 1 1 1 1 1 8
    18 Ќ 0 0 0 0 0 0 0 1 1
    19 Л 1 1 1 1 1 1 1 1 8
    20 Љ 0 0 0 0 0 1 0 1 2
    21 М 1 1 1 1 1 1 1 1 8
    22 Н 1 1 1 1 1 1 1 1 8
    23 Њ 0 0 0 0 0 1 0 1 2
    24 О 1 1 1 1 1 1 1 1 8
    25 П 1 1 1 1 1 1 1 1 8
    26 Р 1 1 1 1 1 1 1 1 8
    27 С 1 1 1 1 1 1 1 1 8
    28 Т 1 1 1 1 1 1 1 1 8
    29 Ћ 0 0 0 0 0 1 0 0 1
    30 У 1 1 1 1 1 1 1 1 8
    31 Ў 0 0 0 1 0 0 0 0 1
    32 Ф 1 1 1 1 1 1 1 1 8
    33 Х 1 1 1 1 1 1 1 1 8
    34 Ц 1 1 1 1 1 1 1 1 8
    35 Ч 1 1 1 1 1 1 1 1 8
    36 Џ 0 0 0 0 0 1 0 1 2
    37 Ш 1 1 1 1 1 1 1 1 8
    38 Щ 1 1 1 0 1 0 1 0 5
    39 Ъ 1 1 1 0 0 0 1 0 4
    40 Ы 1 1 1 1 0 0 0 0 4
    41 Ь 1 1 1 1 1 0 1 0 6
    42 Ѣ 1 0 1 0 0 0 0 0 2
    43 Э 0 1 1 1 0 0 1 0 4
    44 Ю 1 1 1 1 1 0 0 0 5
    45 Я 0 1 1 1 1 0 1 0 5
    46 I 1 0 1 1 1 0 0 0 4
    47 J 0
    Read more »

  • Darthmoth BASIC matrix operations

    Andrey Skvortsov08/09/2017 at 16:49 0 comments

    One of the amazing features of the World's first BASIC implementation from the Dartmouth College

    was the ability to manipulate arrays as matricies. The 1960's are going farther and farther, at the age of Scilab, Octave and other mature numerical computations packages who can be impressed by the matrix-able BASIC. But isn't it fun when small 8-bit uC board can do what mainframes from 1960's can?

    Terminal-BASIC supports these matrix operations. Main difference is that Darthmouth BASIC ignores 0-row and 0-column, making array definition more informative. DIM(3,3) defines 4x4 array, but it was used as 3x3 matrix in matrix operations. Terminal-BASIC uses all rows and columns, so DIM(3,3) defines 4x4 array, which can be used as 4x4 matrix.

View all 8 project logs

Enjoy this project?

Share

Discussions

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 https://hackaday.io/project/2428-single-chip-avr-basic-computer-v03

Terminal-BASIC has necessary libraries and config options. This is my test video https://youtu.be/0uTYnNounNI

  Are you sure? yes | no

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

Cool!

  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:
TERMINAL BASIC
VERSION 1.1-rc1-144
6144 BYTES AVAILABLE
READY
list
:STATIC SEMANTIC ERROR 1
READY
10 print 1+1
list
:STATIC SEMANTIC ERROR 1
READY
run
:STATIC SEMANTIC ERROR 1
READY

READY

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