SET UP CTCl AND CTC2 INTERRUPT VECTORS
FOR USARTS
WARNING
-
3KM0N USE OF
00-OF
IN
PAGE WILL DESTROY THIS PROG
SETIVC
LD
HL,IOVEC
;
COPY INTERRUPT HANDLER ADDRESSES
LD
A,
I
;
GET PAGE ADDR
LD
D,A
LD
E,OOH
;
PLACE TO PUT ADDRS
LD
BC,16
;
8
CHANNNELS-2 PER USART
LDIR
LD
A,0OH
;
USES UNUSED
3K
MON INT PAGE SPACE
OUT
(CTCl)
,A
;
USART RECEIVER VECTOR
LD
A,08H
OUT
(CTC2),A
;
TRANSMIT VECTOR
(4
CHANNELS/CTC)
The final step
in
initializing
the SIB
involves actually
enabling CTC
1
and CTC
2
to
generate interrupts when
a
character has been received
or
when the USART
is
ready to
transmit
a
character.
The CTC
is
enabled
by sending
a
command byte
to the
desired channel with
the
interrupt enable
bit
on,
counter mode enabled,
the slope bit on for
positive
triggering,
the load
time constant bit
on,
and the stop until
time constant loaded bit
on.
The command value
is
0D7H
(see
Z80-CTC Product Spec.)
.
Both
the
receive interrupt, which
occurs when RxRDY goes high,
and the
transmit interrupt,
which occurs when TxRDY goes high, must
be
triggered by
a
positive
slope.
The command byte
is
followed by
a
counter
value
of
1,
causing
an
interrupt
to
occur on every character,
channel before data transmission begins, and
for
every CTC
interrupt which occurs thereafter:
SET UP A CTC TO INTERRUPT (PORT
IN
C)
SETINT
LD
A,INTMP
OUT
(C)
,A
LD
A,l
OUT
(C)
,A
RET
INTMP
EQU
0D7H
;
SET UP CTC MODE
;
INTERRUPT ON EVERY CHAR
;
EI,CNT MOD,
POS
SLOPE
TRIGGER, LD CONST, STOP
51
Need help?
Do you have a question about the Z-80 SIB and is the answer not in the manual?
Questions and answers