2068 Keyboard Notes

See all articles from Sinc-Link v3 n3
Author(s): John Roach
Publication: Sinc-Link
Pub Details: Sinc-Link v3 n3 (Volume 3, Issue 3)
Date: May/June 1985
Pages: 8

The 2068 seems to use the Z80 extended addressing I/O capabilities (register indrect address)in a combination of hardware and software to read the keyboard as 8 separate ports.

During a port read, initiated by the IN command in BASIC, all 16 address lines are used and remain active during the entire port read operation.

Each address line of the high byte is connected to a row line of the keyboard and when a key is pressed in a row where the address line is low, it connects to a column line which is connected to the data bus, putting it low – the data bus is strobed into the port latch and the port is read by the 2068.

This all means that each of the ports available for use on the 2068 could address 256 periferal devices.

Refer to the Table which shows the values of the 8 port addresses used by the 2068 keyboard.

If IN(Addr) returns 31 when no key is pressed then the binary value on the data bus read by the port is BIN 0001 1111, or 31 decimal – D5, D6, and D7 lines have been put low by hardware ?? or software ??

The Spectrum may not put D5, D6, and D7 low when reading the keyboard port as when no key is pressed it will return a value of 255 (BIN 1111 1111). Some reports indicate later models of the Spectrum start returning a no key pressed value of 191 after they warm up, indcating a probable shorting of D7 or port chip latching problems.

Will this work ??

Assume that you have a menu on the screen with 5 options (branch or subroutine) to select and you do not want to use an INPUT statement:

10 print at 20,16;"Enter selection #"
20 let x=IN 63486
30 if x=31 goto 20
40 let x=31-x
50 gosub x*100
.........TABLE OF PORT ADDRESSES.......

ADDR.  ......  ......  ....BINARY..  ...BINARY
LINE.  DECIMAL ..HEX.  ..HIGH.BYTE.  ..LOW.BYTE

A15..  32766.  .7FFE.  ..0111.1111.  1111.1110
A14..  49150.  .BFFE.  ..1011.1111.  .....↓....
A13..  57342.  .DFFE.  ..1101.1111.  .....S....
A12..  61438.  .EFFE.  ..1110.1111.  .....A....
A11..  63486.  .F7FE.  ..1111.0111.  .....M....
A10..  64510.  .FBFE.  ..1111.1011.  .....E....
A09..  65022.  .FDFE.  ..1111.1101.  .....↓....
A08..  65278.  .FEFE.  ..1111.1110.  1111.1110