| |
Oswald
Registered: Apr 2002 Posts: 5094 |
looking for rom independent keyboard read routine
I'm lazy, anyone can help me out? I'd need shift+crsrs + return aswell, not just alphanumeric stuff.
thanks. |
|
... 30 posts hidden. Click here to view all posts.... |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Quote: Quote:Is there an indication as to why this will give unpredicted results when used on real hardware?
look at the matrix. when you press 3 keys of which two are in the same row, and two are in the same column, then due to the shortcut a 4th key will be detected. (press A,D,W -> you will also detect R). and there is no way around it, unfortunately. (dont test this on emu, chances are your pc keyboard cant handle it either, and VICE will show pretty irritating results although it can handle 3 keys and matrix shortcuts)
so if an avg pc keyboard cant detect it whats the fuss about detecting 3 keys? 2 ought to be enough for everyone :)
edit:Tested the one I'm sitting on. usually detects 3, and in 20 seconds found a case when it fails to detect a 3rd one. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:whats the fuss about detecting 3 keys?
it'd be handy for a SID editor :) other than that i also see no use for it :) |
| |
Hein
Registered: Apr 2004 Posts: 954 |
Quote: Quote:whats the fuss about detecting 3 keys?
it'd be handy for a SID editor :) other than that i also see no use for it :)
Indeed. :) |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Just to clarify:
What I define as a "rollover" routine is a routine handling keys being pressed in sequence (first key 1, then key 2 then key 3 without letting go of any of the previous keys). Now before pressing a 4th key the 1st key should be released and so on.
Think of it as a ball "rolling over" the keyboard which then I presume is a metaphore for typing fast where a fast typer holds down more than 1 key at the same time.
Now this is a totally different application then detecting 3 keys at exactly the same time. For typing this is useless as you have no way of knowing which key was intended to be pressed first, second and third. So for a SID composer or some such, the reliable limit is two keys (unless you let go of one of the keys before the other which in case you may detect which was the correct keys. Let go of all at the same time, and you have no chance). For typing text, 3 keys work fine (aka. rollover typing). Just try my routine and type in sequence A+B+C+D then let go of the A and you'll see. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
what you define is kinda irrelevant, lets stick to what the common definition is: https://en.wikipedia.org/wiki/Rollover_(key) "Certain high-end keyboards have "n-key rollover". This means that each key is scanned completely independently by the keyboard hardware, so that each keypress is correctly detected regardless of how many other keys are being pressed or held down at the time." |
| |
TWW
Registered: Jul 2009 Posts: 545 |
ShiIit GPZ..... Did you just create that page at Wiki??
"This page was last modified on 31 July 2013 at 20:16."
I'll never trust the internetz again.
hehe... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
i have not bothered with trying to beat sense into wikipedia retards ever since this hopeless case, no worries =) https://de.wikipedia.org/wiki/Diskussion:Rasterzeileninterrupt |
| |
TWW
Registered: Jul 2009 Posts: 545 |
unglaublich (yeah I did german for some years at school... I even went to germany to pass my fricking exams (hehe))!
Now that shiz (wiki drama) is just messed up.
Anyway, I updated the Codebase "article" and both the code and shiz is altered according to 3 principles: #1: No more SHIFT LOCK (Hardest camel to swallow as SHIFT LOCK roxorz hard!) #2: Unrolled and optimized quite a bit #3: Return of non alphanumeric keys is done as flags in X & Y registers instead of codes in A (more API friendly?!).
The scope and aim of the routine is hopefully more clear as well. Those of you who wants a piano, design a new keyboard, add diodes and let it rock.
NB! This one is not tested fully yet and I am in the progress of rewriting the testprogram. I'll release it shortly.
Only doubt remaining from my side is:
When keys are hit at the exact same time, is it better to:
#1: Ignore and wait for valid input
#2: Return the keys in the order the routine discovers them and get it right some times
??? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
please define "keys are hit at the exact same time" (in VICE this does _never_ happen, btw) |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: please define "keys are hit at the exact same time" (in VICE this does _never_ happen, btw)
Within 1/60th of a second. I.E. One scan has no keys, next scan has two (or three) keys. (hence two (or three) new keys pressed since last time the keyboard scan matrix was read).
So from a programmer point of view, they where pressed at the same time not in sequence (and are thus impossible to determine which one the "typer" intended to hit first.
Before you ask: A sequence means keys pressed no faster than 1/60th of a second between each key press. Any faster then that, they will be detected as simultaneously.
You could do more rapid scanning but I suspect most of us has other things to do with that precious R-Time than scanning the keyboard 10 times each frame. |
Previous - 1 | 2 | 3 | 4 - Next |