PROGRAM Example;

(*

  Example program of Flat Real Mode use in Pascal

 By Double C / HmD. Units (c) June 1993  }{ .\\ I)

*)


USES Crt, Dos, XMS, Power386, Process;
{$M 65520,0,655350}
{$I FRMDRIV.PAS}   (* Necessary but clean ;) *)



VAR
  Memoire  : LongInt;
  LaSuite  : LongInt;
  Car      : Char;
  Pointeur : Pointer;


BEGIN
  Init_Memory;
  ClrScr;
  DirectVideo:=False;
  WriteLN('Free Mem : ', Get_Free_XMS, ' bytes');
  Get_XMS(Memoire, 128000);
  WriteLN;
  WriteLN('Allocating 128000 bytes using Get_XMS procedure');
  WriteLN('Free Mem : ', Get_Free_XMS, ' bytes');
  WriteLN;
  WriteLN('Press a key...');
  Car:=ReadKey;

  GetMem(Pointeur, 64000);
  FillChar(Pointeur^, 64000, 1);
  Get_XMS(LaSuite, 64000);

  Copy_DWord(Adr(Pointeur), LaSuite, 64000); { Copy DOS mem to XMS mem }
  ASM
    MOV AX, $13
    INT $10
  END;
  Copy_DWord(LaSuite, $A0000, 64000); { Copy XMS on Video }
  WriteLN('Example of Filled DOS Memory');
  WriteLN('recopied in  XMS,  and after');
  WriteLN('recopied on  video (Color 1)');
  WriteLN('Using Copy_DWord() procedure');
  WriteLN;
  WriteLN('Press a key...');
  Car:=ReadKey;
  ASM
    MOV AX, $3
    INT $10
  END;
  WriteLN('So, it works.');
  WriteLN('');
  WriteLN('For all others procedures / functions, see VRMDRIV.PAS');
  Car:=ReadKey;

  Free_XMS(Memoire);
  Free_XMS(LaSuite);
  FreeMem(Pointeur, 64000);
END.
