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

 Download ==>>  GWCOM.exe


GWBASIC is in an ".exe" file. Double 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

^ exponentiation

- negation and */+-


Relational Operators = ,<>,<=,>=,<,>

Logical Operators NOT,AND,OR,XOR,EQV,IMP

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

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 retrieve 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 variable 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, boundary paint is fill color, boundry is border color

EDIT line number

END terminate program execution. Does not print message

ENVIRON statement. Modify parameters 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) truncate x to a whole number

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

FRE(x) return available 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 keyboard or file number

INSTR search for occurrence 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 keystroke

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

LINE INPUT A$ input up to 255 from keyboard

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 cursor 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 declare 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 negative


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