{$M 64000,0,655360}
PROGRAM ProbaDeGRAPHiPascal;

USES Crt, grflib;

CONST
   VGA  =  0;

VAR
  HPAL,
  hfont,
  pv1      : Byte;
  i, j, s  : Integer;
  Msg      : Array [1..10] of String;
  Clock    : Integer;
  Col      : Byte;

BEGIN
  InicGRAPH(1,0);
  ASM
    { Truco para doblar la altura de los pixels: }
    MOV dx,3d4h
    MOV al,9
    OUT dx,al
    INC dx
    IN  al,dx
    AND al,0e0h
    ADD al,3
    OUT dx,al
  END;
  pv1:=CreaVirtual;
  BorraPantalla(0, pv1);
  BorraPantalla(0, VGA);
  CambiaTipo(8);
  hfont:=CogeFuenteDOS;
  PonPaleta(CargaPaleta('paleta.col'+chr(0)), 0, 0);

  Msg[1] := '    Hola a tots, a‡¢ ‚s Pascal + GRAPH'+chr(0);
  Msg[2] := '   Hola a todos, esto es Pascal + GRAPH'+chr(0);
  Msg[3] := '  Hello everyone, this is Pascal + GRAPH'+chr(0);
  Msg[4] := '=========================================='+chr(0);
  Msg[5] := '------------------------------------------'+chr(0);
  Msg[6] := '__________________________________________'+chr(0);
  Msg[7] := '..........................................'+chr(0);

  s:=1; clock:=100;
  Repeat
    If s>7 Then s:=1;
    If clock>15 Then
     BEGIN
       clock:=0;
       SetCursor(20, 10);
       Escribe(hfont, Msg[s], pv1, $FF, 18, 18);
       Inc(s);
     END;
    For i:=1 To 318 DO
     BEGIN
       For j:=1 To 99 DO
        BEGIN
          col:=(CogePixel(i  , j-1, pv1)+
                CogePixel(i-1, j-1, pv1)+
                CogePixel(i+1, j-1, pv1)+
                CogePixel(i  , j  , pv1)+
                CogePixel(i-1, j  , pv1)+
                CogePixel(i+1, j  , pv1)) DIV 6;
          PonPixel(i, j, col, VGA);
        END;
     END;
    CopiaPantalla(VGA, pv1);
    Inc(Clock);
  Until KeyPressed;
  EndGRAPH;
END.
