<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS609: System Programming Graded Assignment No. 02 Solution and Discussion]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1558960127739-ed68798f-18fe-4f13-97a5-5a6035004af5-image.png" alt="ed68798f-18fe-4f13-97a5-5a6035004af5-image.png" class=" img-fluid img-markdown" /><br />
Semester: Spring 2019<br />
CS609: System Programming<br />
Graded<br />
Assignment No. 02<br />
Total Marks: 20</p>
<p dir="auto">Due Date: May 29, 2019</p>
<p dir="auto">Instructions:</p>
<p dir="auto">Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">♣	The assignment is submitted after due date.<br />
♣	The submitted assignment does not open or file is corrupt.<br />
♣	You have not followed steps described in Detailed Instructions of the problem statement.<br />
♣	Assignment is copied (partial or full) from any source (websites, forums, students, etc.) Strict action will be taken in this regard.</p>
<p dir="auto">Note: You have to upload only .doc or .docx file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks.</p>
<p dir="auto">Objectives:</p>
<p dir="auto">The objective of this assignment is to provide hands-on experience of System Programming concepts including:</p>
<p dir="auto">•	How can interrupts be generated<br />
•	What are Interrupts<br />
•	Interrupt functions writing<br />
•	TSR program<br />
•	Calling interrupt functions</p>
<p dir="auto">For any assignment related query, contact at <a href="mailto:CS609@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">CS609@vu.edu.pk</a></p>
<p dir="auto">Problem Statement:<br />
You are required to write C program which will act like screen saver. Your program should display multiple characters i.e AAAAAAAAAA…… on whole screen then if 5 seconds elapses and no key is pressed then then the screen characters should be stored in an array and screen should be cleared with blanks. After that if any character from keyboard is pressed then it should recover the same characters i.e AAAAAAA…. on whole screen.<br />
Instructions:</p>
<ol>
<li>You should include all related header files first of all then declare interrupt pointer to hold Timer and Key i.e<br />
void interrupt (*oldTimer)(void);<br />
void interrupt (*oldKey)(void);</li>
<li>Similarly, give prototype for new functions of newtimer() and newKey(); i.e<br />
void interrupt newTimer();<br />
void interrupt newKey();</li>
<li>Declare a far pointer i.e *scr to hold far address =0xB8000000 and declare char array of 4000 i.e char charscr[4000];</li>
<li>Store current vector values of INT 8 and 9 through getvect in oldTimer and oldKey.</li>
<li>Set newTimer and newKey fuctions through setvect.</li>
<li>In newTimer() function, give logic to wait for 5 seconds i.e t&gt;=90 and store the screen characters i.e AAAAA… of all screen in char array of charscr[i] through loop. After that blank space should be displayed by setting keyboard status with black background i.e no character on screen i.e<br />
*(scr+i)=ox20;<br />
*(scr+i+1)=ox07;</li>
<li>When any key is pressed from the keyboard, newKey() function should be called and all the screen characters i.e AAAAA … should again be recovered on whole screen using loop.</li>
<li>*(scr+i)=charscr[i]</li>
</ol>
<p dir="auto">Note: Your assignment file should be a single Word file (.doc or .docx).<br />
Sample Code:<br />
#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
#include&lt;DOS.H&gt;<br />
#include&lt;BIOS.H&gt;<br />
void interrupt (*oldTimer)(void);<br />
void interrupt (*oldKey)(void);<br />
void interrupt newTimer();<br />
void interrupt newKey();<br />
char far *scr=(char far *)0xB8000000;<br />
int i, t=0,m=0;<br />
char charscr[4000];<br />
void main()<br />
{<br />
clrscr();<br />
for(i=0;i&lt;4000;i++)<br />
*(scr+i)=….<br />
oldTimer=……….<br />
oldKey=………….<br />
setvect(8,newTimer);<br />
setvect(9,newKey);<br />
getch();</p>
<p dir="auto">}<br />
void interrupt newTimer()<br />
{<br />
t++;<br />
if ((t&gt;=91) &amp;&amp; (m==0))<br />
{<br />
for(i=0;i&lt;4000;i++)<br />
charscr[i]=…………<br />
for(i=0;i&lt;4000;i+=2)<br />
{<br />
*(scr+i)=………;<br />
*(scr+i+1)=……………;<br />
}<br />
t=0;m=1;<br />
}<br />
(*oldTimer)();<br />
}</p>
<p dir="auto">void interrupt newKey()<br />
{</p>
<p dir="auto">if (m==1)<br />
{<br />
for(w=0;w&lt;4000;w++)<br />
……………………<br />
……………<br />
}</p>
<p dir="auto">(*oldKey)();<br />
}</p>
<p dir="auto">Best of Luck!</p>
<p dir="auto"><a href="/assets/uploads/files/1558960163435-spring-2019_cs609_2.docx">Spring 2019_CS609_2.docx</a></p>
]]></description><link>https://community.secnto.com//topic/70/cs609-system-programming-graded-assignment-no-02-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 20:55:14 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/70.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 May 2019 12:29:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS609: System Programming Graded Assignment No. 02 Solution and Discussion on Thu, 30 May 2019 18:23:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zaasmi" aria-label="Profile: zaasmi">@<bdi>zaasmi</bdi></a></p>
<pre><code>CS609
Correct Solution:


#include&lt;conio.h&gt;
#include&lt;BIOS.H&gt;
#include&lt;stdio.h&gt;
#include&lt;DOS.H&gt;
void interrupt (*oldTimer)(void); // To store current Timer vector
void interrupt (*oldKey)(void);//  To store current KeyVector
void interrupt newTimer();     //New Timer Function
void interrupt newKey(); //New Key Function 
char far *scr= (char far *)0xBS090200381; //Screen segment
int i, t=0,m=0;
char charscr[4000];       //Character Array
void main()
{
	
    clrscr();
for(i=0;i&lt;4000;i++)
*(scr+i)=0x41;  // Displaying A on whole screen
oldTimer=getvect(8);
oldKey=getvect(9);
setvect(8,newTimer);
setvect(9,newKey);
getch();
}
void interrupt newTimer()
{
t++;
if((t&gt;=90) &amp;&amp; (m==0))
{
	
for(i=0;i&lt;4000;i++)
charscr[i]=*(scr+i);             //Storing all characters in array
 for(i=0;i&lt;4000;i+=2)
  {
      *(scr+i)=0x20;            // Blank screen
      *(scr+i+1)=0x07;
   }
    t=0;
m=1;
}
(*oldTimer)();
}
 void interrupt newKey()
{int w;
 if (m==1)
{
for(w=0;w&lt;4000;w++)
    *(scr+w)=charscr[w];    // Recovering all characters on screen.
        m=0;}
   (*oldKey)(); 
   }



</code></pre>
]]></description><link>https://community.secnto.com//post/132</link><guid isPermaLink="true">https://community.secnto.com//post/132</guid><dc:creator><![CDATA[moaaz]]></dc:creator><pubDate>Thu, 30 May 2019 18:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to CS609: System Programming Graded Assignment No. 02 Solution and Discussion on Thu, 30 May 2019 17:52:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moaaz" aria-label="Profile: moaaz">@<bdi>moaaz</bdi></a> 1:18: fatal error: conio.h: No such file or directory<br />
compilation terminated.</p>
]]></description><link>https://community.secnto.com//post/131</link><guid isPermaLink="true">https://community.secnto.com//post/131</guid><dc:creator><![CDATA[zaasmi]]></dc:creator><pubDate>Thu, 30 May 2019 17:52:20 GMT</pubDate></item><item><title><![CDATA[Reply to CS609: System Programming Graded Assignment No. 02 Solution and Discussion on Thu, 30 May 2019 17:51:33 GMT]]></title><description><![CDATA[<pre><code>#include&lt;conio.h&gt;
#include&lt;BIOS.H&gt;
           #include&lt;stdio.h&gt;
#inlcude&lt;DOS.H&gt;
void interrupt (*oldTimer)(*void); // To store current Timer vector
void interrupt (*oldKey)(void);//  To store current KeyVector
void interrupt newTimer();     //New Timer Function
void interrupt newKey(); New Key Function 
char far *scr= (char far *)0xB8000000; Screen segment
int in, t=0,m=0;
char scharscr[4000];       //Character Array
void main()
{
    clrscr();
for(i=0;i&lt;4000;i++)
*(scr+i)=0x42;  // Displaying B on whole screen
oldTimer=getvect(8);
oldKey=getvect(9);
setvect(8,newTimer);
setvect(9,newKey);
getch();
}
void interrupt newTimer();
{
t++;
if((t&gt;=90) &amp;&amp; (m==0))
{
for(i=0;i&lt;4000;i++)
charscr[i]=*(scr+i);             //Storing all characters in array
 for(i=0;i&lt;4000;i+=2)
  {
      *(scr+i)=0x20;            // Blank screen
      *(scr+i+1)=0x07;
   }
    t=0;
m=1;
}
(*oldTimer)();
}
 void interrupt newKey()
{int w;
 if (m==1)
{
for(w=0;w&lt;4000;w++)
    *(scr+w)=charscr[w];    // Recovering all characters on screen.
        m=0;}
   (*oldKey)(); }
</code></pre>
]]></description><link>https://community.secnto.com//post/130</link><guid isPermaLink="true">https://community.secnto.com//post/130</guid><dc:creator><![CDATA[moaaz]]></dc:creator><pubDate>Thu, 30 May 2019 17:51:33 GMT</pubDate></item></channel></rss>