Previous Thread
Next Thread
Print Thread
Page 2 of 3 1 2 3
Joined: Mar 2001
Posts: 16,943
Likes: 69
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,943
Likes: 69
Yeah, the instructions are slightly out of date - KEYCODE changed to ITEM during the 0.117 core input rewrite.

Also, it's important to note that by default, you get the character that would be at that key position on the computer you are emulating. (For instance, on the C64 emulation, Shift-2 generates a " instead of what's on your PC keyboard). If you want the keys on your PC to generate the characters which are on them, you must enable Natural Keyboard (-natural on the commandline).

(That all said, going by the picture on Wikipedia the Coco3 has a largely PC-compatible layout and I can type / properly in MESS just by pressing the normal / key, so it would appear your problem is your non-US keyboard after all).

Last edited by R. Belmont; 08/26/07 05:27 PM.
Joined: Aug 2007
Posts: 17
I
ionmich Offline OP
Member
OP Offline
Member
I
Joined: Aug 2007
Posts: 17
Originally Posted By R. Belmont
Yeah, the instructions are slightly out of date - KEYCODE changed to ITEM during the 0.117 core input rewrite.

Also, it's important to note that by default, you get the character that would be at that key position on the computer you are emulating. (For instance, on the C64 emulation, Shift-2 generates a " instead of what's on your PC keyboard). If you want the keys on your PC to generate the characters which are on them, you must enable Natural Keyboard (-natural on the commandline).

(That all said, going by the picture on Wikipedia the Coco3 has a largely PC-compatible layout and I can type / properly in MESS just by pressing the normal / key, so it would appear your problem is your non-US keyboard after all).


The -natural invocation worked just fine and I can now make slashes. I'll work on the rest later after I am sure more important things work properly. Many thanks for the quick fix.

Joined: Mar 2001
Posts: 16,943
Likes: 69
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,943
Likes: 69
Nice. Glad it's working for you smile

Joined: Aug 2007
Posts: 17
I
ionmich Offline OP
Member
OP Offline
Member
I
Joined: Aug 2007
Posts: 17
Originally Posted By R. Belmont
Yeah, the instructions are slightly out of date - KEYCODE changed to ITEM during the 0.117 core input rewrite.

Also, it's important to note that by default, you get the character that would be at that key position on the computer you are emulating. (For instance, on the C64 emulation, Shift-2 generates a " instead of what's on your PC keyboard). If you want the keys on your PC to generate the characters which are on them, you must enable Natural Keyboard (-natural on the commandline).

(That all said, going by the picture on Wikipedia the Coco3 has a largely PC-compatible layout and I can type / properly in MESS just by pressing the normal / key, so it would appear your problem is your non-US keyboard after all).


I have returned to this problem and as I cannot get the -keymap option to work at all can you confirm the question I asked...

Am I correct in assuming that the line "ITEM_ID_MINUS SDLK_PLUS 0x14 0x2b +" means in order of fields...

1. Identifier to the MESS software.
2. SDL key identifier.
3. Hex value of keypress
4. Hex value of character to be generated
5. Visual representation of character.

...and does the -keymap option work in both full and partial keyboard emulation?

As I see it I have to use "testkeys" to only read the hex values normally generated by a CoCo keyboard. Then I should be able to change them via -keymap.

Thanks.

Joined: Mar 2001
Posts: 16,943
Likes: 69
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,943
Likes: 69
I'm not the expert on this stuff, I've emailed couriersud and hopefully he'll have time to look at this thread and help you.

Joined: Feb 2007
Posts: 507
C
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 507
Originally Posted By ionmich

Am I correct in assuming that the line "ITEM_ID_MINUS SDLK_PLUS 0x14 0x2b +" means in order of fields...

1. Identifier to the MESS software.
2. SDL key identifier.
3. Hex value of keypress
4. Hex value of character to be generated
5. Visual representation of character.


ad 1.) Yes, actually it is the MAME key identifier.
ad 2.) Yes
ad 3.) Not used. Actually it is the scancode
ad 4.) Not used. Actually it is the ASCII representation of the character
ad 5.) Yes.

3. and 4. are just in for completeness. For each keypress, SDL generates a SDLK_* code. This is translated into an ITEM_ID_* code which is used by the core.
Originally Posted By ionmich

...and does the -keymap option work in both full and partial keyboard emulation?

The "keymap" code is working below everything else. It *should* work with full and partial keyboard emulation.

you mention that you are not able to get "-keymap" to work at all. Can you post the output of "mess -verbose <any_other_options>"?


Joined: Aug 2007
Posts: 17
I
ionmich Offline OP
Member
OP Offline
Member
I
Joined: Aug 2007
Posts: 17
Originally Posted By couriersud

you mention that you are not able to get "-keymap" to work at all. Can you post the output of "mess -verbose <any_other_options>"?



When I start the coco3 emulator with no "-keymap" switch and hit the key immediately right of my "0" key (marked "+" on my keyboard but "-" on a QWERTY board) I get a "-" on the screen.

When I run "testkeys" and press the key immediately right of the "0" (marked "+" on my keyboard) I get the following output...

ITEM_ID_XY SDLK_PLUS 0x14 0x2b +

When I edit my keymap.dat file to read...

ITEM_ID_MINUS SDLK_PLUS 0x14 0x5e +

and I rerun the emulator with the "-keymap" switch and "-verbose" I get...

Build version: 0.118 (Aug 24 2007)
Build architecure: SDLMAME_ARCH=
Build defines: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 LSB_FIRST=1 NDEBUG=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=1211 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=1 __GNUC_PATCHLEVEL__=2 __VERSION__="4.1.2 20061115 (prerelease) (SUSE Linux)"
Compiler defines B: __unix__=1 __i386__=1
SDL Device Driver : x11
SDL Monitor Dimensions: 1280 x 1024
Using SDL single-window soft driver (SDL 1.2)
Keymap: Start reading keymap_file keymap.dat
Keymap: Mapped <SDLK_PLUS> to <ITEM_ID_MINUS> with ui-text <+>
Keymap: Mapped <SDLK_PLUS> to <ITEM_ID_MINUS> with ui-text <+>
Keymap: Processed 3 lines
Input: Adding Kbd #1: System keyboard
Input: Adding Mouse #1: System mouse
Joystick: Start initialization
Joystick: End initialization
Input: Autoenabling mouse due to presence of a mouse

and when I press the same key immediately right of my "0" key (marked "+" on my keyboard but "-" on a QWERTY board) I still get a "-" on the screen.

A long, but I hope accurate description.


Joined: Feb 2007
Posts: 507
C
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 507
Thanks for your detailed answer.
Originally Posted By ionmich
When I start the coco3 emulator with no "-keymap" switch and hit the key immediately right of my "0" key (marked "+" on my keyboard but "-" on a QWERTY board) I get a "-" on the screen.

Do disable keymap support, you should use "-nokeymap".
Originally Posted By ionmich

When I edit my keymap.dat file to read...

ITEM_ID_MINUS SDLK_PLUS 0x14 0x5e +

That is the right entry. You are remapping your keyboard to QUERTY.
Originally Posted By ionmich

Keymap: Start reading keymap_file keymap.dat
Keymap: Mapped <SDLK_PLUS> to <ITEM_ID_MINUS> with ui-text <+>
Keymap: Mapped <SDLK_PLUS> to <ITEM_ID_MINUS> with ui-text <+>
Keymap: Processed 3 lines

This is correct as well.
Originally Posted By ionmich

and when I press the same key immediately right of my "0" key (marked "+" on my keyboard but "-" on a QWERTY board) I still get a "-" on the screen.

This is correct as well. Within the coco driver, QWERTY "-" (SDLK_MINUS) is mapped to "-":
Code:
	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(':') PORT_CHAR('*')
	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(';') PORT_CHAR('+')
	PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
	PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=') PORT_CHAR('_')
	PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
	PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')

This mapping is however different to what http://www.coco25.com/wiki/images/7/7d/COCO-CM8.GIF
shows for the two keys to the right of "0".

What is done above is that a QWERTY keyboard is mapped to the layout of the coco3 keyboard.

Actually, with a french/german/swedish keyboard, the following mappings need to be done to arrive at a coco3 key:

german y ==> QWERTY z ==> coco3 z
german - ==> QWERTY / ==> coco3 /

In order to map the slash, you have to use testkeys, press the key to the left of "right shift" and change "MAME_XY" to "ITEM_ID_SLASH".

To map z->y and y->z use
Code:
ITEM_ID_Y SDLK_z 0x00 0x00 Y
ITEM_ID_Z SDLK_y 0x00 0x00 Z


Joined: Aug 2007
Posts: 17
I
ionmich Offline OP
Member
OP Offline
Member
I
Joined: Aug 2007
Posts: 17
Following your detailed instructions I have been able to successfully re-map some keys. But one problem still evades me. I should first explain that the keyboard I am working with is an oddball, a compact. There is a key marked "' *" (QUOTE, ASTERISK) that is three positions to the right of the "P" key. When pressed in the CoCo emulator it produces two characters SIMULTANEOUSLY , ";/" (a semicolon and a slash). When shifted, it produces a "+?". "teskeys" tells me it is SDLK_QUOTE. If I assign another key to it as with...

ITEM_ID_M SDLK_QUOTE

...then it produces three characters in a row ";m/" and when shifted "+M?". In addition the characters ";", "/", "+", and "?" appear to be un-assignable to any other key.

Polling the keystrokes from OS-9 running in the CoCo emulator I get decimal 59,109,47 and 43,77,63 ASCII values.

Now I know absolutely nothing about C programming, but it seems to me that to correct this problem I will have to change the CoCo keyboard driver in src/mess/drivers/coco.c and recompile. Can you confirm this?

Thanks.

Joined: Feb 2007
Posts: 507
C
Senior Member
Offline
Senior Member
C
Joined: Feb 2007
Posts: 507
Originally Posted By ionmich
Following your detailed instructions I have been able to successfully re-map some keys. But one problem still evades me. I should first explain that the keyboard I am working with is an oddball, a compact. There is a key marked "' *" (QUOTE, ASTERISK) that is three positions to the right of the "P" key. When pressed in the CoCo emulator it produces two characters SIMULTANEOUSLY , ";/" (a semicolon and a slash). When shifted, it produces a "+?". "teskeys" tells me it is SDLK_QUOTE. If I assign another key to it as with...

ITEM_ID_M SDLK_QUOTE

...then it produces three characters in a row ";m/" and when shifted "+M?". In addition the characters ";", "/", "+", and "?" appear to be un-assignable to any other key.


Looks like you are assigning multiple ITEM_IDs to one SDLK.

OK. Step by Step. I am doing this on a german keyboard. I am now using the key labeled "+" on my keyboard (2nd to the left of P). Testkeys will report SDLK_PLUS for this key. I will start with an empty keymap. I add the following line to it:
Code:
ITEM_ID_X SDLK_PLUS 0x00 0x00 +


In mess, pressing "+" on my keyboard now gives me an "X". But the X key will not work any longer.

Now I add one line and the file looks like:

Code:
ITEM_ID_X SDLK_PLUS 0x00 0x00 +
ITEM_ID_A SDLK_PLUS 0x00 0x00 +


Pressing "+" now gives "XA" in mess. "A" and "X" will not work any longer. I hope the principle is clear now: We have a fixed list of ITEM_IDs and for each ITEM_ID specify to what SDLK it is mapped. Not the other way round.

At the end of the mapping exercise you need to have a -mathematically spoken- bijective mapping. Each ITEM_ID is assigned to one and only one SDLK.

The easiest and most time consuming way may be use testkeys to record each and every keystroke of your keyboard pressing keys from top-left to bottom-right:

testkeys > keys.txt

Using an editor than manually map each SDLK to an ITEM_ID. The defined ITEM_IDs can be found in src/osd/sdl/input.c in the kt_table initialization. They are the first entry following "KT_ENTRYX(":

Code:
	KTT_ENTRY0(  OPENBRACE,	LEFTBRACKET,		0xdb, 	'[',	"OPENBRACE" ),


This translates into an keymap entry:
Code:
ITEM_ID_OPENBRACE SDLK_LEFTBRACKET 0x00 0x00 OPENBRACE


@RB: Can you add this to the documentation. For the time being as raw as it is or as a link to this thread?

Kind regards,

couriersud

Page 2 of 3 1 2 3

Link Copied to Clipboard
Who's Online Now
2 members (Praxis, nerd4gw), 24 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,132
Posts119,651
Members5,029
Most Online890
Jan 17th, 2020
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com