Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
GW-BASIC
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 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: * <code>WHILE...WEND</code> loops * Variable names of up to 40 characters * <code>OPTION BASE</code> statement to set the starting index of array variables as either 0 or 1 * Dynamic string space allocation * <code>LINE INPUT</code>, which allowed field-separator characters like comma to be ignored * <code>CALL</code> statement for executing machine-language routines * <code>CHAIN</code> and <code>MERGE</code> 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 <code>PEEK</code>/<code>POKE</code> 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 <code>RND</code> function with no parameters and the ability to also save programs in a "protected" format, preventing them from being <code>LIST</code>ed. BASICA also allows double-precision numbers to be used with mathematical and trigonometric functions such as <code>COS</code>, <code>SIN</code>, and <code>ATN</code>, which wasn't allowed in 8-bit versions of BASIC. This feature was normally not enabled and required the optional parameter <code>/D</code> at startup, i.e., <code>GWBASIC /D</code>. 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]]-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 [[Enhanced Graphics Adapter|EGA]] 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 Card]]s 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 [[Color Graphics Adapter|CGA]] emulation, such as SIMCGA. GW-BASIC has a [[Command-line interface|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]] versions of BASIC, GW-BASIC lacks many of the structures needed for [[structured programming]], 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 [[Lexical analysis#Token|tokens]] replacing keywords, with an option to save in [[ASCII]] text form.<ref name="DocUtil">{{cite web|url=http://www.xs4all.nl/~hwiegman/gwbasic.html |title=GW-BASIC Documentation and Utilities |archive-url = https://web.archive.org/web/20071217161146/http://www.xs4all.nl/~hwiegman/gwbasic.html |archive-date = 2007-12-17}}</ref> The GW-BASIC command-line environment has commands to <code>RUN</code>, <code>LOAD</code>, <code>SAVE</code>, <code>LIST</code> the current program, or quit to the operating <code>SYSTEM</code>; these commands can also be used as program statements. There is little support for [[structured programming]] in GW-BASIC. All <code>IF</code>/<code>THEN</code>/<code>ELSE</code> [[Conditional (computer programming)|conditional statements]] must be written on one line, although <code>WHILE</code>/<code>WEND</code> statements may group multiple lines. [[Subroutine|Functions]] can only be defined using the single line <code>[[User-defined function#BASIC language|DEF FN]]f(x)={{var|<mathematical function of x>}}</code> statement (e.g., {{code|1=DEF FNLOG(base,number)=LOG(number)/LOG(base)|2=basic}}). The data type of [[Variable (computer science)|variables]] can be specified with a character at the end of the variable name: <code>A$</code> is a [[string (computer science)|string]] of characters, <code>A%</code> 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 <code>DEFINT</code>, <code>DEFSTR</code>, etc., statements. The default type for undeclared variables not identified by such typing statements is single-precision [[Floating-point arithmetic|floating-point]] ([[Microsoft Binary Format#32-bit MBF|32-bit MBF]]).<ref name="Guide">{{cite web|url=http://www.xs4all.nl/~hwiegman/gw-man/index.html|title=GW-BASIC User's Guide|year=1987|access-date=2008-06-28}}</ref> GW-BASIC allows use of [[joystick]] and [[light pen]] input devices. GW-BASIC can read from and write to files and [[serial port|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 <code>PLAY</code> statement, needing a string of notes represented in a [[music macro language]], e.g., <code>PLAY "edcdeeL2edfedL4c"</code>. More [[High- and low-level|low-level]] control is possible with the <code>SOUND</code> 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. GW-BASIC for the [[Tandy 1000]] allows up to three channels of sound for the <code>SOUND</code> and <code>PLAY</code> commands.<ref name="Guide"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)