INF: How to Create Blinking Output in EGA or VGA Graphics Mode

ID Number: Q74031

5.10 6.00 6.00a 6.00ax 7.00

MS-DOS

Summary:

In Microsoft C versions 5.1, 6.0, 6.0a, 6.0ax, and C/C++ 7.0, 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: QuickC 2.0 2.00 2.5 2.50 2.51 C 5.0 5.1

5.10 6.0 6.00 6.0a 6.00a 6.0ax 6.00ax 7.00