mirror of
https://github.com/holub/mame
synced 2025-06-05 04:16:28 +03:00
wy50: Preliminary keyboard emulation
This commit is contained in:
parent
5ac6046197
commit
aab4f0d2b0
@ -1216,6 +1216,7 @@ function linkProjects_mame_mess(_target, _subtarget)
|
||||
"vtech",
|
||||
"wang",
|
||||
"wavemate",
|
||||
"wyse",
|
||||
"westinghouse",
|
||||
"xerox",
|
||||
"xussrpc",
|
||||
@ -3668,6 +3669,16 @@ files {
|
||||
MAME_DIR .. "src/mame/includes/jupiter.h",
|
||||
}
|
||||
|
||||
createMESSProjects(_target, _subtarget, "wyse")
|
||||
files {
|
||||
MAME_DIR .. "src/mame/drivers/wy100.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wy50.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wy85.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wyse.cpp",
|
||||
MAME_DIR .. "src/mame/machine/wy50kb.cpp",
|
||||
MAME_DIR .. "src/mame/machine/wy50kb.h",
|
||||
}
|
||||
|
||||
createMESSProjects(_target, _subtarget, "xerox")
|
||||
files {
|
||||
MAME_DIR .. "src/mame/drivers/xerox820.cpp",
|
||||
@ -3941,10 +3952,6 @@ files {
|
||||
MAME_DIR .. "src/mame/drivers/vp415.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/vsmilepro.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wicat.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wy100.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wy50.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wy85.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/wyse.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/xor100.cpp",
|
||||
MAME_DIR .. "src/mame/includes/xor100.h",
|
||||
MAME_DIR .. "src/mame/drivers/zms8085.cpp",
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:AJR
|
||||
/*******************************************************************************
|
||||
|
||||
Skeleton driver for Wyse WY-50 and similar display terminals.
|
||||
Preliminary driver for Wyse WY-50 and similar display terminals.
|
||||
|
||||
Wyse Technology introduced the WY-50 green screen terminal in the fall of
|
||||
1983. It was soon followed by the WY-75 ANSI X3.64-compatible terminal and
|
||||
@ -28,6 +28,7 @@
|
||||
#include "cpu/mcs51/mcs51.h"
|
||||
#include "machine/er1400.h"
|
||||
#include "machine/mc2661.h"
|
||||
#include "machine/wy50kb.h"
|
||||
#include "video/scn2674.h"
|
||||
#include "screen.h"
|
||||
|
||||
@ -37,6 +38,7 @@ public:
|
||||
wy50_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_keyboard(*this, "keyboard")
|
||||
, m_earom(*this, "earom")
|
||||
, m_pvtc(*this, "pvtc")
|
||||
, m_sio(*this, "sio")
|
||||
@ -71,6 +73,7 @@ private:
|
||||
void row_buffer_map(address_map &map);
|
||||
|
||||
required_device<mcs51_cpu_device> m_maincpu;
|
||||
required_device<wy50_keyboard_device> m_keyboard;
|
||||
required_device<er1400_device> m_earom;
|
||||
required_device<scn2672_device> m_pvtc;
|
||||
required_device<mc2661_device> m_sio;
|
||||
@ -107,6 +110,9 @@ void wy50_state::machine_reset()
|
||||
{
|
||||
keyboard_w(0);
|
||||
earom_w(0);
|
||||
|
||||
m_sio->cts_w(0);
|
||||
m_sio->dsr_w(0);
|
||||
}
|
||||
|
||||
u8 wy50_state::pvtc_videoram_r(offs_t offset)
|
||||
@ -117,6 +123,12 @@ u8 wy50_state::pvtc_videoram_r(offs_t offset)
|
||||
|
||||
SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character)
|
||||
{
|
||||
// Attribute bit 0 = Dim
|
||||
// Attribute bit 1 = Blink
|
||||
// Attribute bit 2 = Blank
|
||||
// Attribute bit 3 = Underline
|
||||
// Attribute bit 4 = Reverse video
|
||||
|
||||
const bool attr = (charcode & 0xe0) == 0x80;
|
||||
const bool prot = (charcode & 0xe0) > 0x80 && !m_font2;
|
||||
if (attr)
|
||||
@ -124,24 +136,27 @@ SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character)
|
||||
else if (x == 0)
|
||||
m_cur_attr = m_last_row_attr;
|
||||
|
||||
u16 dots;
|
||||
if (attr || (BIT(m_cur_attr, 1) && blink) || BIT(m_cur_attr, 2))
|
||||
dots = 0;
|
||||
else if (BIT(m_cur_attr, 3) && ul)
|
||||
dots = 0x3ff;
|
||||
else
|
||||
dots = m_chargen[(charcode & (m_font2 ? 0xff : 0x7f)) << 4 | linecount] << 2;
|
||||
|
||||
u16 dots = 0;
|
||||
if (!attr)
|
||||
{
|
||||
if (BIT(m_cur_attr, 4))
|
||||
dots = ~dots;
|
||||
if (prot && m_rev_prot)
|
||||
// Blinking suppresses underline but blank attribute doesn't
|
||||
if (!BIT(m_cur_attr, 1) || !blink)
|
||||
{
|
||||
// Shift register load inhibited by blanking conditions or underline
|
||||
if (BIT(m_cur_attr, 3) && ul)
|
||||
dots = 0x3ff;
|
||||
else if (!BIT(m_cur_attr, 2))
|
||||
dots = m_chargen[(charcode & (m_font2 ? 0xff : 0x7f)) << 4 | linecount] << 2;
|
||||
}
|
||||
|
||||
// Reverse video for non-attribute characters (XOR of two conditions)
|
||||
if (BIT(m_cur_attr, 4) != (prot && m_rev_prot))
|
||||
dots = ~dots;
|
||||
}
|
||||
if (cursor)
|
||||
dots = ~dots;
|
||||
|
||||
// Apply dimming conditions
|
||||
const rgb_t fg = BIT(m_cur_attr, 0) || (prot && !m_rev_prot) ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white();
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
@ -186,12 +201,25 @@ u8 wy50_state::rbreg_r()
|
||||
|
||||
void wy50_state::keyboard_w(u8 data)
|
||||
{
|
||||
// Bit 0 = J3-6
|
||||
// Bit 1 = J3-5
|
||||
// Bit 2 = J3-4
|
||||
// Bit 3 = J3-7
|
||||
// Bit 4 = J3-10
|
||||
// Bit 5 = J3-9
|
||||
// Bit 6 = J3-8
|
||||
// Bit 7 = /HSYNC CLAMP
|
||||
m_keyboard->scan_w(data & 0x7f);
|
||||
}
|
||||
|
||||
void wy50_state::earom_w(u8 data)
|
||||
{
|
||||
// Bit 0 = EAROM D
|
||||
// Bit 1 = EAROM CLK
|
||||
// Bit 2 = EAROM C3
|
||||
// Bit 3 = EAROM C2
|
||||
// Bit 4 = EAROM C1
|
||||
// Bit 5 = UPCHAR/NORM
|
||||
|
||||
m_earom->clock_w(BIT(data, 1));
|
||||
m_earom->c3_w(BIT(data, 2));
|
||||
m_earom->c2_w(BIT(data, 3));
|
||||
@ -205,7 +233,7 @@ u8 wy50_state::p1_r()
|
||||
// P1.0 = AUX RDY
|
||||
// P1.1 = NVD OUT
|
||||
// P1.4 = KEY (inverted, active high)
|
||||
return 0xed | (m_earom->data_r() << 1);
|
||||
return 0xed | (m_earom->data_r() << 1) | (m_keyboard->sense_r() ? 0x00 : 0x10);
|
||||
}
|
||||
|
||||
void wy50_state::p1_w(u8 data)
|
||||
@ -259,6 +287,8 @@ void wy50_state::wy50(machine_config &config)
|
||||
m_maincpu->port_in_cb<1>().set(FUNC(wy50_state::p1_r));
|
||||
m_maincpu->port_out_cb<1>().set(FUNC(wy50_state::p1_w));
|
||||
|
||||
WY50_KEYBOARD(config, m_keyboard);
|
||||
|
||||
ER1400(config, m_earom);
|
||||
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
|
187
src/mame/machine/wy50kb.cpp
Normal file
187
src/mame/machine/wy50kb.cpp
Normal file
@ -0,0 +1,187 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:AJR
|
||||
/*******************************************************************************
|
||||
|
||||
The WY-50, like other early Wyse products, has a detachable non-serial
|
||||
keyboard with a custom round connector over which are passed 4 column
|
||||
select bits (S6-S3), 3 row select bits (S2-S0) and one active-low return
|
||||
line. The WY-1100 WysePC has a very similar key matrix.
|
||||
|
||||
1 Ground
|
||||
2 Ground
|
||||
3 +5 Volts
|
||||
4 S2
|
||||
5 S1
|
||||
6 S0
|
||||
7 S3
|
||||
8 S5
|
||||
9 S6
|
||||
10 S4
|
||||
11 Keyboard Data
|
||||
12 Not Used
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/wy50kb.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(WY50_KEYBOARD, wy50_keyboard_device, "wy50kb", "WY-50 Keyboard")
|
||||
|
||||
wy50_keyboard_device::wy50_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, WY50_KEYBOARD, tag, owner, clock)
|
||||
, m_key_matrix(*this, "COL%u", 0U)
|
||||
, m_address(0)
|
||||
{
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START(wy50kb)
|
||||
PORT_START("COL0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(INSERT)) PORT_NAME("Ins Char Ins Line")
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('*') PORT_CODE(KEYCODE_8)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK)) PORT_NAME("Clr Line Clr Scrn")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CODE(KEYCODE_DOWN)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(',') PORT_CHAR('<') PORT_CODE(KEYCODE_COMMA)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H)
|
||||
|
||||
PORT_START("COL1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CODE(KEYCODE_Y)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('&') PORT_CODE(KEYCODE_7)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Set Up")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G)
|
||||
|
||||
PORT_START("COL2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CODE(KEYCODE_T)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CODE(KEYCODE_1_PAD)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('^') PORT_CODE(KEYCODE_6)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F)
|
||||
|
||||
PORT_START("COL3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x09) PORT_CODE(KEYCODE_TAB)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(' ') PORT_CODE(KEYCODE_SPACE)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back Space") PORT_CHAR(0x08) PORT_CODE(KEYCODE_BACKSPACE)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CODE(KEYCODE_F10)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CODE(KEYCODE_F1)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('z') PORT_CHAR('Z') PORT_CODE(KEYCODE_Z)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_CODE(KEYCODE_LCONTROL)
|
||||
|
||||
PORT_START("COL4")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CODE(KEYCODE_F5)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F16)) PORT_CODE(KEYCODE_F16)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CODE(KEYCODE_F12)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_F4)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_CODE(KEYCODE_F9)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_F3)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CODE(KEYCODE_F7)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CODE(KEYCODE_F6)
|
||||
|
||||
PORT_START("COL5")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CODE(KEYCODE_R)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CODE(KEYCODE_5_PAD)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_NAME("Del Char Del Line")
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L)
|
||||
|
||||
PORT_START("COL6")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CODE(KEYCODE_E)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Repl Ins")
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('$') PORT_CODE(KEYCODE_4)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CODE(KEYCODE_ENTER_PAD)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('v') PORT_CHAR('V') PORT_CODE(KEYCODE_V)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D)
|
||||
|
||||
PORT_START("COL7")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CODE(KEYCODE_Q)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Func") PORT_CODE(KEYCODE_LALT)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('@') PORT_CODE(KEYCODE_2)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CHAR(0x1b) PORT_CODE(KEYCODE_ESC)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CODE(KEYCODE_F2)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A)
|
||||
|
||||
PORT_START("COL8")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Next Page Prev Page") PORT_CODE(KEYCODE_PGDN)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('[') PORT_CHAR('{') PORT_CODE(KEYCODE_OPENBRACE)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('_') PORT_CODE(KEYCODE_MINUS)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR(':') PORT_CODE(KEYCODE_COLON)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(']') PORT_CHAR('}') PORT_CODE(KEYCODE_CLOSEBRACE)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\'') PORT_CHAR('"') PORT_CODE(KEYCODE_QUOTE)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL9")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CODE(KEYCODE_W)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CODE(KEYCODE_F8)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('`') PORT_CHAR('~') PORT_CODE(KEYCODE_BACKSLASH) // to right of ]
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('c') PORT_CODE(KEYCODE_C)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S)
|
||||
|
||||
PORT_START("COL10")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F13)) PORT_CODE(KEYCODE_F13)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('p') PORT_CHAR('P') PORT_CODE(KEYCODE_P)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CODE(KEYCODE_3_PAD)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('=') PORT_CHAR('+') PORT_CODE(KEYCODE_EQUALS)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F14)) PORT_CODE(KEYCODE_F14)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F15)) PORT_CODE(KEYCODE_F15)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_CODE(KEYCODE_F11)
|
||||
|
||||
PORT_START("COL11")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('i') PORT_CHAR('I') PORT_CODE(KEYCODE_I)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CODE(KEYCODE_9_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR('(') PORT_CODE(KEYCODE_9)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\\') PORT_CHAR('|') PORT_CODE(KEYCODE_RALT) // between space bar and left
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(COMMA_PAD)) PORT_CODE(KEYCODE_PLUS_PAD)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('.') PORT_CHAR('>') PORT_CODE(KEYCODE_STOP)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J)
|
||||
|
||||
PORT_START("COL12")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(HOME))
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") PORT_CHAR(0x7f)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CHAR(')') PORT_CODE(KEYCODE_0)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Send Print")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('/') PORT_CHAR('?') PORT_CODE(KEYCODE_SLASH)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor wy50_keyboard_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(wy50kb);
|
||||
}
|
||||
|
||||
void wy50_keyboard_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_address));
|
||||
}
|
||||
|
||||
void wy50_keyboard_device::scan_w(u8 address)
|
||||
{
|
||||
m_address = address;
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(wy50_keyboard_device::sense_r)
|
||||
{
|
||||
return BIT(m_key_matrix[(m_address >> 3) & 15].read_safe(0xff), m_address & 7);
|
||||
}
|
29
src/mame/machine/wy50kb.h
Normal file
29
src/mame/machine/wy50kb.h
Normal file
@ -0,0 +1,29 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:AJR
|
||||
|
||||
#ifndef MAME_MACHINE_WY50KB_H
|
||||
#define MAME_MACHINE_WY50KB_H
|
||||
|
||||
#pragma once
|
||||
|
||||
class wy50_keyboard_device : public device_t
|
||||
{
|
||||
public:
|
||||
wy50_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
|
||||
|
||||
void scan_w(u8 address);
|
||||
DECLARE_READ_LINE_MEMBER(sense_r);
|
||||
|
||||
protected:
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
optional_ioport_array<16> m_key_matrix;
|
||||
|
||||
u8 m_address;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(WY50_KEYBOARD, wy50_keyboard_device)
|
||||
|
||||
#endif // MAME_MACHINE_WY50KB_H
|
Loading…
Reference in New Issue
Block a user