Zilog Z16C35 User Manual

Page 176

Advertising
background image

Application Note
Interfacing Z80

®

CPUs to the Z8500 Peripheral Family

SOFTWARE CONSIDERATIONS - POLLED OPERATION

There are several options available for servicing interrupts
on the Z8500 peripherals. Since the vector of IP registers
can be read at any time, software can be used to emulate
the Z80 interrupt response. The interrupt vector read
reflects the interrupt status condition even if the device is

programmed to return to vector that does not reflect the
status change (SAV or VIS is not set). The code below is
a simple software routine that emulates the Z80 vector
response operation.

Z80 Vector Interrupt Response, Emulation by
Software

;This code emulates the Z80 vector interrupt
;operation by reading the device interrupt
;vector and forming an address from a vector
;table. It then executes an indirect jump to
;the interrupt service routine.

INDX: LD

A,CIVREG

;CURRENT INT. VECT. REG

OUT

(CTRL), A

;WRITE REG. PTR.

IN

A, (CTRL)

;READ VECT. REG.

INC

A

;VALID VECTOR?

RET

Z

;NO INT - RETURN

AND

00001110B

;MASK OTHER BITS

LD

E,A

LD

D,0

;FORM INDEX VALUE

LD

HL,VECTAB

ADD

HL,DE

;ADD VECT. TABLE ADDR.

LD

A, (HL)

;GET LOW BYTE

INC

HL

LD

H, (HL)

;GET HIGH BYTE

LD

L,A

;FORM ROUTINE ADDR.

JP

(HL)

;JUMP TO IT

VECTAB:

DEFW

INT1

DEFW

INT2

DEFW

INT3

DEFW

INT4

DEFW

INT5

DEFW

INT6

DEFW

INT7

DEFW

INT8

Page 170 of 316

UM011002-0808

Advertising