Vector Basic Interpreter Basic 80 Reference Manual

5IA)iC
intc:tit=tcl:c=t
MIClOSOI"l'
BASIC-88
Rsrision 5.9
Revision A
January
1, 1988
CopyriC)ht1988 Vector Graphic Inc.
Copyright 1979 Microsoft
Copyright
1980 by
Vector Graphic Inc.
All rights reserved.
Disclaimer Vector Graphic makes no representations or warranties with respect to the contents of this manual itself, \1ohetheror not the product it describes is
covered
by
a warranty or repair agreement. Further, Vector Graphic reserves
the right to revise this publication and to makechanges from time to time
in the content hereof without obl igation of Vector Graphic to notify any person of such revision or changes, except ~en an agreement to the contrary exists.
Revisions The date and reV1Slon of each page herein appears at the bottom of each page. 'I'he revision letter such as A or B changes if the MANUALhas been
improved but the PRODUCTitself has not been significantly ItDdified. 'I'he
date and revision on the Title Page corresponds to that of the page most
recently revised. Whenthe product itself is roodified significantly, the
product will get a new revia ion number, as shownon the manual's title page, and the manual will revert to revision A, as if it were treating a brand new
product. EAaiMANUALSHOULDONLYBEUSEDWITHTHEPRODUCTIDENTIFIEDONTHE
TITLEPAGE.
'Ibis manualis intended for cemputer
suppliers, or others with at least a nr::x:1eratetechnical knowledgeof small
canputers and canputer progranming,and the basic c:p!ration of the Vector Graphic canputer to be used.
'Ibis manualwill describe the features, cannands, and syntax of Microsoft BASIC-80, Revision 5.0, ani explain howit is used on a Vector Graphiccanputer that uses CP/M
as its c:p!rating system. '!houghit oovers every aspect of the language, it is not
intended as a training manualfor novice
programners Chapter
1
discusses BASIC-80generally. Chapter 2 contains the syntax and use of every cxmnandand statenent in BASIC-80,in
alphabetic order. Chapter 3 describes every
intrinsic function in BASIC80, also alpha-
betically. In the appendices, certain
tcpics such as disk I/O, using assembly languagesubroutines, the relationship to
CP/M,ani the carrpatibility with the BASIC
carpiler, are discussed in greater detail,
and there are lists of error messages,ASCII
codes, mathfunctions, newfeatures in
Revision 5.0, ani sane tips on converting
£ran other BASIC's.
\
This is the reference manual for Vector Graphic's implementation of Microsoft's BASIC-Se,Revision 5.e, one of the most extensive and .high-speed BASIC'savailable. It meets the ANSIqualifications for BASIC,as set forth
in document BSRX3.60-l97S. Vector Graphic is proud to offer; the BASIC-S0 interpreter with Vector GraPlic systems.
For readers familiar with earlier versions of Microsoft BASIC,AppendixA describes the enhancements in Revision 5.0 over earlier releases, including incanpatibilities with them. If you have software written in one of the earlier versions, check Appendix A for new features that may affect execution.
This manual covers a number of upwardcompatible versions of BASIC-Se,
specifically the -SK,- -Extended," an; "Disk- versions. My feature in the
SKand Extended versions is available in the Disk version. The version
available fran Vector Graphic is the Disk version. Therefore, everything described in this manual is present in the Vector Graphic implementation, no matter ~at version it is listed under.
Most users will makeuse of the BASIC-aainterpreter. (The interpreter is a progrClll ~ich allows entry and ed!tiB3 of BASICprograms, and executes them line by line W1eneverdesired.) For certain specialized applications, the Microsoft BASICcompiler (BASCOM)is also available through Vector
Graphic. 'lbe canpiler allows ~u to convert a BASIC-S0progrClll,originally written and debu;ged using the interpreter, into machine language, Wlich can
then be executed at very high speed. \\hen ~u obtain the canpiler, you will receiver a manual detailing its use, but because it may be relevent to a user of the BASIC-aeinterpreter, Appendix L discusses the BASICcanpiler in
brief. Note that Appendix L lists several features which are present in the
interpreter but \tbich are absent or different in the canpiler. Programmers intending to compile BASIC-S0programs must pay attention to these differences.
In a Vector Graphic canputer, BASIC-Seruns in conjuction with the CP/M operating system. The name of the BASIC-Seinterpreter file on the disk supplied by Vector Graphic is -MBASIC.CQtl.- Therefore, in order to call up the interpreter fran the CP/Mexecutive, do the following: First, if MBASIC
is not already present on the main CP/Mdiskette, mount the BASIC-Sedisk in drive A. Then, following the A> prompt, type MaASle and then press the RETURNkey. Optionally, you can enter one or more parameters before depressil'Xl RETURN,including the name of the BASICprogram you want to
execute, the number of files you want OPENat one time, and the highest memorylocation you want BASICto use. These options are discussed in Appendix D. In this manual, the term -initialization" means the above process, of calling up BASIC-Se,nothil'Xlmore.
Of particular interest is the option to immediately execute a BASIC program by typiB3 its nane as a paraneter followil'Xl the word MBASIC. This causes the program to be loaded, and then executed as if a RUNcommandwere
typed. In other words, the system jumps directly into the application program whenMBASICis called up. Further, if you are using CP/M2, rather than an earlier version of CP/M,you can configure ~ur system diskette to
bypass the CP/M.executive and instead carry out a particular CP/Mcommandor
utility, su::h as calling up MSASIC. You accomplish this by creating an
"auto" command, which you do
by
running the CONFIGutility present on the CP/M2 serialized diskette. If your auto camnandcontains "MBASIC"followed by the name of a BASICprogrClllon the same diskette, optionally followed
by
other parasneters, followed
by
a RETURN,then \lben you boot up the system, it
will bypass all executives and automatically begin executing the BASIC program. (This assumes MBASIC.CCMand the BASICprogram are on the system diskette aloD; with CP/M.) This allows creation of an attractive "turn-key"
package.
Appendix 0 explains several other canmandsand aspects of BASIC-aethat
deal specifically with CP/M. Use it as an integral part of this manual.
Please note the followirJ;J points whenusirJ;J this manual: It is NOTnecessary to create a file tnder the CP/Mexecutive before it
can be used
by
BASIC-aa.
To return to the CP/Mexecutive fran the BASIC-8eexecutive, tyPe SYSTEM
followed
by
the RETURNkey.
Whenusin;r a Vector System B, Memorite II, Vector 3"311l,or other Vector
Graphic system having "memorymappedvideo" and using the option
gv
Extended Systems M:>nitor, do NOTpress the LF or LINEFEEDkey in order to continue a BASICline on a second line on the screen. Instead, the video driver will cause the text to
"wrap
aro\.md"automatically. The same is true for any
serial terminal that has automatic wrap around.
~en listing progran text or output, BASIC-a"assunes it is outputting to
a l32-character widtb printer. If your system's printer is narrower, it
will be able to print lOn;Jlines only if the printer or the printer driver
software in the operating system has the ability to automatically wrap around at the end of a line. '1bis is dePendent on the particular pr inter you are using.
References to "printing" in this manual, as in most BASICmanuals, refer
to displaying text on the operator's console, which is usually a video screen. '!be tem "printing" derives fran the original use of Teletype and other hard-copy printin;J terminals. '!be manual will refer specifically to
the "line printer" when referring to output intended for the system's output
printer, (sometimes called the "lister"), which is usually a separate peripheral fran the operator's console. OUtput directed
by
BASIC-Sillto the
"line printer" is sent
by
BASIC-aeto CP/M's logical lister output routine,
which normally saRis the data out via a channel connected electronically to
a printer of some kind. The t"'lOcanmandsthat cause BASIC-a"to send data
in this way to the "line printer" are LLISTand LPRINT.
Reference is made in several places to the console's bell. This is only
relevent if the terminal you are using has a bell. The Vector Graphic memory-mapPedvideo console at this time has no bell.
APPENDIX C Assembly Language Subroutines APPENDIX 0 BASIC-SO with the CP/M Operating System APPENDIX E
APPENDIX I Converting Programs to BASIC-SO APPENDIX
J
Summary of Error Codes and Error Messages
APPENDIX K Mathematical Functions
CRAPTER 1
GENE~ INFORMATION ABOUT BASIC-SO
The procedure for initialization will vary with different
implementations of BASIC-SO.· Check the appropriate appendix
at the back of this manual to determine how BASIC-SO is
initialized with your operating system.
1.2 MODES
Q!.
OPERATION
When BASIC-80 is initialized, it types the· prompt wOkw
ftOkftmeans BASIC-SO is at command level, that is, it is
ready to accept commands. At this point, BASIC-SO may be
used in either of two modes: the direct mode or the indirect mode.
In the direct mode, BASIC commands and statements are not
preceded by line numbers. They are executed as they are
entered. Results of arithmetic and logical operations may
be displayed immediately and stored for later use, but the
instructions themselves are lost after execution. This mode is useful for debugging and for using BASIC as a
·calculatorWfor quick computations that do not require a complete program.
The indirect mode is the mode used Program lines are preceded by line memory. The program stored in entering the RUN command.
for entering programs.
numbers and are stored in
memory is executed by
Program.lines in a BASIC program have ~~e following format
(square brackets indicate optional):
nnnnn BASIC statement[:BASIC statement•••l<carriage return>
At the programmerts option, more than one BASIC statement may be placed on a line, but each statement on·a line must be separated from.the last by a colon.
A BASIC program line always begins with a line number, ends with a carriage return, and may contain a maximum of:
72 characters in SK BASIC-SO
255 characters in Extended and Disk BASIC-SO.
In Extended and Disk versions, it is possible to extend a logical line over more than one physical line by use of the terminal's <line feed> key. <Line feed> lets you continue typing a logical line on the next physical line without entering a <carriage return>. (In the SK version, <line feed> has no effect.
Every BASIC program line begins with a line number. Line numbers indicate the order in which the program lines are stored in memory and are also used as references when
branching and editing. Line numbers must be in the range
a
to 65529. In the Extended and Disk versions, a period (.)
may be used in EDIT, LIST, AUTO and DELETE commands to refer
to the current line.
14 CBARACTEll ~
The BASIC-SO character set is comprised of alphabetic characters, numeric characters and special characters.
The alphabetic characters in BASIC-SO are the upper case and lower case letters of the alphabet.
The numeric characters in BASIC-SO are the digits 0 through
9.
The following special characters and terminal keys are recognized by BASIC-SO:
<delete>
<escape>
<line feed> <carriage
return>
<backspace>
Name
BIaiik
Semicolon
Equal sign or assignment symbol Plus sign
Minus sign
Asterisk or multiplication symbol
Slash or division symbol
Up arrow or exponentiation symbol
Left parenthesis Right parenthesis Percent Number (or pound) sign
Dollar sign Exclamation point Left bracket
Right bracket Comma Period or decimal point
Single quotation mark (apostrophe) Colon Ampersand Question mark Less than Greater than Backslash or integer division symbol At-sign Underscore Deletes last character typed. Escapes Edit Mode subcommands.
See Section 2.16. Moves print position to next tab stop. Tab stops are every eight columns. Moves to next physical line.
Terminates input of a line.
Deletes last character typed, and erases it from screen.
Interrupts program execution and returns to BASIC-SO command level.
Backspace. Deletes the last character typed. Tab. Tab stops are every eight columns.
output second
while
Control-o
execution
restarts
Halts program
continues. A
output. Retypes the line that is currently being
typed.
Suspends program execution. Resumes program execution after a Control-S. Deletes the line that is currently being
typed.
Constants are the actual values BASIC uses during execution. There are two types of constants: string and numeric.
A string constant is a sequence of up to 255 characters enclosed in double quotation marks •. string constants:
alphanumeric
Examples of
"HELLO"
"$25,000.00"
"Number of Employees"
Numeric constants are positive or negative numbers. Numeric constants in BASIC cannot contain commas. There are five types of numeric constants:
Whole numbers between -32768 and +32767. Integer constants do not have decimal points.
2. Fixed Point constants
Positive or negative real numbers, i.e., numbers that contain decL~al points.
3. Floating Point
constants
Positive or negative numbers repre-·
sented in exponential form (similar to scientific notation). A floating point constant consists of an optionally signed integer or fixed point number (the mantissa) followed by the letter E and an optionally signed integer (the exponent). The exponent must be in the range -38 to +38. Examples:
235.988E-7=.0000235988 2359E6 2359000000
(Double precision floating point constants use the letter D instead of E. S~e Section 1.5.1.)
Hexadecimal numbers with the prefix &H.Examples:
&H76 &H32!'
Octal numbers with the prefix &0 or &. Examples:
&0347 &1234
1.5.1 Single ~ Double Precision
!2E!~
Numeric constants
In the SK version of BASIC-SO, all numeric constants are single precision numbers. They are stored with 7 digits of
precision, and printed with up to 6 digits.
In .the Extended and Disk versions, however, numeric constants may be either single precision or double prec~s~on numbers. With double precision, the numbers are stored with
16 digits of precision, and printed with up to 16 digits.
A single
precision constant is
any
numeric
constant
that
has:
1
seven or fewer digits, or
2.
exponential form using
E,
or
3.
a trailing exclamation point
(1)
A double precision constant is
any numeric
constant
that
has:
1.
eight or more digits, or
2.
exponential form using
0, or
3.
a trailing number sign
(I)
Examples: Single Precision constants
46.8
-7.09E-06
3489.0
22.51
345692811
-1.094320-06
3489.0+
7654321.1234
V~iables are names used to represent values that are used
in a BASIC program. ~he value of a variable may be assigned explicitly by the programmer, or it may be assigned as the result of calculations in the proqram. Before a variable is assigned a value, its value is assumed to be zero.
BASIC-80 variable names may be any length, however, in the
8K version, only the first two characters are significant
.In the Extended and Disk versions, up to 40 characters are
significant. ~he characters allowed in a variable name are letters and numbers, and the decimal point is allowed in Extended and Disk variable names. The first character must be a letter. Special type declaration characters are also allowed -- see below.
A variable name may not be a reserved word. The Extended and Disk versions allow embedded reserved words; the 8K version does not. If a variable begins with FN, it is assumed to be a call to a user-defined function. Reserved
words include all BASIC-80 commands, statements, function
Variables may represent either a numeric value or a .string.
String variable names are written with a dollar sign
($)
as the last character. For example: A$. nSALES REPORT". The dollar sign is a variable type declaration character, that is, it ndeclares· that the variable
will
represent a string.
In the Extended and Disk versions, numeric variable names
may declare inteqer, single or double precision values.
(All numeric values in SX are single precision.) The type
declaration characters for these variable names are as
follows:
, Integer variable
1 Single precision variable
t
Double precision variable
The default type for a numeric variable name is single precision.
Examples of BASIC-SO variable names follow.
In Extended and Disk versions:
PIt
MINIMUM 1 LIMIT'
declares a double precision value declares a single precision value declares an integer value
In SX, Extended and Disk versions:
N$ declares a string value ABC represents a single precision value
In the Extended and Disk versions of BASIC-SO, there is a second method by which variable types may be declared. The
BASIC-SO statements DEFINT, DEFSTR, DEFSNG and OEFDSL may be
inclcded in a program to declare the types for certain
variable names. These statements are described in detail in
Section 2.12.
1.6.2 Array Variables
An array is a group or table of values referenced by the
same variable name. Each element in an array is referenced
by an array variable that is subscripted with integers or
integer expressions. An array variable name has as many subscripts as there are dimensions in the array. For example V(10) would reference a value in a one-dimensional array, T(1,4) would reference a value in a two-dimensional array, and so on.
When necessary, BAS~C will convert a numeric constant from one type to another. The following rules and examples
should be kept in mind.
1. If a numeric constant of one type is set equal to a numeric variable of a different type, the number
will be stored as the type declared in the variable
name. (If a string 'variable is set equal to a numeric value o~ vice versa, a "Type mismatch" error occurs.) Example:
10 A% 23.42
20 PRINT At
RON
23
2. During expression evaluation, all of the operands
in an arithmetic or relational operation are
converted to the same degree of precision, i.e., that of the most precise operand. Also, the result of an arithmetic operation is returned to this degree of precision. EXamples:
10
ot
61/7
The arithmetic was performed 20 PRINT Of in double precision and the RUN result was returned in Of
.8571428571428571 as a double precision value.
10
0
=-
6#/7
20 PRINT
0
RON
.857143
The arithmetic was performed
in double precision and the
result was returned to 0 (single
precision variable), rounded and
printed as a single precision
value.
3. Logical operators (see Section 1.8.3) convert their operands to integers and return an integer result. Operands must be in the range -32768 to 32767 or an
"Overflow" error occurs.
4. When a floating point value is converted to an integer, the fractional portion is rounded. EXample:
10 C'l
:II
55.88
20 PRINT C%
RON
56
5. If a double precision variable is assigned a single precision value,
only
the first seven digits, rounded, of the converted number will be valid. This is because
only
seven digits of accuracy
were
supplied with the single precision value. The absolute value of the difference between the printed double precision number and the original single precision value will be less than 6.3E-8 times the original single precision value. Example:
10 A 2.04
20 B. A
30 PRINT A;S#
RON
2.04 2.039999961853027
An expression may be simply a string or numeric constant, or
a variable, or it may combine constants and variables with operators to produce a single value.
Operators perform mathematical or logical operations on
values. The operators provided by BASIC-SO may be divided
into four categories:
1. Arithmetic
2. Relational
1.8.1 Arithmetic Operators
The arithmetic operators, in order of precedence, are:
Operation Exponentiation Negation
Multiplication, Floating
Point Division
X·Y
X/Y
To change the order in which the operations use parentheses. Operations within performed first. Inside parentheses, the operations is maintained.
Here are some sample algebraic expressions and their BASIC counterparts.
are performed, parentheses are usual order of
Algebraic Expression
X+2Y
Y
X--
Z
XY
z-
X+Y
-Z
(X2) Y
y
Z
X
BASIC Expression
X+Y*2 X-y/z X*Y/Z
(X+Y)/Z (XA2)AY
XA(YAZ)
X*(-Y)
Two consecutive operators must be separated by parentheses.
1.8.1.1 Integer Division And Modulus Arithmetic - Two additional operators are-available in Extended and Disk versions of BASIC-SO: Integer division and modulus arithmetic.
Integer division is denoted by the operands are rounded to integers
-32768 to 32767) before the division quotient is truncated to an integer.
baCks lash (') The
(must be in the range
is performed, and the
For example:
10\4
:I
2
25.68\6.99 3
The precedence of integer division is
multiplication and floating point division.
Modulus arithmetic is denoted by the operator MOD. It gives
the integer value that is the remainder of an integer division. For example:
10.4 MOO 4
=
2 (10/4=2 with a remaL~der 2)
25.68 MOD 6.99
=
5 (26/7=3 with a remainder 5)
The precedence of modulus arithmetic is just after integer di~lision.
1.8.1.2 Overflow And Division
!I
Zero - If, during the evaluation of an exp-riSsion, a division by zero is encountered, the "Division by zero" error message is
displayed, machine infinity with the sign of the numerator
is supplied as the result of the division, and execution continues. If the evaluation of an exponentiation results in zero being raised to a negative power, the "Division by zero" error message is displayed, positive machine infinity is ·supplied as the result of the exponentiation, and execution continues.
If overflow occurs, the "Overflow" error message is
displayed, machine infinity with the algebraically correct
sign is supplied as the result, and execution continues.
1.8.2 Relational Operators
Relational operators are used to compare two values. The result of the comparison is either "true" (-1) or "false"
(0). This result may then used to make a decision regarding
program flow. (See IF, Section 2.26.) Operator Relation Tested
Expression
"
-
Equality
X-Y
<> Inequality
x<>y
< Less
than X<Y
>
Greater than
x>y
<-
Less 'thanor
equal to
x<=y
>-
Greater than
or equal to
x>-y
(The equal sign
is also used to assign a value
to a
variable. See LET, Section 2.30.) When arithmetic and relational operators are combined in one
expression, the arithmetic is always performed first. 'For
example, the expression
is uue if the value of X plus Y is less than the value of
T-1 divided by Z. More examples:
IF SIN(X)<O GOTO 1000 IF I MOOJ<> 0 THEN K=K+1
1.9.3 Loqieal
Opera~ors
Logical opera~ors perform tes~s on multiple relations, bit manipulation, or Boolean operations. The logical operator returns a bitwise result which is either "true" (not zero) or "false" (zero). In an expression, logical operations are performed after a:ithmetic and relational operations. The outcome of a logieal operation is de~ermined
as
shown in the
following table. The operators are listed in order of
precedence.
NOT
X
NOT
X
1
0
0
1
AND
X
y
X AND
y
1
1 1
1
0 0
0
1
0
0 0
0
OR
X
Y X OR Y
1
1
1
1
0
1
0
1
1
0 0 0
XOR
X
Y
X
XOR Y
1
1
0
1
0
1
0
1 1
0
0 0
IMP
X
Y X IMP Y
1
1 1
1
0 0
0
1
1
0
0
1
EQV
X
Y
X
EQV
y
1
1
1
1
0 0
0
1
0
a
a
1
Just as the relational operators can be used to make decisions regarding program flow, logical operators can connect two or more relations and return a true or false
value to be used in a decision (see IF, Section 2.26). For
IF 0<200 AND F<4 TEEN 80 IF I>10 OR K<O THEN 50 IF NOT P THEN 100
Logical operators work by converting their operands to sixteen bit, siqned, two
r
S
complement integers in the range
-32768 to +32767. (If the operands are not in this range, an error results.) If both operands are supplied as 0 or -1,
logical operators return 0 or -1. The given operation is performed on these integers in bitwise fashion, i.e., each bit of the result is determined by the corresponding bits in the two operands.
Thus, it is possible to use logical operators to test bytes
for a particular bit pattern. For instance, the AND operator maybe used to "mask" all but one of the bits of a
status byte at a machine I/O port. The OR operator may be used to "merge" two bytes to create a particular binary value. Tbe following examples will help demonstrate how the
logical operators work.
63 binary 111111 and 16 binary 10000, so 63 AND 16 - 16
15 binary 1111 and 14 - binary 1110, so 15 AND 14 - 14 (binary 1110)
-1 - binary 1111111111111111 and 8 binary 1000, so -1 AND 8 8
4 binary 100 and 2 -binary 10, so 4 OR 2 - 6 (binary 110)
10 - binary 1010, so 1010 OR 1010
1010 (10)
-1 binary 1111111111111111 and
-2 binary 1111111111111110, so -1 OR -2 -1. The bit
complement of sixteen zeros is
sixteen ones, which is the two's complement representation of -1.
The two's complement of any integer
is t,hebit complement plus one.
1.S.4 Functional Operators
A function is used in an expression to call a predetermined
operation that is to be performed on an operand. BASIC-SO has "intrinsic" functions that reside in the system, such as SQR (square root) or SIN, (sine). All of BASIC-SO's intrinsic functions are described in Chapter 3.
BASIC-SO also allows "user defined" functions that are
written by the programmer. See OEF FN, Section 2.11.
1.S.5 String Operations
Strings may be concatenated using
+.
For example:
10 A$-"FILE" : B$."NAME" 20 PRINT A$+B$ 30 PRINT "NEW "+A$
+
B$ RON FILENAME
NEW FILENAME
Strings may be compared using the same relational operators that are used with numbers:
String comparisons are made by taking one character at a time from each string and comparing the ASCII codes. If all the ASCII codes are the same, the strings are equal. If the ASCII codes differ, the lower code number precedes· the higher. If, during string comparison, the end of one string
is reached, the shorter string is said to be smaller.
Leading and trailing blanks are significant. Examples:
"AA"<"AB" "FILENAME" "FILENAME"
"X,">"X."
"CL "
>
"CL"
"kg">"KG"
" SMYTH"
<
"SMYTHE·
t
B$
<
"9/12/7S" where B$ "S/12/7S"
Thus, string comparisons can be used to test string values or to alphabetize strings. All string constants used in comparison expressions must be enclosed in quotation marks.
If an incorrect character is entered as a line is being typed, it can be deleted with the DElete key 'orwith
BAC<SPACE
DElete surrounds the deleted character (s) with
backslashes, and
~PACE'
has the effect of backspacing over a character and erasing it. Once a character(s) has been deleted, simply continue typing the line as desired.
To delete.a line that is in the process of being typed, type Control-U. A carriage return is executed automatically
after the line is deleted.
To correct program lines for a program that is currently in memory, simply retype the line using the same line number. BASIC-SO will automatically replace the old line with the new line.
More sophisticated editing capabilities are provided in the Extended and Disk versions of BASIC-SO. See EDIT, Section
2.16.
To delete the entire program that is currently residing in memory, enter the NEW command. (See Section 2.41.) NEW is usually used to clear memory prior to entering a new program.
If BASIC-SO de~ects an error that causes program execution to terminate, an error message is printed. In the SK
version, only the error code is printed. In the Extended
and Disk versions, the entire error message is printed. For a complete list of BASIC-SO error codes and error messages, see Appendix
J.
CRAPTER2
BASIc-eo COMMANDS AND STATE.'1EN'I'S
All of the BASIC-eO commands and statements are described in this chapter. Each description is formatted as follows:
Shows the correct format for the instruction. See below for format notation.
Lists the versions of BASIc-eo
in which ~e instruction is available.
Purpose:
Remarks:
Describes in detail how the instruction
is used. Shows sample programs or program segments
that demonstrate the use of the instruction.
Format Notation Wherever the format for a statement or command is given, the
following rules apply:
1. Items in capital letters must be input as shown.
2. Items in lower case letters enclosed in angle brackets
«
»
are to be supplied by the user.
3. Items in square brackets ([
J)
are optional.
4. All punctuation except angle brackets and square
brackets (i.e., commas, parentheses, semicolons, hyphens, equal signs) must be included where shown.
s.
Items followed by an ellipsis (•••) may be repeated any number of times (up to the length of the line).
6. Items separated by a vertical bar (,) are mutually exclusive; choose one.
AUTO [<line number> [,<increment>]] Extended, Disk To generate a line number automatically after
every carriaqe return.
ACTO beqins numberinq at <line number> and
increments each subsequent line number by <increment>. The default for both values is 10. If <line number> is followed by a comma but <increment> is not specified, the last increment
specified in an AUTO command is assumed.
If AUTO generates a line number that is already beinq used, an asterisk is print.edafter the number to warn the user that any input will replace the existing line. However, typinq a
carriaqe return immediately after the asterisk will save the line and qenerate the next line
number. AUTO is terminated by typinq Control-c. The
line in which Control-c is t.ypedis not saved. Aft.er Control-C is typed, BASIC returns to
command level.
Generates line numbers 100,
150,200 •••
Generates line numbers 10, 20, 30, 40 •••
Purpose: Remarks:.
CALL <variable name>[«argument list»] Ex1:ended,Disk To call an assembly lanquaqe subroutine. The CALL statement is one way to transfer
proqram flow to an assembly lanquaqe subroutine.
(See also ~e USR function, Section 3.40)
<variable name> contains an address'that is the
startinq point in memory of ~e subroutine. <variable name> may not be an array variable name. <argument list> contains the arquments that are passed to ~e assembly lanquaqe subroutine.
The CALL statement qenerates the same callinq sequence used by Microsoft's FORT~~, COBOL and BASIC compilers.
110 MYROOT-&HDOOO
120 CALL MYROOT(I,J,X)
~N [MERGE] <filename>[,[<line number exp>]
[,ALL][,DELETE<range>]] Disk To ca.lla program and pass variables to it from
the current program. <filename> is the name of the program that is
called. Example:
CRAIN"PROG1"
<line number exp> is a line number or an
expression that evaluates to a line number in
the called program. It is the starting point
for execution of the called program. If it is omitted, execution begins at the first line. Example:
CBAIN"PROG1",1000
<line number exp> is not affected by a RENOM
command. With the ALL option, every variable in the
current program is passed to the ca~led program.
If the ALL option is omitted, the current program must contain a COMMON statement to list
the variables that are passed. See Section 2.7. Example:
If the MERGE option is included, it allows a
subroutine to be brought into the BASIC program
as an overlay. That is, a MERGE operation is performed with the current program and the
called program. The called program must be an ASCII file if it is to be MERGEd. Example:
After an overlay is desirable to delete be brought in. To option. Example:
CRAJ:NMERGEl'OVIU.AY2 " , 1000,DELETE 1000-5000
brought in, it is usually it so that a new overlay may
do this, use the DELETE
The line numbers in <range> are affected by the
BENUM command.
Loading...
+ 160 hidden pages