Lecture 7 Z80 Interrupt 동국대학교 홍유표 Polling vs. Interrupt Polling : Periodically check if an event occurs Interrupt : Event sends a signal to CPU Y.
Download ReportTranscript Lecture 7 Z80 Interrupt 동국대학교 홍유표 Polling vs. Interrupt Polling : Periodically check if an event occurs Interrupt : Event sends a signal to CPU Y.
Slide 1
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 2
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 3
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 4
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 5
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 6
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 2
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 3
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 4
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 5
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee
Slide 6
Lecture 7
Z80 Interrupt
동국대학교 홍유표
1
Polling vs. Interrupt
Polling : Periodically check if an event
occurs
Interrupt : Event sends a signal to CPU
2
Y. Hong & E. Lee
Interrupt
An hardware-initiated subroutine call or
jump that interrupts the currently executing
program.
Internal
Interrupts : Divide by 0, undefined
instruction, …
External Interrupts : Keyboard input, …
3
Y. Hong & E. Lee
Multiple Interrupt Sources
Typically, there are multiple sources for
interrupts
CPU should be able to identify who
generates the interrupt
Also, there must be a way to give priority
to interrupt sources
4
Y. Hong & E. Lee
Interrupt Source Identification
Polling Type
Once
an interrupt is received, CPU reads a
status register of each device for interrupt
generation check.
Vector Type
Once
an interrupt is received, CPU sends an
acknowledge signal (Low on M1 IORQ) to
interrupt sources. Then the source sends its
ID on data bus.
5
Y. Hong & E. Lee
Interrupt Service Routine
If an interrupt occurs, after the current
instruction is finished an interrupt service
routine is called.
The interrupt service routine can be in a
predefined location. (Mode 1 in Z80)
Or, the corresponding routine is placed in
the address of I + ID, where I is a interrupt
vector register. (Mode 2 in Z80)
6
Y. Hong & E. Lee