home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / turbopas / turbobas.rqf / TURBOBAS.REF
Text File  |  1985-10-13  |  11KB  |  285 lines

  1.                             Cross-Reference
  2.              Microsoft BASIC/Turbo Pascal Cross-Reference
  3.  
  4.                              Compiled by:
  5.  
  6.                             Steve T. Jones
  7.                          East Central College
  8.                              P. O. Box 529
  9.                            Union, MO  63084
  10.  
  11.      This cross-reference shows the Version 3.0 Turbo Pascal equivalents
  12. to features found in Microsoft BASIC (Version 5.21).  A few of Turbo's
  13. functions and procedures which have no direct MBASIC equivalent have
  14. been included to illustrate capabilities mentioned in the accompanying
  15. article.  Turbo lacks some fundamental functions found in MBASIC.  Its
  16. function and procedure declarations are so powerful, however, that this
  17. is rarely a serious problem.
  18.  
  19.      In the chart, "-----" means that the feature is not available in
  20. Turbo Pascal, while "N/A" means "not applicable" to Turbo Pascal.
  21. MBASIC's "AUTO" command is not applicable, for instance, because Pascal
  22. does not use line numbers.  Pascal terms in boldface are Turbo reserved
  23. words or pre-defined identifiers.  Terms in italics are supplied by the
  24. programmer.  See the Turbo Pascal Reference Manual for the correct
  25. syntax.
  26.  
  27.      MBASIC              Turbo Pascal Equivalent
  28.  
  29. DIRECT COMMANDS
  30.  
  31.      AUTO                N/A
  32.      DELETE              Editor function
  33.      EDIT                Editor function
  34.      FILES               Menu -- Directory function
  35.      LIST                Editor function
  36.      LLIST               Separate listing program
  37.      LOAD                Menu -- Workfile function
  38.      MERGE               Editor function
  39.      NAME                -----
  40.      NEW                 Edit a new file
  41.      NULL                N/A
  42.      RENUM               N/A
  43.      RESET               Menu -- Log Drive function
  44.      RUN                 Menu -- Run function
  45.      SAVE                Menu -- Save function
  46.      SYSTEM              Menu -- Quit function
  47.      TROFF               -----
  48.      TRON                -----
  49.      WIDTH               N/A
  50.  
  51. OPERATORS
  52.  
  53.      = (assignment)      :=
  54.      -                   -
  55.      +                   +
  56.      *                   *
  57.      /                   /
  58.      ^                   -----
  59.      \                   div
  60.      MOD                 mod
  61.      NOT                 not
  62.  
  63.      AND                 and
  64.      OR                  or
  65.      XOR                 xor
  66.      EQV                 -----
  67.      IMP                 -----
  68.      = (equality)        =
  69.      <                   <
  70.      >                   >
  71.      <=,=<               <=
  72.      >=,=>               >=
  73.      <>                  <>
  74.      -----               shl -- shift left
  75.      -----               shr -- shift right
  76.      -----               in -- set operator
  77.  
  78. ORDER OF PRECEDENCE
  79.  
  80.      expressions in ()   - (negation)
  81.      exponents           not
  82.      - (negation)        *,/,div,mod,and,shl,shr
  83.      *,/                 +,-,or,xor
  84.      \                   relational operators
  85.      MOD
  86.      +,- (subtraction)
  87.      relational operators
  88.      NOT
  89.      AND
  90.      OR
  91.      XOR
  92.      IMP
  93.      EQV
  94.  
  95. PROGRAM STATEMENTS -- GENERAL
  96.  
  97.      CALL                Procedure name; External address;
  98.  
  99.                          Inline(machine code);
  100.                          Overlay Procedure procedure name;
  101.                          Overlay Function function name;
  102.      CHAIN               Chain(program);
  103.                          Execute(program);
  104.  
  105.      COMMON              automatic if manual's conventions are
  106.                          observed
  107.                          Var name : type Absolute address;
  108.      DEF FN              Function name(parameter list) : type;
  109.                            Begin
  110.                              statement(s);
  111.                            End;
  112.      DEF USRn            -----
  113.      DEFINT              Var name : Integer;
  114.      DEFSNG              Var name : Real;
  115.      DEFDBL              -----
  116.      DEFSTR              Var name : String[length];
  117.      DIM                 Var name : Array[subscript range] Of type;
  118.      END                 End. -- period signifies end of program
  119.      ERASE               -----
  120.  
  121.      ERROR               -----
  122.  
  123.      FOR                 For variable := value To value Do state
  124.                          ments(s);
  125.  
  126.      GOSUB               procedure name;
  127.  
  128.      GOTO                Goto label;
  129.  
  130.      IF/THEN             If condition Then statement(s);
  131.  
  132.      IF/THEN/ELSE        If condition Then statement(s) Else state
  133.                          ment(s);
  134.  
  135.      IF/GOTO             If condition Then Goto label;
  136.      LET                 variable := expression;
  137.                          Move(source,object,length);
  138.      MID$                Insert(source,object,position);
  139.      NEXT                N/A
  140.      ON ERROR            I/O errors can be detected and managed by the
  141.                          program
  142.      ON/GOSUB            Case variable Of
  143.                            value : statement(s);
  144.                            value : statement(s);
  145.                            Else : statement(s);
  146.                          End;
  147.      ON/GOTO             Case variable Of
  148.                            value : Goto label;
  149.                            value : Goto label;
  150.                          End;
  151.      OPTION BASE         N/A
  152.      OUT                 Port[number] := value;
  153.      POKE                Mem[location] := value;
  154.      RANDOMIZE           Randomize;
  155.      REM                 { comment } or (* comment *)
  156.      RESTORE             N/A
  157.      RESUME              -----
  158.      RETURN              End;
  159.  
  160.      STOP                Halt;
  161.      SWAP                -----
  162.      WAIT                -----
  163.      WHILE/WEND          While condition Do statement(s);
  164.      -----               Repeat statement(s) Until condition;
  165.  
  166. PROGRAM STATEMENTS -- I/O
  167.  
  168.      CLOSE               Close(file name);
  169.      DATA                -----
  170.      FIELD               Record
  171.                            variable : type;
  172.                            variable : type;
  173.                          End;
  174.      GET                 Seek(file name,record number);
  175.                          Read(file name,record name);
  176.                          (both required)
  177.      INPUT               Read(variable list);
  178.  
  179.      INPUT #n            Read(filename,variable);
  180.      KILL                Erase(file name); -- not available as a menu
  181.                          function
  182.      LINE INPUT          Readln(variable list);
  183.      LSET, RSET          N/A
  184.      OPEN                Assign(file name,name of disk file);
  185.      (old file)          Reset(file name);
  186.                          (both required)
  187.      OPEN                Assign(file name,name of disk file);
  188.      (new file)          Rewrite(file name);
  189.                          (both required)
  190.      PUT                 Seek(file name,record number);
  191.                          Write(file name,record name);
  192.                          (both required)
  193.      READ                -----
  194.      WRITE               Write(variable(s));
  195.      WRITE #n            Write(file name,variable(s));
  196.      -----               Blockread(file name,buffer,number); (read
  197.                          sectors from a disk)
  198.      -----               Blockwrite(file name,buffer,number); (write
  199.                          sectors to a disk)
  200.  
  201. PROGRAM STATEMENTS -- DISPLAY
  202.  
  203.      -----               ClrEol (clear to end of line)
  204.      -----               ClrScr (clear screen)
  205.      -----               DelLine (delete line)
  206.      -----               InsLine (insert line)
  207.      -----               GotoXY(column,row); (postion cursor at
  208.                          specified coordinates)
  209.  
  210. FUNCTIONS -- ARITHMETIC
  211.  
  212.      ABS                 Abs(integer)
  213.                          Abs(real)
  214.      ATN                 Arctan(expression)
  215.      CDBL                real variable := integer;
  216.      CINT                Round(real)
  217.      COS                 Cos(expression)
  218.      CSNG                real variable := integer;
  219.      EXP                 Exp(expression)
  220.      FIX                 Trunc(expression)
  221.      FRE(exp)            N/A
  222.      FRE(string)         Memavail
  223.      INT                 Int(expression)
  224.      LOG                 Ln(expression)
  225.      RND(num < 0)        -----
  226.      RND(0)              -----
  227.      RND(num > 0)        Random
  228.                          Random(integer)
  229.      SGN                 -----
  230.      SIN                 Sin(expression)
  231.      SQR                 Sqrt(expression)
  232.      TAN                 -----
  233.      -----               Frac(expression) (returns the fractional part
  234.                          of a number)
  235. FUNCTIONS -- STRING
  236.  
  237.      ASC                 Ord(char)
  238.      CHR$                Chr(expression)
  239.      HEX$                -----
  240.      INKEY$              Keypressed
  241.                          Read(Kbd,variable);
  242.      INPUT$              -----
  243.      INSTR               Pos(string1,string2)
  244.      LEFT$               -----
  245.      LEN                 Length(string)
  246.      MID$                Copy(string,start,length)
  247.      OCT$                -----
  248.      RIGHT$              -----
  249.      SPACE$              -----
  250.      STR$                Str(value,string)
  251.      STRING$             Fillchar(variable,number,char)
  252.      VAL                 Val(string,variable,returncode);
  253.      -----               Delete(string,start,length); (remove part of
  254.                          a string)
  255.  
  256. FUNCTIONS -- OTHER
  257.  
  258.      CVI                 N/A
  259.      CVS                 N/A
  260.      CVD                 N/A
  261.      EOF                 Eof(file name)
  262.      ERL                 -----
  263.      ERR                 Ioresult
  264.      INP                 variable := Port[number];
  265.      LOC                 Filepos(file name)
  266.      LPOS                -----
  267.      MKI$                N/A
  268.      MKS$                N/A
  269.      MKD$                N/A
  270.      PEEK                variable := Mem[number];
  271.      POS                 -----
  272.      SPC                 -----
  273.      TAB                 -----
  274.      USR                 Inline(machine code);
  275.      VARPTR              Addr(variable)
  276.      -----               Bdos(func,param)   -- CP/M  BDOS functions,
  277.                          result from "A" register
  278.      -----               BdosHL(func,param) -- CP/M BDOS functions,
  279.                          result from "HL" register pair
  280.      -----               Bios(func,param)   -- CP/M  BIOS functions,
  281.                          result from "A" register
  282.      -----               BiosHL(func,param) -- CP/M BIOS functions,
  283.                          result from "HL" register pair
  284.  
  285.