0

I have written a program which acts as a screensaver i.e after 10 seconds all the command prompt screen is cleared if no keyboard button is pressed. In short I have hooked Timer and Keyboard interrupt. But I want the program to show blinking screen i.e alternatively show all the text of command prompt and blank screen. But my current situation is that it keeps on showing a blank screen after 10 seconds if no button is pressed. How can I modify my program to show blinking screen alternating between cleared screen and textual data instead of just cleared screen. Here is my program:

#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)();
  }

Sorry for my poor indentation. I find it very hard on this site to indent the code.

Hammad
  • 177
  • 1
  • 3
  • 10
  • Somebody find the time machine. We're somewhere in 1985... – Jerry Coffin Dec 03 '12 at 16:29
  • LOL I assure you @JerryCoffin we aren't. Learning fundamentals should never be considered obsolete. Should it be? – Hammad Dec 03 '12 at 16:36
  • TSRs don't involve fundamentals though -- they mostly involve learning trivia about MS-DOS (where's the InDOS flag, under what circumstances can you safely ignore it, etc.) – Jerry Coffin Dec 03 '12 at 16:45
  • inDOS flag? Got the privilege of reading it for the first time. I'm not much learned in system programming as m at the start of the course at uni. – Hammad Dec 03 '12 at 16:53

0 Answers0