CS609 Complete Assignment01 Solution 3 Spring 2013

No Comments
Assignment Questions

Question 1:                                                                                                                               Marks 10     

Answer the following questions precisely. Do not include irrelevant data in your answers. Any answer with more than three lines will neglect your marks. (2 marks for each)
Q1. Where are the interrupt vectors located in the microprocessors memory?
        The interrupt vectors are located in the interrupt vector table which is further located at the address 0000:0000h
Q2. Which interrupt vectors are reserved by Intel?
        First 32 interrupt vector locations are reserved by intel.
Q3. Explain the operation of IRET instruction.
When the interrupt procedure pushes the registers AX, BX, CX, DX, ES etc in the stack. After execution of that interrupt procedure, the iret instruction pops out all the registers that were pushed as a result of interrupt procedure in reverse order. This is the operation of iret instruction.

Q4. List the events that occur when an interrupt becomes active.
A trap flag permits the operation of a processor in a single step mode. The debugger use this program to step through the execution of a computer program

Q5. Explain the purpose of the trap flag (TF).
       A trap flag is used for debugging purpose. If the trap flag is set the single step interrupt is generated after every instruction. By looking this interrupt, a debugger can get control after every instruction and display the registers.
Question 2:                                                                                                                               Marks 10     

Write a C program that should write the value of 'k' in the keyboard buffer whenever the letter 'z' is pressed from keyboard.
Solution:-


#include<dos.h>
void interrupt (*old)();
void interrupt newfunc();
char far *scr = (char far*) 0xb8000000;
int j;
void main()
{
old = getvect(0x09);
setvect(0x09,newfunc);
keep(0,1000);
}
void interrupt newfunc()
{
for(j=0;j<4000;j+=2)
{
if(*(scr+j)==’1’)
*(scr+j) = ‘9’;
}
(*old)();
}







BEST OF LUCK


Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment