Fabrice Frances detected a strange behaviour in the Oric keyboard when testing 1337 and our keyboard scanning routine.
I am sure he would not mind if I post here his conclusions
The explanation:Fabrice Frances wrote:On the real keyboard, when you press 3 random keys on the keyboard matrix, you might sometimes get 4 bits set to 1 in your display.
This happens when the 3 keys are 3 points of a rectangle in the keyboard matrix.
So, if 3 and Q are pressed simultaneously, no problem, they are detected.
Now, if X is added, we detect 3, Q, X and D. And if we press D instead of X, both are detected too.
Same thing if 3 and D are pressed first (they are correctly detected) : as soon as we add X or Q, both X and Q are also detected.
And the same behavior happens if you take 3 keys on any other rectangle in the matrix : for example if you press X, G and 5, you will also detect S.
So basically it is something that cannot be avoided by software. Furure programs should select carefuly the keys to use.Fabrice Frances wrote:When you press a key, this has the effect to put in contact the row and the column. And when you test a key, you put a 0 (ground) to the desired column, and you sense the row level (the level is inversed by a transistor before reaching the PB3 input).
Now imagine that I simultaneously press keys 3, 1 and C, and that I want to test if Z is pressed: I apply a zero level to column PA5, and I sense row #2... Z is not pressed so there's no direct contact between column 5 and row 2, but... there's a contact between column 5 and row #0 (because key 1 is pressed), so row #0 is also at ground level... and there's a contact between row #0 and column PA7 (because key 3 is pressed), so column #7 is forced to ground level **even though you have put a 1 in this column bit** (bit 7 of the PSG IO port) ! You can now see the end of the story : since column #7 is forced to ground, and since there's a contact between column #7 and row #2 (key C is pressed), you sense row #2 and see a zero level... and thus wrongly conclude Z is pressed...
The other interesting bit is that the routine posted here:
http://miniserve.defence-force.org/svn/ ... /keyboard/
works perfectly as is, with no extra waiting cycles or something, tested on Symoon's oric and also on Fabrice's atmos and oric-1.