Hi everyone. I have written an MS-DOS based screensaver program by hooking timer and keyboard interrupt. After 10 seconds the screen is cleared and on clicking any button from the keyboard the contents of dos screen are shown. I want to know how can I make this screen to blink i.e. alternate between cleared screen and screen with text shown when no button is pressed for 10 seconds. If you need further information I can describe what I am trying to achieve. Here is my written code:

#include <dos.h>
#include <conio.h>
void interrupt (*oldTimer)();
void interrupt (*oldKey)();
void interrupt newTimer();
void interrupt newKey();
char far *scr = (char far*) 0xB8000000;
int i, t=0, m=0;
char charscr[4000];


void main()
{
oldTimer=getvect(8);
oldKey=getvect(9);
setvect(8,newTimer);
setvect(9,newKey);


getch();
keep (0,1000);


}


void interrupt newTimer()
{
    t++;
    if((t>=182)&&(m==0))
    {
    for (i=0;i<4000;i++)
    charscr [i]=*(scr+i);
    for (i=0;i<=4000;i+=2)


        {
        *(scr+i)=0x20;
        *(scr+i+1)=0x07;
        }


    t=0; m=1;
    }
    (*oldTimer)();


 }


void interrupt newKey()
{
int w;
if(m==1)
{
for (w=0; w<4000;w++)
*(scr+w)=charscr[w];
m=0;
}
(*oldKey)();
}

Probably the old school way, use the timer and switch the foreground color between what you're using now and the background color and back again. When it's the background color the text is still there but invisible.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.