plusBASIC Quick Reference - fvdhoef/aquarius-plus GitHub Wiki

plusBASIC Quick Reference Guide

Literals

  • Numeric literals evaluate to floating point or integer numbers.
    • {+|-}{digit...|{digit}{.}{digit...}}{E{+|-}digit...} - A floating point decimal number.
    • {+|-}{digit...} - An integer decimal number.
    • $hexdigit... - An integer hexadecimal number.
    • 'character' - An integer number equal to the ASCII code of character.
  • String literals evaluate to a string of ASCII characters.
    • "{character...}" - A string containing the specified characters.
    • $"{hexdigit...}" - A string containing the characters specified by each two-digit hexadecimal number.
    • \"{{\}character}..." - A string containing C style escape codes.

Variables

  • Numeric variables contain an floating point or integer numbers.
    • alpha{alphanum|~...} - Numeric variable.
    • alpha{alphanum|~...}((index{,index...}) - Numeric array element.
  • String variables contain a string of ASCII characters.
    • alpha{alphanum|~...}$ - String variable.
    • alpha{alphanum|~...}$((index{,index...}) - String array element.
  • String slices represent a substring of a string variable.
    • var$[pos] - Character pos of string variable var$.
    • var$[start TO end] - Characters start through end of string variable var$.
    • array$(...)[pos] - Character pos of string array element array$(...).
    • array$(...)[start TO end] - Characters start through end of string array element array$(...).

Operators

  • Arithmetic operations evaluate performed using floating point math.
    • - expression - Negate expression
    • expression + expression - Add second expression to first expression.
    • expression - expression - Subtract second expression from first expression.
    • expression * expression - Multiply first expression by second expression.
    • expression / expression - Divide first expression by second expression.
    • expression ^ expression - Raise first expression to power second expression.
    • expression MOD expression - Calculate the remainder of the first expression divided by the second expression.
  • Relational operations return -1 if true, 0 if false.
    • expression > expression - True if first expression is greater than second expression.
    • expression = expression - True if first expression is equal second expression.
    • expression < expression - True if first expression is less than second expression.
    • expression >= expression - True if first expression is greater than or equal to second expression.
    • expression <= expression - True if first expression is less than or equal to second expression.
  • Logical operators perform the corresponding boolean operation on the bits of the each integer expression.
    • NOT integer - Sets resulting bit to 1 if the operand bit is 0.
    • integer AND integer - Sets resulting bit to 1 if both operand bits are 1.
    • integer OR integer - Sets the resulting bit to 1 if either operand bit is 1.
    • integer XOR integer - Sets resulting bit to 1 if one operand bits is 1, and the other is 0.
    • integer IMP integer - Not implemented.
  • String operators create new temporary string.
    • string + string - Concatenates second string to the end of first string.
    • string %% (expression{,...}) - Perform string substitution.

Special Characters

  • _label - Line label. Valid at the beginining of a line, or as the operand of a GOTO or GOSUB.
  • 'comment - Shortcut for REM. Valid at the beginning of a line, or after a statement terminating colon.

Direct Mode Aliases

  • / - Performs the LIST command.
  • $ - Performs the DIR command.
  • LS - Performs the DIR command.

Statements and Functions

PRINT control characters

  • CHR$(8) / $"08" - Move cursor left, wrapping to previous line, and delete character in the new position.
  • CHR$(10) / $"0A" - Move cursor down one line or scroll screen up if on last line.
  • CHR$(11) / $"0B" - Clear screen to default colors and do SET COLOR OFF and SET CURSOR ON.
  • CHR$(13) / $"0D" - Move cursor to first column of line.

Error Codes

  • 1 - NEXT without FOR
  • 2 - Syntax
  • 3 - RETURN without GOSUB
  • 4 - Out of DATA
  • 5 - Illegal quantity
  • 6 - Overflow
  • 7 - Out of memory
  • 8 - Undefined line number
  • 9 - Subscript out of range
  • 10 - Duplicate definition
  • 11 - Division by zero
  • 12 - Illegal direct
  • 13 - Type mismatch
  • 14 - Out of string space
  • 15 - String too long
  • 16 - String formula too complex
  • 17 - Can't continue
  • 18 - Undefined user function
  • 19 - Missing operand
  • 20 - No RESUME
  • 21 - RESUME without GOSUB
  • 22 - Unprintable
  • 23 - Line buffer overflow
  • 24 - Statement not implemented
  • 25 - Undefined line label
  • 26 - ARGS without GOSUB
  • 27 - Undimensioned array
  • 28 - Too many operands
  • 29 - Invalid mode
  • 30 - Bad range
  • 31 - Empty string
  • 32 - String length
  • 49 - Bad file
  • 50 - File not found
  • 51 - Too many files
  • 52 - Invalid parameter
  • 53 - Input past end
  • 54 - File already exists
  • 55 - I/O
  • 56 - No disk
  • 57 - Not empty