home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / turbo5 / ovrdemo.pas < prev    next >
Pascal/Delphi Source File  |  1988-10-09  |  2KB  |  52 lines

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