Intel MCS-80/85 Computer Hardware User Manual


 
I
I'
~~
"
I
I,
POP
H
POP
!?
EI
RFT
INPUT ROUTINE
The
console
input
routine uses
the
opposite pro-
cedure;
instead
of
moving a
bit
from register C
to
the
CY, then
to
A7,
then
to
SOD, CIN loads a
bit
from SID
into
A7,
then moves it
to
CY, then
into
register
C.
First, set up
the
CPU as before:
CHI
PUSH
H
PI
!,!\,1I
B.:?
When a start bit transition arrives,
the
first sam-
pling should
not
be
taken until
the
middle
of
the
first
data
bit,
one
and one-half
bit
times after the
transition. Await
the
start bit transition, then set
up
the
delay parameter for one-half bit time:
CIi'
RIl'l
(4)
')PA
A
<4>
m
(Ii
<7~.\
LHU'
HALFPrT
'-::1t:>
Loop
for one-half
bit
time before starting
to
sample data:
CI2'
[:ofF.'
L
((i:.
mz
(12
([I)
DCP
H
.:[:
.
..,
..TN:
CI2
,:.[:,':,
Wait until
the
middle
of
the
next
bit before sam-
pling SID, then move the data bit
into
CY:
eB:
LHLf:t
BITTH1E
<16)
C14:
C(:P
L
;;c·)
.m:
Cf4
<O:i
[oCP-
H
<e')
.m:
(:14
W)
RIM
<4)
PP-l
<:4>
Decrement
the
bit
counter.
If
this
is
the
ninth
cycle,
the
8
data
bits are in register
C,
so
quit
(the
first
stop
bit will already have been received, and
be
in CY):
[)CP
P
<4)
..1:
CIS
(7)
A1-35
Otherwise, continue. Rotate
the
data
bit
right
into
register
C,
and repeat
the
cycle:
~10Y
A,C
{4>
RAR
<.f>
NOli
C.F!
{,~)
NOP
<4)
..Tt1P
CE
<113::'
(A NOP
is
needed
to
make
the
COUT and CIN
loops exactly equal in
number
of
machine cycles,
so
that
each can use the same delay parameter.)
Restore status and return.
CI5
POP
E1
FH
TIMING ANALYSIS
H
COUT and CIN now need
to
be provided with
parameters for BITTIME and HALFBIT.
It
can be
seen from
the
above code
that
each
routine
uses
61
+ D machine cycles per
input
or
output
bit,
where D
is
the
number
of
cycles
spent
in
either
four line delay segmen t. If (H) and
(L)
are the
contents
of
the
Hand
L registers going
into
this
section
of
code,
then:
D =
22+«U-I)X
14+«H)-l)X
[(255 X
14)+25]
If
(H)' -
(H)
-
I,
(U'
==
(U
-
I,
and
(HU'
==
256
(H)' +
(U'
then
D
22 + 14
(U'
+ 3595
(H)'
This can be approximated by:
D
= 22 + 14
(HU'
(1)
(2)
(3)
(4)
This
approximation
is
exact for (H)' =
0;
otherwise,
it
is
accurate
to
within
0.3%.
Thus
each loop
of
COUT
or
CIN uses a total of:
C
=
61
+ D = 83 + 14
(HU'
machine cycles
(5)
Each machine cycle uses two crystal cycles in
the
8085,
so
the
resulting data rate is:
B
= cycle frequency
C
(crystal frequency) +2
83 + 14
(HU'
(6)