Input, Output and Traps: I/O Basics Keyboard Input Monitor Output Interrupt Driven I/O DMA High-Level I/O With Traps
Input, Output and Traps: I/O Basics Keyboard Input Monitor Output Interrupt Driven I/O DMA High-Level I/O With Traps
I/O basics
Keyboard input
Monitor output
DMA
I/O
Interrupts
I/O asics
!e"initions
Input
Output
I/O Inter"ace
LC',
5rame &u""ers$ Large areas o" 3emory 3apped I/O "or +ideo
display
LC',
*ro&lem
I" set, C*/ reads the data register and resets the Ready &it
Repeat
Interrupt'dri+en I/O
C*/ chec%s the ready &it o" status register -as per program
instructions.(
I" the I/O de+ice is +ery slo#, C*/ is %ept &usy #aiting(
Input -%ey&oard.
Output -monitor.
0ey&oard
3onitor
IO instructions
8alt
i(e( instructions #here one program can a""ect the &eha+ior o"
another(
The C*/ can &e designed to en"orce t#o modes o" operation$
/ser 3ode
1 set o" trap ser+ice routines or TSRs -part o" the C*/ OS.
#hich loads the starting address o" the TSR into the *C
Return lin%
"rom the end o" the TSR &ac% to the original program(
LC', TR1* Routines
IG -TR1* xE,.
1 set o" trap ser+ice routines or TSRs -part o" the C*/ OS.
#hich loads the starting address o" the TSR into the *C
Return lin%
"rom the end o" the TSR &ac% to the original program(
TR1* )xample
In LC',
TR1* 4 Interrupts
Similar mechanisms
1 TR1* is an
instruction -e+ent
internal to a
program.(
1n interrupt is
external to a
program -"rom an
I/O de+ice.
oth in+o%e a
super+isor ser+ice
routine(
Character Output TSR -O/T.
1 45R$6 /0( 7 Sy&te% call &tartin- addre&&
. S3 R18 SaveR1 7 R1 will be ,&ed 9or !ollin-
(
0 7 :rite the character
5 3ry:rite 'D$ R18 DSR 7 6et &tat,&
1 BR;! 3ry:rite 7 bit 15 < 1 <= di&!lay ready
7 :rite$t S3$ R8 DDR 7 :rite character in R
>
? 7 Ret,rn 9ro% 3R"@
" Ret,rn 'D R18 SaveR1 7 Re&tore re-i&ter&
B R+3 7 Ret,rn (act,ally A2@ R7)
# DSR 4*$'' )*+0 7 di&!lay &tat,& re-i&ter
D DDR 4*$'' )*+1 7 di&!lay data re-i&ter
+ SaveR1 4B'K: 1
* 4+BD
"'S5
1 45R$6 ).1
. 4*$'' )0(
81LT TSR
In this #ay, the C*/ has the "inal say in #ho gets to interrupt itB
*rocessing an interrupt$ one
de+ice
&'(((
How%
Super+isor 3ode
The callee #ould 1L91PS ha+e to sa+e the contents o" the
*C and *SR
/sed &y the programmer "or su&routine calls and other stac%
"unctions
Sa+ed(/S* Q@ -RH.
RH Q@ -Sa+ed(SS*.
*SR<=>? Q@ A
The +ector tells the C*/ #here to loo% "or the ISR(
1 +ectored'interrupt de+ice
x8002
x8000
x8004
Input register
Output register
Device Controer
!t"tus register
x8006
Interrupt #ector
Register
67
Dectored interrupts
1long #ith the IGT signal, the I/O de+ice transmits an F'&it
+ector -IGTD.(
IGTD is an index into the Interrupt Dector Ta&le, i(e( the address o"
the rele+ant ISR is - xA=AA R Next-IGTD. .
TR1*s
Cand more(