home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
turbopas
/
turbobas.rqf
/
TURBOBAS.REF
Wrap
Text File
|
1985-10-13
|
11KB
|
285 lines
Cross-Reference
Microsoft BASIC/Turbo Pascal Cross-Reference
Compiled by:
Steve T. Jones
East Central College
P. O. Box 529
Union, MO 63084
This cross-reference shows the Version 3.0 Turbo Pascal equivalents
to features found in Microsoft BASIC (Version 5.21). A few of Turbo's
functions and procedures which have no direct MBASIC equivalent have
been included to illustrate capabilities mentioned in the accompanying
article. Turbo lacks some fundamental functions found in MBASIC. Its
function and procedure declarations are so powerful, however, that this
is rarely a serious problem.
In the chart, "-----" means that the feature is not available in
Turbo Pascal, while "N/A" means "not applicable" to Turbo Pascal.
MBASIC's "AUTO" command is not applicable, for instance, because Pascal
does not use line numbers. Pascal terms in boldface are Turbo reserved
words or pre-defined identifiers. Terms in italics are supplied by the
programmer. See the Turbo Pascal Reference Manual for the correct
syntax.
MBASIC Turbo Pascal Equivalent
DIRECT COMMANDS
AUTO N/A
DELETE Editor function
EDIT Editor function
FILES Menu -- Directory function
LIST Editor function
LLIST Separate listing program
LOAD Menu -- Workfile function
MERGE Editor function
NAME -----
NEW Edit a new file
NULL N/A
RENUM N/A
RESET Menu -- Log Drive function
RUN Menu -- Run function
SAVE Menu -- Save function
SYSTEM Menu -- Quit function
TROFF -----
TRON -----
WIDTH N/A
OPERATORS
= (assignment) :=
- -
+ +
* *
/ /
^ -----
\ div
MOD mod
NOT not
AND and
OR or
XOR xor
EQV -----
IMP -----
= (equality) =
< <
> >
<=,=< <=
>=,=> >=
<> <>
----- shl -- shift left
----- shr -- shift right
----- in -- set operator
ORDER OF PRECEDENCE
expressions in () - (negation)
exponents not
- (negation) *,/,div,mod,and,shl,shr
*,/ +,-,or,xor
\ relational operators
MOD
+,- (subtraction)
relational operators
NOT
AND
OR
XOR
IMP
EQV
PROGRAM STATEMENTS -- GENERAL
CALL Procedure name; External address;
Inline(machine code);
Overlay Procedure procedure name;
Overlay Function function name;
CHAIN Chain(program);
Execute(program);
COMMON automatic if manual's conventions are
observed
Var name : type Absolute address;
DEF FN Function name(parameter list) : type;
Begin
statement(s);
End;
DEF USRn -----
DEFINT Var name : Integer;
DEFSNG Var name : Real;
DEFDBL -----
DEFSTR Var name : String[length];
DIM Var name : Array[subscript range] Of type;
END End. -- period signifies end of program
ERASE -----
ERROR -----
FOR For variable := value To value Do state
ments(s);
GOSUB procedure name;
GOTO Goto label;
IF/THEN If condition Then statement(s);
IF/THEN/ELSE If condition Then statement(s) Else state
ment(s);
IF/GOTO If condition Then Goto label;
LET variable := expression;
Move(source,object,length);
MID$ Insert(source,object,position);
NEXT N/A
ON ERROR I/O errors can be detected and managed by the
program
ON/GOSUB Case variable Of
value : statement(s);
value : statement(s);
Else : statement(s);
End;
ON/GOTO Case variable Of
value : Goto label;
value : Goto label;
End;
OPTION BASE N/A
OUT Port[number] := value;
POKE Mem[location] := value;
RANDOMIZE Randomize;
REM { comment } or (* comment *)
RESTORE N/A
RESUME -----
RETURN End;
STOP Halt;
SWAP -----
WAIT -----
WHILE/WEND While condition Do statement(s);
----- Repeat statement(s) Until condition;
PROGRAM STATEMENTS -- I/O
CLOSE Close(file name);
DATA -----
FIELD Record
variable : type;
variable : type;
End;
GET Seek(file name,record number);
Read(file name,record name);
(both required)
INPUT Read(variable list);
INPUT #n Read(filename,variable);
KILL Erase(file name); -- not available as a menu
function
LINE INPUT Readln(variable list);
LSET, RSET N/A
OPEN Assign(file name,name of disk file);
(old file) Reset(file name);
(both required)
OPEN Assign(file name,name of disk file);
(new file) Rewrite(file name);
(both required)
PUT Seek(file name,record number);
Write(file name,record name);
(both required)
READ -----
WRITE Write(variable(s));
WRITE #n Write(file name,variable(s));
----- Blockread(file name,buffer,number); (read
sectors from a disk)
----- Blockwrite(file name,buffer,number); (write
sectors to a disk)
PROGRAM STATEMENTS -- DISPLAY
----- ClrEol (clear to end of line)
----- ClrScr (clear screen)
----- DelLine (delete line)
----- InsLine (insert line)
----- GotoXY(column,row); (postion cursor at
specified coordinates)
FUNCTIONS -- ARITHMETIC
ABS Abs(integer)
Abs(real)
ATN Arctan(expression)
CDBL real variable := integer;
CINT Round(real)
COS Cos(expression)
CSNG real variable := integer;
EXP Exp(expression)
FIX Trunc(expression)
FRE(exp) N/A
FRE(string) Memavail
INT Int(expression)
LOG Ln(expression)
RND(num < 0) -----
RND(0) -----
RND(num > 0) Random
Random(integer)
SGN -----
SIN Sin(expression)
SQR Sqrt(expression)
TAN -----
----- Frac(expression) (returns the fractional part
of a number)
FUNCTIONS -- STRING
ASC Ord(char)
CHR$ Chr(expression)
HEX$ -----
INKEY$ Keypressed
Read(Kbd,variable);
INPUT$ -----
INSTR Pos(string1,string2)
LEFT$ -----
LEN Length(string)
MID$ Copy(string,start,length)
OCT$ -----
RIGHT$ -----
SPACE$ -----
STR$ Str(value,string)
STRING$ Fillchar(variable,number,char)
VAL Val(string,variable,returncode);
----- Delete(string,start,length); (remove part of
a string)
FUNCTIONS -- OTHER
CVI N/A
CVS N/A
CVD N/A
EOF Eof(file name)
ERL -----
ERR Ioresult
INP variable := Port[number];
LOC Filepos(file name)
LPOS -----
MKI$ N/A
MKS$ N/A
MKD$ N/A
PEEK variable := Mem[number];
POS -----
SPC -----
TAB -----
USR Inline(machine code);
VARPTR Addr(variable)
----- Bdos(func,param) -- CP/M BDOS functions,
result from "A" register
----- BdosHL(func,param) -- CP/M BDOS functions,
result from "HL" register pair
----- Bios(func,param) -- CP/M BIOS functions,
result from "A" register
----- BiosHL(func,param) -- CP/M BIOS functions,
result from "HL" register pair