APPENDIX E: LIBRARY ROUTINES

The code generated by the Pascal/MT+ compiler is true, native machine code. Run-time library routines are required on each processor to support files and any other features which are not supported by the native hardware but are required to implement the entire Pascal language. The following information is specific to the 8080/Z80, CP/M implementation of Pascal/MT+.

The Pascal/MT+ system requires subroutines from the run-time library in order to support the whole of the Pascal language. All I/O is done via library routines and SET variables are manipulated via library routines. Only the run-time routines needed for a particular program are actually loaded when the program is linked with Link/MT+ when using the /S option. Note that console I/O is assumed by the initialize routine, @INI. This causes the input / output routines to be loaded from the run time package even when the user is not using them. To avoid this, write a replacement @INI routine (similar to the sample in Section 1.4) and link it before linking the run time library to resolve the reference to @INI.

Listed below are the names of the run-time library routines and their function. The purpose of this list is to clarify what these routines do so that when you disassemble a program you have some information as to what is happening in your program. They are not here so that you may call these routines from your program as MT MicroSYSTEMS will not guarantee parameter list compatibility between releases. If you do need to use or alter the run-time library the source is available from your distributor.

        ROUTINE    FUNCTION

        @CHN       Program chaining routine

        @MUL       Integer multiply 16-bit stack

        @MUX       Integer multiply 16-bit register

        @FIN       FOR loop initialization helper

        @EQD        .
        @NED        .
        @GTD        .
        @LTD        .
        @GED       String comparison routines for
        @LED       =, <>, >, <, >=, and <=

        @EQS       Set equality
        @NES       Set in-equality
        @GES       Set superset
        @LES       Set subset

        @HLT       End of program halt routine, return to CP/M

        @PST       Store ret addr temporarily
        @PLD       Return ret addr to stack

        @SAD       Set union
        @SSB       Set difference
        @SML       Set intersection
        @SIN       Set membership
        @BST       Build singleton set
        @BSR       Build subrange set

        @DYN       Load/Store in stack frame mode routine
        @LNK       Allocate stack variable space
        @ULK       De-allocate stack variable space

        @EQA
        @NEA
        @GTA
        @LTA
        @GEA       Array comparison routines
        @LEA       =, <>, >, <, >= and <=

        @XJP       Table Case Jump routine

        @LBA       Load concat string buffer address
        @ISB       Init string buffer
        @CNC       Concatenate a string to the buffer
        @CCH       Concatenate a char   to the buffer

        @RCH       Read a char from a file
        @CRL       Write a newline (CR) to a file
        @CWT       Wait for EOLN to be true on a file

        @INP       Handle variable port input
        @OUT       Handle variable port output

        @WIN       Write an integer to a file
        @RST       Read a string from a file

        TSTBIT     Test for a bit on
        SETBIT     Turn a bit on
        CLRBIT     Turn a bit off

        SRL        Shift a word left
        SHR        Shift a word right

        @EQI
        @NEI
        @GTI
        @LTI
        @GEI
        @LEI       Integer comparisons

        @EQB
        @NEB
        @GTB
        @LTB
        @GEB
        @LEB       Boolean comparisons

        @SFB       Set global FIB address
        @DWD       Set default width and decimal places
        @SIA       Reset input vector
        @SOA       Reset output vector
        @DIO       Set I/O vectors to default addresses

        @INI       Run-time initialization

        @STR       String store

        @GETCH     Read a char from a file onto stack

        @WCH       Write a string to a file

        @DIV       16-bit DIV software routine
        @MOD       16-bit MOD software routine
        @XDIVD     utility divide routine used by @WIN

        @MVL
        MOVE
        MOVELE     Block move left end to left end stack parms

        @MVR
        MOVERI     Block move right end to right end stack parms

        @PUTCH     Write a char from stack
        @LEAD      Handle width in char outputs
        @CHW       Write a char to a file
        @CHW1      entry point used by @WCH and others

        @EQR
        @NER
        @GTR
        @LTR
        @GER       Real comparisons
        @LER       =, <>, >, <, >=, and <=

        @RRL       Read a real from a file
        @WRL       Write a real to a file

        @RAD       Real add
        @RSB       Real subtract
        @RML       Real multiply
        @RDV       Real divide
        @RNG       Real negate
        @RAB       Real absolute value

        @XOP       Real utility load/store routine

        SQRT       Real square root

        TRUNC
        ROUND      Pascal built-in functions

        IOERR      Used for unimplement I/O routines

        CHAIN      Pascal interface for @CHN

        OPEN
        OPENX
        BLOCKR
        BLOCKW
        CREATE
        CLOSE
        CLOSED
        GNB
        WNB
        PAGE
        EOLN
        EOF
        RESET
        REWRIT
        GET
        PUT
        ASSIGN
        PURGE
        IORESU     Run time support for files

        COPY
        INSERT
        DELETE
        POS        Run time support for strings

        @WNC       Write next char to a file
        @RNC       Read next char from a file
        @RIN       Read integer from a file
        @S2I       Convert string to integer
        @RNB       Read n bytes from a file
        @WNB       Write n bytes to a file

        @BDOS      Call CP/M directly

        @SPN       Check for device names
        @NOK       Check for legal file names

        @NEW       Allocate memory for NEW procedure
        @DSP       Deallocate memory for DISPOSE procedure
        MEMAVA     MEMAVAIL function
        MAXAVA     MAXAVAIL function