home *** CD-ROM | disk | FTP | other *** search
- {$P-} { turn pointer checking off.. }
- program scnsave;
-
- {
-
- Program to save and restore the ST display to/from files.
-
- 8-20-86
-
- }
-
-
- TYPE
-
- { The ST screen is 32000 bytes of data, soooo.... }
- screen = packed array [ 0..31999 ] of BYTE;
-
- ptr_screen = ^screen; { pointer to the screen array }
-
- VAR
-
- s_ptr : ptr_screen; { a pointer to a packed array of bytes... }
-
- { **********************************************************************
-
- declare routine to get address of screen
-
- *********************************************************************** }
-
- { physbase returns a pointer to the start of the ST's screen. }
-
- FUNCTION physbase : ptr_screen;
- XBIOS( 2 );
-
-
- { ***********************************************************************
-
- save screen to file.
-
- *********************************************************************** }
-
-
- PROCEDURE SSave( name : STRING );
-
- VAR
-
- f : file of screen; { a file containing a screenful of bytes.. }
-
-
- BEGIN
-
- rewrite( f, name ) ; { bind f to file name }
- f^ := s_ptr^; { assign screen data to file buffer... }
- put( f ); { and write it out to file }
-
- { file is automatically closed when we leave this procedure. }
-
- END;
-
- { ***************************************************************************
-
- Restore screen data from file.
-
- ************************************************************************* }
-
- PROCEDURE SRestore( name : STRING );
-
- VAR
-
- f : file of screen; { a file containing a screenful of bytes.. }
-
- BEGIN
-
- reset( f, name ); { bind f to file name }
-
- { reset automatically fills file buffer with data from first record }
-
- s_ptr^ := f^; { and assign file buffer to screen }
-
- { file is automatically closed when we leave this procedure. }
- END;
-
-
- { *********************************************************************
-
- miscellaneous subroutines...
-
- *********************************************************************** }
-
-
- PROCEDURE waitCR;
-
- BEGIN
-
- writeln('Press <RETURN> to continue. ');
- readln;
-
- END;
-
-
- { clear screen procedure }
-
- PROCEDURE cls;
-
- BEGIN
-
- write( chr( 27 ) );
- write( 'E' );
-
- END;
-
-
- { put some stupid stuff on the screen... }
-
- PROCEDURE fill_scrn;
-
- VAR
-
- i : integer;
-
- BEGIN
-
- cls; { clear screen ... }
-
- FOR i := 0 TO 20 DO
- BEGIN
- writeln('This is line # ', i );
- END;
- END;
-
-
-
- { ************************************************************************
-
- Main routine starts here. Just execute routines in sequence...
-
- ************************************************************************ }
-
-
- BEGIN
-
- s_ptr := physbase; { grab location of screen... }
-
- fill_scrn; { put junk on screen.... }
-
- writeln('saving screen...');
-
- SSave( 'test.scr' ); { write screen data to file... }
-
- waitCR;
-
- cls; { clear screen... }
-
- writeln('restoring screen...');
-
- SRestore( 'test.scr' ); { read screen data from file... }
-
- waitCR;
-
- END.
-