home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / uport-herc / part01 / g_clear.c next >
C/C++ Source or Header  |  1990-04-06  |  2KB  |  109 lines

  1. #ifndef lint
  2. static char sccsid[] = "@(#) g_clear.c 5.1 89/02/20";
  3. #endif
  4.  
  5. /*
  6.  *    Copyright (c) David T. Lewis 1987, 1988
  7.  *    All rights reserved.
  8.  *
  9.  *    Permission is granted to use this for any personal noncommercial use.
  10.  *    You may not distribute source or executable code for profit, nor
  11.  *    may you distribute it with a commercial product without the written
  12.  *    consent of the author.  Please send modifications to the author for
  13.  *    inclusion in updates to the program.  Thanks.
  14.  */
  15.  
  16. /*
  17.  *    Routine to clear video memory (or print buffer memory).  
  18.  *    dtlewis 6-28-87
  19.  *    Sun Mar 13 21:13:59 EST 1988
  20.  *
  21.  *    V386HERC
  22.  *    w. hatch
  23.  *    Sat Feb 17 18:41:59 EST 1990
  24.  */
  25.  
  26. #include "config.h"
  27. #include "bitmaps.h"
  28. #include "graphics.h"
  29. #include "modes.h"
  30.  
  31. extern int g_init(), g_finish();
  32.  
  33. int g_clear()  
  34. {
  35.     extern struct GL_graphics graphics;
  36.     int i, j;
  37.     int istat;
  38.  
  39. #if MIX_C
  40.     /* No long pointers with this compiler.  Cheat and use BIOS.    */
  41.     g_setmod(graphics.grafmode);
  42.     return(0);
  43. #endif /* MIX_C */
  44.  
  45.     switch (graphics.grafmode) {
  46.         case CGA_COLOR_MODE:
  47.             for(i=0; i<100; i++)  {
  48.                 for(j=0; j<80; j++)  {
  49.                     (graphics.cgamem)->page1[i][j] = 0x0;
  50.                     (graphics.cgamem)->page2[i][j] = 0x0;
  51.                 }
  52.             }
  53.             break;
  54.  
  55.         case CGA_HI_RES_MODE:
  56.             for(i=0; i<100; i++)  {
  57.                 for(j=0; j<80; j++)  {
  58.                     (graphics.cgamem)->page1[i][j] = 0x0;
  59.                     (graphics.cgamem)->page2[i][j] = 0x0;
  60.                 }
  61.             }
  62.             break;
  63.  
  64.         case EGA_COLOR_MODE:
  65.             for (i=0 ; i<350 ; i++) {
  66.                 for (j=0 ; j<80 ; j++) {
  67.                     (graphics.egamem)->mem[i][j] = 0x0;
  68.                 }
  69.             }
  70.             break;
  71.  
  72.         case HERC_P0_MODE:
  73.         case HERC_P1_MODE:
  74. #ifdef V386HERC
  75.             weh_clear_herc();
  76. #else
  77.             for(i=0; i<87; i++)  {
  78.                 for(j=0; j<90; j++)  {
  79.                     (graphics.hercmem)->page1[i][j] = 0x0;
  80.                     (graphics.hercmem)->page2[i][j] = 0x0;
  81.                     (graphics.hercmem)->page3[i][j] = 0x0;
  82.                     (graphics.hercmem)->page4[i][j] = 0x0;
  83.                 }
  84.             }
  85. #endif
  86.             break;
  87.  
  88.         /* For hard copy, there is no point in clearing    */
  89.         /* memory.  We will interpret this call as    */
  90.         /* "done with this page; send it to the printer    */
  91.         /* and get ready for another."            */
  92.  
  93.         case IBM_PRINTER:
  94.             if ((istat=g_finish()) != 0) return(istat);
  95.             if ((istat=g_init(IBM_PRINTER)) != 0) return(istat);
  96.             break;
  97.  
  98.         case LJ_PRINTER:
  99.             if ((istat=g_finish()) != 0) return(istat);
  100.             if ((istat=g_init(LJ_PRINTER)) != 0) return(istat);
  101.             break;
  102.  
  103.         default:
  104.             return(1);
  105.  
  106.     }
  107.     return(0);
  108. }
  109.