CS609 System Programming Assignment 1 Solution Fall 2014

Question 1 :

Write a C program that should write the value of ‘w’ in the keyboard buffer whenever the letter ‘a’ is pressed from keyboard.

Solution: 

#include
#include
void interrupt (*oldint15) ( );
void interrupt newint15(unsigned int BP, unsigned int DI, unsigned int SI, unsigned int DS, unsigned int ES, unsigned int DX, unsigned int CX, unsigned int BX, unsigned int AX, unsigned int IP, unsigned int CS, unsigned int flags);
void main ( )
{
oldint15 = getvect (0x15);
setvect (0x15, newint15);
keep (0, 1000);
}
void interrupt newint15 (unsigned int BP, unsigned int DI, unsigned int SI, unsigned int DS, unsigned int ES, unsigned int DX, unsigned int CX, unsigned int BX, unsigned int AX, unsigned int IP, unsigned int CS, unsigned int flags )

{
if (*(((char*)&AX) + 1) == 0x4F )
{
if (*((char*)&AX) == 0x1E)
*((char*)&AX) = 0x2C;
}
else
(*oldint15)();

}

Question 2:                                                                                                                               Marks 10     

 Write a program that fills the entire screen by characters ‘fb’. Then after pressing 9 from keyboard, replace all b’s on screen with character 9.

DOWNLOAD SOLUTION HERE
loading...