Memotech Hardware Emulation
Posted: 13 Jul 2014 16:36
Extracts from an email conversation between Dave and myself that might be of more general interest.
Dave:
On a slightly related subject, if I could only get a MTX case & keyboard, I would like to build a MEMU-Pi inside a real MTX, replacing a duff mother board and using the old MTX keyboard. Yes, I know that the keyboard might not be great, but it would look fantastic.
My questions is, how much work would I it be to directly connect the MTX keyboard connector to the GPIB pins in the Pi and write some code to translate the key presses to MEMU speak?
Bill:
With regard to interfacing a real MTX keyboard to MEMU-Pi, it is certainly possible, but there are a few issues. The MTX keyboard requires 8 drive lines and 10 sense lines, so at least 18 GPIO ports, 19 if you also want to monitor the reset keys. The RPi has at most 17 GPIO on P1. On the Rev. 2 boards there are a few more GPIO on P5, so it would be just about possible. However, a better solution would be to use an I2C based I/O expansion board to provide the necessary number of connections. There are a number of commercial expansion boards that would be sufficient to connect the keyboard. However, I have been fantasising about a custom board that would supply keyboard connector, joystick connections (in parallel with keyboard, as per MTX), printer port, two serial ports, and perhaps even the internal MTX PIO port. Attempting to emulate the expansion bus would probably be a stretch too far.
With regard to user interface, the reset keys could act as the SysReq key, bringing up the configuration screen. If this then included an option to select which of the screens to display, then you would not need to change any of the functionality of the main keyboard at all. Even better would be if it was possible to monitor the two reset keys separately. Then one key could be SysReq, while the other toggles between screens. However, that would require a modification to the keyboard PCB. There are a number of ways this could be done, either adding wires or diodes, without having to cut any of the tracks.
Dave:
Separate reset key functions would be neat, if the MTX keyboard was interfaced with your expansion board, could any required modification be done on the board, rather than on the keyboard PCB? As no tracks need cutting, this might be possible?
Bill:
In order to get separate reset keys, you have to modify the keyboard PCB in some way in order to get at the connection between the two reset keys.
The simplest solution is to solder a wire from the track joining the two reset keys keys (not connected to the plug), and solder the other end to one of the main keyboard drive lines. Then the two reset key connections become additional sense lines.
Another approach is to solder diodes across the reset keys, with cathodes on the sides that connect to the plug, and anodes on the sides that just connect to each other. Then on the interface board, put pull ups on both reset key lines. Drive one side low and the other side becomes sense for one of the keys. Remove the drive from the first side, and apply it to the second. The first side is then sense for the other reset key.
Unfortunately, both of these approaches would interfere with the operation with a standard MTX motherboard. The only fully compatible solution I can think of so far is to add a separate 21st connection to the track joining the two reset keys.
Actually, the second approach would almost work, except that one of the two reset keys (but not the other) would be sufficient to reset the MTX.
Bill again:
A possible solution using available hardware:
* RPi (a model A will do)
* One (or possibly two) IO expansion boards (http://www.pi-supply.com/product/quick2 ... board-kit/)
* 4 port powered USB hub.
* Two USB to serial convertors
* One USB to parallel converter.
There should be room for all of that inside the MTX case.
Then it is only a question of software.
Dave:
That looks like a neat little kit, and with the motherboard removed (and maybe even without) everything would fit inside the case.
As you say, it's just that small matter of the software.
What we need is some one with lots of experience coding for the Z80 and the RPi, where are we going to find someone like that I wonder
Bill:
Post the idea on the forum?
Postscript:
I have for some time been considering adding serial and parallel port hardware to MEMU-Pi, although I had not previously thought of supporting the MTX keyboard. However, knowing how long it takes me to get around to anything, I thought it worth posting the idea here to see whether anyone else wants to run with it.
Dave:
On a slightly related subject, if I could only get a MTX case & keyboard, I would like to build a MEMU-Pi inside a real MTX, replacing a duff mother board and using the old MTX keyboard. Yes, I know that the keyboard might not be great, but it would look fantastic.
My questions is, how much work would I it be to directly connect the MTX keyboard connector to the GPIB pins in the Pi and write some code to translate the key presses to MEMU speak?
Bill:
With regard to interfacing a real MTX keyboard to MEMU-Pi, it is certainly possible, but there are a few issues. The MTX keyboard requires 8 drive lines and 10 sense lines, so at least 18 GPIO ports, 19 if you also want to monitor the reset keys. The RPi has at most 17 GPIO on P1. On the Rev. 2 boards there are a few more GPIO on P5, so it would be just about possible. However, a better solution would be to use an I2C based I/O expansion board to provide the necessary number of connections. There are a number of commercial expansion boards that would be sufficient to connect the keyboard. However, I have been fantasising about a custom board that would supply keyboard connector, joystick connections (in parallel with keyboard, as per MTX), printer port, two serial ports, and perhaps even the internal MTX PIO port. Attempting to emulate the expansion bus would probably be a stretch too far.
With regard to user interface, the reset keys could act as the SysReq key, bringing up the configuration screen. If this then included an option to select which of the screens to display, then you would not need to change any of the functionality of the main keyboard at all. Even better would be if it was possible to monitor the two reset keys separately. Then one key could be SysReq, while the other toggles between screens. However, that would require a modification to the keyboard PCB. There are a number of ways this could be done, either adding wires or diodes, without having to cut any of the tracks.
Dave:
Separate reset key functions would be neat, if the MTX keyboard was interfaced with your expansion board, could any required modification be done on the board, rather than on the keyboard PCB? As no tracks need cutting, this might be possible?
Bill:
In order to get separate reset keys, you have to modify the keyboard PCB in some way in order to get at the connection between the two reset keys.
The simplest solution is to solder a wire from the track joining the two reset keys keys (not connected to the plug), and solder the other end to one of the main keyboard drive lines. Then the two reset key connections become additional sense lines.
Another approach is to solder diodes across the reset keys, with cathodes on the sides that connect to the plug, and anodes on the sides that just connect to each other. Then on the interface board, put pull ups on both reset key lines. Drive one side low and the other side becomes sense for one of the keys. Remove the drive from the first side, and apply it to the second. The first side is then sense for the other reset key.
Unfortunately, both of these approaches would interfere with the operation with a standard MTX motherboard. The only fully compatible solution I can think of so far is to add a separate 21st connection to the track joining the two reset keys.
Actually, the second approach would almost work, except that one of the two reset keys (but not the other) would be sufficient to reset the MTX.
Bill again:
A possible solution using available hardware:
* RPi (a model A will do)
* One (or possibly two) IO expansion boards (http://www.pi-supply.com/product/quick2 ... board-kit/)
* 4 port powered USB hub.
* Two USB to serial convertors
* One USB to parallel converter.
There should be room for all of that inside the MTX case.
Then it is only a question of software.
Dave:
That looks like a neat little kit, and with the motherboard removed (and maybe even without) everything would fit inside the case.
As you say, it's just that small matter of the software.
What we need is some one with lots of experience coding for the Z80 and the RPi, where are we going to find someone like that I wonder

Bill:
Post the idea on the forum?
Postscript:
I have for some time been considering adding serial and parallel port hardware to MEMU-Pi, although I had not previously thought of supporting the MTX keyboard. However, knowing how long it takes me to get around to anything, I thought it worth posting the idea here to see whether anyone else wants to run with it.