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 > Detecting ctrl and shift pressed simultaniously
2006-03-04 08:03
Laxity

Registered: Aug 2005
Posts: 459
Detecting ctrl and shift pressed simultaniously

OK.. here goes.

I need to find out if it's possible to detect simultanious key presses of both Ctrl and shift (both left and or right). The code I've written for detecting this works nicely in Vice, but the question is if the key matrix of the real c64 hardware allows this?

Unfortunately my 64 is broken, so I'm unable to investigate this myself.
 
... 24 posts hidden. Click here to view all posts....
 
2006-03-05 08:33
Zyron

Registered: Jan 2002
Posts: 2381
There's a Crest-demo that goes on automatically where you can hold the parts with Shift-Lock, don't remember which one right now.
2006-03-05 08:48
iopop

Registered: Dec 2001
Posts: 317
Quote: There's a Crest-demo that goes on automatically where you can hold the parts with Shift-Lock, don't remember which one right now.

its Krestology 100% - as if you ever wanted to hold the parts in that one anyhow.. :)
2006-03-05 08:50
Stryyker

Registered: Dec 2001
Posts: 468
Krestology may be the demo - it has a big finger pressing it very early.

LAxity:Yes you can via the link I gave earlier. The biggest issue is if three keys in the grid that align so that you make 3 points of a square (using 8*8 grid) then a 4th key press is registered. Maybe with some clever coding you can eliminate the ghost press. From the link at Joe's site if you pressed 3, 5 and W then R would also be detected even if not pressed.
2006-03-05 09:14
Style

Registered: Jun 2004
Posts: 498
Quote: There's a Crest-demo that goes on automatically where you can hold the parts with Shift-Lock, don't remember which one right now.

and not the corresponding shift key?
2006-03-05 10:43
Laxity

Registered: Aug 2005
Posts: 459
Quote: Krestology may be the demo - it has a big finger pressing it very early.

LAxity:Yes you can via the link I gave earlier. The biggest issue is if three keys in the grid that align so that you make 3 points of a square (using 8*8 grid) then a 4th key press is registered. Maybe with some clever coding you can eliminate the ghost press. From the link at Joe's site if you pressed 3, 5 and W then R would also be detected even if not pressed.


Yes, I saw your link. I'm already detecting key presses using $dc00 and $dc01 and it works like a charm. No problem there... Multiple key presses and all is good. Was just wondering as I said a few times already :), if the physical hardware would allow for the combination of shift and control being pressed simulaniously, and apparently it does.. So there's much rejoycing ;)
2006-03-05 11:08
tlr

Registered: Sep 2003
Posts: 1790
Quote: wow, you can detect the difference between shift and shift lock?

How? any details?

They should be equivalent!


From Markos article in C=Hacking #7:
Quote:

The difference between an input and an output is that an output uses more current to drive the signal to the desired level. An input and an output outputting logical '1' are equivalent for any other inputting chip. But if a chip is trying to drive a signal to ground level, it needs more current to sink an output than an input. You can even use outputs as inputs, i.e. read them in your program.

You can use this feature to distinquish between the left shift and the shift lock keys, although they are connected to same hardware lines. The shift lock key has smaller resistance than the left shift. If you make both CIA 1 ports to outputs (write $FF to $DC03 and $DC01) prior reading the left shift key, only shift lock can change the values you read from CIA 1 port B ($DC01).)

2006-03-05 11:55
Krill

Registered: Apr 2002
Posts: 2980
Indeed, you cannot detect any key combinations possible. Two keys pressed at the same time are possible, but at already three (i think) you get short circuits in the matrix for certain key combinations, and more short circuit-prone combinations with rising number of pressed keys to detect at the same time.
That is, keys may be left released in the checked combination but are still reported as being pressed (Giana Sisters cheat code, pressing ARMIN will skip a level - as intended by the author, but pressing ARMN will do that as well).
Or, different keys kan be pressed instead of some of the keys in the checked combination (Giana Sisters ARMIN again, but i forgot the extra key combination that works as well).

Oh and also Deus Ex Machina allows you to hold parts by pressing left shift or shift lock.
2006-03-05 12:38
Graham
Account closed

Registered: Dec 2002
Posts: 990
Also, if many keys are involved, some completely different key might replace several others. To stick at the Giana Sisters example:

ARMIN is the intended combination.
ARMN is an example that a key might not be needed to achieve the same port settings.

But:

AWXZ also works, or ARM together with one of the SHIFT-keys.
2006-03-05 12:41
Style

Registered: Jun 2004
Posts: 498
Quote: From Markos article in C=Hacking #7:
Quote:

The difference between an input and an output is that an output uses more current to drive the signal to the desired level. An input and an output outputting logical '1' are equivalent for any other inputting chip. But if a chip is trying to drive a signal to ground level, it needs more current to sink an output than an input. You can even use outputs as inputs, i.e. read them in your program.

You can use this feature to distinquish between the left shift and the shift lock keys, although they are connected to same hardware lines. The shift lock key has smaller resistance than the left shift. If you make both CIA 1 ports to outputs (write $FF to $DC03 and $DC01) prior reading the left shift key, only shift lock can change the values you read from CIA 1 port B ($DC01).)



Jesus Marko is a smart guy - I would have never thought to try that, altho the theory is very sound.
2006-03-05 17:45
TNT
Account closed

Registered: Oct 2004
Posts: 189
Quote: Jesus Marko is a smart guy - I would have never thought to try that, altho the theory is very sound.


It was first done by ZYX-soft of Finnish Gold, they used it to select different musics inside one of their demos.

Edit: it's in D.Y.S.P.I.D.C.E.
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
Andy/AEG
MAT64
blitzed
wil/VCC^CTG
Alakran_64
rambo/Therapy/ Resou..
csabanw
Zeus
Dylotic/Xenon
Acidchild/Padua
psych
Guests online: 135
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 The Demo Coder  (9.6)
6 Edge of Disgrace  (9.6)
7 What Is The Matrix 2  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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