Micropower |
Volume 2 · Number 2 · April 1982 |
| Page 7 of 37 |
|---|
The keys of the keyboard are connected in an array of eight rows by seven
columns (six columns in the case of the Nascom 1 keyboard). Each row of keys is
connected to one output line of a chip known as a ‘BCD to Decimal Decoder/
Each key is effectively a miniature transformer, the magnetic circuit of which
is only complete when the key is depressed. Thus as a row is pulled to zero volts by
the decoder/
The routine now scans each row of the keyboard by flipping bit 0 of port 0 eight times. Each time bit 0 is flipped the next key row is selected; the routine then reads the status of the keys in that row, complements the result, and saves it temporarily in the D register. It then looks to see if it differs from the status obtain the last time the row was scanned, which is stored in the appropriate byte of KEYMAP. If there has been no change the routine continues to scan successive rows. After all the rows have been scanned the carry flag is reset and the routine is terminated.
If a change is detected, a short delay (approximately 2.7 msec at 4 mhz) is inserted and the status is re-read. This is designed to remove spurious inputs caused by key bounce. The value obtained on this second read is stored in the E register, and the first read is recovered from D; this value is ‘Exclusive ORed with the mapping
| Page 7 of 37 |
|---|