Thi� documen� i� � quic� referanc�  o� al� o� th� standar� function� �
an� procedure� containe� i� th� programin� envirnmen� Turb� Pascal�  The� �
ar� groupe� b� typ� o� operatio� (eg.- Strin� procedure�, Fil� procedures.).


   Reserved Words

  * absolute     * external       nil          * shr
    and            file           not          * string
    array          for            of             then
    begin          forward        or             to
    case           function       packed         type
    const          goto           procedure      until
    div            if             program        var
    do             in             record         while
    downto       * inline         repeat         with
    else           label          set          * xor
    end            mod          * shl

* - The asterisks indicate reserved words not defined in standard Pascal.


   Standard Identifiers

    ArcTan         Delay          Ln             Rename
    Assign         Delete         Lo             Reset
    Aux            EOF            LowVideo       Rewrite
    AuxInPtr       EOLN           Lst            Round
    AuxOutPtr      Erase          LstOutPtr      Seek
    BlockRead      Execute        Mark           Sin
    BlockWrite     Exp            MaxInt         SizeOf
    Boolean        False          Mem            Sqr
    BufLen         FilePos        MemAvail       Sqrt
    Byte           FileSize       Move           Str
    Chain          FillChar       New            Succ
    Char           Flush          NormVideo      Swap
    Chr            Fract          Odd            Text
    Close          GetMem         Ord            Trm
    ClrEOL         GotoXY         Output         True
    ClrScr         HearPtr        Pi             Trunc
    Con            Hi             Port           UpCase
    ConInPtr       IOresult       Pos            Usr
    ConOutPtr      Input          Pred           UsrInPtr
    Concat         InsLine        Ptr            UsrOutPtr
    ConstPtr       Insert         Random         Val
    Copy           Int            Randomize      Write
    Cos            Integer        Read           Writeln
    CrtExit        Kbd            Readln
    CrtInit        KeyPressed     Real
    DelLine        Length         Release










                                                      Page 1.




�          String Procedures


    Delete
____________________________________________________________________________
Syntax: Delete( St, Pos, Num )

Delet� remove� � substrin� containin� 'Num� character� fro� 'St� startin� a� �
positio� 'Pos'�  'St� i� � strin� variabl� an� bot� 'Pos� an� 'Num� ar� �
intege� expressions�  I� 'Pos� i� greate� the� 'Length� S� )'� n� character� �
ar� removed�  I� a� attemp� i� mad� t� delet� character� beyon� th� en� o� �
th� strin� (i.e� 'Pos� � 'Num� exceed� th� lengt� o� th� string)� onl� �
character� withi� th� strin� ar� deleted�  I� 'Pos� i� outsid� th� rang� �
1..255 a run time error occurs.


    Insert
____________________________________________________________________________
Syntax: Insert( Obj, Target, Pos )

Inser� insert� th� strin� 'Obj� int� th� strin� 'Target� a� th� positio� �
'Pos'�  'Obj� i� � strin� expression� 'Target� i� � strin� variable� an� �
'Pos� i� a� intege� expression�  I� 'Pos� i� greate� tha� 'Length� Targe� �
)'� the� 'Obj� i� concatenate� t� 'Target'�  I� the� resul� i� longe� tha� �
th� maximu� lengt� o� 'Target'� the� exces� character� wil� b� truncate� an� �
'Target� wil� onl� contai� th� left-mos� characters�  I� 'Pos� i� outsid� �
the range 1..255, a run time error occurs.


    Str
____________________________________________________________________________
Syntax: Str( Value, St )

Th� St� procedur� convert� th� numeri� valu� o� 'Value� int� � strin� an� �
store� th� resul� i� 'St'�  'Value� i� � writ� paramete� o� typ� intege� o� �
of type real.



    Val
____________________________________________________________________________
Syntax: Val( St, Var, Code )

Va� convert� th� strin� expressio� 'St� t� a� intege� o� � rea� valu� �
(dependin� o� th� typ� o� th� variabl� 'Var'� an� store� thi� valu� i� �
'Var'�  'St� mus� b� � strin� expressin� � numeri� valu� accordin� t� th� �
rule� applyin� t� numeri� constants�  Neithe� leadin� o� trailin� space� ar� �
allowed�  'Var� mus� b� a� Intege� o� � Rea� variabl� an� 'Code� mus� b� a� �
intege� variable�  I� n� error� ar� detected� th� variabl� 'Code� i� se� t� �
zer� (0)�  Otherwis� 'Code� i� se� t� th� positio� o� th� firs� characte� i� �
error, and the value of 'Var' is undefined.









                                                      Page 2.




�          String Functions


    Copy
____________________________________________________________________________
Syntax: Copy( St, Pos, Num )

Cop� return� � substrin� containin� 'Num� character� fro� 'St� startin� a� �
positio� 'Pos'�  'St� i� � strin� expressio� an� bot� 'Pos� an� 'Num� ar� �
intege� expressions�  I� 'Pos� exceed� th� lengt� o� th� string� th� empt� �
strin� i� returned�  I� a� attemp� i� mad� t� ge� character� beyon� th� en� �
o� th� strin� (i.e� 'Pos� � 'Num� exceed� th� lengt� o� th� string)� onl� �
th� character� withi� th� strin� ar� returned�  I� 'Pos� i� outsid� th� �
range 1..255, a run time error occurs.



    Concat
____________________________________________________________________________
Syntax: Concat( St1, St2 {,StN} )

Th� Conca� functio� return� � strin� whic� i� th� concatenatio� o� it� �
argument� i� th� orde� i� whic� the� ar� specified�  Th� argument� ma� b� �
an� numbe� o� strin� expression� separate� b� comma� (St1,St� .� StN)�  I� �
the length of the result is greater than 255, a run time error occurs.

Note� Th� '+� operato� ca� b� use� t� obtai� th� sam� result� ofte� mor� �
conveniently�  Conca� i� include� onl� t� maintai� compatibilit� wit� othe� �
Pascal compilers.



    Length
____________________________________________________________________________
Syntax: Length( St )

Th� Lengt� functio� return� th� lengt� o� th� strin� expressio� 'St'� i.e� �
the number of characters in 'St'.  The type of the result is integer.



    Pos
____________________________________________________________________________
Syntax: Pos( Obj, Target )

Th� Po� functio� scan� th� strin� 'Target� t� fin� th� firs� occuranc� o� �
'Obj� withi� 'Target'�  'Obj� an� 'Target� ar� strin� expressions� an� th� �
typ� o� th� resul� i� integer�  Th� resul� i� a� intege� denotin� th� �
positio� withi� 'Target� o� th� firs� characte� o� th� matche� pattern�  Th� �
positio� o� th� firs� characte� i� � strin� i� 1�  I� th� pater� i� no� �
found, 'Pos' returns zero (0).









                                                      Page 3.




�          Operations on Files


    Assign
____________________________________________________________________________
Syntax: Assign( FilVar, Str )

'Str� i� � strin� expressio� yieldin� an� lega� fil� name�  Thi� fil� nam� �
i� assigne� t� th� fil� variabl� 'FilVar'� an� al� furthe� operation� o� �
'FilVar� wil� operat� o� th� dis� fil� 'Str'�  Assig� shoul� neve� b� use� �
on a file which is in use.



    Rewrite
____________________________________________________________________________
Syntax: Rewrite( FilVar )

� ne� dis� fil� o� th� nam� assigne� t� th� fil� variabl� 'FilVar� i� �
create� an� prepare� fo� processing� an� th� fil� pointe� i� se� t� th� �
beginnin� o� th� file� i.e� componen� numbe� zer� (0)�  An� previousl� �
existin� fil� wit� th� sam� nam� i� erased�  � dis� fil� create� b� rewrit� �
is initially empty, i.e. it contains no elements.



    Reset
____________________________________________________________________________
Syntax: Reset( FilVar )

Th� dis� fil� o� th� nam� assigne� t� th� fil� variabl� 'FilVar� i� prepare� �
fo� processing� an� th� fil� pointe� i� se� t� th� beginnin� o� th� file� �
i.e� componen� numbe� zer� (0)�  'FilVar� mus� nam� a� existin� file� �
otherwise an I/O error occurs.



    Read
____________________________________________________________________________
Syntax: Read( FilVar, Var )

'Var� denote� on� o� mor� variable� o� th� componen� typ� o� 'FilVar'� �
separate� b� commas�  Eac� variabl� i� rea� fro� th� dis� file� an� �
followin� eac� rea� operation� th� fil� pointe� i� advance� t� th� nex� �
component.



    Write
____________________________________________________________________________
Syntax: Write( FilVar, Var )

'Var� denote� on� o� mor� variable� o� th� componen� typ� o� 'FilVar'� �
separate� b� commas�  Eac� variabl� i� writte� t� th� dis� file� an� �
followin� eac� writ� operation� th� fil� pointe� i� advance� t� th� nex� �
component.




                                                      Page 4.




�     Seek
____________________________________________________________________________
Syntax: Seek( FilVar, n )

See� move� th� fil� pointe� t� th� n't� componen� o� th� fil� denote� b� �
'FilVar'� 'n� i� a� intege� expression�  Th� positio� o� th� firs� componen� �
i� zer� (0)�  Not� tha� i� orde� t� expan� � fil� i� i� possibl� t� see� on� �
component beyond the last component.  The statement

    Seek( FilVar, FileSize( FilVar) );

will place the file pointer at the end of the file.



    Flush
____________________________________________________________________________
Syntax: Flush( FilVar )

Flus� emptie� th� interna� secto� buffe� o� th� dis� fil� 'FilVar'� an� thu� �
assure� tha� th� secto� buffe� i� writte� t� th� dis� i� an� writ� �
operation� hav� occure� sinc� th� las� dis� update�  Flus� als� insure� tha� �
th� nex� rea� operatio� wil� actuall� perfor� � physica� rea� fro� th� dis� �
file.  Flush should never be used on a closed file.



    Close
____________________________________________________________________________
Syntax: Close( FilVar )

Th� dis� fil� associate� wit� 'FilVar� i� closed� an� th� dis� director� i� �
updated to reflect the new status of the file.



    Erase
____________________________________________________________________________
Syntax: Erase( FilVar )

Th� dis� fil� associate� wit� 'FilVar� i� erased�  I� th� fil� i� open� i� �
should be closed before Erase is performed.



    Rename
____________________________________________________________________________
Syntax: Rename( FilVar, Str )

Th� dis� fil� associate� wit� 'FilVar� i� rename� t� � ne� nam� give� b� th� �
strin� expressio� 'Str'�  Th� dis� director� i� update� t� sho� th� ne� nam� �
o� th� file� an� furthe� operation� o� 'FilVar� wil� operat� o� th� fil� �
with the new name.  Rename should not be used on an open file.

Note�  I� i� th� programmer'� responsibilit� t� mak� sur� th� ne� fil� nam� �
doe� no� allread� exis� o� th� disk� otherwis� multipl� occurance� o� th� �
file name will occur.



                                                      Page 5.




�          Standard File Functions


    EOF
____________________________________________________________________________
Syntax: EOF( FilVar )

� Boolea� functio� whic� return� Tru� i� th� fil� pointe� i� positione� a� �
th� en� o� th� dis� file� i.e� beyon� th� las� componen� o� th� file�  I� �
not, EOF returns False.



    FilePos
____________________________________________________________________________
Syntax: FilePos( FilVar )

A� intege� functio� whic� return� th� curren� positio� o� th� fil� pointer�  �
The first component of a file is zero (0).



    FileSize
____________________________________________________________________________
Syntax: FileSize( FilVar )

A� intege� functio� whic� return� th� siz� o� th� dis� fil� expresse� a� th� �
numbe� o� component� i� th� file�  I� FileSize� FilVa� � i� zero� th� fil� �
is empty.































                                                      Page 6.




�          Standard Procedures


    ClrEol
____________________________________________________________________________
Syntax: ClrEol

Clear� al� character� fro� th� curso� positio� t� th� en� o� th� lin� �
without moving the cursor.



    ClrScr
____________________________________________________________________________
Syntax: ClrScr

Clears the screen and places the cursor in the upper left-hand corner.
Not� tha� som� system� ma� als� rese� th� video-attribute� whe� clearin� th� �
screen.



    CrtInit
____________________________________________________________________________
Syntax: CrtInit

Send� th� Termina� Initializatio� Strin� define� i� th� installatio� �
procedure for the screen.



    CrtExit
____________________________________________________________________________
Syntax: CrtExit

Send� th� Termina� Rese� Strin� a� define� i� th� installatio� procedur� fo� �
the screen.



    Delay
____________________________________________________________________________
Syntax: Delay( Time )

Th� Dela� procedur� create� � loo� whic� ru� fo� approx� a� man� milli-�
second� a� define� b� it� argumen� 'Time� whic� mus� b� a� integer�  Th� �
exact delay will vary somewhat with different operating systems.



    DelLine
____________________________________________________________________________
Syntax: DelLine

Delete� th� lin� containin� th� curso� an� move� al� th� line� belo� th� �
cursor up by one line.




                                                      Page 7.




�     InsLine
____________________________________________________________________________
Syntax: InsLine

Insert� a� empt� lin� a� th� curso� position�  Al� line� belo� th� curso� �
are moved down one line and the bottom line scrolls off the screen.



    GotoXY
____________________________________________________________________________
Syntax: GotoXY( Xpos, Ypos )

Move� th� curso� t� th� positio� o� th� scree� specifie� b� th� intege� �
expression� 'Xpos� (horizonta� valu� o� row� an� 'Ypos� (vertica� valu� o� �
column).  The upper left corner (home position) is ( 1, 1 ).



    LowVideo
____________________________________________________________________________
Syntax: LowVideo

Se� th� scree� t� th� vide� attribut� define� a� 'Star� o� Lo� Video� i� th� �
installation procedure.



    NormVideo
____________________________________________________________________________
Syntax: NormVideo

Set� th� scree� t� th� vide� attribut� define� a� 'Star� o� Norma� Video� i� �
the installation procedure.



    Randomize
____________________________________________________________________________
Syntax: Randomize

Initializes the random number generator with a random value.



    Move
____________________________________________________________________________
Syntax: Move( Var1, Var2, Num )

Doe� � mas� cop� directl� i� memor� o� � specifie� numbe� o� bytes�  'Var1� �
an� 'Var2� ar� tw� variable� o� an� type� an� 'Num� i� a� intege� �
expression�  Th� procedur� copie� � bloc� o� 'Num� bytes� startin� a� th� �
firs� byt� occupie� b� 'Var1� t� th� bloc� startin� a� th� firs� byt� �
occupied by 'Var2'.  Move automatically handles overlap situations.






                                                      Page 8.




�     FillChar
____________________________________________________________________________
Syntax: FillChar( Var, Num, Value )

Fill� � rang� o� memor� wit� � give� value�  'Var� i� � variabl� o� an� �
type� 'Num� i� a� intege� expression� an� 'Value� i� a� expressio� o� Byt� �
o� Char�  'Num� bytes� startin� a� th� firs� byt� occupie� b� 'Var'� ar� �
filled with the value 'Value'.




















































                                                      Page 9.




�          Arithmetic Functions


    Abs
________________________________
____________________________________________
Syntax: Abs( Num )

Return� th� absolut� valu� o� 'Num'�  Th� argumen� 'Num� mus� b� eithe� Rea� �
or Integer, and the result is of the same type as the argument.



    ArcTan
____________________________________________________________________________
Syntax: ArcTan( Num )

Return� th� angle� i� radians� whos� tangen� i� 'Num'�  Th� argumen� mus� b� �
either Real or Integer, and the result is Real.



    Cos
____________________________________________________________________________
Syntax: Cos( Num )

Return� th� cosin� o� 'Num'�  Th� argumen� 'Num� i� expresse� i� radians� �
and its type must be either Real or Integer.  The result is of type Real.



    Exp
____________________________________________________________________________
Syntax: Exp( Num )

Return� th� exponentia� o� 'Num� t� bas� e�  Th� argumen� 'Num� mus� b� �
either Real or Integer, and the result is Real.



    Frac
____________________________________________________________________________
Syntax: Frac( Num )

Return� th� fractiona� par� o� 'Num'�  Th� argumen� 'Num� mus� b� eithe� �
Real or Integer, and the result is Real.



    Int
____________________________________________________________________________
Syntax: Int( Num )

Return� th� intege� par� o� 'Num'�  Th� argumen� 'Num� mus� b� eithe� Rea� �
or Integer, and the result is real.






                                                      Page 10.




�     Ln
____________________________________________________________________________
Syntax: Ln( Num )

Return� th� natura� logarith� o� 'Num'�  Th� argumen� 'Num� mus� b� eithe� �
Real or Integer, and the result is Real.



    Sin
____________________________________________________________________________
Syntax: Sin( Num )

Return� th� sin� o� 'Num'�  Th� argumen� 'Num� i� expresse� i� radians� an� �
its type must be either Real or Integer.  The result is of type Real.



    Sqr
____________________________________________________________________________
Syntax: Sqr( Num )

Return� th� squar� o� 'Num'�  Th� argumen� mus� b� eithe� Rea� o� Integer� �
and the result is of the same type as the argument.



    Sqrt
____________________________________________________________________________
Syntax: Sqrt( Num )

Return� th� squar� roo� o� 'Num'�  Th� argumen� 'Num� mus� b� eithe� Rea� o� �
Integer, and the result is of type Real.



























                                                      Page 11.




�          Scalar Functions


    Pred
____________________________________________________________________________
Syntax: Pred( Num )

Return� th� predecesso� o� 'Num� (i� i� exists)�  'Num� i� o� an� scala� �
type.



    Succ
____________________________________________________________________________
Syntax: Succ( Num )

Returns the successor of 'Num' (if it exists).  'Num' is of any scalar type.



    Odd
____________________________________________________________________________
Syntax: Odd( Num )

Return� boolea� Tru� i� 'Num� i� a� od� number� an� Fals� i� 'Num� i� even�  �
'Num' must be of type Integer.


































                                                      Page 12.




�          Transfer Functions


    Chr
____________________________________________________________________________
Syntax: Chr( Num )

Return� th� characte� wit� th� ordina� valu� give� b� th� intege� expressio� �
'Num'.  Example: Chr(65) returns the character 'A'.



    Ord
____________________________________________________________________________
Syntax: Ord( Var )

Return� th� ordina� numbe� o� th� valu� 'Var� i� th� se� define� define� b� �
th� typ� 'Var'�  Ord� Va� � i� equivalen� t� Integer� Va� )�  'Var� ma� b� �
of any scaral type, except Real, and the result is of the type Integer.



    Round
____________________________________________________________________________
Syntax: Round( Num )

Returns the value of 'Num' rounded to the nearest integer as follows:
    if Num>=0, then Round( Num ) = Trunc( Num + 0.5 ), and
    if Num<0, then Round( Num ) = Trunc( Num - 0.5 ).
'Num' must be of type Real, and the result is of type Integer.



    Trunc
____________________________________________________________________________
Syntax: Trunc( Num )

Return� th� greates� intege� les� tha� o� equa� t� 'Num'� o� th� smalles� �
intege� greate� tha� o� equa� t� 'Num'� i� Num<0�  'Num� mus� b� o� typ� �
Real, and the result is of the type Integer.




















                                                      Page 13.




�          Miscellaneous Standard Functions


    Hi
____________________________________________________________________________
Syntax: Hi( I )

Th� lo� orde� byt� o� th� resul� contain� th� hig� orde� byt� o� th� valu� �
o� th� intege� expressio� 'I'�  Th� hig� orde� byt� o� th� resul� i� se� t� �
zero.  The type of the result is Integer.



    KeyPressed
____________________________________________________________________________
Syntax: KeyPressed

Return� boolea� Tru� i� � ke� ha� bee� presse� a� th� console� an� Fals� i� �
n� ke� ha� bee� pressed�  Th� resul� i� obtaine� b� callin� th� operatin� �
system console status routine.



    Lo
____________________________________________________________________________
Syntax: Lo( I )

Return� th� lo� orde� byt� o� th� valu� o� th� intege� expressio� 'I� wit� �
the high order byte forced to zero.  The type of the result is Integer.



    Random
____________________________________________________________________________
Syntax: Random

Return� � rando� numbe� greate� tha� o� equa� t� zer� an� les� tha� one�  �
The type is Real.



    Random( Num )
____________________________________________________________________________
Syntax: Random( Num )

Return� � rando� numbe� greate� tha� o� equa� t� zer� an� les� tha� 'Num'�  �
'Num' and the random number are both integers.



    SizeOf
____________________________________________________________________________
Syntax: SizeOf( Name )

Return� th� numbe� o� byte� occupie� i� memor� b� th� variabl� o� typ� �
'Name'.  The result is of type Integer.




                                                      Page 14.




�     Swap
____________________________________________________________________________
Syntax: Swap( Num )

Th� Swa� functio� exchange� th� hig� an� lo� orde� byte� o� it� intege� �
argument 'Num' and returns the resulting value as an integer.



    UpCase
____________________________________________________________________________
Syntax: UpCase( Ch )

Return� th� uppercas� equivalen� o� it� argumen� 'Ch� whic� mus� b� o� typ� �
Char�  I� n� uppercas� equivalen� exists� th� argumen� i� returne� �
unchanged.












































                                                      Page 15.




�          CP/M-80 Specific Functions


    Addr
____________________________________________________________________________
Syntax: Addr( Name )

Return� th� addres� i� memor� o� th� firs� byt� o� th� type� variable� �
procedure� o� functio� wit� th� identifie� 'Name'�  I� 'Name� i� a� array� �
i� ma� b� subscribed� an� i� 'Name� i� � record� specifi� field� ma� b� �
selected.  The value returned is of type Integer.



    Bdos procedure and function
____________________________________________________________________________
Syntax: Bdos( Func {, Param } )

Th� Bdo� procedur� i� use� t� invok� CP/� BDO� routines�  'Func� an� 'Param� �
ar� intege� expressions�  'Func� denote� th� numbe� o� th� calle� routin� �
an� i� loade� int� th� � register�  'Param� i� optiona� an� denote� � �
paramete� whic� i� loade� int� th� D� registe� pair�  � cal� t� addres� � �
then invokes the BDOS.

Th� Bdo� functio� i� calle� lik� th� procedur� an� return� a� intege� resul� �
which is the value returned by the BDOS in the A register.



    BdosHL function
____________________________________________________________________________
Syntax: BdosHL( Func {, Param } )

Thi� functio� i� exactl� lik� th� Bdo� functio� above� excep� tha� th� �
result is the value returned in the HL register pair.



    Bios Procedure and Function
____________________________________________________________________________
Syntax: Bios( Func {, Param } )

Th� Bio� procedur� i� use� t� invok� BIO� routines� 'Func� an� 'Param� ar� �
intege� expressions�  'Func� denote� th� numbe� o� th� calle� routine� wit� �
zer� (0� meanin� th� WBOO� routine�  'Param� i� optiona� an� denote� � �
parameter which is loaded into the BC register pair prior to the call.

Th� Bio� functio� i� calle� lik� th� procedur� an� return� a� intege� resul� �
which is the value returned by the BIOS in the A register.



    BiosHL Function
____________________________________________________________________________
Syntax: BiosHL( Func {, Param } )

Thi� functio� i� exactl� simila� t� th� Bio� functio� abov� excep� tha� th� �
result is the value returned in the HL register pair.


                                                      Page 16.




�