-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
…ggle keys. Better naming of keys.
src/mame/drivers/hp9845.cpp
Outdated
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("ö Ö") // Ö |
There was a problem hiding this comment.
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.
src/mame/drivers/hp9845.cpp
Outdated
case 2: // Auto st | ||
popmessage("AUTO ST %s", BIT(m_io_key0->read(), 17) ? "ON" : "OFF"); | ||
break; | ||
} |
There was a problem hiding this comment.
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.
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?
What is your preference w.r.t. these options, please? I'm favoring the 2nd one, needless to say.. Thanks. |
Hi, I've added the support for layout LEDs to report the state of latching keys. |
There was a problem hiding this 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.
src/mame/drivers/hp9845.cpp
Outdated
|
||
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) // Ä |
There was a problem hiding this comment.
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.
src/mame/drivers/hp9845.cpp
Outdated
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) // Ü |
There was a problem hiding this comment.
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.
src/mame/drivers/hp9845.cpp
Outdated
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('?') // ß ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise.
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... :) |
|
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