Using standard PC keyboard with ZX81

Discussions about Sinclair ZX80 and ZX81 Hardware
Post Reply
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Using standard PC keyboard with ZX81

Post by David G »

Has this been discussed before?


Seems like we could use an Arduino or Nano Pi to read a USB/Bluetooth or PS/2 keyboard and generate the correct signals for the 9 pins of the ZX81 keyboard connector. I have sooo many spare keyboards ...
User avatar
xelalex
Posts: 14
Joined: Thu May 19, 2022 8:34 pm
Contact:

Re: Using standard PC keyboard with ZX81

Post by xelalex »

You could try spectratur: https://codeberg.org/xelalexv/spectratur

It currently supports ZX80/81 and Spectrum, and can be easily extended to support other machines.
User avatar
Paul
Posts: 1517
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Using standard PC keyboard with ZX81

Post by Paul »

If you would like to use a PC Keyboard and maybe a PC Screen, why do you bother to use the original? There are Emulators for that purpose.
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
xelalex
Posts: 14
Joined: Thu May 19, 2022 8:34 pm
Contact:

Re: Using standard PC keyboard with ZX81

Post by xelalex »

Paul wrote: Tue Jan 17, 2023 11:06 am If you would like to use a PC Keyboard and maybe a PC Screen, why do you bother to use the original? There are Emulators for that purpose.
The OP is not about using a screen, just about the keyboard. Adding a decent keyboard to a ZX80/81 or Spectrum makes for quite a pleasant user experience :D
User avatar
Paul
Posts: 1517
Joined: Thu May 27, 2010 8:15 am
Location: Germanys west end

Re: Using standard PC keyboard with ZX81

Post by Paul »

xelalex wrote: Tue Jan 17, 2023 11:14 am
The OP is not about using a screen, just about the keyboard. Adding a decent keyboard to a ZX80/81 or Spectrum makes for quite a pleasant user experience :D
I agree.
I just find most PC Keyboards quite inconvenient ;)
For a decent keyboard I use Cherry Keys.

https://forum.tlienhard.com/phpBB3/view ... rry#p35439

I know such a thing exists somewhere for PCs as well. They are just very rare compared to the PC Keyboards I know.
On the other hand I can't imagine what to do with all these keys when only 40 are required :mrgreen:
In theory, there is no difference between theory and practice. But, in practice, there is.
User avatar
xelalex
Posts: 14
Joined: Thu May 19, 2022 8:34 pm
Contact:

Re: Using standard PC keyboard with ZX81

Post by xelalex »

Paul wrote: Tue Jan 17, 2023 11:33 am For a decent keyboard I use Cherry Keys.
I know such a thing exists somewhere for PCs as well. They are just very rare compared to the PC Keyboards I know.
PC keyboards with mechanical switches are actually quite common, I'm typing on one right now (Cherry MX Silent Red). In particular gaming keyboards pretty much always have mechanical switches, be it Cherry or other manufacturers. But the cheap ones are mostly unusable, that's right.
Paul wrote: Tue Jan 17, 2023 11:33 am On the other hand I can't imagine what to do with all these keys when only 40 are required :mrgreen:
Assign macros ;)
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Using standard PC keyboard with ZX81

Post by 1024MAK »

The problems with using “IBM” PC keyboards, be they the wired type with 5 pin DIN, 6 pin PS/2 type, USB type or the wireless types are:
  • Each has its own internal matrix, so each will have its own ‘ghost’ key combinations. Some of which may affect game play if said game needs multiple keys pressing at once.
  • The keyboard layout is different.
  • The way that machine code software on the ZX81 (or ZX80, or ZX Spectrum) may scan the (original) keyboard matrix means the interface circuitry has to be more complex than you think.
So, for the later point, to read the keyboard on a ZX81 (or ZX80, or ZX Spectrum), the machine code outputs an 8 bit number on the processor address lines A8 through A15 via an IN instruction. This is the keyboard row. The same IN instruction also reads the five bit column from the keyboard.

Because the row number can be any 8 bit number, any external circuitry must be able to capture this number and then look up to see if any key presses from the PC keyboard matches any of the combinations. Then, before the Z80 reads the columns, it must place the correct 5 bit number on its output lines for the Z80 to read via the keyboard input circuitry (the ULA in the case of the ZX81 or ZX Spectrum). This requires a large amount of processing in a very tight window of time.

Alternatively, instead of trying to have a microcontroller or processor system that is fast enough to do as described in the above paragraph, a electronic matrix using electronic switches can be built. But this obviously requires more hardware.

Simpler systems are possible, but they almost certainly will not support all software.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
User avatar
xelalex
Posts: 14
Joined: Thu May 19, 2022 8:34 pm
Contact:

Re: Using standard PC keyboard with ZX81

Post by xelalex »

1024MAK wrote: Tue Jan 17, 2023 1:01 pm Alternatively, instead of trying to have a microcontroller or processor system that is fast enough to do as described in the above paragraph, a electronic matrix using electronic switches can be built. But this obviously requires more hardware.
This is what spectratur does, using an Arduino Nano (or other) and a Zarlink MT88xx switch matrix. Solves the mentioned problems.
Post Reply