home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / DISPMONO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  1.4 KB  |  68 lines

  1. /*
  2.     dispmono.c
  3.  
  4.     % disp_MapMono        monochome on/off functionw
  5.  
  6.     OWL 1.1
  7.     Copyright (c) 1988, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12. */
  13.  
  14. #include "oakhead.h"
  15. #include "disppriv.h"
  16.  
  17. #define WHITE    0x07
  18. #define BLACK    0x00
  19. #define BOLD    0x0F
  20. #define BLINK    0x08
  21.  
  22. void disp_MapMono(mono)
  23.     boolean mono;
  24. /*
  25.     if mono == TRUE maps colors for mono displays.
  26.  
  27.     higher values are generalized as lighter than lower values, with the
  28.     range being from 0 - 7 (8 - f are moduloed, but bolding and blinking
  29.     are preserved), therefore:
  30.  
  31.     fore < back (eg. 0x31) maps to 0x70
  32.     fore > back (eg. 0x25) maps to 0x07
  33. */
  34. {
  35.     int f, b, diff;
  36.  
  37.     if (!mono) {
  38.         for (f = 0; f < 0x10; f++) {
  39.             for (b = 0; b < 0x10; b++) {
  40.  
  41.                 disp_SetMapEntry((byte)(b * 0x10 + f), (opixval)b, (opixval)f);
  42.             }
  43.         }
  44.         return;
  45.     }            
  46.  
  47.     for (f = 0; f < 0x10; f++) {
  48.         for (b = 0; b < 0x10; b++) {
  49.  
  50.             if ((diff = b%0x08 - f%0x08) == 0) {    /* f == b */
  51.  
  52.                 disp_SetMapEntry((char)(b * 0x10 + f), BLACK, BLACK);
  53.             }
  54.             else if (diff > 0) {                    /* f < b */
  55.  
  56.                 disp_SetMapEntry((char)(b * 0x10 + f),
  57.                     (b > 0x07) ? BOLD:WHITE,        /* back, foreground */
  58.                     (f > 0x07) ? BOLD:BLACK);
  59.             }
  60.             else {                                    /* f > b */
  61.                 disp_SetMapEntry((char)(b * 0x10 + f),
  62.                     (b > 0x07) ? BLINK:BLACK,        /* back, foreground */
  63.                     (f > 0x07) ? BOLD:WHITE);
  64.             }
  65.         }
  66.     }
  67. }
  68.