Interrupts in assembly language x-8086
-
Upload
hassnain-jamil -
Category
Education
-
view
221 -
download
4
Transcript of Interrupts in assembly language x-8086
![Page 1: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/1.jpg)
CSC 222: Computer Organization
& Assembly Language
6 - Interrupts Handling
![Page 2: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/2.jpg)
Basic Instruction Cycle
Fetch Decode Execute
Fetch
1. Fetch an instruction from memory
2. Decode the instruction to determine the operation
3. Fetch data from memory if necessary
Execute
4. Perform the operation on the data
5. Store the result in memory if needed
2
![Page 3: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/3.jpg)
Instruction Cycle State Diagram
3
![Page 4: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/4.jpg)
Contd..
4
Instruction Fetch Read instruction from memory into processor
Instruction Operation Decoding Determine the type of operation to be performed and operand(s) to
be used.
Operand Address Calculation If operation involves reference to an operand in memory or I/O, then
determine the address of operand.
Operand Fetch Fetch from memory or read from I/O
Data Operation Perform the operation
Operand Store Write into memory or out to I/O if required
![Page 5: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/5.jpg)
Interrupts – Changing Program Flow
Mechanism by which other modules (e.g. I/O) may interrupt
normal sequence of processing
Hardware interrupts
Hardware devices to interrupt the processor for some I/O
operation.
Software interrupts
Sent by programs to request system services.
Sent by programs using the INT instruction.
Handling follows a similar procedure to hardware interrupts.
5
![Page 6: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/6.jpg)
Interrupts…
6
Processor exception
System generated interrupts
Occurs when some condition arises in the processor which
requires special handling.
Each exception has a unique handling number
![Page 7: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/7.jpg)
Interrupt Cycle
Added to instruction cycle
Processor checks for interrupt
Indicated by an interrupt signal
If no interrupt, fetch next instruction
If interrupt pending:
Suspend execution of current program
Save context
Set PC to start address of interrupt handler routine
Process interrupt
Restore context and continue interrupted program
7
![Page 8: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/8.jpg)
Transfer of Control via Interrupts
8
![Page 9: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/9.jpg)
Instruction Cycle with Interrupts
9
![Page 10: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/10.jpg)
Instruction Cycle (with Interrupts) - State Diagram
10
![Page 11: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/11.jpg)
Multiple Interrupts
Disable interrupts
Processor will ignore further interrupts while processing one
interrupt
Interrupts remain pending and are checked after first interrupt
has been processed
Interrupts handled in sequence as they occur
Define priorities
Low priority interrupts can be interrupted by higher priority
interrupts
When higher priority interrupt has been processed, processor
returns to previous interrupt
11
![Page 12: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/12.jpg)
Multiple Interrupts - Sequential
12
![Page 13: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/13.jpg)
Multiple Interrupts – Nested
13
![Page 14: Interrupts in assembly language x-8086](https://reader031.fdocuments.net/reader031/viewer/2022020218/55b5dbfcbb61ebf3518b47e3/html5/thumbnails/14.jpg)
Chapter Reading
14
Chapter 3, William Stallings, “Computer Organization
& Architecture”