Separate MS7002 keyboard emulation; use Cyrillic key names and JCUKEN layout

This commit is contained in:
AJR 2018-04-24 17:13:37 -04:00
parent 0759197457
commit 56b9e79ef0
3 changed files with 245 additions and 7 deletions

View File

@ -12,7 +12,7 @@
To do: To do:
- character attributes - character attributes
- keyboard (MS7002) - improve keyboard response and add LED layout (MS7002)
Chips: Chips:
- DD5 - KR580WM80A (8080 clone) - CPU - DD5 - KR580WM80A (8080 clone) - CPU
@ -347,7 +347,7 @@ MACHINE_CONFIG_START(ms6102_state::ms6102)
MCFG_RIPPLE_COUNTER_STAGES(2) MCFG_RIPPLE_COUNTER_STAGES(2)
MCFG_RIPPLE_COUNTER_COUNT_OUT_CB(WRITE8(ms6102_state, kbd_uart_clock_w)) MCFG_RIPPLE_COUNTER_COUNT_OUT_CB(WRITE8(ms6102_state, kbd_uart_clock_w))
MCFG_DEVICE_ADD("keyboard", VT100_KEYBOARD, 0) MCFG_DEVICE_ADD("keyboard", MS7002, 0)
MCFG_VT100_KEYBOARD_SIGNAL_OUT_CALLBACK(DEVWRITELINE("589wa1", ay31015_device, write_si)) MCFG_VT100_KEYBOARD_SIGNAL_OUT_CALLBACK(DEVWRITELINE("589wa1", ay31015_device, write_si))
// serial connection to host // serial connection to host

View File

@ -8,6 +8,11 @@
bidirectional wire. The clock that runs the keyboard's UART and bidirectional wire. The clock that runs the keyboard's UART and
scan counters is multiplexed with the serial data signal. scan counters is multiplexed with the serial data signal.
MS7002 is a Soviet clone of the VT100 keyboard. It features a
bit-paired JCUKEN layout and Russian/Latin mode select keys, but
the codes it produces are mostly the same, as is the electrical
interface.
***************************************************************************/ ***************************************************************************/
#include "emu.h" #include "emu.h"
@ -17,7 +22,7 @@
//************************************************************************** //**************************************************************************
// DEVICE DEFINITIONS // VT100 KEYBOARD DEVICE
//************************************************************************** //**************************************************************************
DEFINE_DEVICE_TYPE(VT100_KEYBOARD, vt100_keyboard_device, "vt100_kbd", "VT100 Keyboard") DEFINE_DEVICE_TYPE(VT100_KEYBOARD, vt100_keyboard_device, "vt100_kbd", "VT100 Keyboard")
@ -94,7 +99,7 @@ static INPUT_PORTS_START(vt100_kbd)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
PORT_START("LINE7") PORT_START("LINE7")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_Y) PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_Y)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U") PORT_CODE(KEYCODE_U)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
@ -160,7 +165,12 @@ INPUT_PORTS_END
//------------------------------------------------- //-------------------------------------------------
vt100_keyboard_device::vt100_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) vt100_keyboard_device::vt100_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, VT100_KEYBOARD, tag, owner, clock) : vt100_keyboard_device(mconfig, VT100_KEYBOARD, tag, owner, clock)
{
}
vt100_keyboard_device::vt100_keyboard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
, m_signal_out_cb(*this) , m_signal_out_cb(*this)
, m_uart(*this, "uart") , m_uart(*this, "uart")
, m_speaker(*this, "beeper") , m_speaker(*this, "beeper")
@ -263,7 +273,7 @@ WRITE_LINE_MEMBER(vt100_keyboard_device::signal_line_w)
if (machine().time() > m_last_signal_change + attotime::from_usec(5)) if (machine().time() > m_last_signal_change + attotime::from_usec(5))
m_uart->write_si(m_signal_line); m_uart->write_si(m_signal_line);
if (m_uart->tbmt_r()) if (scan_enabled())
m_scan_counter->clock_w(state); m_scan_counter->clock_w(state);
if (state) if (state)
@ -282,7 +292,10 @@ WRITE_LINE_MEMBER(vt100_keyboard_device::signal_line_w)
m_speaker->set_state(BIT(data, 7)); m_speaker->set_state(BIT(data, 7));
if (BIT(data, 6)) if (BIT(data, 6))
{
m_scan_counter->reset_w(0); m_scan_counter->reset_w(0);
scan_start();
}
} }
} }
@ -329,3 +342,199 @@ WRITE8_MEMBER(vt100_keyboard_device::key_scan_w)
else else
m_last_scan = data; m_last_scan = data;
} }
//**************************************************************************
// MS7002 KEYBOARD DEVICE
//**************************************************************************
DEFINE_DEVICE_TYPE(MS7002, ms7002_device, "ms7002", "MS7002 Keyboard")
static INPUT_PORTS_START(ms7002)
PORT_START("LINE0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
PORT_START("LINE1")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa4" "3") PORT_CODE(KEYCODE_F3)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa4" "4") PORT_CODE(KEYCODE_F4)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x92\xd0\x92\xd0\x9e\xd0\x94") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad ,") PORT_CODE(KEYCODE_PLUS_PAD)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
PORT_START("LINE2")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9b\xd0\x90\xd0\xa2") // ЛАТ = латинские
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa4" "1") PORT_CODE(KEYCODE_F1)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa4" "2") PORT_CODE(KEYCODE_F2)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
PORT_START("LINE3")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('_') // note that this does NOT double as Ъ
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x97\xd0\x91") PORT_CODE(KEYCODE_DEL) // ЗБ = забой
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa0\xd0\x92") PORT_CODE(KEYCODE_F6) // ПРВ = перерыв
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x92\xd0\xa8") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08) // ВШ = возврат на шаг
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
PORT_START("LINE4")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x92\xd0\x9a") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(0x0d) // ВК = возврат каретки
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa9 ]") PORT_CODE(KEYCODE_O) PORT_CHAR('}') PORT_CHAR(']')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa7 \xc2\xac") PORT_CODE(KEYCODE_X) PORT_CHAR(0x203e, '~') PORT_CHAR(0xac, '^')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR(';') PORT_CHAR('+')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=')
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('0')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f\xd0\xa1") PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(0x0a) // ПС = перевод строки
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("LINE5")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9f P") PORT_CODE(KEYCODE_G) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa8 [") PORT_CODE(KEYCODE_I) PORT_CHAR('{') PORT_CHAR('[')
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_NAME("\xd0\xa0\xd0\xa3\xd0\xa1") // РУС = русские
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xad \\") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('|') PORT_CHAR('\\')
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) // possibly Keypad 9
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('.') PORT_CHAR('>')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('/') PORT_CHAR('?')
PORT_START("LINE6")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9e O") PORT_CODE(KEYCODE_J) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x98 I") PORT_CODE(KEYCODE_B) PORT_CHAR('i') PORT_CHAR('I')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR(')')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('8') PORT_CHAR('(')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9b L") PORT_CODE(KEYCODE_K) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xae @") PORT_CODE(KEYCODE_STOP) PORT_CHAR('`') PORT_CHAR('@')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RALT) PORT_CHAR(',') PORT_CHAR('<')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9c M") PORT_CODE(KEYCODE_V) PORT_CHAR('m') PORT_CHAR('M')
PORT_START("LINE7")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xab Y") PORT_CODE(KEYCODE_S) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa3 U") PORT_CODE(KEYCODE_E) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('7') PORT_CHAR('\'')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('6') PORT_CHAR('&')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9a K") PORT_CODE(KEYCODE_R) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x99 J") PORT_CODE(KEYCODE_Q) PORT_CHAR('j') PORT_CHAR('J')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x9d N") PORT_CODE(KEYCODE_Y) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
PORT_START("LINE8")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa2 T") PORT_CODE(KEYCODE_N) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa0 R") PORT_CODE(KEYCODE_H) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 \xc2\xa4") PORT_CODE(KEYCODE_5) PORT_CHAR('4') PORT_CHAR(0xa4, '$')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('5') PORT_CHAR('%')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x93 G") PORT_CODE(KEYCODE_U) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa5 H") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('h') PORT_CHAR('H')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x91 B") PORT_CODE(KEYCODE_COMMA) PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x96 V") PORT_CODE(KEYCODE_COLON) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16)
PORT_START("LINE9")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x92 W") PORT_CODE(KEYCODE_D) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x95 E") PORT_CODE(KEYCODE_T) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('3') PORT_CHAR('#')
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('2') PORT_CHAR('"')
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa4 F") PORT_CODE(KEYCODE_A) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x94 D") PORT_CODE(KEYCODE_L) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xac X") PORT_CODE(KEYCODE_M) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa6 C") PORT_CODE(KEYCODE_W) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03)
PORT_START("LINEA")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xaf Q") PORT_CODE(KEYCODE_Z) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('1') PORT_CHAR('!')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x90\xd0\xa0" "2") PORT_CODE(KEYCODE_ESC) PORT_CHAR(0x1b) // АР2 = авторегистр 2
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa2\xd0\x90\xd0\x91") PORT_CODE(KEYCODE_TAB) PORT_CHAR(0x09) // ТАБ = табуляция
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x90 A") PORT_CODE(KEYCODE_F) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa1 S") PORT_CODE(KEYCODE_C) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa1\xd0\xa2\xd0\x9e\xd0\x9f") PORT_CODE(KEYCODE_LALT) // СТОП
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x97 Z") PORT_CODE(KEYCODE_P) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a)
PORT_START("LINEB")
PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa3\xd0\xa1\xd0\xa2") PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F1) ) // УСТ = установка
PORT_START("LINEC")
PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\xa3\xd0\x9f\xd0\xa0") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2) // УПР = управляющий
PORT_START("LINED")
PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xd0\x92\xd0\xa0") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // ВР = верхний регистр
PORT_START("LINEE")
PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // maybe
PORT_START("LINEF")
PORT_BIT(0x7F, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) // Always return 0x7f on last scan line
INPUT_PORTS_END
//-------------------------------------------------
// ms7002_device - constructor
//-------------------------------------------------
ms7002_device::ms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: vt100_keyboard_device(mconfig, MS7002, tag, owner, clock)
, m_scan_enable(false)
{
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(ms7002_device::device_add_mconfig)
vt100_keyboard_device::device_add_mconfig(config);
MCFG_DEVICE_MODIFY("uart")
MCFG_AY31015_WRITE_TBMT_CB(WRITELINE(ms7002_device, scan_disable_w))
MACHINE_CONFIG_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor ms7002_device::device_input_ports() const
{
return INPUT_PORTS_NAME(ms7002);
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void ms7002_device::device_start()
{
vt100_keyboard_device::device_start();
save_item(NAME(m_scan_enable));
}
//-------------------------------------------------
// scan_disable_w - suspend scan count once
// keycode is being transmitted
//-------------------------------------------------
WRITE_LINE_MEMBER(ms7002_device::scan_disable_w)
{
if (!state)
m_scan_enable = false;
}

View File

@ -43,14 +43,20 @@ public:
DECLARE_WRITE_LINE_MEMBER(signal_line_w); DECLARE_WRITE_LINE_MEMBER(signal_line_w);
protected: protected:
vt100_keyboard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
virtual void device_resolve_objects() override; virtual void device_resolve_objects() override;
virtual void device_start() override; virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override; virtual ioport_constructor device_input_ports() const override;
virtual bool scan_enabled() const { return m_uart->tbmt_r(); }
virtual void scan_start() { }
private: private:
// internal helpers // internal helpers
DECLARE_WRITE_LINE_MEMBER(signal_out_w); DECLARE_WRITE_LINE_MEMBER(signal_out_w);
DECLARE_WRITE_LINE_MEMBER(scan_disable_w);
DECLARE_WRITE8_MEMBER(key_scan_w); DECLARE_WRITE8_MEMBER(key_scan_w);
devcb_write_line m_signal_out_cb; devcb_write_line m_signal_out_cb;
@ -70,7 +76,30 @@ private:
u8 m_last_scan; u8 m_last_scan;
}; };
// device type definition // ======================> ms7002_device
class ms7002_device : public vt100_keyboard_device
{
public:
// construction/destruction
ms7002_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
protected:
virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual bool scan_enabled() const override { return m_scan_enable; }
virtual void scan_start() override { m_scan_enable = true; }
private:
DECLARE_WRITE_LINE_MEMBER(scan_disable_w);
bool m_scan_enable;
};
// device type definitions
DECLARE_DEVICE_TYPE(VT100_KEYBOARD, vt100_keyboard_device) DECLARE_DEVICE_TYPE(VT100_KEYBOARD, vt100_keyboard_device)
DECLARE_DEVICE_TYPE(MS7002, ms7002_device)
#endif // MAME_MACHINE_VT100_KBD_H #endif // MAME_MACHINE_VT100_KBD_H