EasyManua.ls Logo

Sharp MZ-80B - Page 62

Sharp MZ-80B
138 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
55
For
key interruption
As
stated above, in the MZ-80B, key interruptions can be received by PIO control. Illustrated
below are exampl
es
of
simple key interrupt and response settings.
Try to program the machine
so
that interrupt routine $5080
is
called the
moment
the [
BRE
AK
I
key
is
pressed . In this example the address table
of
th
e interrupt routine
is
set to $3370 and the
vector interrupt
of
interrupt mode 2
is
used. Also, the PIO
is
set in mode 3 and no handshake bus
is
used.
As
shown in Table 4.5,
the
[ B
RE
AK I key is indicated during keyscan
by
strobe signal 3H and
bit
data
7 (7FH). Therefore,
the
strobe signal must be set
to
3H and
the
interru
pt
mask must be set
to
7FH.
It
is
also necessary
to
set 70H in the 8-bit
interrupt
vector (LSB being
'0')
.
The setting codes used
so
far are as follows:
LD A, 33H
LD I, A
IM
2
LD
HL,
5080H
LD
(3370H), HL
LD A,
70H
OUT
(EBH), A
LD
A, CFH
OUT
(EBH), A
LD A,
FFH
OUT
(EBH), A
LD A, 97H
OUT
(EBH), A
LD A, 7FH
OUT
(EBH), A
IN
A, (E8H)
AND
FOH
OR 13H
OUT
(E8H), A
) Setting
of
vector register
)
setting
of
interrupt mode 2
} Setting the address
of
the
interrupt
routine in
the
interrupt address
}
setting
the
interrupt
vector (8-bits)
} Setting
port
B in mode 3
} Setting all
port
B terminals in the
input
mode
}
setting
of
int
errupt
control words,
or
enabli
ng
interruptions
}
Setting
of
mask words;
bit
data 7
(MSB
being 'L')
is
masked by writing
7FH
)
Setting
of
the
key strobe delivered
to
port
A
to
3H. The strobe gate is
opened with A4 set
to
'H'
After setting modes
as
described above,
the
address table at $3370 is referenced
by
the vector
interrupt
when the [ B
REAK
I key
is
pushed at any point, and
interrupt
routine $5080 is called.
After
the
interrupt
routine
is completed, the instruction used
to
return control
to
the
main pro-
gramisRETI.

Other manuals for Sharp MZ-80B

Related product manuals