Chapter 1
Welcome to GW-BASIC

Notational Conventions

Microsoft® GW-BASIC® is a simple, easy-to-learn, easy-to-use computer programming language with English-like statements and mathematical notations. With GW-BASIC you will be able to write both simple and complex programs to run on your computer. You will also be able to modify existing software that is written in GW-BASIC.

This guide is designed to help you use the GW-BASIC Interpreter with the MS-DOS® operating system. Section 1.5 lists resources that will teach you how to program.

1.1 System Requirements

This version of GW-BASIC requires MS-DOS version 3.2 or later.

1.2 Preliminaries

Your GW-BASIC files will be on the MS-DOS diskette located at the back of the MS-DOS User's Reference. Be sure to make a working copy of the diskette before you proceed.


This manual is written for the user familiar with the MS-DOS operating system. For more information on MS-DOS, refer to the Microsoft MS-DOS 3.2 User's Guide and User's Reference.

1.3 Notational Conventions

Throughout this manual, the following conventions are used to distinguish elements of text:


Used for commands, options, switches, and literal portions of syntax that must appear exactly as shown.


Used for filenames, variables, and placeholders that represent the type of text to be entered by the user.


Used for sample command lines, program code and examples, and sample sessions.


Used for keys, key sequences, and acronyms.

Brackets surround optional command-line elements.

1.4 Organization of This Manual

The GW-BASIC User's Guide is divided into six chapters, nine appendixes, and a glossary:

Chapter 1, "Welcome to GW-BASIC," describes this manual.

Chapter 2, "Getting Started with GW-BASIC," is an elementary guideline on how to begin programming.

Chapter 3, "Reviewing and Practicing GW-BASIC," lets you use the principles of GW-BASIC explained in Chapter 2.

Chapter 4, "The GW-BASIC Screen Editor," discusses editing commands that can be used when inputting or modifying a GW-BASIC program. It also explains the unique properties of the ten re-definable function keys and of other keys and keystroke combinations.

Chapter 5, "Creating and Using Files," tells you how to create files and to use the diskette input/output (I/O) procedures.

Chapter 6, "Constants, Variables, Expressions, and Operators," defines the elements of GW-BASIC and describes how you will use them.

Appendix A, "Error Codes and Messages," is a summary of all the error codes and error messages that you might encounter while using GW-BASIC.

Appendix B, "Mathematical Functions," describes how to calculate certain mathematical functions not intrinsic to GW-BASIC.

Appendix C, "ASCII Character Codes," lists the ASCII character codes recognized by GW-BASIC.

Appendix D, "Assembly Language (Machine Code) Subroutines," shows how to include assembly language subroutines with GW-BASIC.

Appendix E, "Converting BASIC Programs to GW-BASIC," provides pointers on converting programs written in BASIC to GW-BASIC.

Appendix F, "Communications," describes the GW-BASIC statements required to support RS-232 asynchronous communications with other computers and peripheral devices.

Appendix G, "Hexadecimal Equivalents," lists decimal and binary equivalents to hexadecimal values.

Appendix H, "Key Scan Codes," lists and illustrates the key scan code values used in GW-BASIC.

Appendix I, "Characters Recognized by GW-BASIC," describes the GW-BASIC character set.

The Glossary defines words and phrases commonly used in GW-BASIC and data processing.

1.5 Bibliography

This manual is a guide to the use of the GW-BASIC Interpreter: it makes no attempt to teach the BASIC programming language. The following texts may be useful for those who wish to learn BASIC programming:

Albrecht, Robert L., LeRoy Finkel, and Jerry Brown. BASIC. 2d ed. New York: Wiley Interscience, 1978.

Coan, James. Basic BASIC. Rochelle Park, N.J.: Hayden Book Company, 1978.

Dwyer, Thomas A. and Margot Critchfield. BASIC and the Personal Computer. Reading, Mass.: Addison-Wesley Publishing Co., 1978.

Ettlin, Walter A. and Gregory Solberg. The MBASIC Handbook. Berkeley, Calif.: Osborne/McGraw Hill, 1983.

Knecht, Ken. Microsoft BASIC. Portland, Oreg.: Dilithium Press, 1982.