BASIC Functions


Cmd       Abbr/Ex.            Comment

Arithmetic Functions

ABS       Y=ABS(X)            Absolute value - |X|
CLOG      Y=CLOG(X)           Base 10 logarithm
EXP       Y=EXP(X)            Inverse of LOG - e^X
INT       Y=INT(X)            Integer, rounds down: INT(-4.5) = -5
LOG       Y=LOG(X)            Natural logarithm, e=2.71...
RND       Y=RND(X)            Random number between 0 and 1 
                               (value of X is irrelevent)
SGN       Y=SGN(X)            Evaluates sign of X; Y=-1,0,1
SQR       Y=SQR(X)            Square root

Trig Functions (others are derived)

ATN       Y=ATN(X)            Inverse tangent  (Arctan)
COS       Y=COS(X)            Cosine
SIN       Y=SIN(X)            Sine
DEG       DEG                 Use degrees for angle measurements
RAD       RAD                 Use radians for angle measurements (default)

Special Functions

ADR       Y=ADR(X$)           Memory address of string
FRE       ? FRE(0)            Remaining free space in RAM (in pages)
PEEK      Y=PEEK(X)           Contents of memory at address X
USR       Y=USR(X)            Result of machine language program
                               at memory address X

String Functions

ASC       Y=ASC(X$)           ATASCII code of first byte of X$
CHR$      Y$=CHR$(X)          Character with ATASCII value X
LEN       Y=LEN(X$)           Length of string
STR$      Y$=STR$(X)          Convert number to string - STR$(12) = "12"
VAL       Y=VAL(X$)           Convert string to number - VAL("12") = 12
substring Y$=X$(5,8)          Y$ contains the 5th through 8th
                               character of X$

Graphics/Sound ( X increases right, Y increases down )

GET #6    GE. #6,A            Input data from screen
GRAPHICS  GR. M               Reset graphics mode to mode M
COLOR     C. 3                Set color number for PLOT or DRAWTO
DRAWTO    DR. X,Y             Draw line to screen coordinate
LOCATE    LOC. X,Y,A          Set A to the COLOR number of coordinate X,Y
PLOT      PL. X,Y             Plot a graphics point
POSITION  POS. X,Y            Set cursor position
PUT #6    PU. #6,A            Output data to screen
SETCOLOR  SE. R,H,L           Change Hue and Luminance of color Register
SOUND     SO. V,P,D,L         Turn on sound: Voice (0-3), Pitch (0-255),
                               Distortion (0-14 even), Loudness (0-15)
XIO 18    X. 18,#6,0,0,"S:"   Fill bounded area of screen with
                               color in memory location 765

Controller Functions

PADDLE    Y=PADDLE(X)         Paddle value, Y=0 to 228
                              400/800: X=0 to 7     XL/XE: X=0 to 3
PTRIG     Y=PTRIG(X)          Paddle trigger, Y=0 if pressed, 1 if not
                              400/800: X=0 to 7     XL/XE: X=0 to 3
STICK     Y=STICK(X)          Joystick position
                              400/800: X=0 to 3     XL/XE: X=0 or 1
STRIG     Y=STRIG(X)          Joystick trigger, Y=0 if pressed, 1 if not
                              400/800: X=0 to 3     XL/XE: X=0 or 1