  _____   _____    ____   _____    _____    ____   _____    ____
 / ____| /_   _\  / __ \ /  __ \  /  _  \  / __ \ /_   _\  / __ \
 | |       | |   / /  \/ | |  \ | | | | | / /  \/   | |   / /  \/
 | |__     | |   | |     | |__/ / | |_| | \ \__     | |   | |
 |  __|    | |   | |     |  __ |  |  _  |  \__ \    | |   | |
 | |       | |   | |     | |  \ \ | | | |     \ \   | |   | |
 \ |       \ |   \ \__/\ | |__/ | \ | \ | /\__/ /  _| |_  \ \__/\
  \|        \|    \____/ \_____/   \|  \| \____/  \_____/  \____/

FTCBASIC

	Beta Version (Updated 7:52 PM 3/1/2023)

	by Gemino Smothers 2022
	http://www.lucidapogee.com

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.
	If statements require at least one relational operator.
	When operands are equal, < and > resolve as equal. (this is a bug)

Strings:

	String variables must have a $ at the end.
	String variables look like name$.
	Use define strname$ = comma to insert a comma into a string.

Arrays:

	Only literal numbers or constants may be used as the array size.
	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.

Constants:

	The main purpose for constants is to set limits for loops and arrays.
	They are usable in most places where variables are accepted as input.
	They may also be used in expressions.

Keywords:

	REM
	(comments)

	DEFINE variable=expression,variable=expression,variable=expression,etc...
	DEFINE strvar$="string",strvar$="string",strvar$="string"
	DEFINE variable=expression,strvar$="string"
	DEFINE variable=COMMA
	DEFINE CONST constant=literalnumber,CONST constant=literalnumber, etc...
	(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 returnvalue
	(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)
	(returnvalue is optional and may be a literal number or integer variable)

	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)

Libraries:

	file.inc provides file access routines
	command.inc provides command line parameters
	shell.inc provides command shell execution
	time.inc provides system time access
	random.inc provides random number generation
	mouse.inc provides mouse handling routines
	speaker.inc provides speaker output routines

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

Tips:

	FASM needs DPMI to run in DOSBOX.
	Run CWSDPMI.EXE -p before compiling.
	Download it at http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip

Credits:

	This compiler uses
	Flas Assembler version 1.73
	Copyright (c) 1999-2022, Tomasz Grysztar.

	Thank you AsmGuru62 on board.flatassembler.net
	for helping with the input routine and conversion
	of strings to segmented data.
