Replacement Keyboard Project Update

Discuss the CreatiVision hardware: models, revisions, fixing, hacking and modding.
User avatar
@username@
Posts: 320
Joined: Tue Oct 22, 2013 6:59 pm
Location: Scotland

Re: Replacement Keyboard Project Update

Post by @username@ » Tue Mar 30, 2021 12:35 am

Here are the two main tables decoded

Code: Select all

BIOS "EVEN" TABLE - JOYSTICK POSITIONS					
$FBB2	84	42	01000010		
$FBB3	04	02	00000010		
$FBB4	06	03	00000011		
$FBB5	0E	07	00000111		
$FBB6	0A	05	00000101		
$FBB7	08	04	00000100		
$FBB8	88	44	01000100		
$FBB9	98	4C	01001100		
$FBBA	90	48	01001000		
$FBBB	10	08	00001000		
$FBBC	30	18	00011000		
$FBBD	70	38	00111000		
$FBBE	60	30	00110000		
$FBBF	40	20	00100000		
$FBC0	C0	60	01100000		
$FBC1	C4	62	01100010		
					
BIOS "ODD" TABLE - KEYBOARD CODES		LEFT	RIGHT
$FBC2	14	0A	00001010		Z	:
$FBC3	22	11	00010001		A	P
$FBC4	30	18	00011000		Q	;
$FBC5	60	30	00110000		2	/
$FBC6	24	12	00010010		X	0
$FBC7	42	21	00100001		S	O
$FBC8	18	0C	00001100		W	L
$FBC9	C0	60	01100000		3	.
$FBCA	44	22	00100010		C	9
$FBCB	82	41	01000001		D	I
$FBCC	28	14	00010100		E	K
$FBCD	50	28	00101000		4	,
$FBCE	84	42	01000010		V	8
$FBCF	06	03	00000011		F	U
$FBD0	48	24	00100100		R	J
$FBD1	90	48	01001000		5	M
$FBD2	0C	06	00000110		B	7
$FBD3	0A	05	00000101		G	Y
$FBD4	88	44	01000100		T	H
$FBD5	A0	50	01010000		6	N
The RAW codes are written to $18,$19,$1A,$1B as they are polled 1,2,3,4.

Within the keyboard processing loop a read value is shifted left - which results in keys like CNTL, SHIFT and RIGHT having 00!

Cheers!

Only two cans of Tennents were harmed during this research :shock:
User avatar
Mobsie
Posts: 708
Joined: Fri Jun 13, 2008 10:38 am
Location: Weinheim, Germany

Re: Replacement Keyboard Project Update

Post by Mobsie » Wed Mar 31, 2021 9:14 pm

Hi Guys,

great project 👍
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Sat Apr 03, 2021 8:22 am

I can't quite get my head around that MT8808 chip. I think I can see how we could use it. I'll have to break out some paper and scribble some designs. see if I can work out how to hang everything together. If we can set it up to send out the joystick signals as well, it gives us "one controller to rule them all" in terms of replacing a failing pair of controllers. Use the Arduino as "glue" and then we can interface with it with whatever takes our fancy.
New PCB for the original controller frame using low profile microswitches? Check! PS/2? Check! Genesis controllers with all the buttons mapped? Check!
Hope we can work it out :-)

Chesh
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Sat Apr 03, 2021 10:01 am

OK so I sat down for an hour and a half and I think I have puzzled it out.

I'm working on a design in KiCAD that currently uses 2 x MT8808, with some tricky crossbar design stuff to choose between which 3 pins are connected. It's not pretty but I think the design is "sane". Once I have both sides wired in and decoded I'll do up a spreadsheet of control logic plus a schematic and post it here.

Not saying someone else won't be able to do it more elegantly, but I figured I'd have a stab it :-D

I'm excited!

Chesh
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Sat Apr 03, 2021 11:59 am

Productive night is productive.
So I THINK I have a device that'll do what we want. I haven't yet wired in any "smarts" yet. That'll be down the track. I just want to get some feedback on if I'm approaching this the right way.
This uses 2 x MT8808, and you address both to get a single keypress.
CreativisionKeyboardAdapter.jpg
The "logic" is in the following spreadsheet.
https://docs.google.com/spreadsheets/d/ ... sp=sharing
So how does it work?
Let's say you wanted to press a letter "Q".
Into U1, on AX, you assert 000, and on AY, you assert 111. This connects pins 4 and 5 on the left controller.
Into U2, on AX, you assert 000, and on AY, you assert 001. This then connects pins 4 and 10 on the left controller.

This should be enough to press "Q".

Have I missed anything? I don't think I have keys like "shift" or "Ctrl" working yet. I may be able to add a bit more logic for that.
(I've based this code set off Tom's post so I think I've probably replicated his error he mentioned.)

Obviously we'll need to bolt on an Arduino and some hardware for the PS/2 connector. Wanted to get this in first, before I went off down the wrong path.
Let me know if you want my kiCAD files. I'll stick them somewhere.

Cheers!

Chesh
You do not have the required permissions to view the files attached to this post.
User avatar
Scouter3d
Posts: 646
Joined: Mon Jun 28, 2010 7:02 am
Location: Wien
Contact:

Re: Replacement Keyboard Project Update

Post by Scouter3d » Sat Apr 03, 2021 9:11 pm

Hi Chesh,

nice work!

I am knee deep in my own design-process, but i will try and "unravel" your solution for me to understand.

Do you use two 8808s because of the timing?

Cheers!
TOM:0)
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Sun Apr 04, 2021 3:19 am

Hi Tom,
I used 2 as I couldn't see a way of using less. Each one controls 8 connections on one side and 2 on the other. That way we can do the 3 way connections we need. I don't even think it gets us SHIFT and CTRL yet. That may need the one spare pin on each side.

Again, I may be going down a completely wrong path here. I'd love for someone to show a less chip heavy approach.

(My ability to drive KiCAD in no way reflects my complete lack of understanding of electronics. I'm very much a "cut'n'paste" tech when it comes to electronics.)

Chesh
User avatar
Scouter3d
Posts: 646
Joined: Mon Jun 28, 2010 7:02 am
Location: Wien
Contact:

Re: Replacement Keyboard Project Update

Post by Scouter3d » Sun Apr 04, 2021 7:25 am

Hi Chesh,

i think i understand your design (it really is a nice logic-puzzle :0))

my guess is: it would work for simple keypresses, but i am not sure about combinations with SHIFT and CTRL...

In my designs (which i havent drawn yet) i try to think more in the direction of connecting:
(4 + 10) and (5 + 10) instead of your (4 + 5) and (4 + 10)
that way the matrix would be much easier (a simple 8 x 4 and only 1x MT8808) i guess

I am more of a hands-on guy, (i only believe, what i see with my own eyes :0)) and the MT8808s i ordered will take some time to arrive, then i will give them a test :0)

Cheers, TOM:0)
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Sun Apr 04, 2021 8:39 am

Scouter3d wrote:
Sun Apr 04, 2021 7:25 am

I am more of a hands-on guy, (i only believe, what i see with my own eyes :0)) and the MT8808s i ordered will take some time to arrive, then i will give them a test :0)

Cheers, TOM:0)
Heh I ordered a bunch of mt8808s last night too.

Chesh
User avatar
cheshirenoir
Posts: 279
Joined: Sun Jun 02, 2019 5:17 am

Re: Replacement Keyboard Project Update

Post by cheshirenoir » Mon Apr 05, 2021 6:35 am

OK just realised the MT8808 is stateful. I thought it was stateless. CTRL and SHIFT are totally fine. We basically have to send two events for each keyboard press. One to enable the connection and a second for disable.
Back to our "Q" key. to send a a Q we'd do the following:
  1. Toggle U1, U2 RESET.
  2. Set U1 AX to 000, AY to 111, DATA to 1.
  3. Set U2 AX to 000, AY to 001, DATA to 1.
  4. Set U1 and U2 STROBE to 1 then back to 0. Wait a few milliseconds to make sure the Creativision has had time to register the keystroke.
  5. Set U1 AX to 000, AY to 111, DATA to 0.
  6. Set U2 AX to 000, AY to 001, DATA to 0.
  7. Set U1 and U2 STROBE to 1 then back to 0.
To do a SHIFTed Q, it's a few more steps
Toggle U1, U2 RESET.
  1. Set U1 AX to 000, AY to 111, DATA to 1.
  2. Set U2 AX to 000, AY to 001, DATA to 1.
  3. Set U1 and U2 STROBE to 1 then back to 0. This turns on the Q key.
  4. Set U2 AX to 010, AY to 001, DATA to 1
  5. Set U2 STROBE to 1 then back to 0. This turns on the SHIFT key. Wait a few milliseconds to make sure the Creativision has had time to register the keystroke.
  6. Set U1 AX to 000, AY to 111, DATA to 0.
  7. Set U2 AX to 000, AY to 001, DATA to 0.
  8. Set U1 and U2 STROBE to 1 then back to 0. This turns off the Q key.
  9. Set U2 AX to 010, AY to 001, DATA to 0
  10. Set U2 STROBE to 1 then back to 0. This turns off the SHIFT key.
Tadaa!
I'm fairly sure this means we can also simulate the joysticks with the same setup. Because of using dual MT8808 (I'd love seeing a way of using only one) I suspect this'll end up needing something like a Teensy 2.0++ as we're at 18 pins just for the MT8808 controls. We could bond a couple of pins to save count, but we still need to add, at a minimum, a PS/2 port. If we start adding DE9 ports for joysticks, we're really pushing up the pin count.

BTW, looks like there are off the shelf PS/2 libraries we can piggy back off:
https://github.com/PaulStoffregen/PS2Keyboard
As well as genesis controllers here:
https://github.com/jonthysell/SegaController

We could end up with one interface "to rule them all" :-D

Chesh
Post Reply