Jump to content
  • 0
kliepatsch

More exposed keyboard interface

Question

Currently, the input stream from the keyboard is simplified by the KERNAL in a way that is optimized for text-based applications. By that I mean each keypress is only registered once (unless the key is held down for a while). This is nice for many applications.

However, for games and other interactive cases (e.g. using the keyboard as a musical keyboard) it would be really nice to access data on which keys are actually held down (at the same time). Because I currently do not find a way to do this, I am asking if this could be made possible in the future? As I understand it, the routines that do the keyboard handling, are currently located entirely in ROM and not available for modification without replacing the ROM.

I understand that for most games, a controller with arrow keys seems sufficient. But I suspect that opening the keyboard interface up would greatly benefit the X16, since a broader range of applications will be made possible.

All the best, Carl

Edited by kliepatsch
  • Like 6

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Bumping this with a related query...

Does the keyboard scanning work in the same way as the C64? If I wanted to write my own keyboard scanning routine, would it have the same rollover issues as the C64?.. or does the X16 ROM do things its own special way?

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Yes and no. I think it fakes it. The keyboard is a standard PS/2 one ; a PS/2 keyboard (or a USB with an adaptor) sends a stream of serial data most of which is 'this key up' 'that key down' messages. So you can take those and build a grid like on a C64 regarding which keys are pressed and which are not. That grid should be accurate, and not have faux keys that are caused by multiple keys allowing paths through because there aren't diodes across the keys.

To get a definitive answer you'd have to look at the ROM code.

Share this post


Link to post
Share on other sites
  • 0
On 11/9/2020 at 4:23 AM, izb said:

Bumping this with a related query...

Does the keyboard scanning work in the same way as the C64? If I wanted to write my own keyboard scanning routine, would it have the same rollover issues as the C64?.. or does the X16 ROM do things its own special way?

No. This computer uses a PS/2 keyboard, so keyboard scanning is nothing like the 64. It’s essentially the same as the keyboard handling in DOS.
 

PS/2 is event based, rather than state based, so you need to read the PS/2 bus as the data comes in. The KERNAL stashes the key presses in the buffer, but you could theoretically place them in a state table that records the up/down state of each key. 

  • Like 2

Share this post


Link to post
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.

Guest
Answer this question...

×   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.


×
×
  • Create New...

Important Information

Please review our Terms of Use