{

 **************************************************************************
 ***                   ABACUS' "PC UNDERGROUND"                         ***
 ***                  ================================                  ***
 ***                                                                    ***
 ***               Demo program for using RMEM unit                     ***
 ***                                                                    ***
 *** The program demonstrates the use of the RMEM unit.                 ***
 *** Program loads an image into RMEM, and then displays it from RMEM.  ***
 ***                                                                    ***
 *** Author          : Boris Bertelsons  (InspirE)                      ***
 *** Filename        : DEMORMEM.PAS                                     ***
 *** Last Update     : 04/28/94                                         ***
 *** Version         : 1.0                                              ***
 *** Compiler        : Turbo Pascal 6.0 and above                       ***
 **************************************************************************

}
program demo386;

uses dos,crt,rmem,gifunit;

var imageposition : longint;

procedure load_the_gifimage;
begin;
  getmem(vscreen,64000);
  Init_ModeX;
  blackpal;
  LoadGif('example.gif',vscreen,0,0);
  textmode(3);
end;

procedure show_the_gifimage;
begin;
  Init_ModeX;
  p13_2_modex(0,16000);
  setpal;
end;

begin
  memory_checks(500,2700);
  enable_Realmem(2700);

  if not Rgetmem(imageposition,64000) then begin;
    textmode(3);
    writeln('Error reserving memory !!!');
  end;
  load_the_gifimage;

  writeln('Loaded the GIF image into memory.');
  writeln('Now storing the image in RMEM and clearing Load buffer !');
  Rmem_write(vscreen,imageposition,64000);
  fillchar(vscreen^,64000,0);

  writeln('Cleared the Load buffer !');
  writeln('Now loading the image from RMEM');
  writeln('<ENTER>, to display the image ... ');
  readln;
  Rmem_read(imageposition,vscreen,64000);
  show_the_gifimage;

  readln;
  textmode(3);
  Exit_Rmem;
end.

