home *** CD-ROM | disk | FTP | other *** search
/ Graphics Programming Black Book (Special Edition) / BlackBook.bin / disk1 / source / chapter16 / maketab.c < prev    next >
C/C++ Source or Header  |  1997-06-18  |  791b  |  34 lines

  1. //  MAKETAB.C -- Build QSCAN3.INC for QSCAN3.ASM
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5.  
  6. #define ChType( c )  (((c) & 0x7f) == '\'' || isalnum((c) & 0x7f))
  7.  
  8. int NoCarry[ 4 ] = { 0, 0x80, 1, 0x80 };
  9. int Carry[ 4 ]   = { 1, 0x81, 1, 0x80 };
  10.  
  11. void main( void )
  12.   {
  13.   int ahChar, alChar, i;
  14.   FILE *t = fopen( "QSCAN3.INC", "wt" );
  15.  
  16.   printf( "Building table.  Please wait..." );
  17.  
  18.   for( ahChar = 0; ahChar < 128; ahChar++ )
  19.     {
  20.     for( alChar = 0; alChar < 256; alChar++ )
  21.       {
  22.       i = ChType( alChar ) * 2 + ChType( ahChar );
  23.  
  24.       if( alChar % 8 == 0 )  fprintf( t, "\ndb %02Xh", NoCarry[ i ] );
  25.       else                   fprintf( t, ",%02Xh", NoCarry[ i ] );
  26.  
  27.       fprintf( t, ",%02Xh", Carry[ i ] );
  28.       }
  29.     }
  30.  
  31.   fclose( t );
  32.   }
  33.  
  34.