MZ-700 – 8255 functions

8255 functions in the MZ-700

General

The 8255 is used by the MZ-700 to manage the keyboard, to control the data recorder, to control the clock interrupt, and to control the timer for the cursor blink frequency.

The table contains the ports used by the 8255.

address
functions
$E000
PA: Output ( keyboard request, reset cursor timer )
$E001
PB: Input ( keyboard data )
$E002
PC: I/O ( data recorder control, clock, cursor timer, VBLK )
$E003
PPI control word
Functions of the 8255 used by MZ-700

Configuration

The 8255 is configured by the monitor’s subroutine named MODE starting at location $073E. For this, see and download the reassembled file mz700lst.zip (50 Kbytes ). MODE is called at location $004F during the startup of the monitor. Here is a copy of the routine:

004D	IM	1	 ; set CPU to interrupt mode 1 
004F	CALL	MODE	 ; initiate 8255

MODE:	LD	HL,$E003 ; address to control word port 
 	LD	(HL),$8A ; 10001010 control word to init 8255 
	LD	(HL),$07 ; 00001101 set bit 3 of port C 
	LD	(HL),$05 ; 00001001 set bit 2 of port C 
	RET

Please refer to the control word to configure the 8255.

The first instruction initiates the register HL to the address of the control word port.
The 2nd instruction loads a binary value of ‘10001010’ ( $8A ) into the port.

Bit D7 is on and defines this word as a control word.
Bit D6 = 0 define the mode of operation for the 8255 port A as mode 0.
Bit D5 = 0
Bit D4 = 0 indicates that port A is an output.
Bit D3 = 1 sets the port C upper 4 bits as inputs.
Bit D2 sets the mode for port B. This logical 0 sets port B to mode 0.
Bit D1 = 1 sets port B up as an input port.
Bit D0 = 0 sets the port C lower 4 bits as an output port.

The following picture shows the resulting configuration:

The 8255 and the MZ-700
The 8255 and the MZ-700

The next 2 instructions will set bits of port C. Please refer to the control word to modify a single bit of port C. The first instruction of these two instructions loads a binary value of ‘00000111’ ( $07 ) into the port $E003. Here is a copy of this instruction:

	LD	(HL),$07 ; 00001101 set bit 3 of port C

This will initiate the flip-flop for the motor control and to understand this, take a look at the following table for the meaning of the bits of port $E002.

port#
pin
I/O
active
function
name of signal
C
$E002

PC0
unused / free
PC1
output
write data to data recorder
WDATA
PC2
output
L
lock clock interrupt
1 = enable clock interrupt
0 = disable clock interrupt
INTMSK
PC3
output
L / H
motor control of data recorder ( on / off )
M-ON
PC4
input
H / L
1 = motor is on
0 = motor is off
MOTOR
PC5
input
read data from recorder
RDATA
PC6
input
timer of cursor blink frequency
0 = display a cursor
1 = display character hidden under the cursor
556OUT
PC7
input
vertical blanking
VBLK

In detail now this control word: A binary value of ‘00000111’ ( $07 ) to the port takes the following effects:
Bit D7 = 0 defines single bit modification of port C.
Bit D0 = 1 indicates a bit is to set.
Bit D3, D2, and D1 = 011 indicates bit 3 of port C is to set.
Bits D6 to D4 are meaningless.

The D-type flip-flop LS74 IC# 7E is reset during startup by setting this bit. It is contacted to bit PC3 of the 8255. This type of flip-flop toggles the logical value at its output line named Q whenever the input line changes from a logical 0 to a logical 1, but never vice-versa. It will be initiated by this command to prevent a disfunction of the motor control.

The last instruction of the mode routine was:

	LD	(HL),$05 ; 00001001 set bit 2 of port C

This control word enables the clock interrupt used by the monitor’s interrupt service routine at location $038D to toggle the AM / PM value of the associated byte at location $119B and to reinitiate the timer 8253.

In detail the control word loaded by the last instruction: A binary value of ‘00000101’ ( $05 ) to the control command port takes the following effects:
Bit D7 = 0 defines single bit modification of port C.
Bit D0 = 1 indicates bit is to set.
Bit D3, D2, and D1 = 010 indicates bit 2 of port C is to set.
Bits D6 to D4 are meaningless.

Please take a note of the description of the tape data processing and of the description of the internal clock too.

How does the 8255 operate the MZ-700’s keyboard? To get the answer click here.