Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HP9845: improved keyboard mapping & German layout #2351

Merged
merged 11 commits into from
Jun 5, 2017

Conversation

fulivi
Copy link
Contributor

@fulivi fulivi commented May 31, 2017

Hi,

this PR is for a set of changes to HP9845 emulation.
I & A.Kueckes have improved the keyboard mapping & added the German layout of keyboard.
We also added pop-up messages to report the state of the 3 "toggle" keys (AUTOST, PRTALL & SHIFT LOCK) whenever it changes.
The variants with German keyboard require a different ROM set, I'm mailing them to the usual "code" email.
Thanks.
--F.Ulivi

PORT_BIT(BIT_MASK(31) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('y') PORT_CHAR('Y') // Y

PORT_MODIFY("KEY1")
PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME("ö Ö") // Ö
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the wrong way to implement this and will stop natural keyboard, UI paste, and lua keypost from working. You need to supply the Unicode value of the character(s) with the PORT_CHAR macro.

See examples in the Sun Swedish keyboard and Amiga German keyboard input matrix definitions.

case 2: // Auto st
popmessage("AUTO ST %s", BIT(m_io_key0->read(), 17) ? "ON" : "OFF");
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the output system for this, not popmessage, and define an XML layout to display the keyboard LEDs on-screen.

@fulivi
Copy link
Contributor Author

fulivi commented May 31, 2017

Ok, I think I got the first one right. I looked at Sun/Amiga keyboards and added PORT_CHAR macros. Is this what you meant?
Regarding the second one (pop-ups) the problem is that the real hw has no state LEDs. Those 3 keys have a mechanical latch and you can always tell the state just by looking at them.
So, there are 3 options here:

  1. Take the pop-up code out and forget about it...
  2. Leave it there
  3. Implement a keyboard layout with different images for the latching keys.. not something that could be done in a flash

What is your preference w.r.t. these options, please? I'm favoring the 2nd one, needless to say..

Thanks.
--F.Ulivi

@fulivi
Copy link
Contributor Author

fulivi commented Jun 4, 2017

Hi,

I've added the support for layout LEDs to report the state of latching keys.
May I ask if I can keep the pop-ups as a compromise solution until we have a working layout with (fake) keyboard LEDs, please?
Thanks.
--F.Ulivi

Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The POPMESSAGE can stay until someone makes a layout with annunciators for key state. Please remove the redundant PORT_NAME in places where it's no different to what MAME makes from the PORT_CHAR characters.

Also, does the German keyboard have an AltGr key for accessing extra characters? If it does, you should assign this to PORT_CHAR(UCHAR_SHIFT_2) and add additional PORT_CHAR to keys that produce a different character in conjunction with AltGr.

The order of PORT_CHAR, assuming UCHAR_SHIFT_1 is Shift, and UCHAR_SHIFT_2 is AltGr, should be:

  • unshifted
  • Shift
  • AltGr
  • AltGr + Shift

The Amiga keyboards currently make the most use of this.


PORT_MODIFY("KEY1")
PORT_BIT(BIT_MASK(10) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME("ö Ö") PORT_CHAR(0x00f6) PORT_CHAR(0x00d6) // Ö
PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("ä Ä") PORT_CHAR(0x00e4) PORT_CHAR(0x00c4) // Ä
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to supply PORT_NAME when the name is the same as what MAME will generate from the combination of PORT_CHAR that you supply. Providing both adds risk of them getting out of sync.

PORT_BIT(BIT_MASK(23) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) // Backspace
PORT_BIT(BIT_MASK(24) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR(']') PORT_CHAR('@') // ] @
PORT_BIT(BIT_MASK(25) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') PORT_CHAR('|') // [ |
PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("ü Ü") PORT_CHAR(0x00fc) PORT_CHAR(0x00dc) // Ü
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one - the PORT_NAME is redundant and risks getting out-of-sync.

PORT_BIT(BIT_MASK(11) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') // 8 (
PORT_BIT(BIT_MASK(12) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') // 6 &
PORT_BIT(BIT_MASK(14) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') // 2 "
PORT_BIT(BIT_MASK(26) , IP_ACTIVE_HIGH , IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("ß ?") PORT_CHAR(0x00df) PORT_CHAR('?') // ß ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise.

@fulivi
Copy link
Contributor Author

fulivi commented Jun 5, 2017

Hi,

I think I'm starting to realize the difference between PORT_CHAR and PORT_NAME, something I always wondered but haven't investigated too much... :)
Is the code better like this?
The German keyboard of 9845 had no key like AltGr, just SHIFT & CONTROL modifiers with the usual "effects" to plain ASCII characters..
Thanks.
--F.Ulivi

@cuavas
Copy link
Member

cuavas commented Jun 5, 2017

PORT_CHAR describes the characters a key produces under normal text input circumstances. It's used by natural keyboard mode, UI paste and lua keypost to map characters to keystrokes. PORT_NAME is just that, a display name for the port in MAME menus, -listxml output, etc. If a port has one or more PORT_CHAR but no PORT_NAME then MAME will make a name from the PORT_CHAR values. This is usually quite suitable for alphanumeric keys.

@cuavas cuavas merged commit 3a2c296 into mamedev:master Jun 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants