---
title: GW-BASIC
slug: gw-basic
qid: 
snapshot: enwiki-001374883415
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1374883415
tags: [116403970, 20326374, 22911578, 23138749, 23230146, 23332931, 23603337, 24623845, 24745122, 26220375, 3469218, 54734851, 60958065, 90990102]
---

# GW-BASIC

> [!note] Provenance
> Snapshot `enwiki-001374883415` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1374883415> · Licensed CC BY-SA 4.0

GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. 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. 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 programmers 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.

GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. 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. It was bundled with MS-DOS operating systems on IBM&nbsp;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 programmers 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&nbsp;— 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&nbsp;1.0 on GitHub under the MIT License. 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)= statement (e.g., ). 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 (32-bit MBF). GW-BASIC allows use of joystick 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&nbsp;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 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&nbsp;speaker in IBM machines. Consequently, sound is limited to single channel beeps and whistles as befits a "business" machine. GW-BASIC for the Tandy&nbsp;1000 allows up to three channels of sound for the SOUND and PLAY commands.
