mirror of
https://github.com/holub/mame
synced 2025-06-01 02:21:48 +03:00
490 lines
19 KiB
C
490 lines
19 KiB
C
/**********************************************************************
|
|
|
|
EC-1841 92-key keyboard emulation
|
|
|
|
Sends 9 non-standard scan codes (54..5C) and reassigns 3 standard
|
|
ones (2A, 36, 3A). EC-1841 BIOS converts scan codes into Cyrillic
|
|
by default; 'Lat' key (mapped to F11) switches it to Latin mode.
|
|
'Rus' (F12) switches back.
|
|
|
|
Copyright MESS Team.
|
|
Visit http://mamedev.org for licensing and usage restrictions.
|
|
|
|
*********************************************************************/
|
|
|
|
#include "kb_ec1841.h"
|
|
|
|
#define VERBOSE_DBG 0 /* general debug messages */
|
|
|
|
#define DBG_LOG(N,M,A) \
|
|
do { \
|
|
if(VERBOSE_DBG>=N) \
|
|
{ \
|
|
logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \
|
|
logerror A; \
|
|
} \
|
|
} while (0)
|
|
|
|
|
|
|
|
//**************************************************************************
|
|
// MACROS / CONSTANTS
|
|
//**************************************************************************
|
|
|
|
#define I8048_TAG "i8048"
|
|
|
|
|
|
|
|
//**************************************************************************
|
|
// DEVICE DEFINITIONS
|
|
//**************************************************************************
|
|
|
|
const device_type PC_KBD_EC_1841 = &device_creator<ec_1841_keyboard_device>;
|
|
|
|
|
|
//-------------------------------------------------
|
|
// ROM( ec_1841_keyboard )
|
|
//-------------------------------------------------
|
|
|
|
ROM_START( ec_1841_keyboard )
|
|
ROM_REGION( 0x400, I8048_TAG, 0 )
|
|
// XXX add P/N etc
|
|
ROM_LOAD( "1816be48.bin", 0x000, 0x400, CRC(e9abfe44) SHA1(1db430c72c2d007ea0b8ae2514ff15c96baba308) )
|
|
ROM_END
|
|
|
|
|
|
//-------------------------------------------------
|
|
// rom_region - device-specific ROM region
|
|
//-------------------------------------------------
|
|
|
|
const rom_entry *ec_1841_keyboard_device::device_rom_region() const
|
|
{
|
|
return ROM_NAME( ec_1841_keyboard );
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// ADDRESS_MAP( kb_io )
|
|
//-------------------------------------------------
|
|
|
|
static ADDRESS_MAP_START( ec_1841_keyboard_io, AS_IO, 8, ec_1841_keyboard_device )
|
|
AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w)
|
|
AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
|
|
AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
|
|
AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
|
|
ADDRESS_MAP_END
|
|
|
|
|
|
//-------------------------------------------------
|
|
// MACHINE_DRIVER( ec_1841_keyboard )
|
|
//-------------------------------------------------
|
|
|
|
static MACHINE_CONFIG_FRAGMENT( ec_1841_keyboard )
|
|
// XXX check
|
|
MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7)))
|
|
MCFG_CPU_IO_MAP(ec_1841_keyboard_io)
|
|
MACHINE_CONFIG_END
|
|
|
|
|
|
//-------------------------------------------------
|
|
// machine_config_additions - device-specific
|
|
// machine configurations
|
|
//-------------------------------------------------
|
|
|
|
machine_config_constructor ec_1841_keyboard_device::device_mconfig_additions() const
|
|
{
|
|
return MACHINE_CONFIG_NAME( ec_1841_keyboard );
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// INPUT_PORTS( ec_1841_keyboard )
|
|
//-------------------------------------------------
|
|
|
|
INPUT_PORTS_START( ec_1841_keyboard )
|
|
PORT_START("MD00")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 = Inf
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD01")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD02")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R)
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD03")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 0x5b = Rus
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD04")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD05")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD06")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD07")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD08")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?")
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD09")
|
|
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_O) PORT_CHAR('o') PORT_CHAR('O')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5c?") // 0x5c = YO
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD10")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD11")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?36?")
|
|
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_STOP) PORT_CHAR('.') PORT_CHAR('>')
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD12")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?3a?")
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x55
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD13")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 0x56
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD14")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR)
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 0x57 = Lat
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
|
|
PORT_START("MD15")
|
|
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
|
|
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
|
|
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x54
|
|
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) // 0x58 = R/L (L)
|
|
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
|
|
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
|
INPUT_PORTS_END
|
|
|
|
|
|
//-------------------------------------------------
|
|
// input_ports - device-specific input ports
|
|
//-------------------------------------------------
|
|
|
|
ioport_constructor ec_1841_keyboard_device::device_input_ports() const
|
|
{
|
|
return INPUT_PORTS_NAME( ec_1841_keyboard );
|
|
}
|
|
|
|
|
|
|
|
//**************************************************************************
|
|
// LIVE DEVICE
|
|
//**************************************************************************
|
|
|
|
//-------------------------------------------------
|
|
// ec_1841_keyboard_device - constructor
|
|
//-------------------------------------------------
|
|
|
|
ec_1841_keyboard_device::ec_1841_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
|
: device_t(mconfig, PC_KBD_EC_1841, "EC-1841 Keyboard", tag, owner, clock, "kb_ec1841", __FILE__),
|
|
device_pc_kbd_interface(mconfig, *this),
|
|
m_maincpu(*this, I8048_TAG),
|
|
m_md00(*this, "MD00"),
|
|
m_md01(*this, "MD01"),
|
|
m_md02(*this, "MD02"),
|
|
m_md03(*this, "MD03"),
|
|
m_md04(*this, "MD04"),
|
|
m_md05(*this, "MD05"),
|
|
m_md06(*this, "MD06"),
|
|
m_md07(*this, "MD07"),
|
|
m_md08(*this, "MD08"),
|
|
m_md09(*this, "MD09"),
|
|
m_md10(*this, "MD10"),
|
|
m_md11(*this, "MD11"),
|
|
m_md12(*this, "MD12"),
|
|
m_md13(*this, "MD13"),
|
|
m_md14(*this, "MD14"),
|
|
m_md15(*this, "MD15"),
|
|
m_bus(0xff),
|
|
m_p1(0xff),
|
|
m_p2(0xff),
|
|
m_q(1)
|
|
{
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// device_start - device-specific startup
|
|
//-------------------------------------------------
|
|
|
|
void ec_1841_keyboard_device::device_start()
|
|
{
|
|
set_pc_kbdc_device();
|
|
|
|
// state saving
|
|
save_item(NAME(m_bus));
|
|
save_item(NAME(m_p1));
|
|
save_item(NAME(m_p2));
|
|
save_item(NAME(m_q));
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// device_reset - device-specific reset
|
|
//-------------------------------------------------
|
|
|
|
void ec_1841_keyboard_device::device_reset()
|
|
{
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// clock_write -
|
|
//-------------------------------------------------
|
|
|
|
WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write )
|
|
{
|
|
DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state));
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// data_write -
|
|
//-------------------------------------------------
|
|
|
|
WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write )
|
|
{
|
|
DBG_LOG(1,0,( "%s: data write %d\n", tag(), state));
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// bus_w -
|
|
//-------------------------------------------------
|
|
|
|
WRITE8_MEMBER( ec_1841_keyboard_device::bus_w )
|
|
{
|
|
DBG_LOG(2,0,( "%s: bus_w %02x\n", tag(), data));
|
|
|
|
m_bus = data;
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// p1_r -
|
|
//-------------------------------------------------
|
|
|
|
READ8_MEMBER( ec_1841_keyboard_device::p1_r )
|
|
{
|
|
/*
|
|
|
|
bit description
|
|
|
|
0 -REQ IN
|
|
1 DATA IN
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
|
|
*/
|
|
|
|
UINT8 data = 0;
|
|
|
|
data |= clock_signal();
|
|
data |= data_signal() << 1;
|
|
|
|
DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data));
|
|
|
|
return data;
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// p1_w -
|
|
//-------------------------------------------------
|
|
|
|
WRITE8_MEMBER( ec_1841_keyboard_device::p1_w )
|
|
{
|
|
/*
|
|
bit description
|
|
|
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5 LED XXX
|
|
6 LED XXX
|
|
7 LED XXX
|
|
*/
|
|
DBG_LOG(1,0,( "%s: p1_w %02x\n", tag(), data));
|
|
|
|
m_p1 = data;
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// p2_w -
|
|
//-------------------------------------------------
|
|
|
|
WRITE8_MEMBER( ec_1841_keyboard_device::p2_w )
|
|
{
|
|
/*
|
|
bit description
|
|
|
|
0 -STROBE (to matrix mux)
|
|
1 XXX CLOCK out 1
|
|
2 XXX DATA out 1
|
|
3
|
|
4
|
|
5 XXX DATA out 2?
|
|
6 XXX CLOCK out 2?
|
|
7 XXX
|
|
*/
|
|
DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data));
|
|
|
|
m_pc_kbdc->data_write_from_kb(BIT(data, 2));
|
|
m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
|
|
|
|
m_p2 = data;
|
|
}
|
|
|
|
|
|
//-------------------------------------------------
|
|
// t1_r -
|
|
//-------------------------------------------------
|
|
|
|
READ8_MEMBER( ec_1841_keyboard_device::t1_r )
|
|
{
|
|
if (BIT(m_p2,0)) {
|
|
m_q = 1;
|
|
} else {
|
|
UINT8 sense = 0xff;
|
|
|
|
switch(m_bus & 15) {
|
|
case 0: sense &= m_md00->read(); break;
|
|
case 1: sense &= m_md01->read(); break;
|
|
case 2: sense &= m_md02->read(); break;
|
|
case 3: sense &= m_md03->read(); break;
|
|
case 4: sense &= m_md04->read(); break;
|
|
case 5: sense &= m_md05->read(); break;
|
|
case 6: sense &= m_md06->read(); break;
|
|
case 7: sense &= m_md07->read(); break;
|
|
case 8: sense &= m_md08->read(); break;
|
|
case 9: sense &= m_md09->read(); break;
|
|
case 10: sense &= m_md10->read(); break;
|
|
case 11: sense &= m_md11->read(); break;
|
|
case 12: sense &= m_md12->read(); break;
|
|
case 13: sense &= m_md13->read(); break;
|
|
case 14: sense &= m_md14->read(); break;
|
|
case 15: sense &= m_md15->read(); break;
|
|
}
|
|
m_q = BIT(sense, (m_bus >> 4) & 7);
|
|
}
|
|
|
|
DBG_LOG(1,0,( "%s: bus %02X t1_r %d\n", tag(), m_bus, m_q));
|
|
|
|
return m_q;
|
|
}
|