ABS(numeric-expression)
The absolute value function returns the unsigned magnitude of its argument. For example, ABS(-1) and ABS(1) are both 1. ■ Example
ASC(stringexpression)
If stringexpression is null, ASC produces a run-time error message (Illegal function call). ■ See Also
ATN(numeric-expression)
The numeric-expression can be of any numeric type. The result is given in radians and is in the range -π/2 to π/2 radians, where π=3.141593. ATN is evaluated by default in single precision unless
BEEP
The BEEP statement makes a sound through the loudspeaker. This statement makes the same sound as the following statement: PRINT CHR$(7)
CALL name«( argumentlist )» name« argumentlist »
The CALL statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
CDBL(numeric-expression)
The numeric-expression may be any numeric expression. This function has the same effect as assigning the numeric expression to a double-precision variable.
CHR$(code)
CHR$ is commonly used to send a special character to the screen or printer. For example, you can send a form feed (CHR$(12)) to clear the screen and return the cursor to the home position.
CINT(numeric-expression)
If numeric-expression is not in the range -32,768 to 32,767, the function produces a run-time error message that reads Overflow. CINT differs from the FIX and INT functions, which truncate, rather than
CLNG(numeric-expression)
If numeric-expression is not in the range -2,147,483,648 to 2,147,483,647, the function produces an error message that reads Overflow. ■ Example
CLS «{0 | 1 | 2}»
There are several ways to use the CLS statement, as described in the following list: Statement Description
CONST constantname = expression «,constantname = expression»...
Argument Description ────────────────────────────────────────────────────────────────────────── constantname A name following the same rules as a BASIC variable name. You may add to the name a
COS(numeric-expression)
The expression, numeric-expression, can be any numeric type. By default, the cosine is calculated in single precision. If numeric-expression is a double-precision value, the cosine is calculated
CSNG(numeric-expression)
The CSNG function has the same effect as assigning the numeric-expression to a single-precision variable. CSNG rounds the value, if necessary, before converting it.
CSRLIN
To return the current column position, use the POS function. ■ See Also
DATA constant1 «,constant2»...
The constant1, constant2, and so on in a DATA statement can be any valid numeric or string constant. Names of symbolic constants (defined in a CONST statement) appearing in
DATE$
The DATE$ function returns a ten-character string in the form mm-dd-yyyy, where mm is the month (01-12), dd is the day (01-31), and yyyy is the year (1980-2099).
Parsed but ignored
DECLARE {FUNCTION | SUB } name «(«parameterlist»)»
The DECLARE statement uses the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
DEFINT letterrange «,letterrange»... DEFSNG letterrange «,letterrange»... DEFDBL letterrange «,letterrange»... DEFLNG letterrange «,letterrange»...
The letterrange has the form: letter1«-letter2»
DIM «SHARED» variable«(subscripts)»«AS type»«,variable«(subscripts)»«AStype
The following list describes the parts of the DIM statement: Part Description ──────────────────────────────────────────────────────────────────────────
DO «statementblock » LOOP «{WHILE | UNTIL} booleanexpression» DO «{WHILE | UNTIL} booleanexpression» «statementblock » LOOP
The following list describes the arguments of the DO...LOOP statement: Argument Description ──────────────────────────────────────────────────────────────────────────
END «{DEF | FUNCTION | IF | SELECT | SUB | TYPE}»
There are several ways to use the END statement, as described in the following list: Statement Description
EXIT {DEF | DO | FOR | FUNCTION | SUB }
There are several ways to use the EXIT statement as described in the following list: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖
EXP(x)
The EXP function returns e (the base of natural logarithms) to the power of x. The exponent x must be less than or equal to 88.02969. A value of x greater than 88.02969 produces an Overflow error message.
FIX(x)
The x is a numeric expression. FIX(x) is equivalent to SGN(x)*INT(ABS(x)). The difference between FIX and INT is that for negative x, FIX returns the first negative integer greater than x, while INT returns the first negative integer less than x.
FOR counter = start TO end «STEP increment» . . .
The FOR statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
FUNCTION name «(parameterlist)»«STATIC» . . .
The following list describes the parts of the FUNCTION statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
GOSUB {linelabel1 | linenumber1 } . . .
The GOSUB...RETURN statements take the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
GOTO {linelabel | linenumber}
The GOTO statement provides a way to branch unconditionally to another line (linelabel or linenumber). A GOTO statement can branch only to another statement at the same level of a program. You cannot use GOTO to enter or exit a SUB, FUNCTION, or multiline DEF FN function. You can,
HEX$(expression)
The argument expression is rounded to an integer or, if the expression is outside the integer range, a long integer before the HEX$ function evaluates it.
IF booleanexpression THEN thenpart «ELSE elsepart» IF booleanexpression1 THEN «statementblock-1» «ELSEIF booleanexpression2 THEN
The single-line form of the statement is best used for short, straightforward tests where only one action is taken. The block form provides several advantages:
INSTR(«start,»stringexpression1,stringexpression2)
The following list describes the INSTR function arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
INT(numeric-expression)
The INT function removes the fractional part of its argument. ■ See Also
LBOUND(array«,dimension»)
The LBOUND function is used with the UBOUND function to determine the size of an array. LBOUND takes the following arguments: Argument Description
LCASE$ (stringexpression)
The LCASE$ function takes a string variable, string constant, or string expression as its single argument. LCASE$ works with both variable- and fixed-length strings.
LEFT$(stringexpression,n)
The argument stringexpression can be any string variable, any string constant, or any string expression. The argument n is a numeric expression in the range 0-32,767 indicating
«LET»variable=expression
Notice that the word LET is optional. The equal sign in the statement is enough to inform QuickBASIC that the statement is an assignment statement. LET statements can be used with record variables only when both variables
LOG(n)
The numeric expression, n, must be greater than zero. The natural logarithm is the logarithm to the base e. The constant e is approximately equal to 2.718282.
LTRIM$(stringexpression)
The stringexpression can be any string expression. ■ See Also
MID$(stringexpression,start«,length»)
The MID$ function takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
OCT$(numeric-expression)
The numeric-expression may be of any type. The numeric-expression is rounded to an integer or long integer before the OCT$ function evaluates it.
POS(0)
The leftmost cursor position is numbered 1. To return the current vertical-line position of the cursor, use the CSRLIN function. ■ See Also
PRINT «expressionlist» «{, | ;}»
If expressionlist is omitted, a blank line is printed. If expressionlist is included, the values of the expressions are printed on the screen. The expressions in the list may be numeric or string expressions. (String literals must be enclosed in quotation marks.)
READ variablelist
A variablelist is a series of valid BASIC variables separated by commas. READ statements are always used with DATA statements. READ assigns DATA values to variables on a one-to-one basis. These variables may be numeric or string. Attempting to read a string value into a numeric variable
REM remark ' remark
REM statements are not compiled, but they appear exactly as entered when the program is listed. You may branch from a GOTO or GOSUB statement to a REM statement. Execution continues with the first executable statement after the REM statement.
RESTORE «{linenumber | linelabel }»
After executing a RESTORE statement without a specified linenumber or linelabel, the next READ statement gets the first item in the first DATA statement in the program.
RETURN «{linenumber | linelabel }»
Without a line label or number, RETURN continues execution where an event occurred (for event handling) or at the statement following the GOSUB (for subroutine calls). GOSUB and RETURN without a line number can be used anywhere in a program, but the GOSUB and corresponding RETURN must be at
RIGHT$(stringexpression,n)
The argument stringexpression can be any string variable, string constant, or string expression. If n is equal to the number of characters in the argument stringexpression, then the RIGHT$ function returns stringexpression. If n = 0, RIGHT$ returns the null string (length zero).
RTRIM$(stringexpression)
The stringexpression can be any string expression. The RTRIM$ function works with both fixed- and variable-length string variables. ■ See Also
SELECT CASE testexpression CASE expressionlist1 «statementblock-1» «CASE expressionlist2
The following list describes the parts of the SELECT CASE statement: Argument Description ──────────────────────────────────────────────────────────────────────────
SGN(numeric-expression)
The SGN function returns a value depending on the sign of its argument: If numeric-expression > 0, then SGN(numeric-expression) returns 1.
SHARED variable «AS type» «, variable «AS type»»...
The argument variable is either an array name followed by () or a variable name. The AS clause can be used to indicate the variable's type. The type argument can be INTEGER, LONG, SINGLE, DOUBLE, STRING, fixed-length string (STRING*length), or a user-defined type.
SIN(x)
When x is a double-precision value, the SIN function is calculated with double-precision accuracy. When x is not double precision, SIN is calculated with single-precision accuracy.
SLEEP « seconds »
The optional argument seconds determines the number of seconds the program is suspended. The SLEEP statement suspends the program until one of the following events occurs:
SPACE$(n)
The expression n is rounded to an integer and must be in the range 0-32,767. ■ See Also
SPC(n)
SPC may only be used with PRINT and LPRINT statements. The argument n must be in the range 0-32,767. A semicolon (;) is assumed to follow the SPC(n) command.
SQR(n)
The argument n must be >= 0. ■ Example
STATIC variablelist
A STATIC statement variablelist has the following syntax: variable«( )»«AS type» «, variable«( )»«AS type»»...
STOP
STOP statements can be used anywhere in a program to terminate execution. When running in the QuickBASIC environment, the STOP statement leaves files open and does not exit to the operating system. In contrast, a STOP
STR$(numeric-expression)
If numeric-expression is positive, the string returned by the STR$ function contains a leading blank. The VAL function complements STR$. ■ See Also
STRING$(m,n) STRING$(m,stringexpression)
The STRING$ function has the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
SUB globalname«(parameterlist)» «STATIC» . . .
The SUB statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
SWAP variable1,variable2
Any type of variable can be swapped (integer, long, single precision, double precision, string, or record). However, the two variables must be exactly the same type or an error message appears (Type mismatch). For example, trying to swap an integer with a single-precision value produces
SYSTEM
When a SYSTEM command is executed, all files are closed and BASIC exits to the operating system (for stand-alone executable programs) or stops program execution (if the program is run in the QuickBASIC environment).
TAB(column)
The argument, column, is a numeric expression that is the column number of the new print position. If the current print position is already beyond column, the TAB function moves the print position to that column on the next line. Column 1 is the leftmost position, and the rightmost position
TAN(x)
TAN is calculated with single-precision accuracy unless x is a double-precision value, in which case TAN is calculated with double-precision accuracy.
TIME$
The TIME$ function returns an eight-character string in the pattern hh:mm:ss, where hh is the hour (00-23), mm is minutes (00-59), and ss is seconds (00-59). A 24-hour clock is used; therefore, 8:00 PM is shown as 20:00:00.
TIMER
The TIMER function can be used with the RANDOMIZE statement to generate a random number. It can also be used to time programs or parts of programs. ■ Example
TYPE usertype elementname AS typename elementname AS typename .
The TYPE statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
UBOUND(array«,dimension»)
The argument dimension is an integer from 1 to the number of dimensions in array. For an array dimensioned as follows, UBOUND returns the values listed below:
UCASE$ (stringexpression)
The stringexpression argument can be any string expression. The UCASE$ function works with both variable- and fixed-length strings. The UCASE$ and LCASE$ statements are helpful in making string comparisons case insensitive.
VAL(stringexpression)
The stringexpression is a sequence of characters that can be interpreted as a numeric value. The VAL function stops reading the string at the first character that it cannot recognize as part of a number. The VAL function also strips leading blanks, tabs, and line feeds from the argument string.
WHILE condition . . .
If the condition is true (that is, if it does not equal zero), then any intervening statements are executed until the WEND statement is encountered. BASIC then returns to the WHILE statement and checks condition. If it is still true, the process is repeated. If it is not true
Only supports COLOR FG, BG
COLOR «foreground»«,«background»«,border»» Screen mode 0 COLOR «background»«,palette» Screen mode 1 COLOR «foreground»«,background» Screen modes 7-10 COLOR «foreground» Screen modes 12-13
With the COLOR statement, you can set the foreground and background colors for the display. In screen mode 0 a border color can also be selected. In screen mode 1 no foreground color can be selected, but one of two four-color palettes can be selected for use with graphics statements. In
Only single line syntax supported
DEF FNname«(parameterlist)» = expression DEF FNname«(parameterlist)» . .
The DEF FN statement takes the following arguments: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Argument Description
Partial support for keycodes
INKEY$
The INKEY$ function returns a one- or two-byte string containing a character read from the standard input device. A null string is returned if no character is waiting there. A one-character string contains the actual character read from the keyboard, while a two-character string
Semicolon before prompt string not supported
INPUT«;»«"promptstring"{; | ,}» variablelist
The following list describes the parts of the INPUT statement: Part Description ──────────────────────────────────────────────────────────────────────────
Files not supported
INPUT$(n«,«#»filenumber»)
The n is the number of characters (bytes) to read from the file. The filenumber is the number that was used in opening the file. If the file is opened for random access, the argument n must be less than
Only supports strings and arrays
LEN(stringexpression) LEN(variable)
In the first form, LEN returns the number of characters in the argument stringexpression. The second syntax returns the number of bytes required by a BASIC variable. This syntax is particularly useful for determining the correct record size of a random-access file.
Semicolon before prompt string not supported
LINE INPUT«;» «"promptstring";» stringvariable
The promptstring is a string constant displayed on the screen before input is accepted. A question mark is not printed unless it is part of the promptstring. All input from the end of promptstring to the carriage return is assigned to stringvariable.
"start" and "stop" not supported
LOCATE«row»«,«column»«,«cursor»«,«start»«,stop»»»»
The following list describes the LOCATE statement's arguments: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Argument Description
Only # and & formatting supported
PRINT USING formatstring; expressionlist «{, | ;}»
The formatstring is a string literal (or variable) containing literal characters to print (such as labels) and special formatting characters. These formatting characters determine the field and the format of the printed strings or numbers. Spaces, commas, and semicolons in the
Ignored - RND always returns randomly seeded number
RANDOMIZE«expression»
If you omit expression, BASIC pauses and asks for a value by printing Random Number Seed (-32768 to 32767)?
Always returns randomly seeded number
RND«(n)»
The value of n determines how RND generates the next random number: Argument Number Returned ──────────────────────────────────────────────────────────────────────────
Only screen mode 0 supported
SCREEN «mode» «,«colorswitch» »«,«apage» »«,«vpage»»
The SCREEN statement selects a screen mode appropriate for a particular combination of display and adapter. Later sections describe the available modes for specific adapters. The following list describes the arguments of the SCREEN statement:
BLOAD filespec «,offset»
The BLOAD statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
BSAVE filespec,offset,length
The BSAVE statement has the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
CALL name «(call-argumentlist)» name «call-argumentlist» CALLS name «(calls-argumentlist)»
The following list describes the parts of the CALL statement: Argument Description ──────────────────────────────────────────────────────────────────────────
CHAIN filespec
The filespec is a string expression that identifies the program to which control is passed. The filespec may include a path specification. Programs running within the QuickBASIC environment assume a .BAS extension (if no extension is given) and cannot chain to executable files (files with a
CHDIR pathspec
The pathspec is a string expression identifying the directory that is to become the default directory. The pathspec must have fewer than 64 characters. It has the following syntax:
CIRCLE «STEP» (x,y),radius«,«color»«,«start»«,«end»«,aspect»»»»
The following list describes the parts of the CIRCLE statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
CLEAR «,,stack»
The CLEAR statement performs the following actions: ■ Closes all files and releases the file buffers
CLOSE ««#» filenumber «,«#» filenumber»...»
The CLOSE statement complements the OPEN statement. The filenumber is the number under which the file was opened. A CLOSE statement with no arguments closes all open files and devices.
COMMAND$
The COMMAND$ function returns the complete command line entered after your BASIC program name, including optional parameters. COMMAND$ removes all leading blanks from the command line and converts all letters to uppercase (capital letters). The COMMAND$ function can be used in stand-alone
CVI(2-byte-string) CVS(4-byte-string) CVL(4-byte-string) CVD(8-byte-string)
CVI, CVS, CVL, and CVD are used with a FIELD statement to read real numbers from a random-access file. The functions take strings defined in the FIELD statement and convert them to a value of the corresponding numeric type. The functions are the inverse of MKI$, MKS$, MKL$, and MKD$:
DECLARE FUNCTION name «CDECL» «ALIAS "aliasname"»«(«parameterlist»)» DECLARE SUB name «CDECL» «ALIAS "aliasname"»«(«parameterlist»)»
The following list describes the parts of the DECLARE statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
DEF SEG «=address»
For BLOAD, BSAVE, CALL ABSOLUTE, PEEK, and POKE, address is used as the segment. The address is a numeric expression returning an unsigned integer in the range 0-65,535. A value outside this range produces the error message Illegal function call. The previous segment is retained if an
DRAW stringexpression
The DRAW statement combines many of the capabilities of the other graphics statements into a graphics macro language, as described below under "Cursor-Movement Commands" and "Angle, Color, and Scale-Factor Commands." This macro language defines a set of characteristics that can be used to
ENVIRON$ (environmentstring) ENVIRON$ (n)
The environmentstring is a string constant or variable containing the name of an environment variable. The argument n is a numeric expression. If you specify an environmentstring name, but it cannot be found in the
ENVIRON stringexpression
The stringexpression must be of the form parameterid=text, or the form parameterid text. Everything to the left of the equal sign or space is assumed to be a parameter, and everything to the right, text.
EOF(filenumber)
The EOF function returns -1 (true) if the end of a sequential file has been reached. Use the EOF function to test for end-of-file while inputting data. In this way you may avoid the Input past end error message.
ERASE arrayname «,arrayname...»
The arrayname arguments are the names of arrays to erase. ERASE has different effects on static and dynamic arrays. The ERASE statement sets the elements of a static array to zeros in the
ERDEV ERDEV$
ERDEV is an integer function that returns an error code from the last device to declare an error. ERDEV$ is a string function that returns the name of the device generating the error. Because ERDEV and ERDEV$ return meaningful information only after an error, they are usually used in error
ERR ERL
After an error, the function ERR returns the code for the error, and the ERL function returns the line number where the error occurred. Because ERR and ERL return meaningful values only after an error, they are usually used in error-handling routines to determine the error and the corrective
ERROR integerexpression
The integerexpression represents the error code. It must be greater than 0 and less than or equal to 255. If the integerexpression is an error code already used by BASIC, then the ERROR statement simulates the occurrence of that error and prints the corresponding error message.
FIELD «#»filenumber, fieldwidth AS stringvariable...
The following list describes the FIELD statement's arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
FILEATTR(filenumber,attribute)
The FILEATTR function takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
FILES «filespec»
The filespec is a string variable or constant that includes either a file name or a path name, and an optional device designation. If you omit filespec, the FILES statement lists all the files in the
FRE(numeric-expression) FRE(stringexpression)
The FRE function returns the following values when it has a numeric argument (numeric-expression): Argument Value Returned
FREEFILE
The FREEFILE function returns the next valid unused file number. You can use this function to avoid having SUB or FUNCTION procedures use file numbers that are already in use.
GET «STEP»(x1,y1) - «STEP»(x2,y2),arrayname«(indices)»
The list below describes the parts of the GET statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
GET «#»filenumber«,«recordnumber»«,variable»»
The following list describes the GET statement's arguments: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Argument Description
INPUT #filenumber, variablelist
The filenumber is the number used when the file was opened for input. The variablelist contains the names of the variables that are assigned values read from the file. (The variable type must match the type specified by the variable name.)
KEY n, stringexpression KEY LIST KEY ON KEY OFF
The placeholder n is a number representing the FUNCTION key. The values for n are 1 to 10 for the FUNCTION keys, and 30 and 31 for FUNCTION keys F11 and F12 on 101-key keyboards. The stringexpression is a string of up to 15 characters that is returned when the FUNCTION key is pressed. If the
KEY(n) ON KEY(n) OFF KEY(n) STOP
The argument n is the number of a FUNCTION key, a cursor-direction key, or a user-defined key. (See the KEY statement for information on assigning soft-key values to FUNCTION keys.) The values of n are as follows:
KILL filespec
The KILL statement is similar to the DOS ERASE or DEL commands. KILL is used for all types of disk files: program files, random data files, and sequential data files. The filespec may contain question marks
LINE ««STEP» (x1,y1)»-«STEP» (x2,y2) «,«color»«,«B«F»»«,style»»»
The coordinates (x1,y1) and (x2,y2) specify the endpoints of the line; note that the order in which these endpoints appear is unimportant, since a line from (10,20) to (120,130) is the same as a line from (120,130) to (10,20).
LINE INPUT #filenumber,stringvariable
The filenumber is the number used to open the file. The stringvariable is the variable the line is assigned to. The LINE INPUT # statement reads all characters in the sequential file up
LOC(filenumber)
The filenumber is the number used in the OPEN statement to open the file. With random-access files, the LOC function returns the number of the last record read from or written to the file. With sequential files, LOC returns the current byte position in the file, divided by 128. With binary
LOCK «#» filenumber «,{record | «start» TO end}» . . .
These statements are used in networked environments where several processes might need access to the same file. The LOCK and UNLOCK statements take the following arguments:
LOF(filenumber)
The argument filenumber is the number used in the OPEN statement. When a file is opened in any mode, the LOF function returns the size of the file in bytes.
LSET {stringvariable=stringexpression | stringexpression1= stringexpression2}
The stringvariable is usually a random-access file field defined in a FIELD statement, although it can be any string variable. The stringexpression is the value assigned to the variable.
MID$(stringvariable,start«,length»)=stringexpression
The MID$ statement has the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
MKDIR pathname
The pathname is a string expression specifying the name of the directory to be created. The pathname must be a string of less than 128 characters. The MKDIR statement works like the DOS command MKDIR; the syntax in BASIC
MKSMBF$(single-precision-expression) MKDMBF$(double-precision-expression)
These functions are used to write real numbers to random-access files using Microsoft Binary format. They are particularly useful for maintaining data files created with older versions of BASIC.
MKI$(integerexpression) MKS$(single-precision-expression) MKL$(long-integer-expression) MKD$(double-precision-expression)
The MKI$, MKS$, MKL$, and MKD$ functions are used with FIELD and PUT statements to write real numbers to a random-access file. The functions take numeric expressions and convert them to strings that can be stored in the strings defined in the FIELD statement. The functions are the inverse
NAME oldfilename AS newfilename
The NAME statement is similar to the DOS RENAME command. NAME can move a file from one directory to another but cannot move a directory. The arguments oldfilename and newfilename are string expressions each of
ON event GOSUB {linenumber | linelabel }
The ON event statement lets you specify a subroutine that is executed whenever an event occurs on a specified device. The following list describes the parts of the statement:
ON ERROR GOTO line
The line argument is the line number or line label of the first line in the error-handling routine. This line must appear in module-level code. If line cannot be found in the module where the error occurred, or if
ON expression GOSUB {line-number-list | line-label-list } ON expression GOTO {line-number-list | line-label-list }
The expression argument can be any numeric expression (expression is rounded to an integer before the ON...GOSUB or ON...GOTO is evaluated). The line-number-list or line-label-list consists of a list of line numbers or line labels, separated by commas. The value of expression determines
ON UEVENT GOSUB { linenumber | linelabel }
The linenumber or linelabel argument is the number or label of the first line in the event-handling routine. ON UEVENT GOSUB lets your program branch to an event-handling routine when a user-defined event occurs. The event is usually a hardware interrupt.
OPEN file «FOR mode1» «ACCESS access» «lock» AS «#» filenum «LEN=reclen» OPEN mode2,«#»filenum, file «,reclen»
The file is a string expression that specifies an optional device, followed by a file name or path name conforming to the DOS file-naming conventions.
OPTION BASE n
The OPTION BASE statement is never required. It is used to change the default lower bound for array subscripts. The value of n must be either 0 or 1. The default base is 0. If the
PAINT «STEP» (x,y)«,«paint» «,«bordercolor» «,background»»»
The following list describes the parts of the PAINT statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
PALETTE «attribute,color» PALETTE USING array-name «(array-index)»
The PALETTE statement takes the following arguments: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Argument Description
PCOPY sourcepage, destinationpage
The sourcepage is an integer expression in the range 0 to n, where n is the maximum number of pages determined by the current video-memory size and the size per page for the current screen mode.
PEEK(address)
The returned value is an integer in the range 0-255. The argument address is a value in the range 0-65,535. The argument address is treated as the offset from the current default segment (as set by the DEF SEG statement).
PLAY commandstring
The commandstring is a string expression containing one or more of the commands listed below. The PLAY statement uses a concept similar to DRAW in that it embeds a
PLAY (n)
The argument n is a dummy argument and may be any numeric value. PLAY(n) will return 0 when the user is in music-foreground mode.
PLAY ON PLAY OFF PLAY STOP
These statements are used with the ON PLAY statement to trap play events. When a PLAY OFF statement is executed, the event-trapping subroutine is not performed and the event is not remembered.
PMAP (expression, function)
The argument expression indicates the coordinate of the point to be mapped. The argument function can have one of the four following values: Value Description
POINT (x,y) POINT (number)
The coordinates x and y refer to the pixel being evaluated by the POINT function. When called with two coordinates, POINT returns the color number of the indicated pixel. If the specified pixel is out of range, POINT returns the value -1.
POKE address,byte
The expression address is a value that represents the address of the memory location; address must be in the range 0-65,535. The expression byte is the data byte to be written; it is an integer value in the range 0-255.
PRESET «STEP»(xcoordinate,ycoordinate) «,color»
PRESET works exactly like PSET, except that if the color is not specified, the background color is selected. The following list describes the parts of the PRESET statement:
PRINT #filenumber,«USING stringexpression;» expressionlist «{, | ;}»
The filenumber is the number specified when the file was opened for output. The stringexpression consists of formatting characters as described under PRINT USING. The expressions in expressionlist are the numeric or string expressions to be written to the file. Spaces, commas,
PSET «STEP»(xcoordinate,ycoordinate) «,color»
The following list describes the parts of the PSET statement: Part Description ──────────────────────────────────────────────────────────────────────────
PUT «STEP» (x, y), arrayname«(indices)» «,actionverb»
The parts of the PUT statement are described as follows: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
PUT «#»filenumber«,«recordnumber»«,variable»» PUT «#»filenumber«,{recordnumber|recordnumber, variable|,variable}»
The following list describes the parts of the PUT statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Argument Description
REDIM «SHARED» variable(subscripts)«AS type» «,variable(subscripts)«AS typ e»»...
The REDIM statement has the following arguments: Arguments Description ──────────────────────────────────────────────────────────────────────────
RESET
The RESET statement closes all open disk files and writes data still in the file buffers to disk. All files must be closed before a disk is removed from its drive.
RESUME «0» RESUME NEXT RESUME { linenumber | linelabel }
The different forms of the RESUME statement redirect program flow as described in the following list: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖
RMDIR pathname
The pathname is the name of the directory that is to be deleted. The pathname must be a string of less than 128 characters. The directory to be removed must be empty except for the working directory ('.') and the parent directory ('..'); otherwise, one of two error messages is printed,
RSET stringvariable=stringexpression
The stringvariable is usually a random-access file field defined in a FIELD statement, although it can be any string variable. The stringexpression is the value assigned to the variable.
RUN «{ linenumber | filespec }»
The RUN statement accepts the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
SADD(stringvariable)
The SADD function returns the address of a string as an offset (near pointer) from the current data segment. The offset is a two-byte integer. SADD is most often used in mixed-language programming.
SCREEN(row,column«,colorflag»)
The following list describes the SCREEN function's arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
SEEK(filenumber)
The filenumber is the number used in the OPEN statement to open the file. SEEK returns a value in the range 1 to 2,147,483,647 (equivalent to 2^31-1).
SEEK «#»filenumber,position
The filenumber is an integer number used in the OPEN statement to open the file. The position is a numeric expression indicating where the next read or
SETMEM(numeric-expression)
The SETMEM function increases or decreases the far heap by the number of bytes indicated by numeric-expression. If the numeric-expression is negative, SETMEM decreases the far heap by the indicated number of bytes. When the numeric-expression is positive, SETMEM attempts to increase the
SHELL «commandstring»
The commandstring must be a valid string expression containing the name of a program to run and any program options. Any .COM file, .EXE file, .BAT program, or DOS function that runs under
SOUND frequency,duration
The frequency is the desired frequency in hertz (cycles/second). It must be a numeric expression returning an integer in the range 37-32,767. The duration is the duration in clock ticks. (There are 18.2 clock ticks
TIMER ON TIMER OFF TIMER STOP
TIMER ON enables timer event trapping by an ON TIMER statement (see the statement ON event). While trapping is enabled, a check is made after every statement to see if the specified time has elapsed. If it has, the ON TIMER event-handling routine is executed.
TRON TROFF
In the QuickBASIC environment, executing a TRON statement has the same effect as selecting Trace On from the Debug menu──each statement is highlighted on the screen as it executes.
UEVENT ON UEVENT OFF UEVENT STOP
The effects of the UEVENT statements are like that of other event-trapping statements. When UEVENT ON is executed, the event-trapping routine is enabled. Occurrences of the event trigger execution of the event-handling routine.
UNLOCK «#» filenumber «,{record | «start» TO end}»
The UNLOCK statement is used only after a LOCK statement. See the LOCK statement for a complete discussion. For binary-mode files, the arguments record, start, and end represent the
In previous versions of QuickBASIC, the only events that could be trapped were those already defined in the language: COM, KEY, PEN, PLAY, STRIG and TIMER. There was no way to define your own event.
VARPTR(variablename) VARSEG(variablename)
The variablename may be any BASIC variable, including a record variable or record element. The VARPTR function returns an unsigned integer that is the offset of the variable within its segment. The VARSEG function returns an unsigned integer that is the segment part of the variable's address. If
VARPTR$(variablename)
The variablename is the name of a variable in the program. If variablename is an array element, then the array must be dimensioned before the VARPTR$ function is used. The array must be an array of variable-length strings.
VIEW ««SCREEN» (x1,y1)-(x2,y2) «,«color» «,border»»»
The list below describes the parts of the VIEW statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
VIEW PRINT «topline TO bottomline»
The topline argument is the number of the upper line in the viewport; the bottomline is the number of the lower line. Without topline and bottomline parameters, the VIEW PRINT statement
WIDTH «columns»«,lines» WIDTH {#filenumber | device},width WIDTH LPRINT width
Both files and devices can be assigned an output-line width. The different forms of the WIDTH statement are explained in the following list: ╓┌─┌────────────────────────────────────┌────────────────────────────────────╖
WINDOW ««SCREEN» (x1,y1)-(x2,y2)»
The WINDOW statement allows the user to create a customized coordinate system to draw lines, graphs, or objects without being constrained by the screen's physical coordinates (the dimensions of the screen). This is done by redefining the screen-border coordinates with the "view coordinates"
WRITE «expressionlist»
If expressionlist is omitted, a blank line is written. If expressionlist is included, the values of the expressions are written to the screen. The expressions in the list may be numeric and/or string expressions. They must be separated by commas.
WRITE #filenumber,expressionlist
The filenumber is the number used in the OPEN statement. The file must be opened in OUTPUT or APPEND mode. The expressions in the argument expressionlist are string and/or numeric expressions, separated by commas. If you omit the expressionlist, the WRITE # statement writes a blank line
CALL ABSOLUTE («argumentlist,»integervariable)
The CALL ABSOLUTE statement takes the following arguments: Argument Description ──────────────────────────────────────────────────────────────────────────
CALL INT86OLD (int_no,in_array(),out_array()) CALL INT86XOLD (int_no,in_array(),out_array())
The CALL INTERRUPT statement provides an easier way to make DOS system calls. See the entry for CALL INTERRUPT for more information. The following list describes the arguments to INT86OLD and INT86XOLD:
CALL INTERRUPT (interruptnum,inregs,outregs) CALL INTERRUPTX (interruptnum,inregs,outregs)
The following list describes the arguments for the CALL INTERRUPT and CALL INTERRUPTX statements: Argument Description
COM(n) ON COM(n) OFF COM(n) STOP
The parameter n is the number of the communications port; n can be either 1 or 2. The COM ON statement enables communications event trapping. If a character
COMMON «SHARED» «/blockname/» variablelist
The following list describes the parts of the COMMON statement: ╓┌─┌────────────────────────┌────────────────────────────────────────────────╖ Part Description
CVSMBF (4-byte-string) CVDMBF (8-byte-string)
The CVSMBF and CVDMBF functions allow you to read old random-access files containing real numbers stored as strings in Microsoft Binary format. These functions convert the string read from the old file to an IEEE-format number:
DATE$ = stringexpression
The DATE$ statement is the complement of the DATE$ function. The stringexpression must have one of the following forms, where mm (01-12) and dd (01-31) are the month and day, and yy and yyyy (1980-2099)
INP(port)
The port must be an integer in the range 0-65,535. The INP function complements the OUT statement. The INP and OUT statements give a BASIC program direct control over the
IOCTL$ («#» filenumber)
The filenumber is the BASIC file number used to open the device. The IOCTL$ function is most frequently used to test whether an IOCTL statement succeeded or failed or to obtain current status information.
IOCTL «#»filenumber, string
The filenumber is the BASIC file number used to open the device. The string is the command sent to the device. Commands are specific to the device driver. See the documentation for the device driver to find out what the valid IOCTL commands are. An IOCTL control data string can be up
LPOS(n)
The argument n is the index of the printer being tested. For example, LPT1: would be tested with LPOS(1), while LPT2: would be tested with LPOS(2), and so on.
LPRINT «expressionlist» «{;|,}» LPRINT USING formatstring; expressionlist «{;|,}»
These statements function in the same way as the PRINT and PRINT USING statements except that output goes to the line printer and the filenumber option is not permitted.
OPEN "COMn: optlist1 optlist2" «FOR mode» AS «#»filenum «LEN=reclen»
COMn: is the name of the device to be opened. The n argument is the number of a legal communications device, such as COM1: or COM2:. The first list of options, optlist1, has the following form:
OUT port, data
The following list describes the arguments of the OUT statement: Argument Description ──────────────────────────────────────────────────────────────────────────
PEN(n)
The argument n indicates what value is to be returned. It is a numeric expression in the range 0-9.
PEN ON PEN OFF PEN STOP
The PEN ON statement enables lightpen-event trapping by using an ON PEN statement. The pen is initially off. A lightpen event occurs whenever the lightpen is activated by pressing the tip to the screen or pressing the touch ring. A PEN ON statement must be executed before any read-pen
STICK(n)
The argument n is a numeric expression whose value is an unsigned integer in the range 0 to 3: Argument Value Returned
STRIG(n) STRIG {ON | OFF}
The STRIG function is used to test the joystick trigger status. In previous versions of BASIC, the statement STRIG ON enables testing of the joystick triggers; STRIG OFF disables joystick trigger testing. QuickBASIC ignores STRIG ON and STRIG OFF statements──the statements are provided for
STRIG(n) ON STRIG(n) OFF STRIG(n) STOP
The argument, n, is a numeric expression indicating the joystick button to trap: Value Button
TIME$=stringexpression
The stringexpression must be in one of the following forms: Form Description ──────────────────────────────────────────────────────────────────────────
WAIT portnumber,and-expression«,xor-expression»
The following list describes the arguments of the WAIT statement: Argument Description ──────────────────────────────────────────────────────────────────────────