Killing the internet one fake blog post at a time.

List of AppleSoft BASIC commands.

Written in

by

Here is a list of all the commands available in Applesoft BASIC, along with a brief explanation of how to use each one:

  1. ABS – Returns the absolute value of a number. Example: ABS(-5)
  2. ASC – Returns the ASCII value of a character. Example: ASC("A")
  3. ATN – Returns the arctangent of a number. Example: ATN(0.5)
  4. CALL – Calls a machine language subroutine. Example: CALL 768
  5. CHR$ – Returns a character given an ASCII code. Example: CHR$(65)
  6. CLOSE – Closes a file that was previously opened. Example: CLOSE
  7. CONT – Continues program execution after a STOP or END statement. Example: CONT
  8. COS – Returns the cosine of an angle in radians. Example: COS(3.14)
  9. DATA – Defines a list of data values that can be read with the READ statement. Example: DATA 1,2,3
  10. DEF – Defines a user-defined function. Example: DEF FNDOUBLE(X)=2*X
  11. DIM – Allocates memory for an array. Example: DIM A(10)
  12. END – Ends program execution. Example: END
  13. EXP – Returns the exponential value of a number. Example: EXP(2)
  14. FN – Calls a user-defined function. Example: FNDOUBLE(5)
  15. FOR – Starts a loop that runs a specified number of times. Example: FOR I=1 TO 10
  16. FRE – Returns the amount of free memory in bytes. Example: FRE()
  17. GET – Reads a character from a file. Example: GET #1, A$
  18. GOSUB – Jumps to a subroutine, then returns to the calling line. Example: GOSUB 100
  19. GOTO – Jumps to a specified line of code. Example: GOTO 100
  20. IF – Tests a condition and executes code based on the result. Example: IF X>5 THEN PRINT "GREATER"
  21. INPUT – Prompts the user to enter a value. Example: INPUT "ENTER YOUR NAME: ", NAME$
  22. INT – Rounds a number down to the nearest integer. Example: INT(3.5)
  23. LEFT$ – Returns a specified number of characters from the beginning of a string. Example: LEFT$("APPLE",3)
  24. LEN – Returns the length of a string. Example: LEN("APPLE")
  25. LET – Assigns a value to a variable. Example: LET X=5
  26. LIST – Displays the code of a program. Example: LIST
  27. LOAD – Loads a program from disk into memory. Example: LOAD "MYPROG.DSK"
  28. LOG – Returns the natural logarithm of a number. Example: LOG(10)
  29. MID$ – Returns a specified number of characters from the middle of a string. Example: MID$("APPLE",2,3)
  30. NEW – Clears the memory and starts a new program. Example: NEW
  31. NEXT – Ends a FOR loop and goes to the next iteration. Example: NEXT
  32. NOT – Returns the logical complement of a Boolean value. Example: NOT (X>5)
  33. ON – Specifies a series of statements to execute based on the value of an expression. Example: ON X GOTO 100,200,300
  34. OPEN – Opens a file for input or output. Example: OPEN "MYFILE.DAT" FOR INPUT AS #1
  35. OR – Performs a logical OR operation on two Boolean values. Example: IF X>5 OR Y<10 THEN PRINT "TRUE"
  36. PEEK – Returns the value of a memory location. Example: PEEK(49152)
  37. POKE – Sets the value of a memory location. Example: POKE 49152, 255
  38. POP – Restores the previous value of the stack pointer. Example: POP
  39. PRINT – Displays text or a value on the screen. Example: PRINT "HELLO WORLD"
  40. READ – Reads a value from a list of data. Example: READ X
  41. REM – Inserts a comment in the code. Example: REM THIS IS A COMMENT
  42. RESTORE – Resets the data pointer to the beginning of the list. Example: RESTORE
  43. RETURN – Returns from a subroutine. Example: RETURN
  44. RIGHT$ – Returns a specified number of characters from the end of a string. Example: RIGHT$("APPLE",3)
  45. RND – Returns a random number. Example: RND
  46. RUN – Runs a program. Example: RUN
  47. SGN – Returns the sign of a number. Example: SGN(-5)
  48. SIN – Returns the sine of an angle in radians. Example: SIN(1)
  49. SPC – Inserts a number of spaces on the screen. Example: PRINT "HELLO"; SPC(10); "WORLD"
  50. SQR – Returns the square root of a number. Example: SQR(25)
  51. STOP – Halts program execution. Example: STOP
  52. STR$ – Converts a number to a string. Example: STR$(5)
  53. SYS – Calls a machine language routine. Example: SYS 49152
  54. TAB – Moves the cursor to a specific column on the screen. Example: PRINT TAB(10);"HELLO"
  55. THEN – Used with the IF statement to specify the code to execute if the condition is true. Example: IF X>5 THEN PRINT "GREATER"
  56. TIME – Returns the current time in seconds. Example: TIME
  57. USR – Calls a machine language routine. Example: A=USR(49152)
  58. VAL – Converts a string to a number. Example: X=VAL("5")
  59. VERIFY – Verifies that a program on disk matches the program in memory. Example: VERIFY "MYPROG.DSK"
  60. WAIT – Pauses program execution for a specified number of seconds. Example: WAIT 5
  61. WEND – Ends a WHILE loop. Example: WHILE X<10: PRINT X: X=X+1: WEND
  62. 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.

Tags