loading...

CS609 System Programming Assignment 3 Solution Fall 2012

Write a TSR program that work like a Screen Saver. If no operation performed for 10 seconds then your Screen Saver must be activated i.e. The All Text on your Screen must start blinking. In Screen Saver mode, all text  appearing on DOS window, shall start blinking. Sample output of the desiredprogram is shown in the attached animated file. If any key pressed then Screen Saver shall be de-activated and text shall appear as normal.

 It shows how to execute .com file in DOS (SS-3.com is my screen saver) and the required output/working of your program.

Submission

You are required to submit two files in Zip format through LMS:

  • Your C-language program (.c file).
  • Its TSR (.com) file.

Hint: The desired task can easily be achieved by modifying “Timer & Keyboard Interrupt Program” given in your handouts at page # 37.

Solution: 

#include <dos.h>
void interrupt (*oldTimer)( ); //corrected
void interrupt (*oldKey)( ); //corrected
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();
getch();
getch();
getch();
}
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) ( );
}

 

DOWNLOAD SOLUTION HERE
loading...