GW-BASIC

From Wikipedia, the free encyclopedia

GW-BASIC
GW-BASIC 3.22 displaying the Hello world program
Developer Microsoft (for Compaq)
Influenced QBASIC,QuickBasic
OS MS-DOS

GW-BASIC was a dialect of BASIC developed by Microsoft from BASICA, originally for Compaq.

It is compatible with Microsoft/IBM BASICA, but was disk based and did not require the ROM BASIC included on IBM's machines. It was bundled with MS-DOS operating systems on IBM PC compatibles by Microsoft. Like other early microcomputer versions of BASIC, GW-BASIC lacked many of the structures needed for structured programming such as local variables, and GW-BASIC programs executed relatively slowly, due to the fact that it was an interpreted programming language. It did have a large number of graphics commands, which gave it the nick-name of Gee Whiz BASIC. Microsoft also sold a BASIC compiler, BASCOM, compatible with GW-BASIC, for applications requiring more speed.

The language was suitable for simple games, business programs and the like. Since it was included with most versions of MS DOS, it was also an inexpensive way for many would-be programmers to learn the fundamentals of computer programming. It provided a way to develop science fair projects for aspiring students.

GW-BASIC has a command line-based Integrated Development Environment (IDE) system based on the original introduced at Dartmouth College. All program lines must be numbered, all non-numbered lines are considered to be commands in direct mode to be executed immediately. The user interface is almost completely command line, except for the function key shortcuts at the bottom. Program source files are normally saved in binary compressed format with tokens replacing commands, 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 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)=<mathematical function of 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 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.

GW-BASIC allowed for the joysticks, mice and light pen input devices of its time. GW-BASIC can read from and write to files and COM ports; it can also do event trapping for ports. Since the cassette port interface of the original IBM PC was never implemented on compatibles, cassette operations are not supported. GW-BASIC is able to play simple music using the PLAY statement, requiring a string of notes (e.g. PLAY "edcdeee2dfedc4"). More low-level 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 such as the Tandy 1000, allowed up to 3 channels of sound for the SOUND and PLAY commands. GW-BASIC also implemented a NOISE command which had 8 sound effects that could be pitch, speed, and length altered.

The initials "GW" may have been named after Greg Whitten, an early Microsoft employee who developed the standards in the Microsoft basic compiler line. It is also purported to stand for Gee-Whiz as stated in the Microsoft User Manual from Microsoft Press for GW-BASIC. Greg Whitten is not certain on this matter.[1] Other common theories as to the initials' origins include "Graphics and Windows" and "Gates, William". Another common belief is that GW stands for Gates-Whitten, the two main designers of the program. [2]

With the release of MS-DOS 5.0, GW-BASIC's place was eventually taken by Microsoft QBASIC[3], a cut-down version of the separately available Microsoft QuickBASIC compiler.

[edit] References

[edit] External links