How to Create Blinking Output in EGA or VGA Graphics Mode

Last reviewed: July 17, 1997
Article ID: Q74031
5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50
MS-DOS                      | WINDOWS
kbprg

The information in this article applies to:

  • The C Run-time (CRT), included with:

        - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax
        - Microsoft C/C++ for MS-DOS, version 7.0
        - Microsoft Visual C++ for Windows, versions 1.0 and 1.5
    

SUMMARY

With Microsoft C in the EGA or VGA graphics mode you can create blinking output for both text and graphics figures by calling Interrupt 10h, Function 10h, Subfunction 03h. This interrupt will either set or clear the enable blink bit of the attribute controller's mode control register (bit 3 of register 10H at port 3COH).

MORE INFORMATION

The enable blink bit of the attribute controller determines whether the most significant bit of a pixel value will cause either a blinking or a more intense output color. The enable blink bit defaults to a 0 (zero), which represents intensity. Changing it to a 1 (one) will enable blinking.

When the enable blink bit is not set and the default palette register is being used, the first eight colors will be a high intensity color. Setting the enable blink bit reverses this and causes the first eight colors to default to a lower intensity. It also changes the normal background color from black to light gray.

The sample program below illustrates the effect of setting the enable blink bit. The color values of 0 through 7 remain constant, while 8 through 15 will blink. If you are using the default palette, the output will switch between high and low intensity colors as the first eight palette registers are being alternated with the last eight.

For more information on blinking output in graphics mode, see the Microsoft Press book "Programmer's Guide to PC & PS/2 Video Systems" by Richard Wilton.

Sample Code

/* Compile options needed: none
*/

#include <stdio.h>
#include <graph.h>
#include <conio.h>

void main(void)
{
   int i, j;
   long colors[16] = { _GRAY, _LIGHTBLUE, _LIGHTGREEN, _LIGHTCYAN,
                       _LIGHTRED,_LIGHTMAGENTA, _YELLOW, _WHITE,
                       _BLACK, _BLUE, _GREEN, _CYAN, _RED, _MAGENTA,
                       _BROWN, _BRIGHTWHITE };

   _setvideomode( _VRES16COLOR );
   _remapallpalette( colors );
   _asm{
           mov bl, 1
           mov ax, 1003h
           int 10h
   }
   for ( i = 0, j = 1 ; i < 16 ; i++, j += 20) {
       _setcolor( i );
       _ellipse( _GFILLINTERIOR, j , j, j + 15, j + 15);
   }
   getch();
   _setvideomode( _DEFAULTMODE );
}


Additional reference words: kbinf 5.10 6.00 6.00a 6.00ax 7.00 1.00 1.50
KBCategory: kbprg
KBSubcategory: CRTIss GraphicsIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.