BASIC details


The syntax of this BASIC is much like the original Microsoft BASIC, QBASIC or early versions of Visual BASIC. As part of the compile process a modified version of the C pre-processor is called that allows #include, #define, #ifdef ... #endif, #if ... #endif, #error and #warn

You can try out the BASICtools download here

Purchase the ARM stamp.

Declarations

  • DIM declares a variable or array
  • AS INTEGER declares an integer variable
  • AS SINGLE declares a floating point variable
  • AS STRING declares a string
  • AS BYTE declares an array of bytes
  • PARAMARRAY declares a variable number of arguments
  • CONST declares an integer, single, string or array constant
  • SUB declares a subroutine
  • FUNCTION declares a function that returns a value
  • INTERRUPT SUB declares an interrupt subroutine
  • ' a comment comments
  • Control Flow
  • DO.. UNTIL repeats a block of statement
  • FOR.. NEXT iterates a block of statemets
  • IF..THEN.. ELSE..ENDIF conditional execution
  • SELECT..CASE conditional execution
  • WHILE.. LOOP repeats a block of statements
  • GOTO transfers control
  • GOSUB call subroutine or function (not required)
  • RETURN return from subroutine or function
  • MAIN start of a program
  • EXIT terminates a block of statements
  • STOP enters a debug monitor

    Hardware function

  • AD returns analog value on specific pins (10 bit)
  • BAUD sets the baud rate on the serial channel
  • RXD receive a character on the serial channel
  • TXD send a character to the serial channel
  • *(expression) access hardware registers (like PEEK or POKE)
  • DIR controls direction of a pin
  • HIGH sets a pin to output and high
  • IN reads digital value of a pin
  • INPUT sets a pin as an input
  • IO controls or reads a pin
  • LOW sets a pin as output and low
  • OUT sets state of an output pin
  • OUTPUT sets a pin to be an output
  • INTERRUPT enable or disable interrupts
  • TIMER returns free running counter incrementing each microsecond
  • WAIT waits a number of milliseconds
  • WAITMICRO waits a number of microseconds
  • Strings
  • LEN returns the number of bytes in a string
  • LEFT returns a number of characters on the left of a string
  • RIGHT returns a number of characters on the right of a string
  • STRCHR finds first instance of a character in a string
  • STRCOMP compares two strings

    Conversions

  • CHR converts an ASCII character to a number
  • HEX returns hex value of a string
  • VAL converts a string to a decimal number

    Console functions

  • DEBUGIN accepts input from console
  • PRINT prints to the console
  • PRINTF formatted print (C conventions)

    Operators

  • - subtraction
  • MOD modulus arithmetic
  • * multiply
  • / divide
  • - negate
  • & string concatenation
  • IF ternary operation
  • NOT binary negate
  • AND binary or conditional and
  • OR binary or conditional or
  • XOR binary or conditional exclusive or
  • >> shift right
  • << shift left
  • = equality
  • <> not equals
  • < less than
  • <= less than or equal to
  • > greater than
  • >= greater than or equal to

Purchase the ARM stamp.

Previous Next