Hatari keyboard and keymap
Moderators: simonsunnyboy, npomarede, thothy, Moderator Team
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Hatari keyboard and keymap
I am trying to configure Hatari for my keyboard using the keymap file, but it's not satisfactory.
I am using a PC spanish keyboard, and many keys are not recognized.
Most of the keys can be configured, excepted a few important ones, especially accents.
I am seeing on the console the symbolic code for the key pressed, but can't attribute many key to an atari key. it doesn't work
Also some keys have the same symbolic code. For example ` ^ [ key and ' " { key have the same symbolic code 1073741824
Finally, I need to set different atari keys for normal, shift and Alt, and dead keys for ` ' ^ " and I don't see a way to do it.
Is there a way to fully configure each key of the keyboard, like Keyedit does in Mint?
I am using a PC spanish keyboard, and many keys are not recognized.
Most of the keys can be configured, excepted a few important ones, especially accents.
I am seeing on the console the symbolic code for the key pressed, but can't attribute many key to an atari key. it doesn't work
Also some keys have the same symbolic code. For example ` ^ [ key and ' " { key have the same symbolic code 1073741824
Finally, I need to set different atari keys for normal, shift and Alt, and dead keys for ` ' ^ " and I don't see a way to do it.
Is there a way to fully configure each key of the keyboard, like Keyedit does in Mint?
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
-
ThorstenOtto
- Fuji Shaped Bastard

- Posts: 3329
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Hatari keyboard and keymap
I think there is not much you can do about it. If the TOS you are using does not recognize the scancodes, then it won't help to configure Hatari to send them. Best thing that you can try is to use something like accent3 https://www.atari-forum.com/viewtopic.p ... 84#p420784
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari keyboard and keymap
EmuTOS supports many different (builtin) keymaps, so that might be best thing to do testing with.
As to Hatari configuration, there are some helper tools to check what key codes libSDL provides to Hatari, and what they are inside the emulation:
https://git.tuxfamily.org/hatari/hatari ... sts/keymap
As to Hatari configuration, there are some helper tools to check what key codes libSDL provides to Hatari, and what they are inside the emulation:
https://git.tuxfamily.org/hatari/hatari ... sts/keymap
-
ThorstenOtto
- Fuji Shaped Bastard

- Posts: 3329
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Hatari keyboard and keymap
Btw, that keymapping is rather bogus with SDL2. The sym you get from the SDL for eg. an "y" on a german keyboard is 0x79, with is just the ascii code of y. But it is larger than KBD_MAX_SCANCODE (0x72) and thus cannot be remapped. Also,the tool only prints the hexadecimal value, while the parser only accepts decimal values. It would help to make the parser also accept hexadecimal values, by using strtol() instead of atoi().
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
I am testing my spanish keyboard with spanish TOS 2.06 in order to have most of the similar keys.
I have tried Accent3.prg and it works for one key : grave and circumflex accent ( sym 27 according to http://eerott.mbnet.fi/hatari/img/st-keymap.png)
I can map it to sym 26 to match my keyboard, but sym 40 has exactly the same SDL code of 1073741824, and this key on my PC keyboard is acute accent , which I need also.
Eero, I don't know how to build from source (sorry I just know GFA), but I have been using your ST-keymap and --trace keymap to find the symbolic SDL code, so I guess it's what your helper tool does.
How do you choose a builtin keymap with emutos?
I have tried Accent3.prg and it works for one key : grave and circumflex accent ( sym 27 according to http://eerott.mbnet.fi/hatari/img/st-keymap.png)
I can map it to sym 26 to match my keyboard, but sym 40 has exactly the same SDL code of 1073741824, and this key on my PC keyboard is acute accent , which I need also.
Eero, I don't know how to build from source (sorry I just know GFA), but I have been using your ST-keymap and --trace keymap to find the symbolic SDL code, so I guess it's what your helper tool does.
How do you choose a builtin keymap with emutos?
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Re: Hatari keyboard and keymap
Hi, on a french forum, I had described how to patch manually a ROM to get a bepo-ish layout : https://www.yaronet.com/topics/191967-t ... avier-bepo
Nowadays, I would write a small TSR program in auto folder to use Keytbl ( https://freemint.github.io/tos.hyp/en/x ... tml#Keytbl ) with the proper table (because I guess the area I patched was the default KEYTAB https://freemint.github.io/tos.hyp/en/x ... tml#KEYTAB structure)
Nowadays, I would write a small TSR program in auto folder to use Keytbl ( https://freemint.github.io/tos.hyp/en/x ... tml#Keytbl ) with the proper table (because I guess the area I patched was the default KEYTAB https://freemint.github.io/tos.hyp/en/x ... tml#KEYTAB structure)
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
Thanks sporkinet. Wow, this is a tedious work !
I would definitely prefer, as you suggested, a way to use Keytbl under plain TOS, as this works very well under mint and also I have an uncommon setup : I am a French guy using a Spanish keyboard and who prefers an English TOS
I would definitely prefer, as you suggested, a way to use Keytbl under plain TOS, as this works very well under mint and also I have an uncommon setup : I am a French guy using a Spanish keyboard and who prefers an English TOS
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
-
ThorstenOtto
- Fuji Shaped Bastard

- Posts: 3329
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Hatari keyboard and keymap
You can also use http://tho-otto.de/keyboards/ if that helps. Those keyboards are generated using the key table files from mint.Faucon2001 wrote: ↑Fri Oct 08, 2021 11:46 am ( sym 27 according to http://eerott.mbnet.fi/hatari/img/st-keymap.png)
If you get the same sym from SDL for different keys, then something seems to be wrong with SDLsym 40 has exactly the same SDL code of 1073741824
and this key on my PC keyboard is acute accent , which I need also.
Just run "make" in the tests/keymap directory. It is standalone, and you don't have to configure or build Hatari for this.Eero, I don't know how to build from source (sorry I just know GFA)
Except for the greek and russian versions of emutos, there is nothing you can choose. There is only one keyboard table compiled in, depending on the language version. The one for spanish is in https://github.com/emutos/emutos/blob/m ... /keyb_es.h and should be identical to the one used in freemint https://github.com/freemint/freemint/bl ... panish.srcHow do you choose a builtin keymap with emutos?
Note that none of these define any deadkeys, although both emutos and mint support those. If you think that should be changed feel free to post any patches
-
ThorstenOtto
- Fuji Shaped Bastard

- Posts: 3329
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Hatari keyboard and keymap
No wonder that you have problems
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
Well, I like complicated stuff 
With the Spanish TOS it doesn’t work better, and the keys with the same symbolic code are still there.
I am surprised than there is not an easy way to setup a keyboard on Hatari.
With the Spanish TOS it doesn’t work better, and the keys with the same symbolic code are still there.
I am surprised than there is not an easy way to setup a keyboard on Hatari.
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari keyboard and keymap
There are multiple steps of interpretation that need to be done:Faucon2001 wrote: ↑Fri Oct 08, 2021 4:52 pm With the Spanish TOS it doesn’t work better, and the keys with the same symbolic code are still there.
I am surprised than there is not an easy way to setup a keyboard on Hatari.
* OS kernel: Keyboard HW => OS scancode
* SDL2: OS scancode => SDL2 scancode / keycode
* Hatari: SDL2 scancode / keycode => ST scancode (inserted to emulated IKBD)
* TOS: ST scancode => character visible on screen
Info may be lost in any of these steps, if given conversion step does not support given scancode, but the main problem is TOS key mapping.
EmuTOS should support setting language and keyboard mapping separately, so that you can get Spanish keyboard layout with English language, but you may need to build your own EmuTOS image for that.
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari keyboard and keymap
I sent a potential fix for that issue to the Hatari mailing list: https://listengine.tuxfamily.org/lists. ... reads.htmlThorstenOtto wrote: ↑Fri Oct 08, 2021 11:36 am Btw, that keymapping is rather bogus with SDL2. The sym you get from the SDL for eg. an "y" on a german keyboard is 0x79, with is just the ascii code of y. But it is larger than KBD_MAX_SCANCODE (0x72) and thus cannot be remapped.
Testing of that would be appreciated.
I pushed a commit changing the tool to show both symbolic and scancode values, both in hex & decimal. But the keymap tracing is actually enough to debug the values (and Faucon2001 was already using that).ThorstenOtto wrote: ↑Fri Oct 08, 2021 11:36 am Also,the tool only prints the hexadecimal value, while the parser only accepts decimal values. It would help to make the parser also accept hexadecimal values, by using strtol() instead of atoi().
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari keyboard and keymap
According to EmuTOS doc: https://raw.githubusercontent.com/emuto ... ountry.txtEero Tamminen wrote: ↑Sat Oct 09, 2021 10:53 pm EmuTOS should support setting language and keyboard mapping separately, so that you can get Spanish keyboard layout with English language, but you may need to build your own EmuTOS image for that.
And Hatari NVRAM info: https://git.tuxfamily.org/hatari/hatari ... on/nvram.c
With 512K version of EmuTOS, it should be enough to set NVRAM bytes 20 & 21, to specify language and keyboard layout. Only for the smaller EmuTOS variants you need to change sources to achieve that.
Re: Hatari keyboard and keymap
Hello,
I had problems last year too with Hatari not handling correctly the French keyboard, for example { which requires shift alt. I improved it so you can map SDL keys with modifiers to Atari keys with modifiers. With this change, all keys on the French ST keyboard worked, I showed it in this (crappy) video: https://www.youtube.com/watch?v=4qWL23X77aI
I think the same would work with the Spanish keyboard, provided you wrote a correct mapping file (there is a new format for it).
That is in https://github.com/vinz6751/hatari/blob ... bd-support
but you'd have to build from sources because this hasn't been merged to the mainstream hatari.
Building from hatari and EmuTOS from sources is pretty easy on linux, a bit less straightforward on Windows.
Ping me if you're interested in trying that out !
Vinz
I had problems last year too with Hatari not handling correctly the French keyboard, for example { which requires shift alt. I improved it so you can map SDL keys with modifiers to Atari keys with modifiers. With this change, all keys on the French ST keyboard worked, I showed it in this (crappy) video: https://www.youtube.com/watch?v=4qWL23X77aI
I think the same would work with the Spanish keyboard, provided you wrote a correct mapping file (there is a new format for it).
That is in https://github.com/vinz6751/hatari/blob ... bd-support
but you'd have to build from sources because this hasn't been merged to the mainstream hatari.
Building from hatari and EmuTOS from sources is pretty easy on linux, a bit less straightforward on Windows.
Ping me if you're interested in trying that out !
Vinz
-
ThorstenOtto
- Fuji Shaped Bastard

- Posts: 3329
- Joined: Sun Aug 03, 2014 5:54 pm
Re: Hatari keyboard and keymap
Building EmuTOS on windows (or macOS) is the same as on linux (provided you installed the correct compiler toolchain), because it does not need any third-party libraries. You only need bash & make for this (either cygwin, or msys2).
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
Great !!! It sounds like what I need.vinz6751 wrote: ↑Sun Oct 10, 2021 7:47 am I had problems last year too with Hatari not handling correctly the French keyboard, for example { which requires shift alt. I improved it so you can map SDL keys with modifiers to Atari keys with modifiers. With this change, all keys on the French ST keyboard worked, I showed it in this (crappy) video: https://www.youtube.com/watch?v=4qWL23X77aI
I think the same would work with the Spanish keyboard, provided you wrote a correct mapping file (there is a new format for it).
What is the new format for the keycap file? Is it explained with the sources ?
Building Hatari on Linux is not an issue, but the link seems to be dead.That is in https://github.com/vinz6751/hatari/blob ... bd-support
but you'd have to build from sources because this hasn't been merged to the mainstream hatari.
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Re: Hatari keyboard and keymap
replace 'blob' by 'tree' to get the branch : https://github.com/vinz6751/hatari/tree ... bd-supportFaucon2001 wrote: ↑Sun Oct 10, 2021 3:28 pmBuilding Hatari on Linux is not an issue, but the link seems to be dead.That is in https://github.com/vinz6751/hatari/blob ... bd-support
but you'd have to build from sources because this hasn't been merged to the mainstream hatari.
there seems to be another branch on the same subject : https://github.com/vinz6751/hatari/tree ... b-support2
Now, I guess that you should look into the latest commits of each branch to grasp the interesting part.
Re: Hatari keyboard and keymap
Sorry not sure why the link didn't work, I copied it from github.
Here's a better one.
https://github.com/vinz6751/hatari/tree ... b-support2
And look in doc/keymap-sample.txt for explanations on the format and
doc/fr/clavier-exemple.txt
for instructions in French, this is a keymap for French keyboards.
Here's a better one.
https://github.com/vinz6751/hatari/tree ... b-support2
And look in doc/keymap-sample.txt for explanations on the format and
doc/fr/clavier-exemple.txt
for instructions in French, this is a keymap for French keyboards.
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
Thank you very much !! It works !
I spent quite some time to build the Keymap file, not an easy task, but now 100% of my keyboard is mapped.
The only grey area is about the dead keys. I have 4 dead keys on a Spanish keyboard ´¨`^ and accent3.prg recognise only `^¨. The acute accent is missing. Anyway, I have mapped AltGr E as é and I am done.
Could you merge your branch with the main one ? that's a big step forward for keyboard configuration.
I spent quite some time to build the Keymap file, not an easy task, but now 100% of my keyboard is mapped.
The only grey area is about the dead keys. I have 4 dead keys on a Spanish keyboard ´¨`^ and accent3.prg recognise only `^¨. The acute accent is missing. Anyway, I have mapped AltGr E as é and I am done.
Could you merge your branch with the main one ? that's a big step forward for keyboard configuration.
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Re: Hatari keyboard and keymap
Thank you, I'm glad it helped you 
I can't merge this to the hatari repo, I have no rights to do so, I submitted the patch at the beginning of the year then lot interest when asked to salami slice it, but Eero has endeavoured to do it and is now working on it, making some refinements in the process that should make keymap files a bit friendlier. So chances are that it will be merged in hatari in the next few weeks or few months
I can't merge this to the hatari repo, I have no rights to do so, I submitted the patch at the beginning of the year then lot interest when asked to salami slice it, but Eero has endeavoured to do it and is now working on it, making some refinements in the process that should make keymap files a bit friendlier. So chances are that it will be merged in hatari in the next few weeks or few months
- Eero Tamminen
- Fuji Shaped Bastard

- Posts: 3899
- Joined: Sun Jul 31, 2011 1:11 pm
Re: Hatari keyboard and keymap
I just sent a rewritten (8) patch series of the relevant functional changes to the hatari mailing list. Hopefully Vincent has time to test and verify that it supports similar things as the commit in his branch. If it does, others can then review it, and if they agree, I can merge it.
Btw. In general, it's better to work so that one does (and finishes) single change at the time and commits it. Small commits are trivial to merge together later, whereas splitting large commits into logically separate ones later on, is a lot of work. Sometimes that does not work and one just needs to rewrite the changes to get reasonable sized & reviewable commits / patches. Vincent's single commit was in fairly good shape for me to do that. Typically such split / rewrite improves the code, so it's not wasted effort.
PS. Any renames or white space changes should be done and sent completely separately. Preferably done with automated tools so that the changes can be easily dropped & re-create them when necessary.
(At work I do some stuff with Golang, and I really like that it has its own formatting & vetting tools, so those can automated and there's no bickering about that kind of things...
)
Btw. In general, it's better to work so that one does (and finishes) single change at the time and commits it. Small commits are trivial to merge together later, whereas splitting large commits into logically separate ones later on, is a lot of work. Sometimes that does not work and one just needs to rewrite the changes to get reasonable sized & reviewable commits / patches. Vincent's single commit was in fairly good shape for me to do that. Typically such split / rewrite improves the code, so it's not wasted effort.
PS. Any renames or white space changes should be done and sent completely separately. Preferably done with automated tools so that the changes can be easily dropped & re-create them when necessary.
(At work I do some stuff with Golang, and I really like that it has its own formatting & vetting tools, so those can automated and there's no bickering about that kind of things...
Re: Hatari keyboard and keymap
Hello,
Somebody can explain to me how the keymapping file works ?
for a simple key I understand (there's an sample in the sources) but is it possible to map composed key, for example on french keyboard:
" is map to "
Shift+" is map to 3
AltGr+" is map to #
is it possible to map this type of behaviour ?
Thanks for help.
Somebody can explain to me how the keymapping file works ?
for a simple key I understand (there's an sample in the sources) but is it possible to map composed key, for example on french keyboard:
" is map to "
Shift+" is map to 3
AltGr+" is map to #
is it possible to map this type of behaviour ?
Thanks for help.
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
With Vinz version, yes it’s possible, but I am afraid that this version is outdated.
I have given up with keymaps and use Clocky instead. It can’t manage AltGR, but you can assign Ctrl shift and Alt to any key.
I have given up with keymaps and use Clocky instead. It can’t manage AltGR, but you can assign Ctrl shift and Alt to any key.
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Re: Hatari keyboard and keymap
Thanks for your answer, but it allow to create mapping like:Faucon2001 wrote: ↑Sat Feb 11, 2023 6:25 pm With Vinz version, yes it’s possible, but I am afraid that this version is outdated.
I have given up with keymaps and use Clocky instead. It can’t manage AltGR, but you can assign Ctrl shift and Alt to any key.
" map to "
Shift+" map to 3
Ctrl+" map to #
?
-
Faucon2001
- Atari God

- Posts: 1038
- Joined: Sat Oct 26, 2013 11:19 pm
- Location: France
- Contact:
Re: Hatari keyboard and keymap
Yes you can setup different keyboard layout for Maj, shift, Ctrl and Alt
The interface is graphical so it’s easier than hatari text keymap.
https://joy.sophics.cz/clocky.htm
Philippe
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/
Firebee, Falcon CT60, STE, BeeKey, BeePi.
My photography http://phil-67.deviantart.com/
EasyAraMint, BeeKey and BeePi https://sites.google.com/site/beebox68k/

