1 BASIC The BASIC interpreter invoked by this command is Digital's BASIC-11, which is compatible with standard "Dartmouth" BASIC, but NOT Microsoft BASIC (which may be made available later). It is exited by its BYE command. To interrupt a running program, type control/C. The following additional HELP is available: Commands gives a summary of keyboard commands, Statements lists statement syntaxes, Functions lists built-in functions, Library lists various general-purpose BASIC programs available, Variables describes variable types and naming. 2 Commands The following keyboard commands are available: RUN Execute currently stored program. RUN file Load and execute program in named file. SAVE file Save program in named file (new version). REPLACE file Save program in named file, overwriting old file. SAVE LP: Print program on the lineprinter. UNSAVE file Delete file. CAT List BASIC program files in your directory. OLD file Load program from file, but do not execute. APPEND file Append program text from to program in memory. LIST List program in memory on the terminal. SCR Clear program from memory. DEL l1-l2 Delete lines l1 to l2 (inclusive) from program. LENGTH Print space used/free. BYE Exit from the interpreter, NOT VMS. SUB l/o/n/p Change p'th occurrence of string "o" to "n" on line l. CALL "TRCON" Trace on -- print line numbers as statements are executed. CALL "TRCOFF" Trace off. 2 Statements CALL "name"(args) LINPUT string CHAIN filename LINPUT #channel,string CLOSE #channel NAME file1 TO file2 COMMON variables NEXT variable DATA list ON expression GOTO DEF FNx=statement ON expression GOSUB DIM array(size) OPEN filename FOR INPUT AS FILE #chan DIM array(size)=channel OPEN filename FOR OUTPUT AS FILE #chan END OVERLAY filename FOR x=a TO b [STEP c] PRINT list GOSUB line no RETURN GOTO line no RANDOMIZE IF condition THEN READ list IF condition GOSUB REM comment IF END #channel THEN RESTORE INPUT RESTORE #channel INPUT #channel RETURN KILL filename STOP filenames are string variables or literals in quotes. Channel numbers are ÿ1-13, plus 0 = TT:. Multiple statements may appear on one line, separated by backslashes (\). 2 Functions arithmetic string utility matrix ---------- ------ ------- ------ ABS(X) ASC(X) SYS(1/4/6) MATZER * ATN(X) BIN(B$) TTYSET(225,W) MATIDN * COS(X) CHR$(I) RCTRLO MATCON * EXP(X) CLK$ RCTRLC MATTRN * INT(X) DAT$ CTRLC MATADD * LOG(X) LEN(S$) ABORT(X) MATSUB * LOG10(X) OCT(O$) MCR * MATMUL * PI POS(S$,K$,N) DCL * MULTRA * RND or RND(X) SEG$(S$,A,B) CLI * TRAMUL * SGN(X) STR$(X) TRCON * MATINV * SIN(X) TRM$(S$) TRCOFF * SUM * SQR(X) VAL(S$) SYSTEM * INPROD * TAB(X) GETADR * Functions marked * are accessed by CALL statements. 3 Matrix_functions Matrix functions are entered through the CALL interface, as: 100 CALL "MATZER"(A,M%,N%) Arrays MUST have previously been DIMensioned. The 0 row and column are not used. Variables MUST be of type shown below. MATZER(A(),M%,N%) Zeroes elements of A(MxN) MATIDN(A(),M%,N%) Sets A(MxN) to the unit matrix MATCON(A(),M%,N%) Sets A(MxN) to a matrix of all ones MATTRN(A(),B(),M%,N%) Sets A(MxN) to transpose (~) of B(NxM) MATADD(A(),B(),C(),M%,N%) A(MxN) = B(MxN) + C(MxN) MATSUB(A(),B(),C(),M%,N%) A(MxN) = B(MxN) - C(MxN) MATMUL(A(),B(),C(),M%,P%,N%) A(MxN) = B(MxP) * C(PxN) MULTRA(A(),B(),C(),M%,P%,N%) A(MxN) = B(MxP) * ~C(NxP) TRAMUL(A(),B(),C(),M%,P%,N%) A(MxN) = ~B(PxM) * C(NxP) MATINV(A(),M%) Inverts A in place, determinant to A(0,0) SUM(R,I%,A(J%),N%) R = Sum(i=1...N%) of A(J%+I%*i) INPROD(R,I%,A(L%),J%,B(M%),N%) R = Sum(i=1...N%) of A(L%+I%*i)*B(M%+J%*i) Internal working of SUM and INPROD is in double-precision. 3 System_Commands DCL, MCR, and CLI functions may be used to send commands to the system. The format is: CALL "DCL"(command$,length%[,exit_status%]) where: command$ is a string containing the command length% is the length of command$ exit_status% is an optional integer which will receive the exit status of the spawned command e.g. 100 CALL "DCL"("DIRECTORY",9%,E%) does a directory listing, and returns success/failure to E%. DCL sends its command to the DCL command line interpreter, MCR and CLI both send commands to MCR. 2 Variables Variable names may consist of a single letter, or single letter plus single digit only. User-defined functions may be FN+letter only. Variables may be simple, arrays (1 or 2 dimensions), and type integer, floating-point, or string, according to suffix, as:- X is a floating-point variable, X% is an integer variable, X$ is a string variable, X(...) is a floating-point array, X%(...) is an integer array. X$(...) is a string array. Different types are distinct, e.g. X, X%, X$, X(), X%(), and X$() may exist in the same program and take different values. Array subscripts are (0...10), or (0...10,0...10) unless DIMed otherwise (upper bound only). 2 Library ACNET AC Network analysis LINFIT Linear regression ALGEBRA Algebraic expansion POLFIT Polynomial fit AUTOPLOT Function/data plotting POLOPS Polynomial arithmetic BANNER Big letter printer POLRO Polynomial roots DCNET DC Network analysis ROOTS Roots of functions DIFFEQ Differential equations SMOOTH Data smoothing EIGEN Eigensystems SORTN Sort string + number list EXSPEC Graphical data editor SORTS Sort list of string pairs FLOGEN Flowchart BASIC program SPLINE Spline interpolation FOUFIT Fourier series fit SPLITUP Split FORTRAN source file FOURIER Fourier transform STATISTIC Statistics INTEGRATE Integration of a function UNSOL Solve underdet lin eqns LINENOS Line nos cross-referencer VARIABLES Variables cross-ref LINEQ Solve linear equations All these programs are in library directory DU:[NUMERICAL.BASIC]. You can use them, having entered BASIC, by typing: RUN DU:[NUMERICAL.BASIC]program User documentation is available in the computer room.