ColinPitrat / caprice32

An emulator of the Amstrad CPC 8bit home computer range.
GNU General Public License v2.0
148 stars 32 forks source link

SRAM: AZERTY keyboard not recognized, QWERTY only #235

Open legluondunet opened 1 year ago

legluondunet commented 1 year ago

Hello, when I play SRAM 1 with Caprice32, my keyboard is in QWERTY, I can not use an AZERTY keyboard.

I can reproduce this issue with Caprice32 compiled from git (today's code) or with RETROARCH Caprice32 core (today's code).

Thank you for your help.

my config: OS: Manjaro 22.1.1 Talos Kernel: x86_64 Linux 6.3.0-1-MANJARO Proc: AMD Ryzen 9 5900HX GPU: AMD AMD Radeon RX 6600M Drivers: Mesa 23.01 32 Go RAM

ColinPitrat commented 1 year ago

Interesting. I'd be curious to know how it behaves on a real Amstrad CPC. Though it would be surprising if it doesn't work...

Changing the PC keyboard layout (e.g. 'keymap_uk_linux.map') doesn't fix the issue. Changing the CPC language does fix it.

It seems to me that the game may be written in a peculiar way. Instead of using the BIOS routines to access the keyboard, it may be doing the translation to a char itself (level 2 in https://www.cpcwiki.eu/imgs/3/3e/S968se03.pdf) ignoring the type of keyboard used.

Or maybe it does take into account the type of keyboard use but determines it based on some difference between keyboards that I don't emulate. The only thing that changes between keyboards in Caprice is that a different charmap and key map table are used.

ColinPitrat commented 1 year ago

I need to dig whether this works or not: https://www.cpcwiki.eu/forum/programming/how-know-the-keyboard-layout-(cpctelera)/

The basic routine at the end seems to work but I need to test the assembly one too.

legluondunet commented 1 year ago

I forgot to precise I use AZERTY keyboard cause I'm french, so during my tests I set Caprice32 to french and set Keyboard layout to keymap_fr_linux.map, that changed nothing. After launching SRAM 1, I choose F for France language.

ColinPitrat commented 1 year ago

Tried the asm routine from cpcwiki.eu, it works as expected too: https://github.com/ColinPitrat/CPCMisc/tree/main/assembly/004_keyboard

ColinPitrat commented 1 year ago

Note that as it works fine with a UK keyboard, a workaround could be to have a special shortcut for this game, something like:

cap32 -O system.keyboard=0 -a 'run"sram' Sram_Side_A.dsk

Other tips:

You can press F9 (toggle limit speed) to accelerate the animation & load times.

Even better, to avoid having to switch the disk each time, once you've loaded Side B you can save a snapshot (F1 - Load/Save - File type = Snapshot). This allows to have a shortcut that will drop you directly from the start of the game.

You can also use the snapshot as a way to save the game. Shift+F3 is a shortcut to take a snapshot (named from the date & time). Shift+F4 restores the latest snapshot.