Jump to content
IGNORED

POKEY keyboard scanning, CTRL-SHIFT keyboard combos.


Recommended Posts

If you mean scan codes $C0-C7 and $D0-D7, no, bypassing the OS and going straight to POKEY isn't enough. The problem is that Ctrl and Shift are part of the keyboard matrix and on the same column on the Atari, so Ctrl+Shift+<key> is guaranteed to produce a fourth phantom key when the third key is on the same row as Ctrl or Shift. That phantom key then prevents POKEY from reporting a key down. There's no way that I know of to sense multiple keys down, and even if there were you couldn't distinguish Ctrl+Shift+L and Ctrl+Shift+V, for instance.

 

It's possible for a keyboard to have diodes to prevent this, but I haven't heard of an Atari keyboard immune to this problem.

  • Like 1
Link to comment
Share on other sites

Shift + Ctrl + A generates $FF and falls through the cracks since that code is also the "no key" condition but can be detected in software.

 

Also not forgetting some OS ignored Ctrl combinations such as 0, 4-9 which some key processing programs use as function keys

Edited by Rybags
  • Like 1
Link to comment
Share on other sites

There's no way that I know of to sense multiple keys down

Well, there kinda is a way, and I believe you are aware of it already - by disabling keyboard debounce (SKCTL's bit 0). In fact, in that mode POKEY detects only pressing multiple keys at once, with the restriction that only two "consecutive" keys are detected ("consecutive" in the sense of the order of POKEY keyboard scanning).

 

For example, try POKE 53775,2 and then press Q, W, I and Return simultaneously. Q and W are consecutive, which is detected by POKEY as pressing Q only, and I and Return are also consecutive, which is detected as pressing I only. The result is, POKEY behaves as if Q and I were being pressed alternatively at a rapid pace.

 

(The 5200's keypads work this way - POKEY is permanently set to non-debounce mode, and every key is wired to short two consecutive positions of the POKEY's keyboard matrix. This allows limited detection of multiple keypresses.)

 

Although the method is limited by the requirement of "consecutiveness", I wonder if there exists some way of avoiding it, by means of switching the debounce bit, or the keyboard scanning bit (SKCTL bit 1), rapidly, in a frequency related to the frequency of keyboard scanning (ie. once a scanline).

Edited by Kr0tki
Link to comment
Share on other sites

Possibly putting Pokey into INIT mode, or just changing SKCTL might be sufficient to restart the scan sequence, or maybe more desirbably alter the state machine in some way.

But whether that could be sufficient to detect mutliple keys?

 

A good starting point might be a custom kb IRQ that changes SKCTL setting for a scanline then back before returning.

Link to comment
Share on other sites

Toggling the keyboard scan enable will restart the scan sequence, but also resets the state machine. The most useful trick I can think of for this would be to truncate the keyboard scan to partially scan the keyboard more quickly (such as the arrow keys).

 

Toggling debounce on the fly allows detecting a specific pair of keys. The problem is that there isn't a way to know which key POKEY has latched for comparison, since it doesn't report a scan code until after the second check passes (if it did, we could just use that to do a raw scan). Precise timing would theoretically allow sweeping for the 8 pairs of hidden Ctrl+Shift+X key combinations. It's still impossible to tell the keys in the aliased pair apart due to the phantom key effect, and this would reduce the key scan to an unusably low rate. As such, I haven't found an actual useful hack for the debounce bit on the computer.

Link to comment
Share on other sites

That won't help in case of key ghosting. Pressing three keys that spawn the fourth ghost key is electrically indistinguishable from pressing all four keys at once (regardless of which three keys of the four were pressed). You simply cannot differentiate the two cases on the hardware level.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...