home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 138 / pascal / scrnsave.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-05-13  |  1.2 KB  |  51 lines

  1. {
  2.  
  3.         Procedures for saving the display to a
  4.         buffer, then restoring it later.
  5.  
  6.         10/28/86 MJC
  7.  
  8.    The following declarations must be made in tne procedure which
  9.    calls SaveScreen and RestoreScreen.
  10.  
  11. TYPE
  12.  
  13.    Screen = packed array [ 1..32000 ] of byte;
  14.    S_Ptr = ^Screen;     { pointer to screen data }
  15.  
  16.  
  17. VAR
  18.  
  19.    Scn_buf : Screen;    { a place to stash the screen }
  20.    Scn_ptr : S_Ptr;     { a pointer to screen }
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. FUNCTION Physbase : S_Ptr;    { xbios routine returns address of screen }
  28.   Xbios( 2 );
  29.  
  30.  
  31. PROCEDURE SaveScreen;              { proc saves screen to buf }
  32. {$P-}           { turn pointer checking off }
  33.  
  34.    begin
  35.       Scn_ptr := Physbase;      { get addr of screen in memory }
  36.       Scn_buf := Scn_Ptr^;      { do assignment, copy entire array }
  37.    end;
  38.  
  39. {$P=}           { restore pointer checking to old state }
  40.  
  41.  
  42. PROCEDURE RestoreScreen;             { restore screen from buf }
  43. {$P-}           { turn pointer checking off }
  44.  
  45.    begin
  46.       Scn_ptr := Physbase;      { get addr of screen in memory }
  47.       Scn_ptr^ := Scn_buf;      { assign, copy array }
  48.    end;
  49.  
  50. {$P=}           { set pointer checking to old state }
  51.