Publication 1746-UM004A-US-P
4-6 Programming Overview
BASIC Operators
BASIC operators are programming instructions that are executed during Run
mode. Typically these operators perform a predefined operation on either variables
or constants. Operators require either one or two operands. Table 4.6 lists the
BASIC programming operators.
Table 4.6 BASIC Operators
Operator Function Examples
ABS ( ) Return the absolute value of expression. ABS (-3)
( ) + ( ) Add expressions together. 1+1
ASC ( ) Return integer value of ASCII character. ASC (3)
ATN ( ) Return arraignment of argument. ATN (1)
CHR ( ) Convert numeric expression to ASCII value. CHR (65)
COS ( ) Return the cosine of argument. COS (0)
( ) / ( ) Divide first expression by second expression. 10/2
EOF Test for empty input buffer. IF (NOT(EOF))
EXP ( ) Raise number to power of argument. EXP (10)
( ) ** ( ) Raise first expression by the power of the second
expression.
2**4
FREE List available bytes in RAM. FREE=
GET Read console. P. GET
INT ( ) Return integer portion of expression. INT (3.2)
IP Read/assign IP register. IP=0
LEN List amount of bytes in current program. LEN
LOG ( ) Return the natural log of the argument. LOG (10)
( ) .AND. ( ) Combine the first expression with the second expression
using .AND..
10.AND.5
( ) .OR. ( ) Combine the first expression with the second expression
using .OR..
2.OR.1
( ) .XOR. ( ) Combine the first expression with the second expression
using .XOR..
3.XOR.2
MTOP Return last valid memory address. PRINT MTOP
( ) * ( ) Multiply expressions together. 4*4
p Store constant. 3.1415926
RND Return a random number. RND
SGN ( ) Return the sign of argument. SGN (-5)
SIN ( ) Return the sine of argument. SIN (3.14)
SQR ( ) Return the square root of the argument. SQR (100)
( ) - ( ) Subtract one expression from another. 8-4
TAN ( ) Return the tangent of argument. TAN (.707)
TCON Read/assign TCON register. TCON=10H
TIME Read/assign the free running clock. P. TIME
XBY ( ) Read/assign external data memory. P. XBY (10)
( ) = ( ) Allow the first expression to equal the second expression. 10=10