home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_06_08 / v6n8049b.txt < prev    next >
Text File  |  1989-09-28  |  2KB  |  60 lines

  1. /* hr_clear.c - Clear high resolution display page from start of page
  2.  * to end of page by filling with the bit pattern for the specified
  3.  * color c.  Two bytes, one word, are filled on each access since
  4.  * adjacent bytes of the same color have the low 7 bits inverted.
  5.  * Integers must be unsigned.  Returns void.
  6.  *
  7.  * Environment:    Apple II, Aztec c65 V1.05B
  8.  * Programmer:    Don Strayer
  9.  * Date:        15-Jun-88
  10.  */
  11.  
  12. #include <hr_apple2.h,d2>
  13.  
  14. hr_clear( sop , eop , c )
  15.     int sop;                        /* start of page */
  16.     int eop;                        /* end of page */
  17.     int c;                            /* color */
  18.  
  19. {    int *wa;                        /* pointer to word address */
  20.     int pat;                        /* bit pattern for that word */
  21.  
  22.     switch ( c )                    /* set pattern for specified color */
  23.  
  24.     {    case HR_BLACK:
  25.         {    pat = 0;                /* black - binary zeroes */
  26.             break;
  27.         }
  28.         case HR_PURPLE:                /* odd columns on, high order off */
  29.         {    pat = 21802;            /* binary 0101010100101010 */
  30.             break;
  31.         }
  32.         case HR_BLUE:                /* even columns on, high order off */
  33.         {    pat = 10837;            /* binary 0010101001010101 */
  34.             break;
  35.         }
  36.         case HR_GREEN:                /* odd columns on, high order on */
  37.         {    pat = 54698;            /* binary 1101010110101010 */
  38.             break;
  39.         }
  40.         case HR_ORANGE:                /* even columns on, high order on */
  41.         {    pat = 43733;            /* binary 1010101011010101 */
  42.             break;
  43.         }
  44.         case HR_WHITE:
  45.         {    pat = 65535;            /* white - binary ones */
  46.             break;
  47.         }
  48.         default:
  49.         {    pat = 0;                /* default black - binary zeroes */
  50.             break;
  51.         }
  52.     }
  53.  
  54.     for ( wa = sop; wa < eop; ++wa )    /* fill the page from sop to eop */
  55.             *wa = pat;
  56.  
  57.     return();
  58. }
  59.  
  60.