Pebble language and compiler for X86 DOS
Programmed by Gemino Smothers
Geek Basic 2022

Last updated 4:19 PM 11/26/2022

About:

	Pebble allows you to develop X86 DOS software.
	It produces small and fast executables.
	The compiler is highly expandable and adaptable.

Compiler:

	Pass source files to the compiler through the command line.
	In windows, you must use a batch file for this.
	The io.lib file is used by several commands during compilation.
	The header.dat file contains your program header.
	The files mouse.inc and speaker.inc are also included.
	These files give support for mouse and sound.

IDE:

	Simple wysiwyg editor with load, save, new, and run ability.
	The run option generates and executes a compilation batch file.
	Load a source file or type a new one and then press F4 to compile and run.
	Source files must be saved before compilation.
	Can only edit tiny files of up to 80x200 characters.
	Tabs display as spaces in the IDE, but load and save as tabs.
	For larger fies, use another text editor and write a batch file to compile.
	You may also load the larger files just to compile them.

Projects:

	Pebble files use .peb as their extension.
	For larger projects, you may create a folder in the pebble folder.
	The examples are provided with batch files in this format.
	This is an alternate way to compiling than using the IDE.
	It allows your projects with multiple include files to be organized.
	You must create your own batch files for this.
	Copy the example batch files to make your own.

Language:

	Only unsigned integers may be used in expressions.
	Pointers may be used wherever variables are used.
	Operator precedence is *, /, +, -, <, >, <=, >=, =, <>, &, and |.
	The & is the and operator. The | is the or operator.
	USe >=1 instead of >0. Using >0 causes an error.
	Use \ at the end of your echo to omit the new line.

Strings:

	String variables must have a $ at the end. (except when declared)
	Declaring a string looks like str$ name[''].
	String variables look like name$.
	When declaring strings, you may include more than one element.
	For example str$ text['hello,',32,255] defines a combo of str and char data.

Arrays:

	Define arrays using int@ arrayname[0] except with the array size instead of 0.
	Only numbers may be used as the array size. No variables.
	Arrays may be used in expressions, with input, and with echo.
	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 @arrayname{0} with the index pointer instead of 0.
	Variables and numbers may be used as index pointers.
	Any other expression including operators may not be used in the index section.
	Arrays are indexed with a starting position of 0.
	The range is 0 to the specified index - 1.

Keywords:

	;
	(semicolon begins a comment)
	(comments must be on their own line)

	Assignment and expressions are in the format or [var]=
	There's no LET command.

	program
	(REQUIRED: program name - assign name to program)
	(name has to match the source file name without the extension)

	data
	(start variable declarations)

	int
	(int var[0] - declares integer variable)

	int@
	(int@ arrayvar[10] - declares an array of ten elements)

	begin
	(REQUIRED: begin main code section)

	if
	(if EXPRESSION then jumplabel - jumps to a label if expression is true)
	(if EXPRESSION then ... endif - execute until endif if expression is true)
	(anonymous labels are supported. @b and @f)

	endif
	(end of if statement block)

	carry
	(carry [var] - places remainder of last division operation in a variable)

	0
	(0 [var] - assign zero to a variable)

	+1
	(+1 [var] - add one to a variable)

	-1
	(-1 [var] - subtract one from a variable)

	goto
	(goto jumplabel - jumps to a label)
	(anonymous labels are supported. @b and @f)

	label
	(label jumplabel - sets a jump location for goto and if)
	(anonymous labels are supported. @@)

	call
	(call subname - calls a sub)

	sub
	(sub subname - sets a sub function label for call)

	ret
	(return from a sub call)

	echo
	(echo "some string data" - prints string data to the screen)
	(echo [var] - prints the value of a variable to the screen)

	cursor
	(cursor [x],[y] - moves the text output position)
	(variables or numbers may be used as parameters)

	input
	(input [var] - returns up to five digits of user input to a variable)

	crlf
	(print carriage return line feed to the screen)

	bell
	(Rings the PC speaker bell by echoing ascii character 7)

	chr
	(chr [ascii] - echo the character of any ascii value)
	(variables or numbers may be used as parameters)

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

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

	compare
	(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
	(length [returnvalue],string$)
	(returns the length of string$)

	find
	(find [returnvalue],string$,'x')
	(returns the first occurance in string$ of 'x' or any other character)

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

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

	intstr
	(intstr string$,[value])
	(converts a value to a string)

	strint
	(strint [value],string$)
	(converts a string to a value)

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

	lower
	(converts a string to all lower case)

	pause
	(halt program execution until any key is pressed to a variable)

	scankey
	(scankey [var] - returns the ascii value of any key being pressed)

	onkey
	(onkey jumplabel - jumps to a label when any key is pressed)

	cls
	(cls - clear screen contents to white on black and reset cursor)
	(cls [color],[scroll],[x1],[x2],[y1],[y2] - sets screen colors and reset cursor)

	kill
	(halt execution and return to DOS or IDE)

	end
	(marks end of main code and beginning of sub section)

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

	include
	(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

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.
