Вы находитесь на странице: 1из 3

CS401- Computer Architecture and Assembly

Language Programming
Assignment # 5
Spring 2009
Total Marks: 15
Due Date
Your assignment must be uploaded before or on 13th June 2009.
Upload Instructions
Please view the document related to assignment submission process provided to
you by the Virtual University to upload the assignment.
Rules for Marking
Kindly note that your assignment will NOT be graded if:
 It is submitted after due date
 The file you uploaded does not open
 The file you uploaded is copied from someone else
 It is in the format other than .doc
Objective
This assignment has been designed to enable you:
 To understand how to enable/disable interrupts by using port
0x21 of PIC

Assignment
Question_1: The following code reads port 0x21 (interrupt mask register) of PIC
(Programmable Interrupt Controller), sets the 2nd bit that is mapped to IRQ1 and
writes it back to port 0x21. As a result keyboard interrupt will be disabled as IRQ1
is used by keyboard. [10 marks]

; disable keyboard interrupt in PIC mask register


01 [org 0x0100]
02 in al, 0x21 ; read interrupt mask register
03 or al, 2 ; set bit for IRQ1
04 out 0x21, al ; write back mask register
05 mov ax, 0x4c00 ; terminate program
06 int 0x21

Modify instruction_03 for the following:


I. set bit for IRQ0
II. set bit for IRQ6
III. set bits for IRQ1, IRQ3 and IRQ4
IV. clear bit for IRQ5
V. clear bits for IRQ2, IRQ5, IRQ6 and IRQ7
sol:
CS401- Computer Architecture and Assembly Language Programming
Assignment # 5
Spring 2009
Question_1: The following code reads port 0x21 (interrupt mask register) of PIC (Programmable
Interrupt Controller), sets the 2nd bit that is mapped to IRQ1 and writes it back to port 0x21. As a
result keyboard interrupt will be disabled as IRQ1 is used by keyboard. [10 marks]

; disable keyboard interrupt in PIC mask register


01 [org 0x0100]
02 in al, 0x21 ; read interrupt mask register
03 or al, 2 ; set bit for IRQ1
04 out 0x21, al ; write back mask register
05 mov ax, 0x4c00 ; terminate program
06 int 0x21

Modify instruction_03 for the following:


I. set bit for IRQ0
II. set bit for IRQ6
III. set bits for IRQ1, IRQ3 and IRQ4
IV. clear bit for IRQ5
V. clear bits for IRQ2, IRQ5, IRQ6 and IRQ7

OR
The following code reads port 0x21 (interrupt mask register) of PIC (Programmable Interrupt
Controller), sets the 2nd bit that is mapped to IRQ1 and writes it back to port 0x21. As a result keyboard
interrupt will be disabled as IRQ1 is used by keyboard.

; disable keyboard interrupt in PIC mask register

01 [org 0x0100]

02 in al, 0x21 ; read interrupt mask register

03 or al, 2 ; set bit for IRQ1

04 out 0x21, al ; write back mask register

05 mov ax, 0x4c00 ; terminate program

06 int 0x21

Modify instruction_03 for the following:

I. set bit for IRQ0

II. set bit for IRQ6

III. set bits for IRQ1, IRQ3 and IRQ4


IV. clear bit for IRQ5

V. clear bits for IRQ2, IRQ5, IRQ6 and IRQ7

I need more help in part III IV and V.

Question_2: Suggest a reason for the following:


[5 marks]
I. We should disable interrupts while hooking interrupt 8h, i.e. while placing its
segment and offset in the interrupt vector table.
II. We need not do this for interrupt 80h.

Sol:

We should disable interrupts while hooking interrupt 8h, i.e. while placing its segment and offset in the
interrupt vector table.
II. We need not do this for interrupt 80h.

OR

I. We should disable interrupts while hooking interrupt 8h, i.e. while placing its segment and
offset in the interrupt vector table.

II. We need not do this for interrupt 80h.

Вам также может понравиться