Previous: Forward Declaration To the Table of Content Next: Interrupt Procedure

- 2.2.12.3 -
TMT Pascal Language Description
Pascal Language Structure
Procedures and Functions

External Declaration

The External clause is used to define a procedure that is linked in from an assembly object.

Example:
;----------------- [vga.asm] ----------------
IDEAL
P386
MODEL FLAT,PASCAL

CODESEG

GLOBAL  SETVIDEOMODE: PROC
PROC    SETVIDEOMODE USES EAX, MODE: WORD
        MOV     AX,  [MODE]
        INT     10H
        RET
ENDP    SETVIDEOMODE

GLOBAL  CLEARVGA: PROC
PROC    CLEARVGA  USES ECX, COLOR: BYTE
        MOV     EDI, 0A0000H
        MOV     AL,  [COLOR]
 MOV     AH,  AL
        MOV     ECX, EAX
        SHL     EAX, 16
        MOV     AX, CX
        MOV     ECX, 64000/4
        CLD
        REP     STOSD
        RET
ENDP    CLEARVGA

END
;--------------------------------------------

 ///////////////// [Test.pas] ////////////////
program Test;
{$ifndef __DOS__}
  This program can not be compiled for OS/2 or Win32
{$endif}
uses
  CRT;
>{$l vga};  // include vga.obj file

procedure SetVideoMode(Mode: Word); external;
procedure ClearVGA(Color: Byte); external;

begin
  SetVideoMode($13);  // setup VGA/MCGA mode 320x200
  ClearVGA(10);       // fill screen with green color
  ReadKey;            // wait for key hit
  ClearVGA(15);       // fill screen with white color
  ReadKey;            // wait for key hit
  ClearVGA(0);        // fill screen with black color
  ReadKey;            // wait for key hit
  SetVideoMode($03);  // setup VGA text mode 80x25
end.
See also:
Dynamic-Link Libraries (DLL’s)


Previous: Forward Declaration To the Table of Content Next: Interrupt Procedure
Forward Declaration Table of Content Interrupt Procedure

- 2.2.12.3 -