C expert help me! Write a TSR program that changes the background color ...

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2007
Posts: 5
Reputation: bc030400412 is an unknown quantity at this point 
Solved Threads: 0
bc030400412 bc030400412 is offline Offline
Newbie Poster

C expert help me! Write a TSR program that changes the background color ...

 
0
  #1
Oct 12th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is online now Online
Code Goddess

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #2
Oct 12th, 2007
No. Do your own homework.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 5
Reputation: bc030400412 is an unknown quantity at this point 
Solved Threads: 0
bc030400412 bc030400412 is offline Offline
Newbie Poster

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #3
Oct 12th, 2007
Please sir i can't do , please sir help me ..
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,740
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 739
Team Colleague
Narue's Avatar
Narue Narue is online now Online
Code Goddess

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #4
Oct 12th, 2007
>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.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,448
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #5
Oct 12th, 2007
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 5
Reputation: bc030400412 is an unknown quantity at this point 
Solved Threads: 0
bc030400412 bc030400412 is offline Offline
Newbie Poster

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #6
Oct 12th, 2007
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 ..
  1. #include <dos.h>
  2. #include <stdio.h>
  3. #include <conio.h>
  4.  
  5. void interrupt (*oldKey)( );
  6. void interrupt newKey ( );
  7. char far *scr = (char far* ) 0xB8000000;
  8. char far *scr1=(char far* ) 0x00400017;
  9.  
  10. int i=0;
  11. int main( )
  12. {
  13. oldKey = getvect(9);
  14. setvect (9,newKey);
  15. keep(0,1000); //To Make it TSR
  16.  
  17. return 0;
  18. }
  19.  
  20. void interrupt newKey ( )
  21. {
  22. if (((*scr1)&4) == 4) /* Ctrl */
  23. {
  24. for (i =0; i <=4000; i +=2)
  25. {
  26. *(scr + i + 1) = 0x40; /* red background */
  27. }
  28. }
  29. if (((*scr1)&2) == 2) /* Left Shift */
  30. {
  31. for (i =0; i <=4000; i +=2)
  32. {
  33. *(scr + i + 1) = 0x70; /* white background */
  34. }
  35. }
  36. (*oldKey) ( );
  37. }
Last edited by Ancient Dragon; Oct 12th, 2007 at 5:47 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,448
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #7
Oct 12th, 2007
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.
Last edited by Ancient Dragon; Oct 12th, 2007 at 5:55 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 5
Reputation: bc030400412 is an unknown quantity at this point 
Solved Threads: 0
bc030400412 bc030400412 is offline Offline
Newbie Poster

Re: C expert help me! Write a TSR program that changes the background color ...

 
-1
  #8
Oct 12th, 2007
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,
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,448
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C expert help me! Write a TSR program that changes the background color ...

 
0
  #9
Oct 12th, 2007
Originally Posted by bc030400412 View Post
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC