Sharp MZ-80B Owner's Manual page 64

Hide thumbs Also See for MZ-80B:
Table of Contents

Advertisement

55
• For key interruption
In the MZ-80B, as stated above, key interrupt can be received by the PIO control. Illustrated
below are examples of setting of simple key interrupt and response.
Try to program the machine so that the interrupt process routine $5080 is called the moment the
[BREAK)
key is pressed. In this programming the address table of this interrupt process routine is set to
$3370 and the vector interrupt of interrupt mode 2 is used. Also, the PIO is set to mode 3 and no
handshake bus is used.
As shown in Table 4.5, the
[BREAK)
key is, in key scanning, detected by strobe signal 3H and bit
data 7 (7FH). Therefore, the strobe signal must be set at 3H, and the interrupt mask must be program-
med in 7FH. It is also necessary to set the interrupt vector lower 8-bit (LSB being
'0')
data 70H.
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 EOH
OR
13H
OUT (E8H), A
} Setting of vector register
)setting of interrupt mode 2
}
Setting the address of interrupt process routine in the interrupt address
table
}setting of interrupt vector (lower 8 bits)
} Setting port B to mode 3
}Handling all port B as input
}setting of interrupt control words, or enabling interrupt
}
Setting of mask words; bit data 7 (MSB being 'L') is masked by writing
7FH
)
Of the data delivered to port A, key strobe is set to 3H. The strobe gate
is opened with A4 set at 'H'
After the mode setting above, when the
[BREAK)
key is pushed at an arbitrary point, the $3370 is
referenced by vector interrupt, and the interrupt process routine $5080 is
called.
The instruction to return, after terminating the interrupt process routine, to the program being
executed before interruption is RETI.

Advertisement

Table of Contents
loading

Table of Contents