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


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

Registered: Apr 2002
Posts: 4398
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: 4398
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
Groepaz
Account closed

Registered: Dec 2001
Posts: 9100
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: 840
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: 448
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
Groepaz
Account closed

Registered: Dec 2001
Posts: 9100
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: 448
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
Groepaz
Account closed

Registered: Dec 2001
Posts: 9100
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: 448
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
Groepaz
Account closed

Registered: Dec 2001
Posts: 9100
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: 448
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
Core/VPN
aNdy/AL/Cosine
hedning/G★P
Krill/Plush
jeroen1328
Ghostrider/No Name
Bones99
Guests online: 58
Top Demos
1 Unboxed  (9.7)
2 Uncensored  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 The Shores of Reflec..  (9.6)
7 Lunatico  (9.6)
8 X Marks the Spot  (9.5)
9 Wonderland XII  (9.5)
10 OMG Got Balls!  (9.5)
Top onefile Demos
1 Smile to the Sky  (9.5)
2 Instinct  (9.5)
3 Daah, Those Acid Pil..  (9.5)
4 Dawnfall V1.1  (9.4)
5 Crystal Gazer  (9.4)
6 Rewind  (9.4)
7 Pandemoniac Part 2 o..  (9.4)
8 Bad Boy  (9.4)
9 Official X2018 Report  (9.4)
10 Party Horse  (9.4)
Top Groups
1 Fossil  (9.6)
2 PriorArt  (9.6)
3 Oxyron  (9.4)
4 Booze Design  (9.4)
5 Censor Design  (9.3)
Top Original Suppliers
1 hedning  (9.8)
2 Derbyshire Ram  (9.3)
3 Irata  (9.2)
4 Fungus  (9.1)
5 Jazzcat  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2019
Page generated in: 0.066 sec.