## BASIC language statements

ATTRB `X,Y`

  Defines the height and width of the characters. The possible values are 0 and 1.

CLEAR `I`[,`J`[`,K`]]

  Erases all variables and reserves space for string storage, highest address for BASIC and graphical characters.

  CLEAR 500
  CLEAR 200,25000

CLS

  Clears display

CONSOLE `top,bottom`

  Reserves the lines between top and bottom for text.

  CONSOLE 5,15
  CONSOLE 0,24

DATA

  Stores data in program for use by READ statement

  DATA January, 31, "Martian History Month".

DEFINT/DEFSNG/DEFSTR `A` [,`B`...]

  Declares the type of a variable as either integer, real or string.

  DEFINT A-B,O-Q defines A,B,O,P and Q as integer

DIM `VARNAME`(`SIZE 1`[,`SIZE2`...])

  Dimensions one or more arrays.

  DIM X(40),A$(7,6),B(10,2)

END

  Terminates program execution. This statement is not required at the end of a program because control flow will end automatically there.

ERL, ERR

  When an error has occurred, the function ERR gives the code number and ERL gives the line number in which the error occurred.

ERROR `N`

  Makes it possible to simulate error number `N`.

EXEC `address`

  Transfers control to machine language programs at `address`.

FOR `VARNAME` = `START` TO `END` [STEP `INCREMENT`]

  Creates a program loop which is executed, for specified range of values, STEP indicates the increment. If STEP omitted, one is used.

GOSUB

  Calls subroutine beginning at specified line number.

GOTO

  Causes immediate program branch to specified line number.

IF `condition` THEN `action 1` ELSE `action 2`

  Tests condition. If true performs action 1 and jumps to next line, if false performs action 2.

INPUT [`PROMPT`;] `VAR1`, `VAR2`

  Causes program to halt for entry from keyboard. The optional prompt string is followed by a question mark and a space. The user may then enter a series of values separated by commas.

  INPUT"ENTER NAME";N$
  INPUT A,B,C,D

LET `VAR` = `EXPR`

  Assigns value to variable. LET is not implemented. Use implied assignment.

  A=42
  Hw$="HELLO WORLD"

LINE INPUT

  Allows input of line from keyboard, including commas. Line is terminated by [ENTER].

LOCATE `I,J,K`

  Place the cursor at location `I,J`

NEXT [`VARNAME`]

  Returns control to a FOR statement to determine whether the loop should be repeated. If the termination condition has not been met, control will proceed with the line following the FOR statement. If the termination condition has been met, control will proceed with the statement following the NEXT.

ON `EXPR` GOSUB `LABEL1`[,`LABEL2`...]

  Multiway branch to specified lines. Upon encountering a RETURN statement, control will return to the statement following the ON GOSUB. The value of `EXPR` is rounded up or down to the nearest integer, and is used as an index into the list of labels, starting with 1. If the index is less than 1 or greater than the number of labels, control falls through to the next statement.

  ON I GOSUB 100,200,300

ON `EXPR` GOTO `LABEL1`[,`LABEL2`...]

  Multiway branch to specified lines. The value of `EXPR` is rounded up or down to the nearest integer, and is used as an index into the list of labels, starting with 1. If the index is less than 1 or greater than the number of labels, control falls through to the next statement.

  ON K GOTO 245,187,310

ON ERROR GOTO

  Directs control to the specified line if a subsequent error is detected.

  ON ERROR GOTO 5000

POKE `location,value`

  Places value in specified memory location. Value must be 0 - 255.

PRINT [`EXPR1`[;|,]`EXPR2`[;|,]...]

  Prints content of following list on screen. Expressions can be ended with semicolons, commas or nothing. Comma causes tab to next 12 column print zone. Semicolon holds print head position. '?' is a synonym for PRINT.

  PRINT"THE ANSWER"
  PRINT A,B
  PRINT "YOU'VE HAD";T;"TRIES"

PRINT TAB(`X`)

  Moves the cursor to the position given in `X`. If the cursor is already past, then moves to next line first.

PRINT USING

  Prints output in specified format.

  # number field
  $ dollar sign in front of number.
  * fills leading spaces with asterisks.
  ^ prints in exponential format.
  + causes sign to be printed.

READ `VAR1`[,`VAR2`...]

  Assigns the next item in a DATA statement to specified variable.

REM `TEXT`

  Allows comments to be inserted in a program. Everything in a line following REM is ignored. The quote (') is a synonym for REM.

RESTORE [`LABEL`]

  Resets the data pointer back to the first item in the first DATA statement or the statement at the specified line number.

  RESTORE
  RESTORE 200

RESUME

  Return to the main program after execution of error subroutine.

RETURN

  Returns the program from subroutine to the statement following GOSUB.

STOP

  Halts execution of program at line containing STOP. Variables are not cleared, so that they can be inspected for debugging purpose. Use CONT to continue execution.