Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:20 02 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Key code for cursor key different with shift

Author Message
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 523
Posted: 04:23am 04 Apr 2025
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 7464
Posted: 07:10am 04 Apr 2025
Copy link to clipboard 
Print this post

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: Canada
Posts: 523
Posted: 04:03pm 04 Apr 2025
Copy link to clipboard 
Print this post

  Mixtel90 said  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.

.


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: Germany
Posts: 28
Posted: 06:09am 22 Apr 2025
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 7464
Posted: 07:23am 22 Apr 2025
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025