2. Basic commands Basic Commands and Statements (Continued) Basic Commands and Statements COMMAND/ STATEMENT EXAMPLE PURPOSE CLR CLR Sets variables to zero or null. CMD CMD D Keep IEEE device D open to monitor bus. CONT CONT Continue program execution after a STOP command. No program changes permitted. GOTO GOTO L Continue program execution at line L after a STOP command. Program changes are permitted. FRE PRINT FIRE (0) Returns number of bytes of available memory. END END Ends program. LET LET A-2 Assign a value to a variable. LIST LIST Lists current program. LIST -L Lists current program through line L. L)ST L-M Lists lines L through M of current program.
L)ST L Lists current program from line L to end. LOAD LOAD Loads next encountered program from built-in tape unit. LOAD "NAME" Loads program NAME from built-in tape LOAD "NAME," D uLonaitd.s program NAME from device D. NEW NEW Deletes current program from memory, sets variables to zero. PEEK PEEK(A) Returns byte value from address A. POKE POKE A,B Loads byte B into address A. PRINT PRINT A Prints value of A on display screen. PRINT A$ Prints specified string on screen. PRINT #L,A Prints value of A on logical file L. PRINT #L,A$ Prints specified string on logical file L. RUN RUN Begins execution of program at lowest line number. RUN L Begins execution of program at line L.
SAVE SAVE Saves current program on built-in tape unit. SAVE "NAME" Saves current program NAME on built-in tape unit. SAVE "NAME,",D Saves current program NAME on device D. SAVE "NAME,",D,C Saves program NAME on device D. C spec ifies EOF or EOT. STOP STOP Stops program execution. SYS SYS(X) Complete control of PET is transferred to a subsystem at decimal address contained in the argument. 40 COMMAND/ STATEMENT EXAMPLE PURPOSE TI$ TI$-"HHMMSS" Sets PET's internal clock to real time. TI PRINT TI Displays number of 'jiffies' since PET was powered up or clock was zeroed. (A jiffy - 1 r'60 of a second.) USR USR(X) Transfers program control to a program whose address is at locations 1 and 2.
X is a parameter passed to and from the machine language program. WAIT WAIT A,B,C Stops execution of BASIC until contents (Note' the WAIT com- of location A, ANDed with B and exclusive mand may not operate ORed with C, is not equal to zero. C is on your particular PET) optional and defaults to zero. CLOSE 10 CLOSE L Closes logical file L. DATA 10 DATA 1,2,3,4 Specifies data to be read from left to right. 20 DATA TOM,SUE Alphabetics do not need to be enclosed in quotes. 30 DATA "TOM DOE" If strings contain spaces, commas, colons, or graphic characters, the string must be enclosed in quotes. 10 DIM A(n) Specifies maximum number of elements DIM in an array or matrix.
20 DIM A(n,m,o,p) Specifies maximum number of dimensions in an array. Number of arrays limited by memory. 30 DIM A(o),B(m) May be dimensioned dynamically. 40 DIM Aft Strings may be dimensioned. 50 DIM A$(n) Terminates program execution. 999 END END GET 10 GET C Accepts single numeric character from keyboard. 20 GET C$ Accepts single string character from keyboard. 30 GET #L,C Accepts single character from specified logical file, 40 GET #L,C$ Accepts specified single string character from logical file. Accepts value of A from keyboard. INPUT 10 INPUT A 20 INPUT A$ Accepts value of string variable A from keyboard. The string does not have to be enclosed in quotes.
30 INPUT A,A$,B,B$ Accepts specified values from keyboard. 40 INPUT #L,A Accepts value of A from logical file L. 50 INPUT #L,A$ Accepts specified string from logical file L. 60 INPUT #L,A,A$,B,B$ Accepts specified values and strings from logical file L. Strings do not have to be enclosed in quotes. 41 COMMAND/ STATEMENT EXAMPLE PURPOSE