CS609 Assignment 2 Solution and Discussion
-
Re: CS609 Assignment 2 Solution and Discussion
Semester: Spring 2020
CS609: System Programming
Graded
Assignment No. 02 Total Marks: 20Due Date: June 11, 2020
Instructions:
Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
The assignment is submitted after due date.
The submitted assignment does not open or file is corrupt.
You have not followed steps described in Detailed Instructions of the problem statement.
Assignment is copied (partial or full) from any source (websites, forums, students, etc.) Strict action will be taken in this regard.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.
Objectives:
The objective of this assignment is to provide hands-on experience of System Programming concepts including:
• How can interrupts be generated
• What are Interrupts
• Interrupt functions writing
• BIOS data area.
• TSR program
• Calling interrupt functionFor any assignment related query, contact at [email protected]
Problem Statement:
Q: Write down a program in C which will display any long string on the screen and after passing 5 seconds, if no key is pressed then the string should be changed by replacing all character of ‘y’ on the screen (video text memory) by ‘z’. For example: String on Screen is : “Hey young man, you have a lovely watch”. It should be changed to “Hez zoung man, zou have a lovelz watch”.[Hint: Video text memory area starts from location B800:0000. You have to traverse whole text memory area by using for loop, and then use simple if statements, to replace y with z.
Instructions:
- You should include all related header files first of all then declare string array to store string to be displayed and declare interrupt pointer to hold old interrupt i.e
char str1[80]={“ “Hey young man, you have a lovely watch”$”}
void interrupt (*old)(void); - Similarly, give prototype for new functions of i.e
void interrupt newfunc(); - Declare a far pointer i.e *scr to hold far address =0xB8000000
- Store current vector values of INT 8 through getvect in old().
- Set newFunc() fuctions through setvect.
- In newFunc() function, give logic to wait for 5 seconds i.e t>=90
- Replace y character to z i.e
for ( int j = 0; j < 4000; j += 2) {
if(*(scr + j) == 0x79’) // small y ASCII code.
*(scr + j) = 0x7A;// small z ASCII code.
Sample Code:
#include <stdio.h> #include <BIOS.H> #include <DOS.H> int t=0; char str1[…..Hey young boy you have a lovely watch$”}; void interrupt (*old)(void); char far *……..)0xb8000000; // code to access video text memory area void interrupt newFunc(); void main( ) { clrscr(); // Display string on screen by calling int21h. old=getvect(…….); setvect(0x08,newFunction); } void interrupt newFunction( ) { If (t>=90 ) // write for loop here // write body of for loop} //if part ….. (*old)(); }
Note: Your assignment file should be a single Word file (.doc or .docx).
- You should include all related header files first of all then declare string array to store string to be displayed and declare interrupt pointer to hold old interrupt i.e
-