GW-BASIC is a dialect of the
BASIC
BASIC (Beginners' All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College ...
programming language developed by
Microsoft from
IBM BASICA
The IBM Personal Computer Basic, commonly shortened to IBM BASIC, is a programming language first released by IBM with the IBM Personal Computer, IBM Personal Computer, Model 5150 (IBM PC) in 1981. IBM released four different versions of the Micr ...
. Functionally identical to BASICA, its
BASIC interpreter is a fully self-contained executable and does not need the
Cassette BASIC ROM found in the original
IBM PC. It was bundled with
MS-DOS operating systems on
IBM PC compatibles by Microsoft.
The language is suitable for simple games, business programs and the like. Since it was included with most versions of MS-DOS, it was also a low-cost way for many aspiring
programmer
A computer programmer, sometimes referred to as a software developer, a software engineer, a programmer or a coder, is a person who creates computer programs — often for larger computer software.
A programmer is someone who writes/creates ...
s to learn the fundamentals of
computer programming. Microsoft also sold a BASIC
compiler, BASCOM, compatible with GW-BASIC, for programs needing more speed.
According to Mark Jones Lorenzo, given the scope of the language, "GW-BASIC is arguably the ''
ne plus ultra'' of Microsoft's family of line-numbered BASICs stretching back to
Altair BASIC and perhaps even of line-numbered BASIC in general."
With the release of MS-DOS 5.0, GW-BASIC's place was taken by
QBasic, a slightly abridged version of the interpreter part of the separately available
QuickBASIC interpreter and compiler package.
On May 21, 2020, Microsoft released the
8088 assembler source code for GW-BASIC 1.0 on
GitHub under the
MIT License.
Features
IBM BASICA and GW-BASIC are largely ports of
MBASIC version 5.x, but with added features specifically for the IBM PC hardware. Common features of BASIC-80 5.x and BASICA/GW-BASIC include:
*
WHILE...WEND
loops
* Variable names of up to 40 characters
*
OPTION BASE
statement to set the starting index of array variables as either 0 or 1
* Dynamic string space allocation
*
LINE INPUT
, which allowed field-separator characters like comma to be ignored
*
CALL
statement for executing machine-language routines
*
CHAIN
and
MERGE
commands
* Ability to save programs in either tokenized binary format or ASCII text
The ability to "crunch" program lines by omitting spaces, a common feature of earlier Microsoft BASIC implementations, was removed from BASIC-80 5.x and BASICA/GWBASIC.
BASIC-80 programs not using
PEEK
/
POKE
statements run under GW-BASIC. BASICA adds many features for the IBM PC such as sound, graphics, and memory commands. Features not present in BASIC-80 include the ability to execute the
RND
function with no parameters and the ability to also save programs in a "protected" format, preventing them from being
LIST
ed. BASICA also allows double-precision numbers to be used with mathematical and trigonometric functions such as
COS
,
SIN
, and
ATN
, which wasn't allowed in 8-bit versions of BASIC. This feature was normally not enabled and required the optional parameter
/D
at startup, i.e.,
GWBASIC /D
. BASIC's memory footprint was slightly increased if it was used.
Microsoft did not offer a generic version of MS-DOS until v3.20 in 1986; before then, all variants of the operating system were OEM versions. Depending on the OEM, BASIC was distributed as either BASICA.EXE or GWBASIC.EXE. The former should not be confused with IBM BASICA, which always came as a
COM file. Some variants of BASIC has extra features to support a particular machine. For example, the AT&T and Tandy versions of DOS include a special GW-BASIC that supports their enhanced sound and graphics capabilities.
The initial version of GW-BASIC is the one included with Compaq DOS 1.13, released with the Compaq Portable in 1983, and was analogous to IBM BASICA 1.10. It uses the
CP/M
CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/ 85-based microcomputers by Gary Kildall of Digital Research, Inc. Initial ...
-derived file control blocks for disk access and does not support subdirectories. Later versions support subdirectories, improved graphics, and other capabilities.
GW-BASIC 3.20 (1986) adds
EGA
Ega or EGA may refer to:
Military
* East German Army, the common western name for the National People's Army
* Eagle, Globe, and Anchor, the emblem of the United States Marine Corps
People
* Aega (mayor of the palace), 7th-century noble of Neus ...
graphics support (no version of BASICA or GW-BASIC had
VGA support) and is the last major new version released before it was superseded by
QBasic.
Buyers of
Hercules Graphics Cards received a special version of GW-BASIC on the card's utility disk that is called HBASIC, which adds support for its 720×348 monochrome graphics. Other versions of BASICA/GW-BASIC do not support Hercules graphics and can only display graphics on that card through the use of third-party
CGA emulation, such as SIMCGA.
GW-BASIC has a
command-line-based
integrated development environment (IDE) based on
Dartmouth BASIC. Using the cursor movement keys, any line displayed on the screen can be edited. It also includes
function key shortcuts at the bottom of the screen. Like other early
microcomputer
A microcomputer is a small, relatively inexpensive computer having a central processing unit (CPU) made out of a microprocessor. The computer also includes memory and input/output (I/O) circuitry together mounted on a printed circuit board (PC ...
versions of BASIC, GW-BASIC lacks many of the structures needed for
structured programming
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
, such as local variables. GW-BASIC programs executed relatively slowly because it was an
interpreted language. All program lines must be numbered; all non-numbered lines are considered to be commands in
direct mode to be executed immediately. Program source files are normally saved in binary compressed format with
tokens replacing keywords, with an option to save in
ASCII text form.
The GW-BASIC command-line environment has commands to
RUN
,
LOAD
,
SAVE
,
LIST
the current program, or quit to the operating
SYSTEM
; these commands can also be used as program statements. There is little support for
structured programming
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
in GW-BASIC. All
IF
/
THEN
/
ELSE
conditional statements must be written on one line, although
WHILE
/
WEND
statements may group multiple lines.
Functions can only be defined using the single line
DEF FNf(x)=
statement (e.g.,
DEF FNLOG(base,number)=LOG(number)/LOG(base)
). The data type of
variables can be specified with a character at the end of the variable name:
A$
is a
string
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* ''Strings'' (1991 film), a Canadian anim ...
of characters,
A%
is an
integer, etc. Groups of variables can also be set to default types based on the initial letter of their name by use of the
DEFINT
,
DEFSTR
, etc., statements. The default type for undeclared variables not identified by such typing statements is single-precision
floating-point
In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
(
32-bit MBF
3 (three) is a number, numeral and digit. It is the natural number following 2 and preceding 4, and is the smallest odd prime number and the only prime preceding a square number. It has religious or cultural significance in many societie ...
).
GW-BASIC allows use of
joystick
A joystick, sometimes called a flight stick, is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. A joystick, also known as the control column, is the principal cont ...
and
light pen input devices. GW-BASIC can read from and write to files and
COM ports; it can also do event trapping for ports. Since the cassette tape port interface of the original IBM PC was never implemented on compatibles, cassette operations are not supported. GW-BASIC can play simple music using the
PLAY
statement, needing a string of notes represented in a
music macro language, e.g.,
PLAY "edcdeeL2edfedL4c"
. More
low-level
High-level and low-level, as technical terms, are used to classify, describe and point to specific goals of a systematic operation; and are applied in a wide range of contexts, such as, for instance, in domains as widely varied as computer scienc ...
control is possible with the
SOUND
statement, which takes the arguments of a
frequency in
hertz and a length in clock ticks for the standard internal
PC speaker in IBM machines. Consequently, sound is limited to single channel beeps and whistles as befits a "business" machine. Home-based PCs like the
Tandy 1000 allow up to three channels of sound for the
SOUND
and
PLAY
commands.
Name
There are several theories on what the initials "GW" stand for.
Greg Whitten
Greg Whitten is an American computer engineer, investor and car collector.
Whitten graduated from the University of Virginia with a B.A. in mathematics in 1973, and from Harvard University with a Ph.D. in applied mathematics in 1978.
He worked ...
, an early
Microsoft employee who developed the standards in the company's BASIC compiler line, says that
Bill Gates picked the name GW-BASIC. Whitten refers to it as ''Gee-Whiz'' BASIC and is unsure whether Gates named the program after him.
The ''Microsoft User Manual'' from
Microsoft Press also refers to it by this name. It may have also been
nicknamed ''Gee-Whiz'' because of its numerous
graphics
Graphics () are visual images or designs on some surface, such as a wall, canvas, screen, paper, or stone, to inform, illustrate, or entertain. In contemporary usage, it includes a pictorial representation of data, as in design and manufacture ...
commands.
Other common theories as to the initials' origins include "Graphics and Windows", "
Gates, William" (Microsoft's president at the time), or "Gates–Whitten" (the two main designers of the program).
See also
*
Microsoft Binary Format
In computing, Microsoft Binary Format (MBF) is a format for floating-point numbers which was used in Microsoft's BASIC language products, including MBASIC, GW-BASIC and QuickBASIC prior to version 4.00.
There are two main versions of the format ...
(MBF)
References
External links
GW-BASIC source code on GitHub*
regarding BASIC, with timeline dates for DOS, Windows and BASIC dialects
GW-BASIC– A resource for GW-BASIC, gathered from various sources.
{{DEFAULTSORT:Gw-Basic
Discontinued Microsoft BASICs
Programming languages created in 1983
BASIC interpreters
BASIC programming language family
Software using the MIT license
Assembly language software
Formerly proprietary software
Microsoft free software
Microsoft programming languages