KindlyRat's GW-BASIC Page

Geocities Archive

This is a single-page reprinting of KindlyRat's popular website hosted on Geocities at . Yahoo! shut down this webhosting service in 2009 and the only trace of the author currently apparent on the web is a defunct Blogspot: KindlyRat, if you're out there, please email me.

KindlyRat GW-BASIC

Download GW-BASIC here! Below we have GWBASIC 3.23, GW-BASIC Manual, Compiler, tutorials, examples and games, all absolutly free. Just click on the blue lettered selection, save and un-zip.

Welcome Modern School of Nagpur


Click, download and unzip the following zip files: - the complete GW-BASIC 3.23 ( 60.3K ) - a complete GW-BASIC manual by Microsoft in "help" format with indexes and easy to use format. Many thanks to Tom Cloud! - a complete GW-BASIC manual by Microsoft in html files. Thanks to Thomas Shaffner. Click on index 2 after downloading. It is an excellent linked index.

Another manual for GW-BASIC. - a GW-BASIC compiler. Read the "read me" for all the information that I know. It outputs a stand alone exe file when compiled with the /O option and linked. - a list of options for the GW-BASIC compiler (BASCOM). Some do not work.

Compiling GW-BASIC -porting GW-BASIC to QuickBasic2.0 ( probably our compiler ).

GWCOM.html - an optional list of commands. 12 Jun 2002 by KindlyRat before the above manual was recieved.

exil- a Linux / GW-BASIC converter. - an optional tutorial by Castcoly Software. After unzipping click BT1 and BT2 and press "page up" and "page down" to read.

Free BASIC Compilers and Interpreters

Norman DeForest - deep research into the GW-BASIC language.

Scott's GW-BASIC / Windows solutions!

Icon To Basic - run your favorite BASIC programs from desktop Icons!

BASIC to TEXT - change BASIC to Text (Notepad) files.

GWscan - a program from ScottServer that does the same thing. Check out the other programs too!

Here's another good GW-BASIC tutorial.

Here's a link to a TRS-80 (RadioShack) to Windows translator by AW Software. - A version of GW-BASIC for Hercules graphics

Commodore Basic for Windows.

Microsoft Small Basic A new BASIC for Windows!. - a font set for GW-BASIC for Hercules graphics

Here's some new fonts for the DOS Box that we use with GW-BASIC, Thanks to Matt Gregory!

-- HINTS --

GW-BASIC was once the main language used on home computers and is still useful in learning the fundamentals of computer programming and smaller utility programs. It still runs on Microsoft Windows computers thru WindowsXP, though not in a window, but on the black screen used for MS-DOS programming above that will pop up when you click on the GWBASIC icon.

GW-BASIC is an interpreted language which means that it isn't compiled. You type the program in or copy and paste it into a text ( Notepad ) file saved with the name and a .BAS suffix, surrounded by quotation marks. Entering "run" will start the program. GW-BASIC uses line numbers and runs and saves files with a ".BAS" suffix in the same file as the interpreter. You can also run a program by "dragging and dropping" the program on top of the interpreter.

You can find a Users Guide and Reference at any good garage sale or library. Also don't forget to check's used books and I found a "Microsoft GW-BASIC Users Guide and Reference" at for $0.75! If all else fails I have a list of GW-Basic commands for download above and several tutorials and links to tutorials.


note: these games are for GW-BASIC, BUT can be "LIST"ed and clipboarded and saved to notepad. Then you can load them into other BASIC languages. You may have to change a few lines.




I'm constantly suprised by the number of people that are interested in GW Basic as judged by the number of hits I get. I have a GW Basic Users Guide and I'll attempt to list some of the commands. Some may not work on your computer


In all attemps to tell you how to enter something, <--- will mean "hit the Enter key"


If you downloaded GWBASIC from KindlyRat, it's in a ZIP file. Use WinZip or some other compression program to unzip the file. It will then look like your computer's symbol for an ".exe" file. Clicking the icon will start GWBASIC.


System <--- , then click the Close box (X)


To Load a Program

Programs must be in the same folder as GWBASIC.exe.

Before opening GWBASIC:

you can drag and drop a BASIC program on the GWBASIC.exe icon. The program will load and begin running.

After opening GWBASIC:

F3 and finish the statement

load "MyProgram" <---

To Run a Program

F2 and finish the statement

run "MyProgram" <---

To Save a Program

save "MyProgram" <---

Arithmetic Operators

^ exponentation

- negation and */+-

Relational Operators


Logical Operators


String Operators



ABS() return the absolute value PRINT ABS(7*(-5))

ACS(x$) ASCII numbers for strings PRINT ASC(X$)

ATN(x) arctangent with X in radians PRINT ATN(X)

AUTO 100,50 gives automatic line numbers starting w/100 increment 50, exit with CTRL-C

BEEP sound PRINT CHR$(7) does the same thing, 800Hz for 0.25 seconds


CALL ARK(A,B$) Ark is assembly language location,A,B$ pass variables

CDBL(x) convert x to double precision

CHAIN "PROG1",100 passes control to "prog1" program line 100

CHDIR "B:INVENTORY" changes directory to "INVENTORY" on B drive

CHR$(66) convert ascii code to character, "66" is upper case B

CINT(x) round number with decimal to next integer

CIRCLE(100,100),50 draws a circle of radius 50 at point x100 y100

CLEAR veriables to 0, strings to null, close open files

CLOSE 1,#2,#3 terminate input/output to disk file or device 1, 2, 3

CLS clear screen


COLOR foreground,background,border

maximums (screen 0) are foreground 31 ( for blink, add 16 ), background 7, border 15.

to return to Windows screen the command is SCREEN 0. See SCREEN also for dimensions

COLOR 31, 7, 15

SCREEN 1 ( I don't understand SCREEN 1 )

COLOR 15, 15

COLOR 15, 15

COLOR 15, 15

More Functions

COMMON A,G$ used with CHAIN to pass variables to chained program

CONT continue after a break

COS(x) cosine(radians)

CSNG(x) convert x to single precision

y=CSRLIN return cursor row position


DATA 3,10,5 data constants

v$=DATE$,DATE$=V$ set or retrive current date mm-dd-yy,mm/dd/yy or yyyy

DEF FN define & name a function written by user DEF FNAB(X,Y)=X^3/Y^2

DEFINT/SGN/DBL/STR define as integer,single precision,double precision or string

DEF SEG assign current segment address to be addressed by BLOAD,BSAVE,PEEK,POKE,USR

DEF USR specify starting address of Assembly Language program called by USR function


DIM A(220) max values for array variable subscript and allocate memory


DRAW "Un;Dn;Ln;Rn;En;Fn;Gn;Hn;"
Drawing starts at middle of screen in a graphics mode.
Small n (above) is a varible representing a number or a number
U is up, D down, L left, R right, E up&right, F down&right, G down&left, H up&left
Mx,y line is drawn from current position to point x,y M+or-x,y x&y are added to position
Prefixes B move but plot no points, N Move but return when done
Commands As is Set angle 0 to 3, TA is turn angle -360 to +360, Cn is set color, Sn is scale.
Ppaint, boundry paint is fill color, boundry is border color

More Functions

EDIT line number

END terminate program execution. Does not print message

ENVIRON statement. Modify perameters in string table

ENVIRON$ function. Retrieve environment string form table

EOF returns -1 when end of sequential or com file is found, 0 if not found

ERASE erase arrays from a program

ERDEV ERDEV$ return value of device error or name of device causing error

ERR or ERL return error codes

ERROR simulate an error

EXP(x) return base of natural log to the power of x

EXTERR(n) return extended error info

FIELD(#) allocate space random file buffer

FILES(pathname) like DIR in dos

FIX(x) trundate x to a whole number

FOR and NEXT for n = 1 to 10 step 2:print n:next n

FRE(x) return avalible bites in string memory

GET read a record from random disk file to random buffer

GET Statement (graphics) GET (125,139)-(170-180),A

GOSUB...RETURN branch to & return from subroutine

GOTO branch to specified line number

A$=HEX$(x) return hex value of argument

IF...THEN...ELSE determine program flow by testing

A$=INKEY$ return one character from keyboard

INP(n) return byte from port n


INPUT# file number,variable list

INPUT$ return string of X characters from keaboard or file number

INSTR search for occurance of string & return position

INT(x) truncate to a whole number

IOCTL #1, "PL66" send "control data" string to device driver

IOCTL$(#1) read "control data" string from open device driver

KEY key number,string Up to 15 characters w/ one keastroke

n is 1-10 functions,11 cursor up,12 left,13right,14 down

KILL filename delete file from disk

LEFT$(x$,n) return a string that is the

LEN(x$) return number of characters in x$

LET D=12 optional in GWBASIC


LINE(X1,Y1)-(X2,Y2),2 draw lines in color 2
LINE(X1,Y1)-(X2,Y2),2,B B is Box X & Y are box corners
LINE(X1,Y1)-(X2,Y2),2,BF 2 is color 2 (BF is filled box)
LINE -(X2-Y2) draw from last point in foreground color
LINE -(RND*319,RND*199)RND*2,BF draws random lines

More Functions

LINE INPUT A$ input up to 255 from keaboard

LINE INPUT# read line from a sequential file to a string variable

LIST 10-50 list all or part of program line numbers

LLIST to line printer

LOAD "MYPROGRAM" loads a file from same folder to memory

LOC return current position in file

LOCATE 1,1 move cursur to screen location

LOCK #n locks entire file n
LOCK #n,X locks record X only
LOCK #n, TO Y locks records 1 through Y
LOCK #n, X TO Y locks records X through Y

LOF(file number) length of file in bytes

LOG(x) returns natural log. X is > 0

LPOS(x) return position of line printer head within line printer buffer

LPRINT expression1, expression 2 & LPRINT USING print data to line printer

LSET,RSET move data to random file buffer and left or right justify for PUT statement

MERGE filename merge the lines from program file to file in memory


MKDIR "C:SALES\JOHN" make a subdirectory

MKI$, MKS$, MKD$ convert numeric values to strings I is Integer, S is single, D double

NAME "oldFilename" AS "newFilename"

NEW delete program in memory and clear variables

OCT$(x) convert decimal value to octal

ON COM(n), ON KEY(n), ON PEN, ON PLAY(n), ON STRIG(n), ON TIMER(1 to 86400) event traps

ON ERROR GOTO lineNumber




OPTION BASE n 0 or 1 declair minimum value for array subscript, default is 0

OUT integer,port OUT 12345,225send a byte to output port

PAINT (x start,ystart)[,paint attribute[,border attribute][,bckgrnd attribute]]
10 CLS
30 LINE (0,0)-(100,150),2,B
40 PAINT (50,50),1,2
50 LOCATE 20,1

PCOPY 1,2 copy one screen page to another

PEEK A=PEEK(&H5A00) read from a memory location

PEN read the light pen X=P(n)

PLAY "B-D+C" play Bflat,Dsharp,C music

PLAY(n) return number of notes in the background music queue

PMAP(exp,function) map to a logical or physical location.

POINT(x,y) read color from screen

POKE a,b poke a byte into memory location POKE &H5A00,&HFF

POS(c) return current cursor position

PRESET,PSET(x,y)[,color] display a point on the screen


PRINT USING "###.##"; 987.654 print strings or numbers in a format

PRINT#1,A PRINT# USING write data to sequential disk file

PUT write record from random buffer to random disk file

PUT transfer graphics images to screen

RANDOMIZE TIMER reseed random number generator

READ A(n) reads value from data statement and assign to variable

REM remark

RENUM 1000,900,20 renumbers lines from 900 up so they start with 1000 and increment 20

RESET close files and write directory info to diskette

RESTORE(line no) allow DATA statements to be reread from a line

RESUME continue program execution after an error-recovery procedure

RETURN return from a subroutine


RMDIR delete a directory

RND return a random number between 0 and 1

RUN MYPROGRAM execute program in memory


SCREEN (10,10) return character at x,y position

SCREEN 0 text mode
SCREEN 1 320X200 80X25 text character-box = 8X8
SCREEN 2 640X200 40X25 text character-box = 8X8
SCREEN 7 320X200 40X25 text character-box = 8X8
SCREEN 8 640X200 80X25 text character-box = 8X8
SCREEN 9 640X350 80X25 text character-box = 8X14
SCREEN 10 640X350 80X25 text character-box = 8X14

SGN(x) returns sign of x 1 is positive, 0 is 0, -1 is negitive


SIN(x) in radians

SOUND frequency,duration

SPC(n) skip n number of spaces in a PRINT or LPRINT statement

SPACE$(x) return a string of x spaces

SQR(x) square root of x

STICK(n) return x and y coordinates of two joysticks

STOP stop execution and return to command mode

STR$(x) return a string version of x, the opposite of VAL(x$)

STRING$(n,f) return n characters of ASCII f, or first letter of f$


SYSTEM return to MS-DOS

TAB(n) spaces to position n (1 - 255)

TAN(x) radians

TIME$ A$=TIME$ set or get the current time

TIMER v=TIMER number of seconds since midnight or system reset

TRON/TROFF trace execution of a program


USR call an assembly language program

VAL(a$) return numeric value of a string. VAL( -3) returns a neg 3

VARPTR(variable name) memory address of variable



WAIT 32,2 suspend operation until port 32 gets a 2 as input

WHILE-WEND WHILE A<=100: do stuff :WEND

WIDTH 80 set line width

WINDOW(x1,y1)-(x2,y2) draws windows


WRITE# write data to a sequential file

Changing GW-BASIC files into Notepad (text) files

With old non-commercial GW-BASIC programs you can load them into the GW-BASIC program and then enter LIST. Then you can use the "Mark" feature on the DOS screen to drag and mark the whole program then save it to your clipboard. Then you paste the program into windows "Notepad" and save it as anything you want. It will come out as a text file that you can change around. For it to run like it is as a BASIC program it must be saved as a BASIC file with a BASIC subscript ( "MYFILE.BAS" ), with parenthesis around it, and saved as "All Files" which is the alternative in the "save as type" dropdown box. You can still "drag and drop" the text file on the GW-BASIC icon and it'll still run AND you can change it back to that horrible GW-BASIC format if you want.

I'd been using the above overly clever method for years when Matt Gregory wrote and said all you have to do is load the tokenized, "compressed" program into GW-BASIC and then save it in the following form: SAVE "MYPROGRAM",A . It works like a dream. I decided to keep the above paragraph to again demonstrate my lack of expertise in GW-BASIC!

Running BASIC programs from Desktop Icons

1) Put the program you want to run in the same folder as the GWBASIC.exe file.

2) Create a shortcut to the program on your desktop.

3) Right click the shortcut ( now on your desktop ) and in the "pop up box" click "properties"

4) The "pop up box" target entry shows the address that the shortcut is pointing to. It should look something like:


Change it to something like:


5) On my computer the Icon changes to the MSDOS icon.

6) Now when you click the Icon, your GW-BASIC program will pop up and automatically run!

Short Biography

Waisted Life As...

Civil Servant ( big suprise ! ), NARF Norfolk VA, MCLB Albany GA, Ft Devens MASS, Ft Story VA, Picatinny NJ

Second Job, Musician(Bass)

Norfolk ........

BensKitchen, WhingDing, Vito's, PurpleOnion, Continental, Esquire, BellsPeppermint, EbbTide, Congo, Jamaican, Romeo's, PenMar, Moose, VFW, Chief, Aerodrome

AlBiny GA.......

WagonWheel,VFW, Moose


Email me at if you have any comments or questions.