home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / SCBORDER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  2.0 KB  |  76 lines

  1. /**
  2. *
  3. * Name        scborder -- Set border color of current video display.
  4. *
  5. * Synopsis    ercode = scborder(color);
  6. *
  7. *        int ercode      SC_NO_ERROR if successful,
  8. *                  SC_BAD_OPT if operation not valid for
  9. *                    current video adapter and mode.
  10. *        unsigned color      Color to select.
  11. *
  12. * Description    This function sets the border color of the current video
  13. *        device.  Resetting the adapter sets the border color to
  14. *        0 (black).
  15. *
  16. *        See SCPAL1 for a description of the color values on the
  17. *        Enhanced Graphics Adapter.
  18. *
  19. *        (The Enhanced Color Display supports a border color only
  20. *        in 200-line modes.)
  21. *
  22. * Returns    ercode          SC_NO_ERROR if successful,
  23. *                  SC_BAD_OPT if operation not valid for
  24. *                    current video adapter.
  25. *
  26. * Version    6.00 (C)Copyright Blaise Computing Inc.  1987,1988,1989
  27. *
  28. **/
  29.  
  30. #include <dos.h>
  31.  
  32. #include <bscreens.h>
  33.  
  34. int scborder(color)
  35. unsigned color;
  36. {
  37.     int        result;
  38.     int        mode,act_page,columns;
  39.     union REGS inregs,outregs;
  40.  
  41.     scequip();                  /* Sense equipment and switch   */
  42.                       /* settings.              */
  43.  
  44.     scmode(&mode,&columns,&act_page); /* Retrieve current device      */
  45.                       /* (b_device).              */
  46.  
  47.     if (mode == 7)              /* Rule out monochrome text mode*/
  48.     result = SC_BAD_OPT;
  49.     else if (    b_device  == b_ega
  50.          || b_device  == b_vga
  51.          || b_pcmodel == IBM_JR)
  52.     {                      /* Rule out Enhanced Color      */
  53.                       /* Display 350-line modes.      */
  54.     if (   (mode     <= 3 || mode      == 15  || mode == 16)
  55.         && b_device  == b_ega
  56.         && (b_sw_ega == 3 || b_sw_ega ==  9))
  57.         result = SC_BAD_OPT;
  58.     else
  59.     {                  /* Use BIOS function.          */
  60.         inregs.x.ax = 0x1001;
  61.         inregs.h.bh = (unsigned char) color;
  62.         int86(SC_BIOS_INT,&inregs,&outregs);
  63.         result = SC_NO_ERROR;
  64.     }
  65.     }
  66.     else
  67.     {                      /* Use the CGA BIOS function.   */
  68.     inregs.h.ah = 0x0b;
  69.     inregs.h.bh = 0;
  70.     inregs.h.bl = (unsigned char) color;
  71.     int86(SC_BIOS_INT,&inregs,&outregs);
  72.     result = SC_NO_ERROR;
  73.     }
  74.     return result;
  75. }
  76.