Previous: 2.2.12.2. Forward Declaration To the Table of Contents Next: 2.2.12.4. Interrupt Procedure
2.2.12.2. Forward Declaration Table of Contents 2.2.12.4. Interrupt Procedure

- 2.2.12.3. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.12. Procedures and Functions
2.2.12.3. External Declaration


2.2.12.3. 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: 2.2.12.2. Forward Declaration To the Table of Contents Next: 2.2.12.4. Interrupt Procedure
2.2.12.2. Forward Declaration Table of Contents 2.2.12.4. Interrupt Procedure

- 2.2.12.3. -