home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / tel2305s.zip / ENGINE / SCR_REST.C < prev    next >
C/C++ Source or Header  |  1992-03-26  |  922b  |  39 lines

  1. #include <stdio.h>
  2. #if !defined(__TURBOC__) && !defined(__WATCOMC__)
  3. #include <memory.h>
  4. #else
  5. #include <string.h>
  6. #endif
  7. #include <stdlib.h>
  8. #include <malloc.h>
  9. #include "vidinfo.h"
  10. #include "externs.h"
  11.  
  12. extern int save_screen;
  13.  
  14. static char *vid_buffer=NULL;
  15. static char *old_screen;
  16.     
  17. void init_text(void)
  18. {
  19.     unsigned int size;
  20.  
  21.     vid_buffer=(char far *)MK_FP(0,tel_vid_info.segment);
  22.  
  23.     if(save_screen) {
  24.         size=tel_vid_info.cols*tel_vid_info.rows*2;
  25.         if((old_screen=(char *)malloc(size))==NULL) {
  26.             printf("Couldn't get enough memory to save video page - exiting\n");
  27.             exit(-1);
  28.           } /* end if */
  29.         memcpy(old_screen,vid_buffer,size);
  30.       } /* end if */
  31. }   /* end init_text() */
  32.  
  33. void end_text(void)
  34. {
  35.     memcpy(vid_buffer,old_screen,tel_vid_info.cols*tel_vid_info.rows*2);
  36.     free(old_screen);
  37. }   /* end end_text() */
  38.  
  39.