Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > looking for rom independent keyboard read routine
2010-04-24 07:07
Oswald

Registered: Apr 2002
Posts: 5022
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....
 
2013-07-31 07:22
Oswald

Registered: Apr 2002
Posts: 5022
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.
2013-07-31 07:59
chatGPZ

Registered: Dec 2001
Posts: 11127
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 :)
2013-07-31 10:43
Hein

Registered: Apr 2004
Posts: 933
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. :)
2013-07-31 20:41
TWW

Registered: Jul 2009
Posts: 541
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.
2013-08-01 06:55
chatGPZ

Registered: Dec 2001
Posts: 11127
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."
2013-08-01 12:01
TWW

Registered: Jul 2009
Posts: 541
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...
2013-08-01 12:06
chatGPZ

Registered: Dec 2001
Posts: 11127
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
2013-08-03 08:46
TWW

Registered: Jul 2009
Posts: 541
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

???
2013-08-03 10:10
chatGPZ

Registered: Dec 2001
Posts: 11127
please define "keys are hit at the exact same time" (in VICE this does _never_ happen, btw)
2013-08-03 11:30
TWW

Registered: Jul 2009
Posts: 541
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
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
jamespurcell
zscs
csabanw
Guests online: 151
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Webmasters
1 Slaygon  (9.7)
2 Perff  (9.6)
3 Morpheus  (9.5)
4 Sabbi  (9.5)
5 CreaMD  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.053 sec.