QBasic GW-BASIC
Legend
  Functions have some differences
--- Function not available
Declarations
DIM  DIM  Declares an array
REDIM --- Declares or resizes a dyname array, erasing any previous values
CONST --- Exchanges the values of two variables
STATIC --- Makes a variable local to a procedure, preserves value between calls
SHARED --- Gives a procedure access to module-level variables
TYPE --- Defines a data type containing one or more elements (user-defined type)
LET  LET  Assigns the value of an expression to a variable
SWAP  SWAP 
CLEAR  CLEAR  To set all numeric variables to zero, all string variables to null, and to close all open files.
DATA  DATA  To store the numeric and string constants that are accessed by the program READ statement(s).
READ  READ  To read values from a DATA statement and assign them to variables.
RESTORE  RESTORE  To allow DATA statements to be reread from a specified line.
CINT  CINT  To round numbers with fractional portions to the next whole number or integer.
CDBL  CDBL  To convert x to a double-precision number.
CSNG  CSNG  To convert x to a single-precision number.
CLNG --- Rounds a numeric expression to a long
CVD  CVD  To convert string values to numeric values.
CVI  CVI  To convert string values to numeric values.
CVS  CVS  To convert string values to numeric values.
CVL --- To convert string values to numeric values.
CVSMBF --- To convert string values to numeric values.
CVDMBF --- To convert string values to numeric values.
DEFINT  DEFINT  To declare variable types as integer
DEFDBL  DEFDBL  To declare variable types as double
DEFSNG  DEFSNG  To declare variable types as single
DEFSTR  DEFSTR  To declare variable types as string
DEFLNG --- To declare variable types as long
Arithmetic
ABS ABS To return the absolute value of the expression n.
EXP  EXP  To return e (the base of natural logarithms) to the power of x.
FIX  FIX  To truncate x to a whole number.
HEX$  HEX$  To return a string which represents the hexadecimal value of the numeric argument.
INT  INT  To truncate an expression to a whole number.
LOG  LOG  To return the natural logarithm of x.
MOD Operator --- Divides on number by another and returns the remainder
OCT$  OCT$  To convert a decimal value to an octal value.
RANDOMIZE  RANDOMIZE  To reseed the random number generator.
RND  RND  To return a random number between 0 and 1.
SGN  SGN  To return the sign of x.
SQR  SQR  Returns the square root of x.
Boolean
NOT NOT Returns bit-wise complement Expr1 Expr2 NOT AND OR XOR EQV IMP
AND AND Returns conjunction T T F T T F T T
OR OR Returns disjunction T F F F T T F F
XOR XOR Returns exclusive "or" F T T F T T F T
EQV EQV Returns equivalance F F T F F F T T
IMP IMP Returns implication
Trigonometry
ATN  ATN  To return the arctangent of x, when x is expressed in radians.
COS  COS  To return the cosine of the range of x.
SIN  SIN  To calculate the trigonometric sine of x, in radians.
TAN  TAN  To calculate the trigonometric tangent of x, in radians.
Arrays
ERASE  ERASE  To eliminate arrays from a program.
OPTION BASE  OPTION BASE  To declare the minimum value for array subscripts.
Ubound --- Returns upper bound (index) of an array for the specified array dimension
Lbound --- Returns lower bound (index) of an array for the specified array dimension
Strings
UCASE$ --- Convert strings to all uppercase
LCASE$ --- Convert strings to all lowercase
LTRIM$ --- Remove leading spaces from a string
RTRIM$ --- Remove trailing spaces from a string
ASC  ASC  To return a numeric value that is the ASCII code for the first character of the string x$.
CHR$  CHR$  To convert an ASCII code to its equivalent character.
LEFT$  LEFT$  To convert an ASCII code to its equivalent character.
RIGHT$  RIGHT$  To return the rightmost n characters of string x$.
MID$  MID$  To replace a portion of one string with another string.
INSTR  INSTR  To search for the first occurrence of string y$ in x$, and return the position at which the string is found.
MKD$  MKD$  To convert numeric values to string values.
MKI$  MKI$  To convert numeric values to string values.
MKS$  MKS$  To convert numeric values to string values.
MKL$ --- To convert numeric values to string values.
MKDMBF$ --- To convert numeric values to string values.
MKSMBF$ --- To convert numeric values to string values.
VAL  VAL  Returns the numerical value of string x$.
LEN  LEN  To return the number of characters in x$.
RSET  RSET  To move data from memory to a random-file buffer and left- or right-justify it in preparation for a PUT statement.
LSET  LSET  To move data from memory to a random-file buffer and left- or right-justify it in preparation for a PUT statement.
SPACE$  SPACE$  To return a string of x spaces.
STR$  STR$  To return a string representation of the value of x.
STRING$  STRING$  To return string of length OR first character of X$
Date/Time
DATE$  DATE$  To set or retrieve the current date.
TIME$  TIME$  To set or retrieve the current time.
TIMER  TIMER  To return single-precision floating-point numbers representing the elapsed number of seconds since midnight or system reset.
WAIT  WAIT  To suspend program execution while monitoring the status of a machine input port.
Graphics - Screen
SCREEN SCREEN To set the specifications for the display screen.  (screen 0 = text, screen n = resolution) and switch between pages
COLOR  COLOR  To select display colors
PALETTE  PALETTE  Changes one or more of the colors in the palette
PALETTE USING  PALETTE USING  Changes one or more of the colors in the palette
PCOPY  PCOPY  To copy one screen page to another in all screen modes.
CLS  CLS  To clear the screen.
WINDOW  WINDOW  To draw lines, graphics, and objects in space not bounded by the physical  limits of the screen.
VIEW  VIEW  To define a physical viewport limit from x1,y1 (upper-left x,y coordinates) to x2,y2 (lower-right x,y coordinates).
PMAP  PMAP  To map expressions to logical or physical coordinates.
Graphics - General
CIRCLE  CIRCLE  To draw a circle, ellipse, and angles on the screen during use of the Graphics mode.
LINE  LINE  To draw lines and boxes on the screen.
PSET  PSET  To display a point at a specified place on the screen during use of the graphics mode.
PRESET  PRESET  To display a point at a specified place on the screen during use of the graphics mode.
POINT  POINT  To read the color or attribute value of a pixel from the screen.
DRAW  DRAW  To draw a figure.
PAINT  PAINT  To fill in a graphics figure with the selected attribute.
GET GET To transfer graphics images from the screen.
PUT PUT To transfer graphics images from the screen.
Graphics - Text Mode
WIDTH  WIDTH  To set the printed line width in number of characters for the screen and line printer.
VIEW PRINT  VIEW PRINT  To set the boundaries of the screen text window.
Screen Screen To return the ASCII code (0-255) for the character at the specified row (line) and column on the screen.
CSRLIN CSRLIN To return the current line (row) position of the cursor.
POS  POS  To return the current cursor position.
LOCATE  LOCATE  To move the cursor to the specified position on the active screen
TAB  TAB  Spaces to position n on the screen.
SPC  SPC  To skip a specified number of spaces in a PRINT or an LPRINT statement.
PRINT  PRINT  To output a display to the screen.
PRINT USING  PRINT USING  To print strings or numbers using a specified format.
WRITE  WRITE  To output data to the screen.
Flow Control
Select Case --- Executes one of several statements depending on the value of an expression
DO-LOOP --- Repates a block of statements while a condition is true or until a condition is false
GOSUB-RETURN  GOSUB-RETURN  To branch to, and return from, a subroutine.
GOTO  GOTO  To branch unconditionally out of the normal program sequence to a specified line number.
  
ON-GOSUB  ON-GOSUB  To branch to one of several specified line numbers, depending on the value returned when an expression is evaluated.
ON-GOTO  ON-GOTO  To branch to one of several specified line numbers, depending on the value returned when an expression is evaluated.
FOR … NEXT FOR … NEXT To execute a series of instructions a specified number of times in a loop.
WHILE-WEND  WHILE-WEND  To execute a series of statements in a loop as long as a given condition is true.
IF  IF  To make a decision regarding program flow based on the result returned by an expression.
STOP  STOP  To terminate program execution and return to command level.
END  END  To terminate program execution, close all files, and return to command level.
EXIT --- Exits a DO or FOR loop, Function or Sub procedure, or a DEF FN function
RETURN  RETURN  To return from a subroutine.
SYSTEM  SYSTEM  To return to MS-DOS.
Subroutines
Sub --- Defines a SUB procedure
Function --- Defines a Function procedure
DEF FN  DEF FN  To define and name a function written by the user.
STATIC --- Makes a variable local to a procedure, preserves value between calls
DECLARE --- Declares Function/Sub procedure and invokes argument data type checking
Assembly Language
Call Absolute CALL Transfers control to a machine-language procedure
--- DEF USR  To specify the starting address of an assembly language subroutine to be called from memory by the USR function.
--- USR  To call an assembly language subroutine.
Exceptions (Errors)
TROFF  TROFF  To trace the execution of program statements.
TRON  TRON  To trace the execution of program statements.
ERDEV ERDEV To return the actual value (ERDEV) of a device error, and the name of the device (ERDEV$) causing the error.
ERDEV$ ERDEV$ To return the actual value (ERDEV) of a device error, and the name of the device (ERDEV$) causing the error.
ERL ERL To return the error code (ERR) and line number (ERL) associated with an error.
ERR ERR To return the error code (ERR) and line number (ERL) associated with an error.
--- EXTERR  To return extended error information.
ON ERROR GOTO  ON ERROR GOTO  To enable error trapping and specify the first line of the error-handling subroutine.
RESUME  RESUME  To continue program execution after an error-recovery procedure has been  performed.
ERROR  ERROR  To simulate the occurrence of an error, or to allow the user to define error codes.
Directories
CHDIR  CHDIR  To change from one working directory to another
MKDIR  MKDIR  To create a subdirectory.
RMDIR RMDIR To delete a subdirectory
Files
BLOAD  BLOAD  To load an image file anywhere in user memory.
BSAVE  BSAVE  To save portions of user memory on the specified device.
DEF SEG  DEF SEG  To assign the current segment address to be referenced by a subsequent BLOAD, BSAVE, CALL, PEEK, POKE, or USR.
LOCK  LOCK  To restrict the access to all or part of a file that has been opened by another process
UNLOCK  UNLOCK  To release locks that have been applied to an opened file
INPUT#  INPUT#  To read data items from a sequential file and assign them to program variables
LINE INPUT#  LINE INPUT#  To read an entire line (up to 255 characters), without delimiters, from a sequential disk file to a string variable.
PRINT#  PRINT#  To write data to a sequential disk file.
PRINT# USING  PRINT# USING  To write data to a sequential disk file.
WRITE#  WRITE#  To write data to a sequential file.
KILL  KILL  To delete a file from a disk.
NAME  NAME  To change the name of a disk file.
OPEN  OPEN  To establish input/output (I/O) to a file or device
CLOSE  CLOSE  To terminate input/output to a disk file or a device.
FreeFile ---
CLEAR  CLEAR  To set all numeric variables to zero, all string variables to null, and to close all open files.
EOF  EOF  To return -1 (true) when the end of a sequential or a communications file has been reached, or to return 0 if end of file (EOF) has not been found.
RESET  RESET  To close all disk files and write the directory information to a diskette before it is removed from a disk drive.
GET GET To read a record from a random disk file into a random buffer
FIELD  FIELD  To allocate space for variables in a random file buffer.
PUT PUT To write a record from a random buffer to a random disk file.
SEEK --- Returns/sets the current file position
LOC  LOC  To return the current position in the file.
LOF  LOF  To return the length (number of bytes) allocated to the file
FILEATTR --- Returns information about an open file
Keyboard
INPUT  INPUT  To prepare the program for input from the terminal during program execution.
INPUT$  INPUT$  To return a string of x characters read from the keyboard, or from file number
LINE INPUT  LINE INPUT  To input an entire line (up to 255 characters) from the keyboard into a string variable, ignoring delimiters.
Line Printer
LPOS  LPOS  To return the current position of the line printer print head within the line printer buffer.
LPRINT  LPRINT  To print data at the line printer
LPRINT USING  LPRINT USING  To print data at the line printer
SPC  SPC  To skip a specified number of spaces in a PRINT or an LPRINT statement.
SOUND 
BEEP  BEEP  To sound the speaker at 800 Hz (800 cycles per second) for one-quarter of a second.
PLAY  PLAY  To play music by embedding a music macro language into the string data type.
PLAY(n)  PLAY(n)  To return the number of notes currently in the background music queue.
SOUND  SOUND  To generate sound through the speaker.
Light Pen
PEN PEN To read the light pen.
Joystick
STICK  STICK  To return the x and y coordinates of two joysticks.
STRIG  STRIG  To return the status of the joystick triggers.
STRIG(n)  STRIG(n)  To allow the use of a joystick by enabling or disabling the trapping of its buttons.
System Calls
SLEEP --- Suspends program execution for a specified number of seconds
ENVIRON  ENVIRON  To allow the user to modify parameters in GW-BASIC's environment string table
ENVIRON$  ENVIRON$  To allow the user to retrieve the specified environment string from the environment table.
FRE  FRE  To return the number of available bytes in allocated string memory.
INKEY$ INKEY$ To return one character read from the keyboard.
OUT  OUT  To send a byte to a machine output port.
INP  INP  To return the byte read from machine port n.
KEY  KEY  To allow rapid entry of as many as 15 characters into a program with one keystroke by redefining GW-BASIC special function keys.
KEY(n)  KEY(n)  To initiate and terminate key capture in a GW-BASIC program.
PEEK  PEEK  To read from a specified memory location.
POKE  POKE  To write (poke) a byte of data into a memory location.
OPEN "COM(n)  OPEN "COM(n)  To allocate a buffer to support RS-232 asynchronous communications with other computers and peripheral devices in the same manner as OPEN for disk files.
COM(n)  COM(n)  To enable or disable trapping of communications activity to the specified communications adapter.
CHAIN  CHAIN  To transfer control to the specified program and pass (chain) variables to it from the current program.
COMMON  COMMON  To pass variables to a chained program.
SHELL  SHELL  To load and execute another program or batch file
IOCTL  IOCTL  To allow GW-BASIC to send a "control data" string to a character device driver anytime after the driver has been opened.
IOCTL$  IOCTL$  To allow GW-BASIC to read a "control data" string from an open character device driver.
VARPTR  VARPTR  Returns the offset address of a variable
VARPTR$  VARPTR$  Returns a string representation of a variable's address for use in DRAW/PLAY statements
VARSEG --- Returns the segment address of a variable
ON COM(n)  ON COM(n)  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
ON KEY(n)  ON KEY(n)  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
ON PEN  ON PEN  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
ON PLAY(n)  ON PLAY(n)  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
ON STRIG(n)  ON STRIG(n)  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
ON TIMER(n)  ON TIMER(n)  To create an event trap line number for a specified event (such as communications, pressing function or cursor control keys, using the light pen, or using joysticks).
Editor
FILES  FILES  To print the names of the files residing on the specified drive.
--- LOAD  To load a file from diskette into memory.
--- SAVE  To save a program file on diskette.
--- MERGE  To merge the lines from an ASCII program file into the program already in memory.
--- NEW  To delete the program currently in memory and clear all variables.
--- AUTO  To generate and increment line numbers automatically each time you press the RETURN key.
--- RENUM  To renumber program lines.
--- DELETE  To delete program lines or line ranges.
--- EDIT  To display a specified line, and to position the cursor under the first digit of the line number, so that the line may be edited.
--- LIST  To list all or part of a program to the screen, line printer, or file.
--- LLIST  To list all or part of the program currently in memory to the line printer.
REM  REM  To allow explanatory remarks to be inserted in a program.
RUN  RUN  To execute the program currently in memory, or to load a file from the diskette into memory and run it.
--- CONT  To continue program execution after a break.