The bit definitions of the keyboard ports are as follows:
See the block diagram of the MZ-700 keyboard:
Port A outputs are connected to the four keyboard columns PA0 - PA3. Port B inputs are connected to the eight keyboard rows. All of the eight row inputs are pulled up to +5 Volts via 10K pull-up resistors. This means, all of the eight row input lines are forced to a logical 1. For further details refer to the software configuration of the 8255 by the monitor 1Z-013A.
The four column lines are forced to a logical 0 one at a time by the
keyboard search routine and by the hardware IC# AE ( LS145 ). This
chip is a BCD-to-decimal decoder ( BCD = Binary Coded Decimal
). The chip has 4 input lines
The four input lines P0 - P3 are called by SHARP A, B, C, and D in the diagrams shown above ( P0 = A, P1 = B, and so on ) and the outputlines Q0 - Q9 are called 0 - 9.
For further details download the datasheet SN74LS154 ( PDF, 53 kb ).
Depending on the input value the activated output line ( low active )
will be as follows:
The output lines Q0 - Q9 of the chip 74LS145 are physically connected to the keyboard columns 1 - 10.
The associated output line selected by the input value is set to a logical 0 ( low active ). All other lines remain unchanged ( logical 1 ).
After each column line has set to a logical 0 by the keyboard search routine, the input port B is read. If any bit read from the input port B is a logical 0, then a key has been pressed. You can determine which key has been pressed by determining the bit that is a logical 0 and the column line that is active at this time.
The value returned by the keyboard will be $FF if no key was pressed.
The hexadecimal values shown in the picture may help to program your own
keyboard search routine. The hexadecimal values from $F0 to $F9 at the
The value of the upper 4 bits of port A is meaningless except bit PA7, you should set it to a logical 1. If you set it to a logical 0, then the timer for the cursor blink frequency will be reset. When you return to the monitor, the cursor is reactivated. This timer is designed for a frequency of about 1.5 cycles ( Hz ), the duty cycle is 50 %, and the pulse width is about 0.3 seconds. This means, the cursor pulses symmetrically for 0.3 seconds. It is displayed for 0.3 seconds and then pauses for 0.3 seconds.
The bits PA4 - PA6 are unused, no hardware is connected to the physical output lines.
If you want to use these lines for your own purposes, you have to read the contents of the port first and then to select a column by the assembler command OR. Otherwise, if you don't want to use these lines, you can load the value directly by using a simple assembler command LD into that port.