Three keys on the keyboard at the same time

All 680x0 related coding posts in this section please.

Moderators: Zorro 2, Moderator Team

Post Reply
Samoteph
Atari freak
Atari freak
Posts: 53
Joined: Tue Jun 28, 2022 2:37 pm

Three keys on the keyboard at the same time

Post by Samoteph »

Hello everyone,

I am developing the game Miracle Boy In Dragon Land.
I am facing a problem with the game controls.
When I press two keys on the keyboard at the same time for example DOWN+RIGHT I can no longer press SPACE to hit. On the joystick it is the same problem but more restricted (only UP+LEFT+FIRE) which poses a problem.
I find the problem on games like RTYPE+ or Blood Money.
Is this a known problem on the hardware (Atari ST/Ste) or on the software side (ACIA manager)?

The only information I have on this subject is this post https://www.atari-forum.com/viewtopic.php?t=30715 which seems to be clear on the hardware part.

What do you think?
mikro
Hardware Guru
Hardware Guru
Posts: 4724
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Three keys on the keyboard at the same time

Post by mikro »

Samoteph wrote: Mon Jul 15, 2024 9:31 pmOn the joystick it is the same problem but more restricted (only UP+LEFT+FIRE) which poses a problem.
This sounds suspicious. I don't see a reason why this combination shouldn't work. Every direction and fire button has its own line in the DSUB9 connector, there's no conflict.
User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1937
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: Three keys on the keyboard at the same time

Post by Greenious »

It's down to whatever keyboard handling routine you use I guess.

The keyboard itself has no such restrictions, it reports when a key is pressed, and when it is released. It is up to the keyboard handler to keep the tabs correct.
Check out the hardware preservation project: https://www.atari-forum.com/viewtopic.php?t=43023
And my old guide thread with various information: https://www.atari-forum.com/viewtopic.php?t=5040
AnthonyJ
Captain Atari
Captain Atari
Posts: 165
Joined: Sat Jan 26, 2013 8:16 am

Re: Three keys on the keyboard at the same time

Post by AnthonyJ »

There was also some discussion in the Bad Mood thread about this issue (on Falcon, but I guess it's similar): https://www.atari-forum.com/viewtopic.p ... 51#p243251
User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1849
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Three keys on the keyboard at the same time

Post by MasterOfGizmo »

The keyboard itself has these restrictions. Nearly any keyboard arranges the keys in a matrix which reduces the necessary connections required on the keyboard controller. It's physically possible to exactly identify two keys being pressed at once but a third key is.not exactly identifiable. Some keys occupy a complete row or column in the matrix "wasting" several key codes and reducing the number of keys installable. But these can be detected additionally. Keys like shift and control are usually implemented that way.

Do you really need to use the space key? If you can live with two cursor keys and e.g. shift then this might work.
MISTeryNano, tiny FPGA based STE: https://github.com/Harbaum/MiSTeryNano
zerkman
Atari freak
Atari freak
Posts: 59
Joined: Fri Jun 17, 2011 7:14 am
Contact:

Re: Three keys on the keyboard at the same time

Post by zerkman »

It's just how the IKBD (ST keyboard) processor is programmed. As already said, it can manage two simultaneous "ordinary" key presses plus the shifts, alt, control, caps lock which are managed separately.
zeST, an Atari ST implementation on low-cost FPGA platforms | Mastodon | Bluesky
User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1937
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: Three keys on the keyboard at the same time

Post by Greenious »

MasterOfGizmo wrote: Tue Jul 16, 2024 5:54 pm The keyboard itself has these restrictions.
Doh! I feel stupid, you are obviously correct. The matrix construction of the keyboard limits what keys can be detected at the same time.

If you look at the "Atari Mega ST Keyboard schematic" from the Atari Document Archive, you can see the layout of the keyboard matrix.

two keys are never a problem to identify, but more can be a problem, depending on how they share a row/column with the first two and, in what order they are pressed. (which is why ctrl, alt and the shift keys are on their own columns, more or less anyway, the last 3 shares it with f1-f3.) For example, If you press i and o, and the u (or p), in that order, u (or p) won't be detected, but if you press in the order of i, u and then o, it should detect all three correctly.

But as you can see on the matrix below, space have no row/column in common with the arrow keys and should be no problem.
kbd matrix.png
But it is also up to the keyboard handling routine. The IKBD reports when it detects a key being pressed, and when it is released. And if it reports more pressed keys, the keyboard handler must be able to handle that.
You do not have the required permissions to view the files attached to this post.
Check out the hardware preservation project: https://www.atari-forum.com/viewtopic.php?t=43023
And my old guide thread with various information: https://www.atari-forum.com/viewtopic.php?t=5040
Samoteph
Atari freak
Atari freak
Posts: 53
Joined: Tue Jun 28, 2022 2:37 pm

Re: Three keys on the keyboard at the same time

Post by Samoteph »

Thanks you all for your help with this problem :)

Here a link to the ACIA handkler I use for the game.

This is Daniel Hedberg's work that I modified for my needs:
https://1drv.ms/u/s!AvFd4WDBeDUns74UeYN ... A?e=5cfAOp
Samoteph
Atari freak
Atari freak
Posts: 53
Joined: Tue Jun 28, 2022 2:37 pm

Re: Three keys on the keyboard at the same time

Post by Samoteph »

If I replace Space by Shift Left I can use two supplementary keys. So I guess the software part seems to be ok.
Post Reply

Return to “680x0”