Dwight Elvey
Veteran Member
I'd earlier stated that it would not be too big a deal to convert the output of a PS/2 keyboard to a parallel for older computers, now that keyboards were getting rare.
It turns out that it is not as simple as I'd thought going in. Making a PS/2 to XT looks to be relatively trivial.
I've put about 15 hours into this so far an looks like I'm on the home stretch.
Here is a list of "I gotchyas":
1. First, most of the stuff on the web says that 1Ch translates to 'A'. Actually, if you think about it, it translates to 'a', not 'A'.
2. You need to read strings of data continuously. This means you really need a FIFO. If a character does not have a stop bit = 1 it means it isn't done yet. You have more to buffer up.
3. You need to give careful thought about which special keys have precedence over other keys.
a. Control key takes over only letters. I've included ` in this because I know the System88 of the Polymorphic 8813 editor expect there to be a 00h from the keyboard.
b. CapsLock only effect letters
c. Shift effects others that are not simple ANDing with 6Fh, like letters.
4. Control and Shift keys also generate repeats ( not sure why ) but entering an effected key stops the repeats ( what if I wanted a repeated control character )?
5. What to do with the rest of the keys. F keys, number pad keys, arrow keys, and newer ones have a number of short cut keys along the top. Right now, I'm just ignoring them but maybe I should be doing something with them, at least the number keys and maybe the arrow keys? What to do with smaller keyboards that don't have separate arrow and number keys? The Window key?? Other keys???
6. Now simpler stuff, turning on LEDs, selecting auto repeat, repeat speed, number pat lock and on.
7. Even the parallel port needs a special select for the polarity of the strobe.
I wanted the project to be simple. It is more than I'd thought up front. Not to serious though. I'm well along and now I'm just tidying things up. I wanted it to be cheap. You don't need a special PC board made. A rats nest of point to point wires is all that is needed to the keyboard, power supply ( running mine from USB port right now ) and the parallel out connector. You do need some pullup resistors. I'd used individual resistor and LEDs ( so I could see things happening ) but a simple 4.7K 10 resistor R-pack would be enough. If you want LEDs, you may need to shunt the LED with a 4.7K to get full swing. I run my LEDs with a limiting resistor to 5ma. You just buy a "Blue Pill" ( STM32F103 on a tiny board for about $3 on ebay or elsewhere ) and wire it up. The resistor are because the chip runs at 3.3V but everything we want to connect it to is 5V. The chip has a number of 5V tolerant I/Os.
Now here's another thought that occurred to me this morning. The STM32F103 is running an ARM Forth. I could easily add an "Easter Egg" to drop into Forth. I can make it dual so that the serial, that I use and the keyboard/parallel are both running. I can think of all types of advantages. One could store sequences on the F103 to help in debugging. One could use the serial port for logging and downloading sequences to the old computer. One could even patch the code to change any behavior one wanted and save it to flash. The possibilities are endless. ( the blue pill has a USB end point connector that I don't have any code currently to run but could be added ).
When I get things as I like I'll put the source and a *.HEX file on github.
Any thoughts about the extra keys?
Dwight
It turns out that it is not as simple as I'd thought going in. Making a PS/2 to XT looks to be relatively trivial.
I've put about 15 hours into this so far an looks like I'm on the home stretch.
Here is a list of "I gotchyas":
1. First, most of the stuff on the web says that 1Ch translates to 'A'. Actually, if you think about it, it translates to 'a', not 'A'.
2. You need to read strings of data continuously. This means you really need a FIFO. If a character does not have a stop bit = 1 it means it isn't done yet. You have more to buffer up.
3. You need to give careful thought about which special keys have precedence over other keys.
a. Control key takes over only letters. I've included ` in this because I know the System88 of the Polymorphic 8813 editor expect there to be a 00h from the keyboard.
b. CapsLock only effect letters
c. Shift effects others that are not simple ANDing with 6Fh, like letters.
4. Control and Shift keys also generate repeats ( not sure why ) but entering an effected key stops the repeats ( what if I wanted a repeated control character )?
5. What to do with the rest of the keys. F keys, number pad keys, arrow keys, and newer ones have a number of short cut keys along the top. Right now, I'm just ignoring them but maybe I should be doing something with them, at least the number keys and maybe the arrow keys? What to do with smaller keyboards that don't have separate arrow and number keys? The Window key?? Other keys???
6. Now simpler stuff, turning on LEDs, selecting auto repeat, repeat speed, number pat lock and on.
7. Even the parallel port needs a special select for the polarity of the strobe.
I wanted the project to be simple. It is more than I'd thought up front. Not to serious though. I'm well along and now I'm just tidying things up. I wanted it to be cheap. You don't need a special PC board made. A rats nest of point to point wires is all that is needed to the keyboard, power supply ( running mine from USB port right now ) and the parallel out connector. You do need some pullup resistors. I'd used individual resistor and LEDs ( so I could see things happening ) but a simple 4.7K 10 resistor R-pack would be enough. If you want LEDs, you may need to shunt the LED with a 4.7K to get full swing. I run my LEDs with a limiting resistor to 5ma. You just buy a "Blue Pill" ( STM32F103 on a tiny board for about $3 on ebay or elsewhere ) and wire it up. The resistor are because the chip runs at 3.3V but everything we want to connect it to is 5V. The chip has a number of 5V tolerant I/Os.
Now here's another thought that occurred to me this morning. The STM32F103 is running an ARM Forth. I could easily add an "Easter Egg" to drop into Forth. I can make it dual so that the serial, that I use and the keyboard/parallel are both running. I can think of all types of advantages. One could store sequences on the F103 to help in debugging. One could use the serial port for logging and downloading sequences to the old computer. One could even patch the code to change any behavior one wanted and save it to flash. The possibilities are endless. ( the blue pill has a USB end point connector that I don't have any code currently to run but could be added ).
When I get things as I like I'll put the source and a *.HEX file on github.
Any thoughts about the extra keys?
Dwight
Last edited: