Documente Academic
Documente Profesional
Documente Cultură
0
The QuickBASIC 3.0 database, Copyright (C) 1987 by
Peter Norton Computing, Inc., was written by Craig Stinson,
Burton L. Alperson, Brad Kingsbury, John Socha, and Peter Norton.
2
Naredbe po nameni
Control program flow
----------------------------------
DO...LOOP Begin Definition of DO/LOOP Loop
END Terminate Program
EXIT Exit Multiline Function, Loop, or Subprogram
FOR...NEXT Begin Definition of FOR/NEXT Loop
GOSUB Execute Subroutine
GOTO Unconditional Branch
IF Conditional Branch
ON...GOSUB Branch to nth Item in Subroutine List
ON...GOTO Branch to nth Item in Line List
SELECT CASE Case Structure
SLEEP Suspends execution of the calling program
STOP Halt Program
SYSTEM Return to Operating System
WEND End Definition of WHILE/WEND Loop
WHILE Begin Definition of WHILE/WEND Loop
Device input/output
----------------------------------
CLOSE Close File or Device
CLS Clear Screen
CSRLIN Line Position of Cursor
INKEY$ Most Recent Character at Keyboard
INP Read from an I/O Port
INPUT Get Input from Keyboard
INPUT$ Read Specified Number of Characters
IOCTL Send Control String to Device Driver
IOCTL$ Read Control String from Device Driver
KEY Set or Display Soft Keys
LINE INPUT Read Line from Keyboard, Ignoring Delimiters
LOC Current File Position
LOCATE Position the Cursor
3
LPOS Current Position of Print Head
LPRINT Output to LPT1:
LPRINT USING Formatted Output to LPT1:
OPEN "COM... Open a Communications File
OUT Send Byte to Output Port
POS Current Cursor Column Position
PRINT Display on Screen
PRINT USING Formatted Screen Display
RESET Close All Disk Files
SCREEN Character at Specified Location (Function)
SPC Skip n Spaces in a PRINT statement
TAB Tab to a Specified Position
VIEW PRINT Set Screen Text Window
WAIT Wait for Port Status
WIDTH Set Output Width
WRITE Output to Screen
File input/output
----------------------------------
BINARY Used in an OPEN statement to specify binary file mode.
BLOAD Load Binary (Memory Image) File
BSAVE Save a Binary (Memory Image) File
CLOSE Close File or Device
EOF End of File Status
FIELD Allocate Space for Random File Variables
FILEATTR Returns information about an open file
FREEFILE Returns the next free BASIC file number
GET Read Random File into Buffer (File I/O)
INPUT # Get Input from Sequential File or Device
INPUT$ Read Specified Number of Characters
KILL Delete File(s)
LINE INPUT# Read Line from File, Ignoring Delimiters
LOC Current File Position
LOCK Control File or Record Access
LOF Length of File
LSET Left-Justify Data in Field Variable
NAME Rename File
OPEN Allow File or Device I/O
PRINT # Output to Sequential File
PRINT # USING Formatted Output to File
PUT Write Record from Random Buffer to File (File I/O)
RSET Right-Justify Data in Field Variable
SEEK Function that returns the current file position
UNLOCK Remove File or Record Access Lock
4
WRITE # Output to Sequential File
Menage memory
----------------------------------
BLOAD Load Binary (Memory Image) File
BSAVE Save a Binary (Memory Image) File
CLEAR Close Files, Reset Variables, Set Stack Space
DEF SEG Define Segment
FRE Available Memory
PEEK Value at Specified Address
POKE Write Byte to Memory
SADD String Address
VARPTR Offset of Variable or Offset of File Buffer
VARPTR$ Offset of Variable, in Character Form
Manipulate strings
----------------------------------
ASC ASCII Value of First Character
CHR$ Convert ASCII Code to Character
CVD Convert String to Double-Precision
CVDMBF MBF Double-Precision String to IEEE (QB87 only)
CVI Convert String to Integer
CVS Convert String to Single Precision
CVSMBF MBF Single-Precision String to IEEE (QB87 only)
HEX$ Hexadecimal Value, as String
INSTR Find Substring
LCASE$ Returns a string with all letters in lower-case
LEFT$ Substring at Left
LEN Length of String
LSET Left-Justify Data in Field Variable
LTRIM$ Returns a copy of a string with leading spaces removed
MID$ Assign Substring (Statement)
MID$ Substring in Middle (Function)
MKD$ Convert Double-Precision to String
MKDMBF$ IEEE Double-Precision to MBF String (QB87 only)
MKI$ Convert Integer to String
MKS$ Convert Single-Precision to String
MKSMBF$ IEEE Single-Precision to MBF String (QB87 only)
OCT$ Octal Value, as String
RIGHT$ Substring at Right
RSET Right-Justify Data in Field Variable
RTRIM$ Returns a string with trailing (right-hand) spaces removed
SPACE$ String of n Spaces
STR$ String Representation of Numeric Expression
STRING$ String of Specified Length and Character
UCASE$ Returns a string expression with all letters in uppercase
VAL Numeric Value of a String
5
ERDEV$ Device Causing Critical Error
ERL Line Number of Most Recent Error
ERR Error Number
ERROR Force Error
KEY(n) Enable/Disable Key Trapping
ON COM Trap for Communications Activity
ON ERROR Enable Error Trapping
ON KEY Trap for Keypress
ON PEN Trap for Light Pen Activity
ON PLAY(n) Trap for Background Music Remaining
ON STRIG(n) Trap for Specified Joystick Button
ON TIMER Trap for Elapsed Time
PEN Enable/Disable Pen Read and Trap (Statement)
PEN Light Pen Status (Function)
PLAY Enable/Disable Music Trap (Statement)
RESUME Continue after Error Trap
STRIG Enable/Disable the STRIG Function (Statement)
STRIG Status of Joystick Buttons (Function)
TIMER Enable/Disable Timer Trap (Statement)
Time
----------------------------------
DATE$ Get or Set System Date
TIME$ Get System Time (Function)
TIME$ Set System Time (Statement)
TIMER Enable/Disable Timer Trap (Statement)
TIMER Number of Seconds since Midnight (Function)
Sound
----------------------------------
BEEP Beep the Speaker
PLAY Enable/Disable Music Trap (Statement)
PLAY Number of Notes in Background Buffer (Function)
PLAY Play Music (Statement)
SOUND Sound the Speaker
Ostalo
----------------------------------
$INCLUDE Include File
COMMAND$ Get Command Line
TROFF Trace Off
TRON Trace On
6
1 BASIC
Language
$DYNAMIC Declare Arrays Dynamic
REM $DYNAMIC
--------------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
7
' Comment
' [remark]
-----------------------------------------------------------------------
Notes: BASIC does not execute comments, but a program may branch
to a statement beginning with '. Execution will then
continue with the first executable statement thereafter.
ANY Clause
(QuickBasic 4.5)
variable AS ANY
-----------------------------------------------------------------------
ATN Arctangent
y = ATN(numexpr)
-----------------------------------------------------------------------
8
Notes: If the argument is a double-precision expression, ATN
returns a double-precision value. Otherwise single
precision is returned.
-----------------------------------------------------------------------
BINARY Keyword
(QuickBasic 4.5)
BINARY is used in an OPEN statement to specify binary file mode. In
binary mode, you may read or write information to any byte position in
the file using GET or PUT statements.
-----------------------------------------------------------------------
Notes: The segment from which the BSAVE is made is that specified
by the most recent DEF SEG statement.
9
CALL Invoke Subprogram or Assembly Subroutine
CALL procname [(parmlist)]
-----------------------------------------------------------------------
-----------------------------------------------------------------------
10
name Specifies the subprogram or subroutine to be called. The
first 31 characters are significant. If name is an
assembly language subroutine, it must be a PUBLIC symbol
and must not contain '$' or '_' characters.
-----------------------------------------------------------------------
-----------------------------------------------------------------------
Notes: If the calling program and the chained-to program are both
compiled with the default library, BRUN20.LIB, variables
may be passed to the chained-to program via COMMON, and
files opened by the calling program remain open to the
CHAINed program.
11
2. QuickBASIC does not support the ALL, MERGE, DELETE,
and line options of the interpreted BASIC CHAIN
statement.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
12
If negative values for start and end are given, the end
points of the resulting arc are connected to the center
point, thus creating pie-chart wedges.
Closes all files, clears all COMMON variables, resets all numeric
variables to 0 and all string variables to null, releases all disk
buffers, resets the stack, and optionally specifies the size of the
stack.
-----------------------------------------------------------------------
CLNG
a conversion function that converts a numeric expression to a long (4-byte) integer
by rounding the fractional part of the expression
(QuickBasic 4.5)
CLNG(numeric-expression)
Example:
A=32767.45
B=32767.55
PRINT CLNG(A); CLNG(B)
Sample Output
32767 32768
13
Closes one or more files or devices and terminates the association
between a file or device and its number.
----------------------------------------------------------------------
Clears the screen, as described below, and returns the cursor to the
Home position (row 1, column 1).
2 CLS 2 clears just the text window. The bottom screen line
(line 25 or line 43) is left unchanged.
----------------------------------------------------------------------
14
SCREEN mode 0, this value must be in the range 0 to 7; for
SCREEN modes 1-10, this value must be in the range 0 to
63.
Color values
If the background and foreground are the same, then the characters
will be invisible.
The following is a list of legal values for each of the SCREEN modes:
Palettes
SCREEN 7 and 8
The foreground color must be in the range 1 to 15.
The background color must be in the range 0 to 15.
15
EGA only. The colors are dependent on the current
palette selected (See PALETTE statement).
SCREEN 9
The foreground color must be in the range 1 to 15 for
EGAs with more than 64K. If the EGA only has 64K, the
foreground color must be in the range 1 to 3.
SCREEN 10
The foreground color must be in the range 1 to 3. The
values are as follows: 1 = Black; 2 = Blink; and
3 = High Intensity.
--------------------------------------------------------------------------
----------------------------------------------------------------------
16
If the "Event Trapping" option is selected, QB checks
after each new program line. If neither option is
selected, no trapping takes place.
----------------------------------------------------------------------
Notes: Returns everything that was typed on the command line when
the program was executed, except the program name and any
redirection or piping commands.
----------------------------------------------------------------------
17
a larger size. Blank COMMON blocks may be resized.
-----------------------------------------------------------------------
COS Cosine
y = COS(numexpr)
Returns the row number of the current cursor location on the current
screen page.
18
----------------------------------------------------------------------
Notes: To get the current column position, use POS. To set the
cursor position, use LOCATE.
----------------------------------------------------------------------
See Also: GET (File I/O) CVI CVS MKD$ MKI$ MKS$
----------------------------------------------------------------------
Notes: The IEEE format for real numbers offers more accuracy and
range than the Microsoft Binary Format. But the IEEE
format is supported only by the QB87 version of the
compiler, and programs compiled with QB87 run only on
machines equipped with 8087 or 80287 coprocessors.
----------------------------------------------------------------------
See Also: CVD CVS GET (File I/O) MKD$ MKI$ MKS$
----------------------------------------------------------------------
19
file. To retrieve such a number, first assign it to a file
buffer field (with GET), then use CVS.
See Also: CVD CVI GET (File I/O) MKD$ MKS$ MKI$
----------------------------------------------------------------------
Notes: The IEEE format for real numbers offers more accuracy and
range than the Microsoft Binary Format. But the IEEE
format is supported only by the QB87 version of the
compiler, and programs compiled with QB87 run only on
machines equipped with 8087 or 80287 coprocessors.
Stores one or more constants, of any type, for subsequent access via
READ statements.
----------------------------------------------------------------------
20
"mm-dd-yy"
"mm-dd-yyyy"
-------------------------------------------------------------------------
"mm-dd-yyyy"
DECLARE - a non-executable statement that declares references to BASIC procedures and invokes
argument type checking
(QuickBasic 4.5)
Argument Description
name The procedure's name. The name is limited to 40
characters. FUNCTION names can end in one of the
type-declaration characters (%, &, !, #, or $) to
indicate the type of value returned.
For calls within BASIC, the DECLARE statement is required only if you
call SUB procedures without the CALL keyword, or if you invoke a
FUNCTION defined in another module.
A DECLARE statement also causes the compiler to check the number and
type of arguments used to invoke the procedure. QuickBASIC
automatically generates DECLARE statements when you save your program
while working in the environment. The DECLARE statement can appear
only in module-level code (not in a SUB or FUNCTION) and affects the
entire module.
21
Note: You cannot have fixed-length strings in DECLARE statements
because only variable-length strings can be passed to SUB
and FUNCTION procedures. Fixed-length strings can appear
in an argument list but are converted to variable-length
strings before being passed.
Declaration Meaning
Other Uses of the DECLARE Keyword: DECLARE can also be used to declare
references to procedures written in other programming languages, such as C
Example:
2. DEF FNname[(parmlist)]
.
. [statements]
.
[EXIT DEF]
FNname = expression
END DEF
parmlist One or more formal parameters for the function. Each must
be a valid variable name. Parameters are passed by value.
----------------------------------------------------------------------
22
Functions must be defined before they are called. They may
not be defined within IF/THEN/ELSE, FOR/NEXT, WHILE/WEND,
or SUB/END SUB blocks, and they may not be defined in
terms of themselves.
----------------------------------------------------------------------
Notes: DEF SEG defaults to BASIC's data segment (DS). A DEF SEG
statement with no argument returns the DEF SEG address to
this default value.
----------------------------------------------------------------------
----------------------------------------------------------------------
23
assigned or used. The compiler reads from beginning to
end, without regard for execution path.
----------------------------------------------------------------------
----------------------------------------------------------------------
Defines the maximum subscript numbers for and allocates storage for
one or more arrays.
24
----------------------------------------------------------------------
-----------------------------------------------------------------------
25
Draws an object according to instructions specified as a string
expression.
Un Move up.
Dn Move down.
Ln Move left.
Rn Move right.
TAn Turn angle. n may range from -360 degrees to +360 degrees.
Positive values cause counterclockwise rotation; negative
values cause clockwise rotation.
"=" + VARPTR$(var)
Get argument from variable. May be used to supply
arguments to any of the foregoing commands.
"X" + VARPTR$(stringvar)
Execute command sequence stored in a string variable. This
command allows you to call graphics-language subroutines.
-------------------------------------------------------------------------
26
LPR is updated as the object is being drawn.
----------------------------------------------------------------------
----------------------------------------------------------------------
parameter is case-sensitive.
----------------------------------------------------------------------
27
will be PATH (if a PATH command has been issued), and the
third will be PROMPT (if a PROMPT command has been
issued).
----------------------------------------------------------------------
Notes: If the end of the file has been reached, EOF returns -1
(true); otherwise, it returns 0 (false).
----------------------------------------------------------------------
Returns the error status of a device error. The low-order byte will
contain the INT 24h error code. The high-order byte will contain the
bits 15, 14, 13, 3, 2, 1, and 0 of the device attribute word.
----------------------------------------------------------------------
Returns the name of the device that has caused an INT 24h (critical
error).
----------------------------------------------------------------------
28
Notes: If the device is a character device, ERDEV$ returns the
eight-bit device name. If the device is a block device,
ERDEV$ returns a two-character string consisting of the
drive letter and a colon.
Returns the program line number at which the most recent error
occurred.
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
29
EXIT Exit Multiline Function, Loop, or Subprogram
EXIT {DEF | DO | FOR | SUB}
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
Notes: Once the random file has been FIELDed, data may be
extracted from the random file buffer after a GET
statement or placed into the buffer in preparation for a
PUT statement.
30
associated file is CLOSEd or RESET. (In interpreted BASIC,
such variables retain their last assigned values.)
See Also: GET (File I/O) LSET PUT (File I/O) RSET
FILEATTR a file I/O function that returns information about an open file
(QuickBasic 4.5)
FILEATTR(filenumber,attribute)
Details:
Argument Description
filenumber The number of an open file. This is the same number
used in the OPEN statement. You can use a numeric
expression as long as it evaluates to the number of
an open file.
The table below lists the return values and corresponding file modes
when the value of attribute is 1.
Example:
The following example opens two files and prints out the DOS file
handles and modes returned by FILEATTR:
Sample Output
----------------------------------------------------------------------
31
Notes: If the filespec argument is omitted, FILES lists all the
files in the current directory.
----------------------------------------------------------------------
There must be one and only one NEXT statement for each FOR
statement. Inclusion of counter in the NEXT statement is
optional; if counter is omitted, its value is assumed to
be that of counter in the most recent FOR statement.
32
Nested loops that have a common termination point may use
a single NEXT statement with values of counter matching
the values for each FOR statement.
FREEFILE a file I/O function that returns the next free BASIC file number
(QuickBasic 4.5)
FREEFILE
You can use this function to avoid having SUB or FUNCTION procedures use
file numbers that are already in use.
Example:
Sample Output
FUNCTION...END FUNCTION
(QuickBasic 4.5)
a non-executable statement that declares the name, the parameters, and the code
that form the body of a FUNCTION procedure
- name, which follows the same rules as are used for naming BASIC
variables, determines the data type the function returns
- (parameterlist) is one or more variables, separated by commas,
that will be passed to the function when it is called
- expression is the return value of the function
33
- Use of the keyword STATIC is a Detail
Details:
Part Description
name The name of the function. FUNCTION names follow the
same rules as BASIC variable names and can include a
type-declaration character (%, &, !, #, or $). Note
that the type of the name determines the type of
value the function returns. For example, to create a
function that returns a string, you would include a
dollar sign in the name or give it a name defined as
a string name by a DEFSTR statement.
FUNCTION ParseLine(Keywords$(),KeywordTypes())
FUNCTION BinarySearch(...)
CONST FALSE=0
.
.
.
IF Lower>Upper THEN
34
BinarySearch=FALSE
EXIT FUNCTION
END IF
.
.
.
END FUNCTION
Examples:
----------------------------------------------------------------------
35
----------------------------------------------------------------------
Notes: To determine how large the array must be, use the
following formula:
4+INT(((x2-x1+1)*bitsperpixel+7)/8)*((y2-y1)+1)
Mode Bitsperpixel
SCREEN 1 2
SCREEN 2 1
SCREEN 7 4
SCREEN 8 4
SCREEN 9 2 (EGA memory = 64K)
4 (EGA memory > 64K)
SCREEN 10 2
----------------------------------------------------------------------
----------------------------------------------------------------------
Notes: The target of the GOTO must be at the same program level.
That is, you cannot GOTO a subprogram, subroutine, or
multiline function definition.
36
HEX$ Hexadecimal Value, as String
s$ = HEX$(numexpr)
--------------------------------------------------------------------------
IF Conditional Branch
1. Block syntax
IF expression THEN
statement1
[statement2]
.
.
.
[ELSEIF expression THEN
statement10
[statement11]
.
.
.
[ELSE
statement15
[statement16]]
.
.
.
ENDIF
----------------------------------------------------------------------
37
IF, ELSE, ELSEIF, and ENDIF must all be the first
keywords on their respective lines.
Returns, without echo, the character most recently entered into the
keyboard buffer, or a null string if no character is pending.
----------------------------------------------------------------------
See Also: INPUT INPUT # INPUT$ LINE INPUT LINE INPUT # Keyboard Codes
38
variables.
----------------------------------------------------------------------
filenum The number under which the input file was OPENed. It may
refer to a disk file, a communications file, or the
keyboard (KYBD:).
----------------------------------------------------------------------
39
Notes: The input data must match in type the variable(s) in the
INPUT # statement.
filenum The number under which the input file was OPENed. If
omitted, the characters are read from the standard input
device (the keyboard, by default). Characters input from
the keyboard are not echoed to the screen.
-----------------------------------------------------------------------
----------------------------------------------------------------------
40
start).
----------------------------------------------------------------------
filenum The number under which the device driver was OPENed.
filenum The number under which the device driver was OPENed.
Controls the display and contents of the function keys F1 through F10;
allows trapping of any scan code in any shift state.
OFF KEY OFF removes the function key display from line 25,
making line 25 available for other purposes. With KEY OFF
in effect, a LOCATE 25,n can be used to display other text
at the bottom of the screen. Line 25 does not scroll, but
it is erased by a CLS statement.
41
LIST KEY LIST displays the current soft key definitions on
screen.
n, CHR$(KBflag) + CHR$(scancode)
The statement KEY n, CHR$(KBflag) + CHR$(scancode) enables
your program to trap specified Ctrl keys, Alt keys, and
Shifted keys. n is a numeric expression in the range 15 to
20 (up to six traps may be in effect at once). KBflag,
which must be expressed in hexadecimal, specifies the
shift state of the key to be trapped, and scancode
specifies which alphanumeric key is to be trapped.
-----------------------------------------------------------------------
42
QB checks for communication activity after each statement.
If the "Event Trapping" option is selected, QB checks
after each new program line. If neither option is
selected, no trapping takes place.
-----------------------------------------------------------------------
LCASE$ a string processing function that returns a string expression with all letters in lower-case
(QuickBasic 4.5)
LCASE$(stringexpression)
Example:
43
Sample Output
----------------------------------------------------------------------
LET Assignment
[LET] variable = expression
----------------------------------------------------------------------
44
style Allows you to draw a broken (dashed) line or box (see
below).
----------------------------------------------------------------------
Notes: If STEP is included with x2,y2 but not x1,y1, then x2 and
y2 are measured relative to the absolute coordinate pair
(x1,y1).
----------------------------------------------------------------------
----------------------------------------------------------------------
Notes: LINE INPUT # treats all commas and quote marks as part of
the input string. Input is terminated by a carriage
return-line feed pair (the carriage return and line feed
are included in the string variable assignment).
45
filenum The number under which the file was OPENed.
----------------------------------------------------------------------
----------------------------------------------------------------------
46
-----------------------------------------------------------------------
----------------------------------------------------------------------
-----------------------------------------------------------------------
47
UNTIL Causes execution of the loop as long as expression is
FALSE.
-----------------------------------------------------------------------
Returns the position of the print head within the printer buffer.
1 LPT1:
2 LPT2:
3 LPT3:
----------------------------------------------------------------------
48
LPRINT USING Formatted Output to LPT1:
LPRINT USING formatstr; exprlist [; | ,]
Formatting options:
Symbol Meaning
49
^^^^ Print a number in exponential format. The four carets
should appear after all place holders in the format
string.
----------------------------------------------------------------------
----------------------------------------------------------------------
LTRIM$ a function that returns a copy of a string with leading spaces removed
(QuickBasic 4.5)
LTRIM$(stringexpression)
Example:
This example copies a file to a new file, removing all leading and
trailing spaces.
----- Note -----
To run this example, you must supply the name of an existing text file.
----------------
50
OPEN InFile$ FOR INPUT AS #1
OPEN OutFile$ FOR OUTPUT AS #2
CLOSE #1, #2
END
----------------------------------------------------------------------
----------------------------------------------------------------------
51
the first five characters of stringexpr will be assigned
to stringvar.
52
singleexpr A single-precision expression.
-----------------------------------------------------------------------
----------------------------------------------------------------------
There must be one and only one NEXT statement for each FOR
statement. Inclusion of counter in the NEXT statement is
optional; if counter is omitted, its value is assumed to
be that of counter in the most recent FOR statement.
53
must have its NEXT statement appear within the enclosing
FOR-NEXT block.
-----------------------------------------------------------------------
54
line of an error-trapping routine.
----------------------------------------------------------------------
----------------------------------------------------------------------
55
ON ERROR statement).
----------------------------------------------------------------------
56
-----------------------------------------------------------------------
0 button A1
2 button B1
4 button A2
6 button B2
-----------------------------------------------------------------------
57
ON TIMER Trap for Elapsed Time
ON TIMER(n) GOSUB {linenum | linelabel}
-----------------------------------------------------------------------
-----------------------------------------------------------------------
58
See Also: ON...GOTO
-----------------------------------------------------------------------
or
59
mode2 (Syntax 2) A string expression that must evaluate to one
of the following:
I Sequential input
O Sequential output
A Sequential output at EOF
R Random input/output
----------------------------------------------------------------------
Opens a communications device for input and output via GET and PUT.
Required arguments:
60
milliseconds, the delay before a timeout occurs. Default:
1000. Acceptable values: 0 to 65535. If m is 0, the CS
argument is ignored. If RTS is suppressed via the RS
parameter, the default CS time is 0 milliseconds.
FOR mode mode may be OUTPUT, for sequential output, or INPUT, for
sequential input. If this argument is omitted, the device
is opened for random access (input and output).
-----------------------------------------------------------------------
The remaining arguments--RS, CS, DS, CD, LF, BIN, and ASC
may be specified in any order.
----------------------------------------------------------------------
61
data An integer expression in the range 0 to 255; specifies the
data byte.
--------------------------------------------------------------------------
Changes a color in the palette. This statement can be used only with
the Enhanced Graphics Adapter (EGA).
62
2 Color/CGA N/A 0-1
Color/EGA 0-1 0-15
7 Color/EGA 0-15 0-15
8 Color/EGA 0-15 0-15
9 EGA (64K) 0-3 0-15
EGA (>64K) 0-15 0-63
10 Mono/EGA 0-3 0-8
--------------------------------------------------------------------------
--------------------------------------------------------------------------
63
PEEK Value at Specified Address
y = PEEK(n)
----------------------------------------------------------------------
Returns information about the status of the light pen. For the PEN
function to be available, a PEN ON statement must first be executed.
Enables or disables the PEN function (which returns light pen status
information. Also enables or disables trapping of light pen activity.
-----------------------------------------------------------------------
64
Notes: If the "Checking Between Statements" option is in effect,
QB checks for light pen activity after each statement. If
the "Event Trapping" option is selected, QB checks after
each new program line. If neither option is selected, no
trapping takes place.
-----------------------------------------------------------------------
65
BASIC to raise the specified note by a half step. The
symbol - tells BASIC to lower the specified note by a half
step. Only those sharps and flats that correspond to black
keys on a piano are valid; i.e., E# and B# are not valid
notes. Append these symbols to the notes.
>A to >G Increment the octave value by 1 and play the named note.
The octave value stays at the increased level. If the
current octave is 6, > has no effect.
<A to <G Decrement the octave value by 1 and play the named note.
The octave value stays at the decreased level. If the
current octave is 0, < has no effect.
"=" + VARPTR$(var)
Get argument from variable. May be used to supply
arguments to any of the foregoing commands.
"X" + VARPTR$(stringvar)
Execute command sequence stored in a string variable. This
command allows you to call "subtunes."
--------------------------------------------------------------------------
66
See Also: BEEP ON PLAY(n) PLAY (Event Trap) SOUND
67
PRESET Draw Point on Screen
PRESET [STEP] (x,y) [,color]
----------------------------------------------------------------------
-----------------------------------------------------------------------
68
PRINT #filenum, [exprlist] [;]
filenum The number under which the file was opened for output.
----------------------------------------------------------------------
Formatting options:
Symbol Meaning
69
expression has fewer digits to the left of the decimal
point than the format string has #s, QuickBASIC right-
justifies the number; that is, it pads the number on the
left with spaces. (But if there are any #s to the left of
the decimal point in the format string, QuickBASIC always
prints at least one digit--a 0 if necessary--to the left
of the decimal point.)
----------------------------------------------------------------------
70
strexpr A string variable or constant specifying the format in
which the data is to be printed (see below).
Formatting options:
Symbol Meaning
71
[other] Characters other than the foregoing may be included as
literals in the format string. Thus, for example, a single
dollar sign may be positioned to the left of a series of
place holders (#s) to achieve vertically aligned dollar
signs, and space characters may be placed at the right
side of the format string to achieve horizontal separation
between a series of numbers.
----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
72
PUT Plot Array Image on Screen Graphics
PUT (x,y), array [,action]
-----------------------------------------------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
73
Notes: A single READ statement can assign multiple DATA items to
multiple variables; or several READ statements can assign
the same DATA item to several variables.
-----------------------------------------------------------------------
----------------------------------------------------------------------
74
RESET Close All Disk Files
RESET
----------------------------------------------------------------------
Resets the DATA item pointer to the first item in the first DATA
statement or to the first DATA item in a specified DATA statement.
----------------------------------------------------------------------
----------------------------------------------------------------------
Notes: All ON ERROR GOTO routines must end with some form of
RESUME statement.
-----------------------------------------------------------------------
75
Notes: {linenum | linelabel}, if used, must refer to a line at
the same program level from which the subroutine was
called.
n A numeric expression.
----------------------------------------------------------------------
----------------------------------------------------------------------
n A numeric expression.
----------------------------------------------------------------------
76
fieldvar A variable defined in a FIELD statement; specifies the
variable into which strexpr is to be right-justified.
----------------------------------------------------------------------
RTRIM$(stringexpression)
The RTRIM$ function works with both fixed- and variable-length string
variables.
Example:
Output
1 2
12345678901234567890
Twine *
Twine*
Braided *
Braided*
----------------------------------------------------------------------
77
Interpreter's ,R option is not supported by QuickBASIC).
-----------------------------------------------------------------------
---------------------------------------------------------------------
Screen modes:
------------------------------------------------------------------------
SCREEN 0 | 40 x 25 text | 16 colors, 2 attributes (CGA) | MDA, CGA, EGA
| 80 x 25 text | 16 colors, 16 attributes (EGA |
----------+--------------+-------------------------------+--------------
SCREEN 1 | 320 x 200 | 16 colors, 4 attributes | CGA, EGA
| 40 x 25 text | |
78
----------+--------------+-------------------------------+--------------
SCREEN 2 | 640 x 200 | 16 colors, 2 attributes | CGA, EGA
| 80 x 25 text | |
----------+--------------+-------------------------------+--------------
SCREEN 7 | 320 x 200 | 16 colors, 16 attributes | EGA only
| 40 x 25 text | 2 pages if 64K on EGA |
| | 4 pages if 128K on EGA |
| | 8 pages if 256K on EGA |
----------+--------------+-------------------------------+--------------
SCREEN 8 | 640 x 200 | 16 colors, 16 attributes | EGA only
| 80 x 25 text | 1 page if 64K on EGA |
| | 2 pages if 128K on EGA |
| | 4 pages if 256K on EGA |
----------+--------------+-------------------------------+--------------
SCREEN 9 | 640 x 350 | 16 colors, 16 attributes | EGA only
| 80 x 25 text | if >64K on EGA; |
| in 8 x 14 | 16 colors, 4 attributes |
| matrix | if 64K on EGA; |
| | 2 pages if 256K on EGA |
----------+--------------+-------------------------------+--------------
SCREEN 10 | 640 x 350 | 9 pseudo colors, 4 attributes | EGA only
| 80 x 25 text | 2 pages if 256K on EGA |
| in 8 x 14 | |
| matrix | |
------------------------------------------------------------------------
SEEK a file I/O function that returns the current file position
(QuickBasic 4.5)
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 returns the number of the next record read or written when used on
RANDOM mode files. For files opened in BINARY, OUTPUT, APPEND, or INPUT
mode, SEEK returns the byte position in the file where the next operation
is to take place. The first byte in a file is 1.
When used on a device that does not support SEEK, the function returns zero.
The BASIC devices (SCRN:, CONS:, KYBD:, COMn:, and LPTn:) do not support
SEEK.
The following code fragment prints a message indicating whether the last
read or write was done in the first, second, or final third of the file:
79
END SELECT
Example:
See the SEEK statement programming example , which uses both the SEEK
function and the SEEK statement.
-----------------------------------------------------------------------
CASE 100
CASE IS = 100
CASE IS <> "Yomama"
CASE IS > -5
CASE IS < 2E15
CASE 5 TO 10
80
SGN Sign of Number
y = SGN(numexpr)
----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
81
SIN Sine
y = SIN(numexpr)
-----------------------------------------------------------------------
SLEEP A control flow statement that suspends execution of the calling program
(QuickBasic 4.5)
SLEEP [seconds]
-----------------------------------------------------------------------
Example:
-----------------------------------------------------------------------
82
See Also: PLAY (Statement)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
83
metacommand (which statically allocates memory for
arrays).
-----------------------------------------------------------------------
84
0 Returns -1 if button A has been pressed since the most
recent STRIG(0) call; otherwise, returns 0.
1 Returns -1 if button A is currently pressed; otherwise
returns 0.
2 Returns -1 if button B has been pressed since the most
recent STRIG(2) call; otherwise returns 0.
3 Returns -1 if button B is currently pressed; otherwise
returns 0.
-------------------------------------------------------------------------
Defines a subprogram.
-----------------------------------------------------------------------
85
You may not enter or exit a subprogram by means of GOSUB,
GOTO, or RETURN.
Closes all open files and returns control to DOS (for standalone EXE
programs) or to QuickBASIC (for programs compiled and run from within
QB).
----------------------------------------------------------------------
TAN Tangent
y = TAN(numexpr)
----------------------------------------------------------------------
86
TYPE A BASIC declaration that defines a data type containing one or more elements
(QuickBasic 4.5)
TYPE usertype
elementname AS typename
[elementname AS typename]
. . .
END TYPE
----------------------------------------------------------------------
Keyword AS STRING * 40
Example:
----------------------------------------------------------------------
87
TIMER Number of Seconds since Midnight Function
y = TIMER
----------------------------------------------------------------------
TRON Trace On
TRON
----------------------------------------------------------------------
88
See Also: LBOUND OPTION BASE
UCASE$ a string processing function that returns a string expression with all letters in uppercase
(QuickBasic 4.5)
UCASE$(stringexpression)
Example:
-----------------------------------------------------------------------
----------------------------------------------------------------------
89
If the first character in the argument (or the first
character following all space and tab characters) is a
letter, VAL returns 0. Thus, for example, VAL("Yomama")
returns 0.
----------------------------------------------------------------------
----------------------------------------------------------------------
2 Integer
3 String
4 Single-precision
8 Double-precision
90
statements are measured relative to the defined viewport,
whose upper left corner becomes 0,0. If included, 0,0 is
still the upper left corner of the screen, but only those
points that fall within the defined viewport are visible.
----------------------------------------------------------------------
Notes: QuickBASIC sorts the coordinates x1, x2, y1, and y2, so
that the lower value of x and the lower value of y specify
the upper left corner, regardless of how the coordinates
are presented; i.e., VIEW (280,120)-(140,180) would be
equivalent to VIEW (140,120)-(280,180).
Sets the top and bottom boundaries of the screen text window.
bottom The bottom line of the screen text window. Defaults to 25.
-----------------------------------------------------------------------
----------------------------------------------------------------------
91
should be omitted and n should have a 1 at the position in
question. To test for a 0 in port, both n and m should
have a 1 in the position in question.
WEND
----------------------------------------------------------------------
----------------------------------------------------------------------
92
WIDTH Set Output Width
WIDTH [{#filenum | device},] width[,lines] or WIDTH LPRINT width
Sets the maximum width for a specified output device; QuickBASIC sends
a carriage return to the device when the specified width has been
reached.
----------------------------------------------------------------------
Notes: WIDTH size and WIDTH "SCRN:" size both set the screen
width. In this case, size must be either 40 or 80 (only 80
is allowed on the IBM Monochrome Display).
SCREEN If omitted, x1,y1 and x2,y2 specify the upper left and
lower right corners of the world space, respectively. If
included, x1,y1 and x2,y2 specify the lower left and upper
right corners of the world space, respectively.
----------------------------------------------------------------------
93
exprlist Numeric or string expressions separated by commas or
semicolons. QuickBASIC outputs a carriage return and line
feed at the end of the list. If no items are included, a
blank line is displayed.
----------------------------------------------------------------------
----------------------------------------------------------------------
Operators
Precedence Operator Precedence in BASIC
Operator Precedence
Highest: ^
- (negation)
* /
\
MOD
+ -
= <> < > <= >=
NOT
AND
OR
XOR
EQV
Lowest: IMP
94
grouping (through parentheses), an expression is evaluated in the
order dictated by this inherent precedence. Operators of the same
precedence level are evaluated in left-to-right order.
^ Exponentiation
exp1 ^ exp2
* Multiplication
exp1 * exp2
/ Division
exp1 / exp2
exp1 + exp2
Concatenation
str1 + str2
95
See Also: ^^ - * / \ MOD Precedence
exp1 - exp2
Negation
- exp1
\ Integer Division
exp1 \ exp2
= Equal to/Assignment
Equal to
exp1 = exp2
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
Assignment
96
[LET] var = exp1
exp1 Any numeric expression, but exp1 and exp2 must either both
be numeric or both be strings; otherwise a Type Mismatch
error occurs.
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
97
<= Less than or Equal to
exp1 <= exp2
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
exp1,exp2 Any numeric or string expression, but exp1 and exp2 must
either both be numeric or both be strings; otherwise a
Type Mismatch error occurs.
98
AND is a logical operator. BASIC converts each operand to an integer
(each operand must yield an integer in the range -32768 to 32767, or
else an Overflow error occurs), then performs a bitwise comparison of
the results, according to the truth table below:
OR Logical OR
exp1 OR exp2
EQV Equivalence
exp1 EQV exp2
99
else an Overflow error occurs), then performs a bitwise comparison of
the results, according to the truth table below:
IMP Implication
exp1 IMP exp2
Data Types
BASIC Data Types
Declaration
Type Character * Range Accuracy Storage
Integer % -32768 to 32767 Perfect 2 bytes
Single precision ! 10E-38 to 10E38 6 digits 4 bytes
Double precision # 10D-38 to 10D38 16 digits 8 bytes
String $ See below
Command-line syntax:
100
/b Turns off the color burst. For use with composite displays
attached to CGAs.
Compiler options
101
Type Conversions
How BASIC converts data from one precision to another
Reserved Words
ABS DATA GOTO$ MKDIR RANDOM SWAP
ACCESS DATE$ HEX$ MKDMBF$ RANDOMIZE SYSTEM
AND DO IF MKI$ READ TAB
APPEND DEF FN IMP MKS$ REDIM TAN
AS DEF SEG INKEY$ MKSMBF$ REM THEN
ASC DEF USR INP MOD RENUM TIME$
ATN DEFDBL INPUT MOTOR RESET TIMER
AUTO DEFINT INPUT# NAME RESTORE TO
BASE DEFSNG INPUT$ NEW RESUME TROFF
BEEP DEFSTR INSTR NEXT RETURN TRON
BLOAD DELETE INT NOISE* RIGHT$ UBOUND
BSAVE DIM IOCTL NOT RMDIR UNLOCK
CALL DO* IOCTL$ NULL* RND UNTIL
CALLS DRAW KEY OCT$ RSET USING
CASE EDIT KILL OFF RUN USR
CDBL ELSE LBOUND ON SADD USR0
CHAIN ELSEIF LCOPY OPEN SAVE USR1
CHDIR END LEFT$ OPEN COM SCREEN USR2
CHR$ ENVIRON LEN OPTION SEG USR3
CINT ENVIRON$ LET OR SELECT USR4
CIRCLE EOF LINE OUT SGN USR5
CLEAR EQV LIST OUTPUT SHARED USR6
CLOSE ERASE LLIST PAINT SHELL USR7
CLS ERDEV LOAD PALETTE USING SIN USR8
COLOR ERDEV$ LOC PEEK SOUND USR9
COM ERL LOCAL PEN SPACE VAL
COMMAND$ ERR LOCATE PLAY SPACE$ VARPTR
COMMON ERROR LOCK PMAP SPC VARPTR$
CONST EXIT LOF POINT SQR VIEW
CONT EXP LOG POKE STATIC WAIT
COS FIELD LOOP POS STEP WEND
CSNG FILES LPOS PRESET STICK WHILE
CSRLIN FIX LPRINT PRINT STOP WIDTH
CVD FOR LPRINT# PRINT# STRIG WINDOW
CVDMBF FRE LSET PRINT# USING STR$ WRITE
CVSMBF GET MERGE PSET STRING$ WRITE#
CVI GO MID$ PUT SUB XOR
CVS GOSUB MKD$
102
Runtime Errors
1 (not defined) 39 CASE ELSE expected
2 Syntax error 40 (not defined)
3 RETURN without GOSUB 41 (not defined)
4 Out of data 42 (not defined)
5 Illegal function call 43 (not defined)
6 Overflow 44 (not defined)
7 Out of memory 45 (not defined)
8 (not defined) 46 (not defined)
9 Subscript out of range 47 (not defined)
10 Redimensioned array 48 (not defined)
11 Division by zero 49 (not defined)
12 (not defined) 50 FIELD overflow
13 Type mismatch 51 Internal error
14 Out of string space 52 Bad file number
15 (not defined) 53 File not found
16 String formula too complex 54 Bad file mode
17 (not defined) 55 File already open
18 (not defined) 56 (not defined)
19 No RESUME 57 Device I/O error
20 RESUME without error 58 File already exists
21 (not defined) 59 (not defined)
22 (not defined) 60 (not defined)
23 (not defined) 61 Disk full
24 Device timeout 62 Input past end
25 (not defined) 63 Bad record number
26 (not defined) 64 Bad file name
27 (not defined) 65 (not defined)
28 (not defined) 66 (not defined)
29 (not defined) 67 Too many files
30 (not defined) 68 Device unavailable
31 (not defined) 69 (not defined)
32 (not defined) 70 Permission denied
33 (not defined) 71 Disk not ready
34 (not defined) 72 Disk media error
35 (not defined) 73 (not defined)
36 (not defined) 74 Rename across disks
37 (not defined) 75 Path/file access error
38 (not defined) 76 Path not found
103
2Dec
0
Hex
00h
Char
Tables
ASCII Chart
NUL |
Dec
64
Hex
40h
Char
@ |
Dec
128
Hex
80h
Char
. |
Dec
192
Hex
C0h
Char
+
1 01h . SOH | 65 41h A | 129 81h . | 193 C1h -
2 02h . STX | 66 42h B | 130 82h . | 194 C2h -
3 03h . ETX | 67 43h C | 131 83h . | 195 C3h |
4 04h . EOT | 68 44h D | 132 84h . | 196 C4h -
5 05h . ENQ | 69 45h E | 133 85h . | 197 C5h +
6 06h . ACK | 70 46h F | 134 86h . | 198 C6h -
7 07h . BEL | 71 47h G | 135 87h . | 199 C7h -
8 08h . BS | 72 48h H | 136 88h . | 200 C8h +
9 09h . HT | 73 49h I | 137 89h . | 201 C9h +
10 0Ah . LF | 74 4Ah J | 138 8Ah . | 202 CAh -
11 0Bh . VT | 75 4Bh K | 139 8Bh . | 203 CBh -
12 0Ch . FF | 76 4Ch L | 140 8Ch . | 204 CCh |
13 0Dh . CR | 77 4Dh M | 141 8Dh . | 205 CDh -
14 0Eh . SO | 78 4Eh N | 142 8Eh . | 206 CEh +
15 0Fh . SI | 79 4Fh O | 143 8Fh . | 207 CFh -
16 10h . DLE | 80 50h P | 144 90h . | 208 D0h -
17 11h . DC1 | 81 51h Q | 145 91h . | 209 D1h -
18 12h . DC2 | 82 52h R | 146 92h . | 210 D2h -
19 13h . DC3 | 83 53h S | 147 93h . | 211 D3h +
20 14h . DC4 | 84 54h T | 148 94h . | 212 D4h +
21 15h . NAK | 85 55h U | 149 95h . | 213 D5h +
22 16h . SYN | 86 56h V | 150 96h . | 214 D6h +
23 17h . ETB | 87 57h W | 151 97h . | 215 D7h +
24 18h . CAN | 88 58h X | 152 98h . | 216 D8h +
25 19h . | 89 59h Y | 153 99h . | 217 D9h +
26 1Ah . SUB | 90 5Ah Z | 154 9Ah . | 218 DAh +
27 1Bh . ESC | 91 5Bh [ | 155 9Bh . | 219 DBh #
28 1Ch . FS | 92 5Ch \ | 156 9Ch . | 220 DCh #
29 1Dh . GS | 93 5Dh ] | 157 9Dh . | 221 DDh #
30 1Eh . RS | 94 5Eh ^ | 158 9Eh . | 222 DEh #
31 1Fh . US | 95 5Fh _ | 159 9Fh . | 223 DFh #
32 20h | 96 60h ` | 160 A0h . | 224 E0h .
33 21h ! | 97 61h a | 161 A1h . | 225 E1h .
34 22h " | 98 62h b | 162 A2h . | 226 E2h .
35 23h # | 99 63h c | 163 A3h . | 227 E3h .
36 24h $ | 100 64h d | 164 A4h . | 228 E4h .
37 25h % | 101 65h e | 165 A5h . | 229 E5h .
38 26h & | 102 66h f | 166 A6h . | 230 E6h .
39 27h ' | 103 67h g | 167 A7h . | 231 E7h .
40 28h ( | 104 68h h | 168 A8h . | 232 E8h .
41 29h ) | 105 69h i | 169 A9h . | 233 E9h .
42 2Ah * | 106 6Ah j | 170 AAh . | 234 EAh .
43 2Bh + | 107 6Bh k | 171 ABh . | 235 EBh .
44 2Ch , | 108 6Ch l | 172 ACh . | 236 ECh .
45 2Dh - | 109 6Dh m | 173 ADh . | 237 EDh .
46 2Eh . | 110 6Eh n | 174 AEh . | 238 EEh .
47 2Fh / | 111 6Fh o | 175 AFh . | 239 EFh .
48 30h 0 | 112 70h p | 176 B0h # | 240 F0h .
49 31h 1 | 113 71h q | 177 B1h # | 241 F1h .
50 32h 2 | 114 72h r | 178 B2h # | 242 F2h .
51 33h 3 | 115 73h s | 179 B3h | | 243 F3h .
52 34h 4 | 116 74h t | 180 B4h | | 244 F4h .
53 35h 5 | 117 75h u | 181 B5h | | 245 F5h .
54 36h 6 | 118 76h v | 182 B6h | | 246 F6h .
55 37h 7 | 119 77h w | 183 B7h + | 247 F7h .
56 38h 8 | 120 78h x | 184 B8h + | 248 F8h .
57 39h 9 | 121 79h y | 185 B9h | | 249 F9h .
58 3Ah : | 122 7Ah z | 186 BAh | | 250 FAh .
59 3Bh ; | 123 7Bh { | 187 BBh + | 251 FBh .
60 3Ch < | 124 7Ch | | 188 BCh + | 252 FCh .
61 3Dh = | 125 7Dh } | 189 BDh + | 253 FDh .
62 3Eh > | 126 7Eh ~ | 190 BEh + | 254 FEh .
63 3Fh ? | 127 7Fh . | 191 BFh + | 255 FFh
104
Line-Drawing Chars
218 196 194 191 201 205 203 187
+----------------+ +----------------+
179 | 197 | | 179 186 | 206 | | 186
| \ | | | \ | |
195 |----------+-----| 180 204 |----------+-----| 185
| | | | | |
+----------------+ +----------------+
192 196 193 217 200 205 202 188
Special Characters
---------------------------------- Arrows ----------------------------------
. 30 . 24 . 18
. 31 . 25 . 23
. 16 . 26
. 17 . 27 . 29
----------------------------- Block Characters -----------------------------
-
# 176 # - 219
# 221
# 177 # - 220
# 222
# 178 # - 223
-
----------------------- Foreign-Language Characters ------------------------
131 . | 136 . | 147 . | 150 .
132 . . 142 | 137 . | 148 . . 153 | 129 . . 154
133 . | 138 . | 149 . | 151 .
160 . | 130 . . 144 | 162 . | 163 .
134 . . 143 | | |
| 140 . | 164 . . 165 | 152 .
145 . . 146 | 139 . | |
| 141 . | 225 . |
135 . . 128 | 161 . | |
-------------------- Miscellaneous Language Characters ---------------------
. 155 . 166 . 168 . 19
. 156 . 167 . 173 . 20
. 157 . 174 . 21
. 159 . 175 . 158
------------------------ Math and Greek Characters -------------------------
. 143 . 224 alpha
. 238 . 225 beta
. 239 . 226 gamma
. 240 . 235 delta
. 241 . 233 theta
. 242 244 . 230 mu
. 243 . . 227 pi
. 244 | 179 . 229 . 228 sigma
. 245 . . 231 tau
. 246 245 . 237 . 232 phi
. 247 . 234 omega
. 248
. 249
. 250
. 251
. 252
. 253
. 236
105
Color Chart
Number I R G B Monochrome Color Background Foreground
------ --- --- --- --- ---------- ----- ---------- ----------
0 0 0 0 0 Black Black Sample Sample
1 0 0 0 1 Underlined Blue Sample Sample
2 0 0 1 0 Green Sample Sample
3 0 0 1 1 Cyan Sample Sample
4 0 1 0 0 Red Sample Sample
5 0 1 0 1 Violet Sample Sample
6 0 1 1 0 Brown Sample Sample
7 0 1 1 1 White White Sample Sample
--------------------------------------------------------------------------
Keyboard Codes
This table lists (in decimal notation) the values that are placed in
the keyboard buffer by all the possible keystrokes and two-keystroke
combinations on the 83/84-key and 101/102-key keyboards. These are the
values returned (as strings) by the INKEY$ function.
83/84-Key[1] 101/102-Key
Keystroke Keyboard Keyboard[2]
Esc 027 same
1 049 same
2 050 same
3 051 same
4 052 same
5 053 same
6 054 same
7 055 same
8 056 same
9 057 same
0 048 same
- 045 same
= 061 same
Backspace 008 same
Tab 009 same
q 113 same
w 119 same
e 101 same
r 114 same
t 116 same
y 121 same
u 117 same
i 105 same
o 111 same
p 112 same
[ 091 same
] 093 same
Enter 013 same
Ctrl ** **
a 097 same
106
s 115 same
d 100 same
f 102 same
g 103 same
h 104 same
j 106 same
k 107 same
l 108 same
; 059 same
' 039 same
` 096 same
Shift ** **
\ 092 same
z 122 same
x 120 same
c 099 same
v 118 same
b 98 same
n 110 same
m 109 same
, 044 same
. 046 same
/ 047 same
Gray * 042 same
Alt ** **
Space 032 same
Caps Lock ** **
F1 000 059 same
F2 000 060 same
F3 000 061 same
F4 000 062 same
F5 000 063 same
F6 000 064 same
F7 000 065 same
F8 000 066 same
F9 000 067 same
F10 000 068 same
F11 no key 000 133
F12 no key 000 134
Num Lock ** **
Scroll Lock ** **
White Home 000 071 same
White Up Arrow 000 072 same
White PgUp 000 073 same
Gray - 045 same
White Left Arrow 000 075 same
Center Key -- 000 076
White Right Arrow 000 077 same
Gray + 043 same
White End 000 079 same
White Down Arrow 000 080 same
White PgDn 000 081 same
White Ins 000 082 same
White Del 000 083 same
SysReq no key **
Key 45 [3] no key 092
Enter (number keypad) no key 000 013
Gray / no key 000 047
PrtSc no key **
Pause no key **
Gray Home no key 071
Gray Up Arrow no key 072
Gray Page Up no key 073
Gray Left Arrow no key 075
Gray Right Arrow no key 077
Gray End no key 079
Gray Down Arrow no key 080
Gray Page Down no key 081
Gray Insert no key 082
Gray Delete no key 083
107
% 037 same
^ 094 same
& 038 same
* (white) 042 same
( 040 same
) 041 same
_ 095 same
+ (white) 043 same
Shift Backspace 008 same
Shift Tab (Backtab) 000 015 same
Q 081 same
W 087 same
E 069 same
R 082 same
T 084 same
Y 089 same
U 085 same
I 073 same
O 079 same
P 080 same
{ 123 same
} 125 same
Shift Enter 013 same
Shift Ctrl ** **
A 065 same
S 083 same
D 068 same
F 070 same
G 071 same
H 072 same
J 074 same
K 075 same
L 076 same
: 058 same
" 034 same
~ 126 same
| 124 same
Z 090 same
X 088 same
C 067 same
V 086 same
B 066 same
N 078 same
M 077 same
< 060 same
> 062 same
? 063 same
Shift Gray * ** 042
Shift Alt ** **
Shift Space 032 same
Shift Caps Lock ** **
Shift F1 000 084 same
Shift F2 000 085 same
Shift F3 000 086 same
Shift F4 000 087 same
Shift F5 000 088 same
Shift F6 000 089 same
Shift F7 000 090 same
Shift F8 000 091 same
Shift F9 000 092 same
Shift F10 000 093 same
Shift F11 no key 000 135
Shift F12 no key 000 136
Shift Num Lock ** **
Shift Scroll Lock ** **
Shift 7 (number pad) 055 same
Shift 8 (number pad) 056 same
Shift 9 (number pad) 057 same
Shift Gray - 045 same
Shift 4 (number pad) 052 same
Shift 5 (number pad) 053 same
Shift 6 (number pad) 054 same
Shift Gray + 043 same
Shift 1 (number pad) 049 same
Shift 2 (number pad) 050 same
Shift 3 (number pad) 051 same
108
Shift 0 (number pad) 048 same
Shift . (number pad) 046 same
Shift SysReq no key **
Shift Key 45 [3] no key 124
Shift Enter (number pad) no key 000 013
Shift Gray / no key 000 047
Shift PrtSc no key **
Shift Pause no key **
Shift Gray Home no key 071
Shift Gray Up Arrow no key 072
Shift Gray Page Up no key 073
Shift Gray Left Arrow no key 075
Shift Gray Right Arrow no key 077
Shift Gray End no key 079
Shift Gray Down Arrow no key 080
Shift Gray Page Down no key 081
Shift Gray Insert no key 082
Shift Gray Delete no key 083
109
Ctrl F2 000 095 same
Ctrl F3 000 096 same
Ctrl F4 000 097 same
Ctrl F5 000 098 same
Ctrl F6 000 099 same
Ctrl F7 000 100 same
Ctrl F8 000 101 same
Ctrl F9 000 102 same
Ctrl F10 000 103 same
Ctrl F11 no key 000 137
Ctrl F12 no key 000 138
Ctrl Num Lock -- --
Ctrl Scroll Lock -- --
Ctrl White Home 000 119 same
Ctrl White Up Arrow -- 000 141
Ctrl White PgUp 000 132 same
Ctrl Gray - -- 000 142
Ctrl White Left Arrow 000 115 same
Ctrl 5 (number pad) -- 000 143
Ctrl White Right Arrow 000 116 same
Ctrl Gray + -- 000 144
Ctrl White End 000 117 same
Ctrl White Down Arrow -- 000 145
Ctrl White PgDn 000 118 same
Ctrl White Ins -- 000 146
Ctrl White Del -- 000 147
Ctrl SysReq no key **
Ctrl Key 45 [3] no key --
Ctrl Enter (number pad) no key 000 010
Ctrl / (number pad) no key 000 149
Ctrl PrtSc no key 114
Ctrl Break no key 000 000
Ctrl Gray Home no key 119
Ctrl Gray Up Arrow no key 141
Ctrl Gray Page Up no key 132
Ctrl Gray Left Arrow no key 115
Ctrl Gray Right Arrow no key 116
Ctrl Gray End no key 117
Ctrl Gray Down Arrow no key 145
Ctrl Gray Page Down no key 118
Ctrl Gray Insert no key 146
Ctrl Gray Delete no key 147
110
Alt g 000 034 same
Alt h 000 035 same
Alt j 000 036 same
Alt k 000 037 same
Alt l 000 038 same
Alt ; -- 000 039
Alt ' -- 000 040
Alt ` -- 000 041
Alt Shift ** **
Alt \ -- 000 043
Alt z 000 044 same
Alt x 000 045 same
Alt c 000 046 same
Alt v 000 047 same
Alt b 000 048 same
Alt n 000 049 same
Alt m 000 050 same
Alt , -- 000 051
Alt . -- 000 052
Alt / -- 000 053
Alt Gray * -- 000 055
Alt Space 032 same
Alt Caps Lock ** **
Alt F1 000 104 same
Alt F2 000 105 same
Alt F3 000 106 same
Alt F4 000 107 same
Alt F5 000 108 same
Alt F6 000 109 same
Alt F7 000 110 same
Alt F8 000 111 same
Alt F9 000 112 same
Alt F10 000 113 same
Alt F11 no key 000 139
Alt F12 no key 000 140
Alt Num Lock ** **
Alt Scroll Lock ** **
Alt Gray - -- 000 074
Alt Gray + -- 000 078
Alt 7 (number pad) # #
Alt 8 (number pad) # #
Alt 9 (number pad) # #
Alt 4 (number pad) # #
Alt 5 (number pad) # #
Alt 6 (number pad) # #
Alt 1 (number pad) # #
Alt 2 (number pad) # #
Alt 3 (number pad) # #
Alt Del -- --
Alt SysReq no key **
Alt Key 45 [3] no key --
Alt Enter (number pad) no key 000 166
Alt / (number pad) -- 000 164
Alt PrtSc no key **
Alt Pause no key **
Alt Gray Home no key 000 151
Alt Gray Up Arrow no key 000 152
Alt Gray Page Up no key 000 153
Alt Gray Left Arrow no key 000 155
Alt Gray Right Arrow no key 000 157
Alt Gray End no key 000 159
Alt Gray Down Arrow no key 000 160
Alt Gray Page Down no key 000 161
Alt Gray Insert no key 000 162
Alt Gray Delete no key 000 163
--------------------------------------------------------------------------
Footnotes
111
[3] In the United States, the 101/102-key keyboard is shipped
with 101 keys. Overseas versions have an additional key
sandwiched between the left Shift key and the Z key. This
additional key is identified by IBM (and in this table) as
"Key 45."
[**] Keys and key combinations marked ** are used by the ROM
BIOS but do not put values into the keyboard buffer.
[--] Keys and key combinations marked -- are ignored by the ROM
BIOS.
112
Sadržaj
Naredbe po nameni .................................................................3
BASIC .............................................................................7
Language .........................................................................7
$DYNAMIC Declare Arrays Dynamic ..................................7
$INCLUDE Include File ............................................7
$STATIC Declare Arrays Static ...................................7
' Comment .................................................8
ABS Absolute Value ..........................................8
ANY Clause Disables type checking ..................................8
ASC ASCII Value of First Character ..........................8
ATN Arctangent ..............................................8
BEEP Beep the Speaker ........................................9
BINARY Keyword Used in an OPEN statement to specify binary file mode ...9
BSAVE Save a Binary (Memory Image) File .......................9
CALL Invoke Subprogram or Assembly Subroutine ...............10
CALL ABSOLUTE Invoke Subprogram or Assembly Subroutine ...............10
CALLS Invoke Subprogram or Assembly Subroutine ...............10
CDBL Convert to Double Precision ............................11
CHAIN Transfer to Another Program ............................11
CHDIR Change Directory .......................................12
CHR$ Convert ASCII Code to Character ........................12
CINT Convert to Integer .....................................12
CIRCLE Draw Ellipse on Screen .................................12
CLEAR Close Files, Reset Variables, Set Stack Space ..........13
CLNG Converts long (4-byte) integer by rounding .............13
CLOSE Close File or Device ...................................13
CLS Clear Screen ...........................................14
COLOR Set Foreground, Background, and Border Colors ..........14
COM(n) Enable/Disable Comm Port Trapping ......................16
COMMAND$ Get Command Line .......................................17
COMMON Pass Variables to CHAINed Program or Subprogram ........17
CONST Declare Symbolic Constant(s) ...........................18
COS Cosine .................................................18
CSNG Convert to Single Precision ............................18
CSRLIN Line Position of Cursor ................................18
CVD Convert String to Double-Precision .....................19
CVDMBF MBF Double-Precision String to IEEE (QB87 only) ........19
CVI Convert String to Integer ..............................19
CVS Convert String to Single Precision .....................19
CVSMBF MBF Single-Precision String to IEEE (QB87 only) ........20
DATA Store Constant(s) for Retrieval via READ ...............20
DATE$ Get or Set System Date .................................20
DECLARE Declares references to procedures and functions ........21
DEF FN Define Function ........................................22
DEF SEG Define Segment .........................................23
DEFDBL Define Variable(s) as Double Precision .................23
DEFINT Define Variable(s) as Integer ..........................23
DEFSNG Define Variable(s) as Single Precision .................24
DEFSTR Define Variable(s) as String ...........................24
DIM Dimension Array(s) .....................................24
DO Begin Definition of DO/LOOP Loop .......................25
DRAW Draw Object ............................................25
END Terminate Program ......................................27
ENVIRON Modify Environment Table ...............................27
ENVIRON$ Environment Table Entry ................................27
EOF End of File Status .....................................28
ERASE Reset Static Array or Deallocate Dynamic Array .........28
ERDEV Critical Error Code ....................................28
ERDEV$ Device Causing Critical Error ..........................28
ERL Line Number of Most Recent Error .......................29
ERR Error Number ...........................................29
ERROR Force Error ............................................29
EXIT Exit Multiline Function, Loop, or Subprogram ...........30
EXP Exponent (Natural) .....................................30
FIELD Allocate Space for Random File Variables ...............30
FILEATTR Returns information about an open file .................31
FILES Display File Directory .................................31
FIX Truncate to Integer ....................................32
FOR Begin Definition of FOR/NEXT Loop ......................32
113
FRE Available Memory .......................................33
FREEFILE Returns the next free BASIC file number ................33
FUNCTION Declares the function ..................................33
GET Read Random File into Buffer (File I/O) ................35
GET Read Points from Screen (Graphics) .....................35
GOSUB Execute Subroutine .....................................36
GOTO Unconditional Branch ...................................36
HEX$ Hexadecimal Value, as String ...........................37
IF Conditional Branch .....................................37
INKEY$ Most Recent Character at Keyboard ......................38
INP Read from an I/O Port ..................................38
INPUT Get Input from Keyboard ................................38
INPUT # Get Input from Sequential File or Device ...............39
INPUT$ Read Specified Number of Characters ....................40
INSTR Find Substring .........................................40
INT Next Lower Integer .....................................41
IOCTL Send Control String to Device Driver ...................41
IOCTL$ Read Control String from Device Driver .................41
KEY Set or Display Soft Keys ...............................41
KEY(n) Enable/Disable Key Trapping ............................42
KILL Delete File(s) .........................................43
LBOUND Lower Bound of Array Dimension .........................43
LCASE$ Returns a string with all letters in lower-case ........43
LEFT$ Substring at Left ......................................44
LEN Length of String .......................................44
LET Assignment .............................................44
LINE Draw Line or Box .......................................44
LINE INPUT Read Line from Keyboard, Ignoring Delimiters ...........45
LINE INPUT# Read Line from File, Ignoring Delimiters ...............45
LOC Current File Position ..................................45
LOCATE Position the Cursor ....................................46
LOCK Control File or Record Access ..........................46
LOF Length of File .........................................47
LOG Natural Logarithm ......................................47
LOOP End Definition of DO/LOOP Loop .........................47
LPOS Current Position of Print Head .........................48
LPRINT Output to LPT1: ........................................48
LPRINT USING Formatted Output to LPT1: ..............................49
LSET Left-Justify Data in Field Variable ....................50
LTRIM$ Returns a copy of a string with leading spaces removed .50
MID$ Substring in Middle (Function) .........................51
MID$ Assign Substring (Statement) ...........................51
MKD$ Convert Double-Precision to String .....................52
MKDIR Create Subdirectory ....................................52
MKDMBF$ IEEE Double-Precision to MBF String (QB87 only) ........52
MKI$ Convert Integer to String ..............................52
MKS$ Convert Single-Precision to String .....................52
MKSMBF$ IEEE Single-Precision to MBF String (QB87 only) ........52
NAME Rename File ............................................53
NEXT End Definition of FOR/NEXT Loop ........................53
OCT$ Octal Value, as String .................................54
ON COM Trap for Communications Activity .......................54
ON ERROR Enable Error Trapping ..................................54
ON KEY Trap for Keypress ......................................55
ON PEN Trap for Light Pen Activity ............................56
ON PLAY(n) Trap for Background Music Remaining ....................56
ON STRIG(n) Trap for Specified Joystick Button .....................57
ON TIMER Trap for Elapsed Time ..................................58
ON...GOSUB Branch to nth Item in Subroutine List ..................58
ON...GOTO Branch to nth Item in Line List ........................59
OPEN Allow File or Device I/O ...............................59
OPEN "COM... Open a Communications File .............................60
OPTION BASE Set Minimum Array Subscript ............................61
OUT Send Byte to Output Port ...............................61
PAINT Fill an Area with a Pattern or Color ...................62
PALETTE Change Color in the Palette ............................62
PALETTE USING Change Many Colors in the Palette ......................63
PCOPY Copy Screen Page .......................................63
PEEK Value at Specified Address .............................64
PEN Light Pen Status (Function) ............................64
PEN Enable/Disable Pen Read and Trap (Statement) ...........64
PLAY Enable/Disable Music Trap (Statement) ..................65
PLAY Number of Notes in Background Buffer (Function) ........65
PLAY Play Music (Statement) .................................65
PMAP Map Physical Coordinates to World ......................67
POINT Attribute or Value at Screen Location ..................67
114
POKE Write Byte to Memory ...................................67
POS Current Cursor Column Position .........................67
PRESET Draw Point on Screen ...................................68
PRINT Display on Screen ......................................68
PRINT # Output to Sequential File ..............................68
PRINT # USING Formatted Output to File ...............................69
PRINT USING Formatted Screen Display ...............................70
PSET Draw Point on Screen ...................................72
PUT Write Record from Random Buffer to File (File I/O) .....72
PUT Plot Array Image on Screen (Graphics) ..................73
RANDOMIZE Reseed Random Number Generator .........................73
READ Assign DATA Items to Variables .........................73
REDIM Redimension Array ......................................74
REM Comment or Metacommand .................................74
RESET Close All Disk Files ...................................75
RESTORE Reset DATA Item Pointer ................................75
RESUME Continue after Error Trap ..............................75
RETURN Return from Subroutine .................................75
RIGHT$ Substring at Right .....................................76
RMDIR Remove Subdirectory ....................................76
RND Random Number ..........................................76
RSET Right-Justify Data in Field Variable ...................76
RTRIM$ Rreturns a string with right-hand spaces removed .......77
RUN Execute Program ........................................77
SADD String Address .........................................78
SCREEN Character at Specified Location (Function) .............78
SCREEN Set Screen Attributes (Statement) ......................78
SEEK Returns the current file position ......................79
SELECT CASE Case Structure .........................................80
SGN Sign of Number .........................................81
SHARED Declare Global Variables ...............................81
SHELL Execute DOS Command ....................................81
SIN Sine ...................................................82
SLEEP Suspends execution of the calling program ..............82
SOUND Sound the Speaker ......................................82
SPACE$ String of n Spaces .....................................83
SPC Skip n Spaces in a PRINT statement .....................83
SQR Square Root ............................................83
STATIC Declare Local Variable(s) ..............................83
STICK Joystick Coordinates ...................................84
STOP Halt Program ...........................................84
STR$ String Representation of Numeric Expression ............84
STRIG Enable/Disable the STRIG Function (Statement) ..........84
STRIG Status of Joystick Buttons (Function) ..................84
STRING$ String of Specified Length and Character ...............85
SUB...END SUB Define Subprogram ......................................85
SWAP Exchange the Values of Two Variables ...................86
SYSTEM Return to Operating System .............................86
TAB Tab to a Specified Position ............................86
TAN Tangent ................................................86
TYPE Declaration that defines a data type ...................87
TIME$ Get System Time (Function) .............................87
TIME$ Set System Time (Statement) ............................87
TIMER Number of Seconds since Midnight (Function) ............88
TIMER Enable/Disable Timer Trap (Statement) ..................88
TROFF Trace Off ..............................................88
TRON Trace On ...............................................88
UBOUND Upper Bound of Array Dimension .........................88
UCASE$ Returns a string with all letters in uppercase .........89
UNLOCK Remove File or Record Access Lock ......................89
VAL Numeric Value of a String ..............................89
VARPTR Offset of Variable or Offset of File Buffer ............90
VARPTR$ Offset of Variable, in Character Form ..................90
VIEW Define Screen Window ...................................90
VIEW PRINT Set Screen Text Window .................................91
WAIT Wait for Port Status ...................................91
WEND End Definition of WHILE/WEND Loop ......................92
WHILE Begin Definition of WHILE/WEND Loop ....................92
WIDTH Set Output Width .......................................93
WINDOW Redefine Screen Coordinates ............................93
WRITE Output to Screen .......................................93
WRITE # Output to Sequential File ..............................94
Operators .......................................................................94
Precedence Operator Precedence in BASIC ...........................94
^ Exponentiation .........................................95
115
* Multiplication .........................................95
/ Division ...............................................95
+ Addition and Concatenation .............................95
- Subtraction and Negation ...............................96
\ Integer Division .......................................96
MOD Modulo Arithmetic ......................................96
= Equal to/Assignment ....................................96
<> Not Equal to ...........................................97
< Less than ..............................................97
> Greater than ...........................................97
<= Less than or Equal to ..................................98
>= Greater than or Equal to ...............................98
NOT Logical NOT ............................................98
AND Logical AND ............................................98
OR Logical OR .............................................99
XOR Logical Exclusive OR ...................................99
EQV Equivalence ............................................99
IMP Implication ...........................................100
Tables ..........................................................................104
Sadržaj .........................................................................113
116