![]() |
Forum Index : Microcontroller and PC projects : CMM2: Key code for cursor key different with shift
Author | Message | ||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 523 |
So this isn't a problem, but it is unusual behavior and I was just curious if there was an explanation. If I set up a loop to read the keycode from the keyboard, the cursor keys give me: UP 128 DOWN 129 LEFT 130 RIGHT 131 Holding down the shift (as far as I understand it) shouldn't change the keycode. Yet, when I hold down shift I get the following: UP 128 DOWN 161 <------ LEFT 130 RIGHT 163 <------ I've tried it on three different keyboards and they all exhibit the same effect. It's not a problem in the slightest - easily handled in code, I'm just curious as to what I'm missing. |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7464 |
I'm not sure if those keys are standardised when shifted as they are never marked with a second function. I simply wouldn't use them with modifier keys as no-one will be expecting a result. :) Another reason to avoid them is that not all keyboards have separate arrow keys anyway and use the codes from the unlocked number keys 8,4,6,2. (Is that what you are seeing, I wonder?) This is something I haven't investigated, but Shift has a specific purpose. It sets bit 6 of the ASCII code for a character and used to be done in hardware sometimes. Control keys do not generate ASCII characters so the effect of pressing Shift, Alt or Ctrl might not be valid. It may or may not vary between keyboards, I suppose, depending on the hardware used to scan them. . Edited 2025-04-04 17:33 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PeteCotton![]() Guru ![]() Joined: 13/08/2020 Location: CanadaPosts: 523 |
Thanks Mick, that is very insightful. I can confirm that it's not the number keys (although that was a good suggestion). I'll just leave it alone as it is. It's not causing any problems, I was just curious as to what was happening - and I think you've probably hit the nail on the head with your comment. It's for the Maxi-Trek game. If it turns out that it is an issue on some keyboards, then I can easily re-map it. Thanks again! Edited 2025-04-05 02:04 by PeteCotton |
||||
joker Newbie ![]() Joined: 06/02/2024 Location: GermanyPosts: 28 |
Hello, If the keys Shift-Cursor have no purpose, could we put Cursor left on shift cursor right and Cursor up on shift cursor down? I have a retro keyboard, that has only two cursor keys and i had to patch the kernel to get it work properly. This is not the only key I had to patch, so a loadable custum keytab would be great (just dreaming 🤤) Cheers Matthias |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7464 |
Hehe... Dream on... :) Appendix H of the current PicoMite manual shows that Down arrow and Right arrow do change their codes when shifted. The other arrow keys don't. (It's probably the same for the CMM2). This is probably from back in the realms of history. You can backspace and scroll down on a teletype but you can't always do much else. . Edited 2025-04-22 17:25 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |