|
|
GWCOMMANDS
Conventions In all attempts to tell you how to enter something, <--- will mean "hit the Enter key" Download ==>> GWCOM.exe To Start GWBASIC GWBASIC is in an ".exe" file. Double clicking the icon will start GWBASIC.
To Stop GWBASIC System <--- , then click the Close box (X)
YOUR MOUSE WILL NOT WORK IN THE GWBASIC WINDOW.
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 =,<>,<,>,<=,>=
Functions 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 BLOAD,BSAVE 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 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 CVI,CVS,CVD 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 DELETE 40 DELETE 40-100 DELETE -40 DIM A(220) max values for array variable subscript and allocate memory DRAW "Un;Dn;Ln;Rn;En;Fn;Gn;Hn;" 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 "Enter BIRTHDATE",B$ 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 KEA(n)ON,KEY(n)OFF,KEY(n)STOP 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 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 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 MID$ 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 ON ...GOSUB, ON...GOTO OPEN "B:TEMP" FOR INPUT AS #1 OPEN "COM(n) 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]] 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 "HELLO WORLD",X$,A;B 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 RIGHT$ RMDIR delete a directory RND return a random number between 0 and 1 RUN MYPROGRAM execute program in memory SAVE MYPROGRAM SCREEN (10,10) return character at x,y position SCREEN 0 text mode SGN(x) returns sign of x 1 is positive, 0 is 0, -1 is negative SHELL 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$ SWAP A$,B$ 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 UNLOCK 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 VARPTR$ VIEW[[SCREEN][(x1-y1)-(x2-y2)[,[fill][,border]]]] 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 A,B,C$ WRITE# write data to a sequential file
|