Interrupt Interface OF THE 8088 AND 8086 Microprocessor
Interrupt Interface OF THE 8088 AND 8086 Microprocessor
Interrupt Interface OF THE 8088 AND 8086 Microprocessor
INTERRUPT INTERFACE
OF THE 8088 AND 8086
MICROPROCESSOR
mechanism
EXAMPLE
At what address are CS50 and IP50 stored in memory?
Solution:
Increasing priority
Reset
Internal interrupts and exceptions
Software interrupts
Nonmaskable interrupts
External hardware interrupts
Meaning
Format
Operation
Flags affected
CLI
CLI
0 (IF)
IF
STI
STI
1 (IF)
IF
INT n
Type n software
interrupt
INT n
(Flags) ((SP)-2)
0 TF, IF
(CS) ((SP) 4)
(2+4xn) (CS)
(IP) ((SP) 6 )
(4xn) (IP)
TF, IF
IRET
Interrupt return
IRET
((SP)) (IP)
((SP)+2) (CS)
((SP)+4) (Flags)
(SP) + 6 (SP)
All
INTO
Interrupt on overflow
INTO
INT 4 steps
TF, IF
HLT
Halt
HLT
None
WAIT
Wait
WAIT
YES
NO
YES
NMI
NO
YES
INTR
1
IF
NO
ACKNOWLEDGE
INTERRUPT
TF
READ TYPE
NUMBER
0
COMPLET CURRENT
INSTRUCTION
EXECUTE NEXT
INSTRUCTION
LET TEMP = TF
CLEAR IF & TF
8288 bus controller is added in the interface. The INTA and ALE
signals are produced by the 8288.
The bus priority lock signal LOCK is also added. This signal
ensures that no other device can take over control of the system
bus until the interrupt-acknowledge bus cycle is completed.
PUSH CS & IP
CALL INTERRUPT
SERVICE ROUTINE
EXECUTE USER
INTERRUPT ROUTINE
POP IP & CS
POP FLAGS
RESUME INTERRUPT
PROCEDURE
Solution:
PUSH XX
PUSH YY
PUSH ZZ
.
.
.
.
.
POP ZZ
POP YY
POP XX
IRET
a.
b.
EXAMPLE
Solution:
EXAMPLE
Solution:
d. The flowcharts of the main program and interrupt-service routine
Main Program
SRVRTN
Save processor
status
Set up the
interrupt vector
Increment
the count
Enable
interrupts
Restore processor
status
Wait for
interrupt
Return
Solution:
ICW1
ICW2
NO (SNGL=1)
IN CASCADE
MODE ?
YES (SNGL=0)
ICW3
NO (IC4=0)
IS ICW4
NEEDED ?
YES (IC4=1)
ICW4
Initialization sequence of
the 82C59A
READY TO ACCEPT
INTERRUPT REQUESTS
EXAMPLE
What should be programmed into register ICW 2 if the type
numbers output on the bus by the device are to range from F016
through F716?
Solution:
To set the 82C59A up so that type numbers are in the range of F016
through F716, its device code bits must be
D7D6D5D4D3 = 111102
The lower three bits are dont-care states and all can be 0s. This
gives the word
D7D6D5D4D3D2D1D0 = 111100002 = F016
EXAMPLE
Solution:
Since ICW4 is to be initialized, D0 must be logic 1, D0 = 1
For cascaded mode of operation, D1 must be 0, D1 = 0
And for level-sensitive inputs, D3 must be 1, D3 = 1
Bits D2 and D5 through D7 are dont-care states and are 0.
D2 = D5 = D6 = D 7 = 0
Moreover, D4 must be fixed at the 1 logic level, D4 = 1
This gives the complete command word
D7D6D5D4D3D2D1D0 = 000110012 = 1916
EXAMPLE
EXAMPLE
Solution:
Solution:
EXAMPLE
What OCW2 must be issued to the 82C59A if the priority
scheme rotate on nonspecific EOI command is to be selected?
Solution:
To enable the rotate on nonspecific EOI command priority scheme,
bits D7 through D5 must be set to 101. Since a specific level does
not have to be considered, the rest of the bits in the command word
can be 0. This gives OCW2 as
D7D6D5D4D3D2D1D0 = 101000002 = A016
Minimum-mode interrupt interface for the 8088 microcomputer using the 82C59A
EXAMPLE
Write a program that will initialize an 82C59A with the
initialization command words ICW1, ICW2, ICW3 derived in the
previous examples, and ICW4 is equal to 1F16. Assume that the
82C59A resides at address A00016 in the memory address space.
Solution:
Since the 82C59A resides in the memory address space, we can
use a series of move instructions to write the initialization command
words into its registers. Note that the memory address for an ICW is
A00016 if A0 = 0, and it is A00116 if A0 = 1. However, before doing
this, we must first disable interrupts. This is done with the instruction
CLI
; Disable interrupts
Minimum-mode interrupt interface for the 8086 microcomputer using the 82C59A
Maximum-mode interrupt interface for the 8088 microcomputer using the 82C59A
EXAMPLE
Analyze the circuit in the following figure and write an
appropriate main program and a service routine that counts as a
decimal number the positive edges of the clock signal applied to the
IR0 input of the 82C59A.
Main Program
SRV72
Save processor
status
Set up the
interrupt vector
Increment
the count
Initialize
82C59A
Restore processor
status
Enable interrupts
Return
Wait for
interrupt
;MAIN PROGRAM
CLI
START:
MOV AX, 0
MOV ES, AX
MOV AX, 1000H
MOV DS, AX
MOV AX, 0FF00H
MOV SS, AX
MOV SP, 100H
MOV
MOV
MOV
MOV
hardware.
MOV
MOV
OUT
MOV
MOV
OUT
MOV
OUT
MOV
OUT
STI
DX, 0FF00H
AL, 13H
DX, AL
DX, 0FF02H
AL, 48H
DX, AL
AL, 03H
DX, AL
AL, 0FEH
DX, AL
;ICW1 address
;Edge trig input, single 8259A
;ICW2, ICW4, OCW1 address
;ICW2, type 72
;ICW4, AEOI, nonbuf mode
;OCW1, mask all but IR0
;Enable the interrupts
11.11 Reset
The RESET input of the 8088 and 8086
PUSH
MOV
INC
DAA
MOV
POP
IRET
AX
AL, [COUNT]
AL
[COUNT], AL
AX
11.11 Reset
Bus and control signal status of the 8088/8086 during system reset
10
11.11 Reset
CONTENT
Flags
Clear
Instruction pointer
0000H
CS Register
FFFFH
DS Register
0000H
SS Register
0000H
ES Register
0000H
Queue
Empty
11.11 Reset
The external hardware interrupts are disabled after
the initialization.
Program execution begins at address FFFF016 after
11