This manual gives a description of the Basmark QuickBASIC Compiler, including the syntax and semantics of the language it accepts, its operation, and its compatibility with Microsoft BASIC as implemented on the IBM Personal Computer. See BASIC to QuickBASIC: A Basmark Odyssey in the Supplemental Documentation section of this manual for additional background.
This manual does not attempt to provide tutorial information on the fundamentals of the BASIC language. BASIC is a very popular language and instructional material is available from a variety of sources. The best sources are often friends who have experience in the language. In addition many courses are available at educational institutions and a large number of books have been published on the subject.
Some of the features of Basmark QuickBASIC are not thoroughly discussed in independent publications so a tutorial is included about these features. See A QuickBASIC Tutorial in the Supplemental Documentation section of this manual.
The official statement of the language follows this introduction (see The Basmark QuickBASIC Language). The remainder of this manual is comprised of three sections:
Section 1 (Statements, Functions and Variables) describes in details all the statements, functions and special variables available in Basmark QuickBASIC. This is the section most frequently referenced.
Section 2 (Run-Time Support Library) describes in detail the run-time support library of Basmark QuickBASIC. This section is intended for programmers experienced in the BASIC and C languages who wish to interface BASIC with other languages.
Section 3 (Supplemental Documentation) contains other useful documents about Basmark QuickBASIC. In particular see Basic(1) - Manual Page which amends your UNIX Programmer’s Manual and see A QuickBASIC Tutorial which offers instruction on the less widely known features of Basmark QuickBASIC. The other documents form a set of appendices to the body of this manual.
The first two sections of this manual are organized in a format familiar to users of the UNIX Programmer’s Manual. Each section is composed of a series of short entries beginning with an introduction. Each entry is titled for the name and subsection of the statement, function, etc. the entry describes. The subsections provide further organization: see the section introduction for a description of these. The title appears in the upper left and right hand corners of each page of the entry with the subsection name in parentheses. The pages of each entry are numbered starting with one. Each section is ordered alphabetically by title. At the end of each section is a permuted index. A permuted index is handy when you know what you want but do not recall its name.
Each entry is organized in sections by a series of headings. Not every heading is appropriate to every entry. Some headings appear only rarely and are not described here. The standard headings are described below and appear in this order:
This section describes some of the basic information required to get started using the Basmark QuickBASIC Compiler.
Getting started with UNIX: In order to use the compiler some familiarity with UNIX (the host operating system) is necessary. See How to get started in the Introduction of the UNIX Programmer’s Manual.
Creating a BASIC source file: Generally a BASIC source file is entered with a text editor such as vi(1) or ed(1). See the appropriate section of the UNIX Programmer’s Manual.
Upper/Lower Case: It is important that the keywords of the BASIC language appear in lower-case. If you enter these keywords in upper-case, the compiler will not recognize them and the compilation will be aborted.
If a program with keywords in upper-case must be compiled, use the “-m” option on the compiler. This option causes the compiler to automatically translate all upper-case characters to lower-case (characters appearing in string constants and filenames in $include meta-statements are not translated). See basic(1) in the Supplemental Documentation section of this manual (or in the UNIX Programmer’s Manual).
Compiling: The syntax for the compiler invocation command basic is designed after that of cc(1). The important options are the same. See basic(1) for details. The output of the compiler (the executable) will be left in a file named “a.out” in the current directory.
The program basic usually resides in /usr/bin since this directory is searched automatically by the shell. The compiler passes and run-time library normally reside in /usr/lib/basic. Temporary files used by the compiler are normally placed in /tmp. The location of the compiler passes and library and the location of temporary files may be changed: see basic(1).
Running a BASIC program: The executable version of a BASIC program is run by simply naming the executable file as a command to a UNIX shell. The standard input, output and error output (normal directed to the user’s terminal) may be redirected to files with the shell. See sh(1) or csh(1) in the UNIX Programmer’s Manual.
The behavior of a few BASIC statements depends on the type of terminal in use. For these statements to work properly, the environment variable TERM must be set appropriately before the program is run. This is the same method used by the vi screen editor. If the screen editor works on your terminal, these BASIC statements will almost certainly work also. If you suspect that the TERM variable has not been set properly, see vi(1) in the UNIX Programmer’s Manual which will refer you to your system’s vi tutorial.
In addition, some BASIC I/O statements and functions depend on the use of a full-duplex terminal. Mainframe computers are often equipped with half-duplex terminals. If you are using a mini- or micro-computer, your terminal is almost certainly of the full-duplex variety so you need not be concerned with this issue. On the other hand, if a half-duplex terminal (such as the IBM 3278) is used, some BASIC I/O statements and functions must make adjustments. For these statements and functions to work properly, the environment variable BASECHO must be set to a non-null value. Any value may be used as long as it is not the empty string. The same executable program will work for both kinds of terminals: BASECHO need only be set when the program is run for half-duplex terminals. Since half-duplex terminals are line-oriented some of the unusual features of the BASIC input statements and functions work somewhat differently. See the appropriate entries in the Statements, Functions and Variables section of this manual under the Usage Notes headings.
At the source level, Basmark QuickBASIC is highly compatible with Microsoft BASIC on the IBM PC. See A Comparison of Basmark QuickBASIC and Microsoft BASIC in the Supplemental Documentation section of this manual for a complete discussion of the differences.
The UNIX file system: File naming conventions in UNIX differ from those in MS-DOS. Where file name specifications are required, UNIX file names must be used.
Floating-point Support: The Basmark QuickBASIC Compiler generates code which takes full advantage of floating-point processors present in the system configuration.
Graphics and Hardware Support: The Microsoft compiler supports BASIC language features which are used to access particular hardware components of the IBM PC (e.g., light pens, joy sticks, color graphics monitor, serial ports, some function keys, printer port). Basmark QuickBASIC assumes only that an ordinary ASCII terminal is available and that the TERM environment variable is properly set to identify the terminal. IBM PC hardware-dependent statements and functions are not supported.
from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber