Here is a list of all the commands available in Applesoft BASIC, along with a brief explanation of how to use each one:
- ABS – Returns the absolute value of a number. Example:
ABS(-5)
- ASC – Returns the ASCII value of a character. Example:
ASC("A")
- ATN – Returns the arctangent of a number. Example:
ATN(0.5)
- CALL – Calls a machine language subroutine. Example:
CALL 768
- CHR$ – Returns a character given an ASCII code. Example:
CHR$(65)
- CLOSE – Closes a file that was previously opened. Example:
CLOSE
- CONT – Continues program execution after a STOP or END statement. Example:
CONT
- COS – Returns the cosine of an angle in radians. Example:
COS(3.14)
- DATA – Defines a list of data values that can be read with the READ statement. Example:
DATA 1,2,3
- DEF – Defines a user-defined function. Example:
DEF FNDOUBLE(X)=2*X
- DIM – Allocates memory for an array. Example:
DIM A(10)
- END – Ends program execution. Example:
END
- EXP – Returns the exponential value of a number. Example:
EXP(2)
- FN – Calls a user-defined function. Example:
FNDOUBLE(5)
- FOR – Starts a loop that runs a specified number of times. Example:
FOR I=1 TO 10
- FRE – Returns the amount of free memory in bytes. Example:
FRE()
- GET – Reads a character from a file. Example:
GET #1, A$
- GOSUB – Jumps to a subroutine, then returns to the calling line. Example:
GOSUB 100
- GOTO – Jumps to a specified line of code. Example:
GOTO 100
- IF – Tests a condition and executes code based on the result. Example:
IF X>5 THEN PRINT "GREATER"
- INPUT – Prompts the user to enter a value. Example:
INPUT "ENTER YOUR NAME: ", NAME$
- INT – Rounds a number down to the nearest integer. Example:
INT(3.5)
- LEFT$ – Returns a specified number of characters from the beginning of a string. Example:
LEFT$("APPLE",3)
- LEN – Returns the length of a string. Example:
LEN("APPLE")
- LET – Assigns a value to a variable. Example:
LET X=5
- LIST – Displays the code of a program. Example:
LIST
- LOAD – Loads a program from disk into memory. Example:
LOAD "MYPROG.DSK"
- LOG – Returns the natural logarithm of a number. Example:
LOG(10)
- MID$ – Returns a specified number of characters from the middle of a string. Example:
MID$("APPLE",2,3)
- NEW – Clears the memory and starts a new program. Example:
NEW
- NEXT – Ends a FOR loop and goes to the next iteration. Example:
NEXT
- NOT – Returns the logical complement of a Boolean value. Example:
NOT (X>5)
- ON – Specifies a series of statements to execute based on the value of an expression. Example:
ON X GOTO 100,200,300
- OPEN – Opens a file for input or output. Example:
OPEN "MYFILE.DAT" FOR INPUT AS #1
- OR – Performs a logical OR operation on two Boolean values. Example:
IF X>5 OR Y<10 THEN PRINT "TRUE"
- PEEK – Returns the value of a memory location. Example:
PEEK(49152)
- POKE – Sets the value of a memory location. Example:
POKE 49152, 255
- POP – Restores the previous value of the stack pointer. Example:
POP
- PRINT – Displays text or a value on the screen. Example:
PRINT "HELLO WORLD"
- READ – Reads a value from a list of data. Example:
READ X
- REM – Inserts a comment in the code. Example:
REM THIS IS A COMMENT
- RESTORE – Resets the data pointer to the beginning of the list. Example:
RESTORE
- RETURN – Returns from a subroutine. Example:
RETURN
- RIGHT$ – Returns a specified number of characters from the end of a string. Example:
RIGHT$("APPLE",3)
- RND – Returns a random number. Example:
RND
- RUN – Runs a program. Example:
RUN
- SGN – Returns the sign of a number. Example:
SGN(-5)
- SIN – Returns the sine of an angle in radians. Example:
SIN(1)
- SPC – Inserts a number of spaces on the screen. Example:
PRINT "HELLO"; SPC(10); "WORLD"
- SQR – Returns the square root of a number. Example:
SQR(25)
- STOP – Halts program execution. Example:
STOP
- STR$ – Converts a number to a string. Example:
STR$(5)
- SYS – Calls a machine language routine. Example:
SYS 49152
- TAB – Moves the cursor to a specific column on the screen. Example:
PRINT TAB(10);"HELLO"
- THEN – Used with the IF statement to specify the code to execute if the condition is true. Example:
IF X>5 THEN PRINT "GREATER"
- TIME – Returns the current time in seconds. Example:
TIME
- USR – Calls a machine language routine. Example:
A=USR(49152)
- VAL – Converts a string to a number. Example:
X=VAL("5")
- VERIFY – Verifies that a program on disk matches the program in memory. Example:
VERIFY "MYPROG.DSK"
- WAIT – Pauses program execution for a specified number of seconds. Example:
WAIT 5
- WEND – Ends a WHILE loop. Example:
WHILE X<10: PRINT X: X=X+1: WEND
- WHILE – Starts a loop that runs as long as a condition is true. Example:
WHILE X<10: PRINT X: X=X+1: WEND
These are the basic commands available in Applesoft BASIC, and this list should be a helpful reference for anyone learning or using the language.