home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / turbo55 / install / demos.arc / OVRDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1989-05-02  |  2KB  |  53 lines

  1.  
  2. { Turbo Overlays }
  3. { Copyright (c) 1985, 1989 by Borland International, Inc. }
  4.  
  5. {$F+,O+}
  6. program OvrDemo;
  7. (*
  8.   This is a simple example of how to use the new overlay system. For
  9.   more complete documentation, refer to the overlay chapter in the
  10.   Turbo Pascal manual. Here's a quick checklist:
  11.  
  12.     1.  Turn "far calls" on {$F+} (to be safe, in all overlaid units and
  13.         the main program).
  14.     2.  Turn "Overlays allowed" on {$O+}
  15.     3.  Use Overlay unit in main program.
  16.     4.  Issue separate {$O} directives for each overlaid unit.
  17.     5.  Make sure to call OvrInit and pass the name of the .OVR file.
  18.     6.  Test OvrResult after OvrInit calls (optional).
  19.     7.  Compile to disk (cannot run in memory).
  20.  
  21.   Here the overlay error returns for quick reference:
  22.  
  23.     const
  24.       ovrOk          =  0;   { Success }
  25.       ovrError       = -1;   { Overlay manager error }
  26.       ovrNotFound    = -2;   { Overlay file not found }
  27.       ovrNoMemory    = -3;   { Not enough memory for overlay buffer }
  28.       ovrIOError     = -4;   { Overlay file I/O error }
  29.       ovrNoEMSDriver = -5;   { EMS driver not installed }
  30.       ovrNoEMSMemory = -6;   { Not enough EMS memory }
  31. *)
  32.  
  33. uses
  34.   Overlay, Crt, OvrDemo1, OvrDemo2;
  35.  
  36. {$O OvrDemo1}                  { overlay 'em }
  37. {$O OvrDemo2}
  38.  
  39. begin
  40.   TextAttr := White;
  41.   ClrScr;
  42.   OvrInit('OVRDEMO.OVR');          { init overlay system, reserve heap space }
  43.   if OvrResult <> 0 then
  44.   begin
  45.     Writeln('Overlay error: ', OvrResult);
  46.     Halt(1);
  47.   end;
  48.   repeat
  49.     Write1;
  50.     Write2;
  51.   until KeyPressed;
  52. end.
  53.