home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / SVGALIB1.TAR / svgalib / src / vgaclear.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-08  |  1.4 KB  |  68 lines

  1. /* VGAlib version 1.2 - (c) 1993 Tommy Frandsen            */
  2. /*                                   */
  3. /* This library is free software; you can redistribute it and/or   */
  4. /* modify it without any restrictions. This library is distributed */
  5. /* in the hope that it will be useful, but without any warranty.   */
  6.  
  7. /* Multi-chipset support Copyright 1993 Harm Hanemaayer */
  8. /* partially copyrighted (C) 1993 by Hartmut Schirmer */
  9.  
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include "vga.h"
  13. #include "libvga.h"
  14.  
  15. int vga_clear()
  16. {
  17.     vga_screenoff();
  18.  
  19.     if (MODEX) goto modeX;
  20.     switch (CM) {
  21.         case G320x200x256 :
  22.         case G320x240x256 :
  23.     case G320x400x256 :
  24.     case G360x480x256 :
  25. modeX:
  26.             /* write to all planes */ 
  27.             port_out(0x02, SEQ_I ); 
  28.             port_out(0x0F, SEQ_D );
  29.    
  30.             /* clear video memory */
  31.             memset(GM, 0, 65536);
  32.             break;
  33.  
  34.     default:
  35.         switch (CI.colors) {
  36.               case  2 :
  37.               case 16 :
  38.                 vga_setcolor(0);
  39.  
  40.             /* write to all bits */
  41.                 port_out(0x08, GRA_I ); 
  42.                 port_out(0xFF, GRA_D );
  43.  
  44.               default : 
  45.             {
  46.             int i;
  47.                       int pages = (CI.ydim * CI.xbytes + 65535) >> 16;
  48.  
  49.             for (i = 0; i < pages; ++i) {
  50.                           vga_setpage(i);
  51.  
  52.               /* clear video memory */
  53.                           memset(GM, 0, 65536);
  54.             }
  55.                     }
  56.                     break;
  57.             }
  58.             break;
  59.     }
  60.  
  61.     vga_setcolor(15);
  62.         
  63.     vga_screenon();
  64.  
  65.     return 0;
  66. }
  67.  
  68.