944,051 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2414
  • C RSS
Oct 12th, 2007
0

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

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bc030400412 is offline Offline
5 posts
since Oct 2007
Oct 12th, 2007
0

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

No. Do your own homework.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 12th, 2007
0

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

Please sir i can't do , please sir help me ..
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bc030400412 is offline Offline
5 posts
since Oct 2007
Oct 12th, 2007
0

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

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Oct 12th, 2007
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Oct 12th, 2007
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bc030400412 is offline Offline
5 posts
since Oct 2007
Oct 12th, 2007
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005
Oct 12th, 2007
-1

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

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,
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bc030400412 is offline Offline
5 posts
since Oct 2007
Oct 12th, 2007
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,954 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Making a letter counting program
Next Thread in C Forum Timeline: compiler





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC