This page is a stub. It needs more information! You can help Rosetta Code by filling it in!
Language
FTCBASIC
This programming language may be used to instruct a computer to perform a task.
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using FTCBASIC.

FTCBASIC homepage

FTCBASIC

Alpha Version

by Gemino Smothers 2022

About:

FTCBASIC means fast tiny compiled BASIC.
It is a BASIC compiler for x86 DOS.
The compiler is written in QuickBasic and generates FASM output.
Using batch files, you may compile your source to com files instantly.

Generated com files are tiny and fast.
They start at less than 50 bytes.

The compiler and language is derived from the Pebble language.
Many of the great features of Pebble have been kept in translation.
As a result, there's support for inline asm, include files, and more.
There's even some basic 1D array and string data type support.

In all, there's integer, integer array, and string data types.
Floating point is not supported, but may be implemented with libraries.

IDE:

A simple WYSWYG IDE for small projects has been included.
It only displays 80 chars each of 200 lines, but has a few advantages.
You may load a file and select the compile option to generate a batch file.
This works even if the file is too large to display.

Without the IDE, you must manually create the compilation batch files.
The compiler may also be ran by itself to manually type the source file name.
There's plenty of customizable editors you might want to set up as well.

Language:

Only unsigned integers may be used in expressions.
Operator precedence is *, /, +, -, <, >, <=, >=, =, <>, AND, and OR.
Parenthesis override operator precedence.
Use \ at the end of your echo to omit the new line.

Strings:

String variables must have a $ at the end.
String variables look like name$.

Arrays:

Only numbers may be used as the array size. No variables.
Arrays may be used in expressions, with input, and with print.
Array values must be passed to regular variables for other uses.
Likewise for other uses, data must be passed to the array.
Access arrays with @list[index].
Variables and numbers may be used as the index.
Expressions may not be used as the index.
Arrays are indexed with a starting position of 0.
The range is 0 to the specified index - 1.


Keywords:

REM
(comments)

DEFINE variable=expression,variable=expression,variable=expression,etc...
DEFINE strvar$="string",strvar$="string",strvar$="string"
DEFINE variable=expression,strvar$="string"
(string variabes must have a $ after the name)
(you may define integers and strings on the same line)
(variables may only be defined once)

DIM variable[literal number or comma separated list]
(does not support variables as a parameter)
(arrays must be referenced as @list[index])
(array index may be a literal number or variable)
(array index may not be an expression)

IF expression THEN labelname

IF expression THEN
ENDIF

DO
LOOP expression
(loops while condition is true)
(loop with no parameter for an infinite loop)

LET variable=expression

CARRY variable
(places remainder of last division operation in a variable)

0 variable
(same as let variable=0)
(output asm is the same)

+1 variable
(same as let variable=variable+1)
(produces smaller asm code)

-1 variable
(same as let variable=variable-1)
(produces smaller asm code)

PRINT expression OR "TEXT" or string$
(does not support concatenation)
(use \ at the end of the statement to omit the newline)
(string variables already print with the newline omitted)

INPUT variable

GOTO labelname
LABEL labelname

GOSUB subname
SUB subname
RETURN

SCANKEY variable
(returns the ascii value of any key being pressed)

ONKEY labelname
(jumps to a label when any key is pressed)

CURSOR x,y
(moves the text output position)
(variables or numbers may be used as parameters)

CHR ascii
(echo the character of any ascii value)
(variables or numbers may be used as parameters)

CLS
(clears the screen)
(supports bios color control options)
(this is demonstrated in the example ballandp.bas)
(further documentation will be included in the beta release)

PAUSE

BELL
(rings the PC speaker bell by echoing ascii character 7)

END
(this command is required to prevent execution past the end of the source)
(it may only be omitted when the program ends with an endless loop)

COPY string1$,string2$
(copies the contents of string2$ to string1$)

CONCAT string1$,string2$
(concatenates the contents of string1$ and string2$)
(the result is placed in string1$)

COMPARE returnvalue,string1$,string2$
(compares the contents of string1$ with string2$)
(if they are exactly the same, the return value is 1 and 0 otherwise)

LENGTH returnvalue,string$
(returns the length of string$)

FIND returnvalue,string$,'x'
(returns the first occurance in string$ of 'x' or any other character)
(characters may be represented in single quotes or as literal ascii numbers)

TRIM string$
(removes spaces from the left and right sides of string$)

CUT start,amount,string1$,string2$
(parses from start up to the amount and places the result in string1$)

INTSTR string$,value
(converts a value to a string)

STRINT value,string$
(converts a string to a value)

UPPER string$
(converts a string to all upper case)

LOWER string$
(converts a string to all lower case)

USE filename.inc
(includes a file at the bottom of the code)

INCLUDE filename.inc
(includes a file in the code)

BEGINASM
(start inline asm block)

ENDASM
(end inline asm block)

Commands that don't support arrays yet:

You must use variables to pass values.

carry, 0, +1, -1, cursor, chr, scankey, cls,
compare, length, find, cut, intstr, strint