home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / SVGALIB / SVGALIB1.TAR / svgalib / src / vgadump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-17  |  1.4 KB  |  64 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.  
  9. #include <stdio.h>
  10. #include "vga.h"
  11. #include "libvga.h"
  12. #include "driver.h"
  13.  
  14.  
  15. int vga_dumpregs()
  16. {
  17.     unsigned char regs[MAX_REGS];
  18.     int i, n;
  19.  
  20.     __vga_getchipset();
  21.  
  22.     n = __vga_saveregs(regs);
  23.  
  24.     printf("static unsigned char regs[%d] = {\n  ", n);
  25.  
  26.     for (i = 0; i < 12; i++) 
  27.         printf("0x%02X,", regs[CRT+i]);
  28.     printf("\n  "); 
  29.     for (i = 12; i < CRT_C; i++) 
  30.         printf("0x%02X,", regs[CRT+i]);
  31.     printf("\n  "); 
  32.     for (i = 0; i < 12; i++) 
  33.         printf("0x%02X,", regs[ATT+i]);
  34.     printf("\n  "); 
  35.     for (i = 12; i < ATT_C; i++) 
  36.         printf("0x%02X,", regs[ATT+i]);
  37.     printf("\n  "); 
  38.     for (i = 0; i < GRA_C; i++) 
  39.         printf("0x%02X,", regs[GRA+i]);
  40.     printf("\n  "); 
  41.     for (i = 0; i < SEQ_C; i++) 
  42.         printf("0x%02X,", regs[SEQ+i]);
  43.     printf("\n  "); 
  44.     printf("0x%02X", regs[MIS]);
  45.  
  46.  
  47.     n -= 60;
  48.     if (n > 0) {
  49.     fputs(",\n  ", stdout);
  50.     i=0;
  51.     while (i < n - 1)
  52.         {
  53.             printf("0x%02X,", regs[EXT + i++]);
  54.         if ( ! ( i % 10) )
  55.         fputs("\n  ", stdout);
  56.         }
  57.     printf("0x%02X", regs[EXT + n - 1]);
  58.     }
  59.  
  60.     printf("\n};\n"); 
  61.  
  62.     return 0;
  63. }
  64.