GWBASIC User's Manual
Total Page:16
File Type:pdf, Size:1020Kb
GWBASIC User's Manual User's Guide GW-BASIC User's Guide Chapters 1. Welcome Microsoft Corporation 2. Getting Started Information in this document is subject to change without 3. Reviewing and Practicing notice and does not represent a commitment on the part of 4. The Screen Editor Microsoft Corporation. The software described in this 5. Creating and Using Files document is furnished under a license agreement or 6. Constants, Variables, nondisclosure agreement. It is against the law to copy this Expressions and Operators software on magnetic tape, disk, or any other medium for any Appendicies purpose other than the purchaser's personal use. A. Error Codes and Messages © Copyright Microsoft Corporation, 1986, 1987. All rights B. Mathematical Functions reserved. C. ASCII Character Codes D. Assembly Language Portions copyright COMPAQ Computer Corporation, 1985 E. Converting Programs Simultaneously published in the United States and Canada. F. Communications G. Hexadecimal Equivalents Microsoft®, MS-DOS®, GW-BASIC® and the Microsoft logo H. Key Scan Codes are registered trademarks of Microsoft Corporation. I. Characters Recognized Compaq® is a registered trademark of COMPAQ Computer Glossary Corporation. DEC® is a registered trademark of Digital Equipment Corporation. User's Reference Document Number 410130001-330-R02-078 ABS Function ASC Function ATN Function GW-BASIC User's Reference AUTO Command Microsoft Corporation BEEP Statement BLOAD Command Information in this document is subject to change without BSAVE Command notice and does not represent a commitment on the part of Microsoft Corporation. The software described in this CALL Statement document is furnished under a license agreement or CDBL Function nondisclosure agreement. The software may be used or copied CHAIN Statement only in accordance with the terms of the agreement. It is CHDIR Command against the law to copy this software on magnetic tape, disk, or CHR$ Function any other medium for any purpose other than the purchaser's CINT Function personal use. file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (1 of 6)28/03/2004 21.28.55 GWBASIC User's Manual CIRCLE Statement © Copyright Microsoft Corporation, 1986, 1987. All rights CLEAR Command reserved. CLOSE Statement CLS Statement Portions copyright COMPAQ Computer Corporation, 1985 COLOR Statement Simultaneously published in the United States and Canada. COM(n) Statement COMMON Statement Microsoft®, MS-DOS®, GW-BASIC®, and the Microsoft CONT Command logo are registered trademarks of Microsoft Corporation. COS Function EGA® and IBM® are registered trademarks of International CSNG Function Business Machines Corporation. CSRLIN Variable CVD Function Document Number 410130013-330-R02-0787 CVI Function CVS Function Introduction DATA Statement This manual is an alphabetical reference to GW-BASIC DATE$ Statement instructions: statements, functions, commands, and variables. DEF FN Statement The name and type of each instruction is listed at the top of the DEFINT Statement page, and is followed by: DEFDBL Statement DEFSNG Statement Purpose The purpose of the instruction DEFSTR Statement Syntax The complete notation of the instruction DEF SEG Statement Comments Pertinent information about the instruction, and DEF USR Statement what happens when it is encountered by GW- DELETE Command BASIC An illustration of the instruction as it might DIM Statement Examples DRAW Statement appear in a program Notes Any special information about the instruction EDIT Command END Statement ENVIRON Statement ENVIRON$ Function EOF Function ERASE Statement ERDEV($) Variables ERL Variable ERR Variable ERROR Statement EXP Function EXTERR Function FIELD Statement file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (2 of 6)28/03/2004 21.28.55 GWBASIC User's Manual FILES Command FIX Function FOR Statement FRE Function GET Statement (Files) GET Statement (Graphics) GOSUB-RETURN Statement GOTO Statement HEX$ Function IF Statement INKEY$ Variable INP Function INPUT Statement INPUT# Statement INPUT$ Function INSTR Function INT Function IOCTL Statement IOCTL$ Function KEY Statement KEY(n) Statement KILL Command LEFT$ Function LEN Function LET Statement LINE Statement LINE INPUT Statement LINE INPUT# Statement LIST Command LLIST Command LOAD Command LOC Function LOCATE Statement LOCK Statement LOF Function LOG Function LPOS Function LPRINT Statement file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (3 of 6)28/03/2004 21.28.55 GWBASIC User's Manual LPRINT USING Statement LSET Statement MERGE Command MID$ Function MID$ Statement MKDIR Command MKD$ Function MKI$ Function MKS$ Function NAME Command NEXT Statement NEW Command OCT$ Function ON COM(n) Statement ON KEY(n) Statement ON PEN Statement ON PLAY(n) Statement ON STRIG(n) Statement ON TIMER(n) Statement ON ERROR GOTO Statement ON-GOSUB Statement ON-GOTO Statement OPEN Statement OPEN "COM(n) Statement OPTION BASE Statement OUT Statement PAINT Statement PALETTE Statement PALETTE USING Statement PCOPY Command PEEK Function PEN Statement and Function PLAY Statement PLAY(n) Function PMAP Function POINT Function POKE Statement POS Function PRESET Statement file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (4 of 6)28/03/2004 21.28.55 GWBASIC User's Manual PSET Statement PRINT Statement PRINT USING Statement PRINT# Statement PRINT# USING Statement PUT Statement (Files) PUT Statement (Graphics) RANDOMIZE Statement READ Statement REM Statement RENUM Command RESET Command RESTORE Statement RESUME Statement RETURN Statement RIGHT$ Function RMDIR Command RND Function RSET Statement RUN Command SAVE Command SCREEN Function SCREEN Statement SGN Function SHELL Statement SIN Function SOUND Statement SPACE$ Function SPC Function SQR Function STICK Function STOP Statement STR$ Function STRIG Statement STRIG(n) Statement STRING$ Function SWAP Statement SYSTEM Command TAB Function file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (5 of 6)28/03/2004 21.28.55 GWBASIC User's Manual TAN Function TIME$ Statement TIMER Function TROFF Command TRON Command UNLOCK Statement USR Function VAL Function VARPTR Function VARPTR$ Function VIEW Statement VIEW PRINT Statement WAIT Statement WHILE-WEND Statement WIDTH Statement WINDOW Statement WRITE Statement WRITE# Statement file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/index.html (6 of 6)28/03/2004 21.28.55 GW-BASIC User's Guide 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. Note 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: bold Used for commands, options, switches, and literal portions of syntax that must appear exactly as shown. italic Used for filenames, variables, and placeholders that represent the type of text to be entered by the user. monospaceUsed for sample command lines, program code and examples, and sample sessions. SMALL CAPS Used for keys, key sequences, and acronyms. Brackets surround optional command-line elements. file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter 1.html (1 of 3)28/03/2004 21.28.56 GW-BASIC User's Guide 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