mirror of
https://github.com/holub/mame
synced 2025-05-22 05:38:52 +03:00
(MESS) apple3: hooked up modifier keys [R. Belmont]
This commit is contained in:
parent
7bf568d972
commit
049c4db019
@ -171,8 +171,8 @@ static INPUT_PORTS_START( apple3 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Control") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Open Apple") PORT_CODE(KEYCODE_LALT)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Solid Apple") PORT_CODE(KEYCODE_RALT)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
@ -119,15 +119,40 @@ READ8_MEMBER(apple3_state::apple3_c0xx_r)
|
||||
|
||||
switch(offset)
|
||||
{
|
||||
/* keystrobe */
|
||||
case 0x00: case 0x01: case 0x02: case 0x03:
|
||||
case 0x04: case 0x05: case 0x06: case 0x07:
|
||||
result = AY3600_keydata_strobe_r(machine());
|
||||
break;
|
||||
|
||||
/* modifier keys */
|
||||
case 0x08: case 0x09: case 0x0A: case 0x0B:
|
||||
case 0x0C: case 0x0D: case 0x0E: case 0x0F:
|
||||
/* modifier keys */
|
||||
result = 0x7d;
|
||||
{
|
||||
UINT8 tmp = AY3600_keymod_r(machine());
|
||||
|
||||
result = 0x7e;
|
||||
if (tmp & AY3600_KEYMOD_SHIFT)
|
||||
{
|
||||
result &= ~0x02;
|
||||
}
|
||||
if (tmp & AY3600_KEYMOD_CONTROL)
|
||||
{
|
||||
result &= ~0x04;
|
||||
}
|
||||
if (tmp & AY3600_KEYMOD_CAPSLOCK)
|
||||
{
|
||||
result &= ~0x08;
|
||||
}
|
||||
if (tmp & AY3600_KEYMOD_COMMAND)
|
||||
{
|
||||
result &= ~0x10;
|
||||
}
|
||||
if (tmp & AY3600_KEYMOD_OPTION)
|
||||
{
|
||||
result &= ~0x20;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x10: case 0x11: case 0x12: case 0x13:
|
||||
|
@ -264,17 +264,6 @@ static const unsigned char ay3600_key_remap_2e[2][9*8][4] =
|
||||
|
||||
#define AY3600_KEYS_LENGTH 128
|
||||
|
||||
// IIgs keymod flags
|
||||
#define A2_KEYMOD_SHIFT 1
|
||||
#define A2_KEYMOD_CONTROL 2
|
||||
#define A2_KEYMOD_CAPSLOCK 4
|
||||
#define A2_KEYMOD_REPEAT 8
|
||||
#define A2_KEYMOD_KEYPAD 0x10
|
||||
#define A2_KEYMOD_MODLATCH 0x20
|
||||
#define A2_KEYMOD_COMMAND 0x40
|
||||
#define A2_KEYMOD_OPTION 0x80
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
HELPER FUNCTIONS
|
||||
@ -327,7 +316,7 @@ int AY3600_init(running_machine &machine)
|
||||
state->m_keywaiting = 0;
|
||||
state->m_keycode = 0;
|
||||
state->m_keystilldown = 0;
|
||||
state->m_keymodreg = A2_KEYMOD_CAPSLOCK; // caps lock on
|
||||
state->m_keymodreg = AY3600_KEYMOD_CAPSLOCK; // caps lock on
|
||||
|
||||
state->m_last_key = 0xff; /* necessary for special repeat key behaviour */
|
||||
state->m_last_key_unmodified = 0xff; /* necessary for special repeat key behaviour */
|
||||
@ -370,13 +359,13 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
{
|
||||
caps_lock = 1;
|
||||
set_led_status(machine,1,1);
|
||||
state->m_keymodreg |= A2_KEYMOD_CAPSLOCK;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_CAPSLOCK;
|
||||
}
|
||||
else
|
||||
{
|
||||
caps_lock = 0;
|
||||
set_led_status(machine,1,0);
|
||||
state->m_keymodreg &= ~A2_KEYMOD_CAPSLOCK;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_CAPSLOCK;
|
||||
}
|
||||
|
||||
switchkey = A2_KEY_NORMAL;
|
||||
@ -385,42 +374,42 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
if (state->apple2_pressed_specialkey(SPECIALKEY_SHIFT))
|
||||
{
|
||||
switchkey |= A2_KEY_SHIFT;
|
||||
state->m_keymodreg |= A2_KEYMOD_SHIFT;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_SHIFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_keymodreg &= ~A2_KEYMOD_SHIFT;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_SHIFT;
|
||||
}
|
||||
|
||||
/* control key check - only one control key on the left side on the Apple */
|
||||
if (state->apple2_pressed_specialkey(SPECIALKEY_CONTROL))
|
||||
{
|
||||
switchkey |= A2_KEY_CONTROL;
|
||||
state->m_keymodreg |= A2_KEYMOD_CONTROL;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_CONTROL;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_keymodreg &= ~A2_KEYMOD_CONTROL;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_CONTROL;
|
||||
}
|
||||
|
||||
/* apple key check */
|
||||
if (state->apple2_pressed_specialkey(SPECIALKEY_BUTTON0))
|
||||
{
|
||||
state->m_keymodreg |= A2_KEYMOD_COMMAND;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_COMMAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_keymodreg &= ~A2_KEYMOD_COMMAND;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_COMMAND;
|
||||
}
|
||||
|
||||
/* option key check */
|
||||
if (state->apple2_pressed_specialkey(SPECIALKEY_BUTTON1))
|
||||
{
|
||||
state->m_keymodreg |= A2_KEYMOD_OPTION;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_OPTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_keymodreg &= ~A2_KEYMOD_OPTION;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_OPTION;
|
||||
}
|
||||
|
||||
/* reset key check */
|
||||
@ -445,7 +434,7 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
/* run through real keys and see what's being pressed */
|
||||
num_ports = a2_has_keypad(state) ? 9 : 7;
|
||||
|
||||
state->m_keymodreg &= ~A2_KEYMOD_KEYPAD;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_KEYPAD;
|
||||
|
||||
for (port = 0; port < num_ports; port++)
|
||||
{
|
||||
@ -469,7 +458,7 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
|
||||
if (port == 8)
|
||||
{
|
||||
state->m_keymodreg |= A2_KEYMOD_KEYPAD;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_KEYPAD;
|
||||
}
|
||||
|
||||
/* prevent overflow */
|
||||
@ -491,7 +480,7 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
}
|
||||
}
|
||||
|
||||
state->m_keymodreg &= ~A2_KEYMOD_REPEAT;
|
||||
state->m_keymodreg &= ~AY3600_KEYMOD_REPEAT;
|
||||
|
||||
if (!any_key_pressed)
|
||||
{
|
||||
@ -514,7 +503,7 @@ static TIMER_CALLBACK(AY3600_poll)
|
||||
state->m_keywaiting = 1;
|
||||
state->m_keycode = state->m_last_key;
|
||||
state->m_keycode_unmodified = state->m_last_key_unmodified;
|
||||
state->m_keymodreg |= A2_KEYMOD_REPEAT;
|
||||
state->m_keymodreg |= AY3600_KEYMOD_REPEAT;
|
||||
}
|
||||
}
|
||||
state->m_keystilldown = (state->m_last_key_unmodified == state->m_keycode_unmodified);
|
||||
|
@ -3,12 +3,21 @@
|
||||
ay3600.h
|
||||
|
||||
Include file for AY3600 keyboard; used by Apple IIs
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef AY3600_H
|
||||
#define AY3600_H
|
||||
|
||||
// keymod flags returned by AY3600_keymod_r()
|
||||
#define AY3600_KEYMOD_SHIFT 1
|
||||
#define AY3600_KEYMOD_CONTROL 2
|
||||
#define AY3600_KEYMOD_CAPSLOCK 4
|
||||
#define AY3600_KEYMOD_REPEAT 8
|
||||
#define AY3600_KEYMOD_KEYPAD 0x10
|
||||
#define AY3600_KEYMOD_MODLATCH 0x20
|
||||
#define AY3600_KEYMOD_COMMAND 0x40
|
||||
#define AY3600_KEYMOD_OPTION 0x80
|
||||
|
||||
/*----------- defined in machine/ay3600.c -----------*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user