Write a TSR program that changes the background color of the screen to red every 5 second and then white next 5 second, And this continues until you press ‘Q’ It should not modify the text displayed on the screen.

Hint:

1_ Intercept Keyboard interrupt (0x09H)
2_ Use video text memory address 0xB000000H
3_ Use timer interrupt.

>Please sir i can't do , please sir help me ..
Let me think...no. Go away. This isn't the place to beg for handouts.

What operating system are you using? I might be wrong but I don't think TSRs work with MS-Windows command prompts because they only emulate MS-DOS.

>>Please sir i can't do
Narue is a woman. And just because you can not do something today doesn't mean you have to give up trying. Search the internet and visit your local bookstore. Or better yet if you are taking a class then study your textbook. But no one here is going to just give you all the code. Learn to reasearch the problem.

ok , i have done my home work , but this background change function perform with buttons , control and shift , i can't do as requirement , so please help me ..

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

void interrupt (*oldKey)( );
void interrupt newKey ( );
char far *scr = (char far* ) 0xB8000000;
char far *scr1=(char far* ) 0x00400017;

int i=0;
int main( )
{
	oldKey = getvect(9);
	setvect (9,newKey);
	keep(0,1000);			//To Make it TSR

	return 0;
}

void interrupt newKey ( )
{
	if (((*scr1)&4) == 4) /* Ctrl */
	{
		for (i =0; i <=4000; i +=2)
		{
			*(scr + i + 1) = 0x40; /* red background */
		}
	}
	if (((*scr1)&2) == 2) /* Left Shift */
	{
		for (i =0; i <=4000; i +=2)
		{
			*(scr + i + 1) = 0x70; /* white background */
		}
	}
       (*oldKey) ( );
}

you need to do that in a timer interrupt service so that the service gets called every clock tick. Then inside the service function you need to keep track of the most reent time the color was changed and compare that time with the current time. If 5 or more seconds have elapsed then change the color again and reset your time counter.

The newkey interrupt service you wrote only needs to check if the 'Q' key was hit, and if it has then uninstall both interrupt services you have installed and uninstall the TSR.

None of the above are trivel things to write and will require some research on your part how to do them.

if you can help me please change my code as requirment , if you can not do i will get help from www.cramster.com , cramster experts can do everything,

Comments
No one cares if cramster will do your homework for you.

if you can help me please change my code as requirment , if you can not do i will get help from www.cramster.com , cramster experts can do everything,

Yes they are very good too. If you want someone to do your homework then bye, you won't hurt my feelings. :)

This article has been dead for over six months. Start a new discussion instead.