diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-12-21 00:23:54 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-12-21 00:24:26 -0500 |
commit | fae17ac3a675f32afe72e36f286abbfb4dfc25f7 (patch) | |
tree | 47edec974647e152b6a510b1e10c6dfc7e8a2377 | |
parent | a5dffb560c924023ade2a28cea1edf8588c2d2a5 (diff) |
tv955: Make keyboard begin to work; add cursor
-rw-r--r-- | scripts/target/mame/mess.lua | 1 | ||||
-rw-r--r-- | src/mame/drivers/tv955.cpp | 56 | ||||
-rw-r--r-- | src/mame/machine/tv955kb.cpp | 275 | ||||
-rw-r--r-- | src/mame/machine/tv955kb.h | 59 |
4 files changed, 372 insertions, 19 deletions
diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index c7ebe08a09f..d84b897709f 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3299,6 +3299,7 @@ files { MAME_DIR .. "src/mame/drivers/tv965.cpp", MAME_DIR .. "src/mame/drivers/tv990.cpp", MAME_DIR .. "src/mame/drivers/ts3000.cpp", + MAME_DIR .. "src/mame/machine/tv955kb.cpp", } createMESSProjects(_target, _subtarget, "tem") diff --git a/src/mame/drivers/tv955.cpp b/src/mame/drivers/tv955.cpp index 8023ab87bf1..722d0d167ea 100644 --- a/src/mame/drivers/tv955.cpp +++ b/src/mame/drivers/tv955.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders: +// copyright-holders:AJR /*********************************************************************************************************************************** Skeleton driver for "third generation" TeleVideo terminals (905, 955, 9220). @@ -7,9 +7,9 @@ Skeleton driver for "third generation" TeleVideo terminals (905, 955, 9220). ************************************************************************************************************************************/ #include "emu.h" +#include "machine/tv955kb.h" #include "bus/rs232/rs232.h" #include "cpu/m6502/m65c02.h" -#include "cpu/mcs48/mcs48.h" #include "machine/input_merger.h" #include "machine/mos6551.h" #include "machine/nvram.h" @@ -24,6 +24,8 @@ public: , m_maincpu(*this, "maincpu") , m_crtc(*this, "crtc") , m_hostuart(*this, "hostuart") + , m_printuart(*this, "printuart") + , m_keybuart(*this, "keybuart") , m_mainport(*this, "mainport") , m_printer(*this, "printer") , m_chargen(*this, "chargen") @@ -38,6 +40,7 @@ private: SCN2674_DRAW_CHARACTER_MEMBER(draw_character); void control_latch_w(u8 data); + DECLARE_WRITE_LINE_MEMBER(system_reset_w); void mem_map(address_map &map); void char_map(address_map &map); @@ -46,6 +49,8 @@ private: required_device<cpu_device> m_maincpu; required_device<scn2674_device> m_crtc; required_device<mos6551_device> m_hostuart; + required_device<mos6551_device> m_printuart; + required_device<mos6551_device> m_keybuart; required_device<rs232_port_device> m_mainport; required_device<rs232_port_device> m_printer; required_region_ptr<u8> m_chargen; @@ -55,16 +60,24 @@ void tv955_state::machine_reset() { m_printer->write_rts(0); m_printer->write_dtr(0); + + m_printuart->write_cts(0); + m_keybuart->write_cts(0); } SCN2674_DRAW_CHARACTER_MEMBER(tv955_state::draw_character) { u16 dots = m_chargen[charcode << 4 | linecount] << 1; - dots |= (BIT(dots, 1) && BIT(charcode, 7) ? 1 : 0) | (dots & 0x100) << 1; + if (BIT(dots, 1) && BIT(charcode, 7)) + dots |= 1; + + // TODO: attribute logic + if (cursor) + dots = ~dots; for (int i = 0; i < 9; i++) { - bitmap.pix32(y, x++) = BIT(dots, 9) ? rgb_t::white() : rgb_t::black(); + bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black(); dots <<= 1; } } @@ -89,14 +102,19 @@ void tv955_state::control_latch_w(u8 data) } } +WRITE_LINE_MEMBER(tv955_state::system_reset_w) +{ + // TODO +} + void tv955_state::mem_map(address_map &map) { // verified from maintenance manual (131968-00-C) map(0x0000, 0x07ff).mirror(0x0800).ram().share("nvram"); map(0x1100, 0x1100).mirror(0x00ff).w(FUNC(tv955_state::control_latch_w)); - map(0x1200, 0x1203).mirror(0x00fc).rw("keybuart", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); - map(0x1400, 0x1403).mirror(0x00fc).rw("printuart", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); - map(0x1800, 0x1803).mirror(0x00fc).rw("hostuart", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); + map(0x1200, 0x1203).mirror(0x00fc).rw(m_keybuart, FUNC(mos6551_device::read), FUNC(mos6551_device::write)); + map(0x1400, 0x1403).mirror(0x00fc).rw(m_printuart, FUNC(mos6551_device::read), FUNC(mos6551_device::write)); + map(0x1800, 0x1803).mirror(0x00fc).rw(m_hostuart, FUNC(mos6551_device::read), FUNC(mos6551_device::write)); map(0x2000, 0x2007).mirror(0x0ff8).rw("crtc", FUNC(scn2674_device::read), FUNC(scn2674_device::write)); map(0x3000, 0x3fff).rom().region("option", 0); map(0x4000, 0x7fff).ram().share("attrram"); @@ -124,7 +142,9 @@ void tv955_state::tv955(machine_config &config) INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, m6502_device::IRQ_LINE); - I8049(config, "keyboard", 5.7143_MHz_XTAL); + tv955kb_device &keyboard(TV955_KEYBOARD(config, "keyboard")); + keyboard.txd_cb().set("keybuart", FUNC(mos6551_device::write_rxd)); + keyboard.reset_cb().set(FUNC(tv955_state::system_reset_w)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // HM6116LP-4 + 3.2V battery @@ -151,16 +171,17 @@ void tv955_state::tv955(machine_config &config) m_hostuart->rts_handler().set(m_mainport, FUNC(rs232_port_device::write_rts)); m_hostuart->dtr_handler().set(m_mainport, FUNC(rs232_port_device::write_dtr)); - mos6551_device &printuart(MOS6551(config, "printuart", 0)); - printuart.set_xtal(3.6864_MHz_XTAL / 2); - printuart.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); - printuart.txd_handler().set(m_printer, FUNC(rs232_port_device::write_txd)); + MOS6551(config, m_printuart, 0); + m_printuart->set_xtal(3.6864_MHz_XTAL / 2); + m_printuart->irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); + m_printuart->txd_handler().set(m_printer, FUNC(rs232_port_device::write_txd)); - mos6551_device &keybuart(MOS6551(config, "keybuart", 0)); - keybuart.set_xtal(3.6864_MHz_XTAL / 2); - keybuart.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); + MOS6551(config, m_keybuart, 0); + m_keybuart->set_xtal(3.6864_MHz_XTAL / 2); + m_keybuart->irq_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); + m_keybuart->txd_handler().set("keyboard", FUNC(tv955kb_device::write_rxd)); - RS232_PORT(config, m_mainport, default_rs232_devices, nullptr); // DTE + RS232_PORT(config, m_mainport, default_rs232_devices, "loopback"); // DTE m_mainport->rxd_handler().set(m_hostuart, FUNC(mos6551_device::write_rxd)); m_mainport->cts_handler().set(m_hostuart, FUNC(mos6551_device::write_cts)); m_mainport->dsr_handler().set(m_hostuart, FUNC(mos6551_device::write_dsr)); @@ -190,9 +211,6 @@ ROM_START( tv955 ) ROM_REGION(0x1000, "chargen", 0) ROM_LOAD( "t180002-26b.u45", 0x0000, 0x1000, CRC(69c9ebc7) SHA1(32282c816ec597a7c45e939acb7a4155d35ea584) ) - - ROM_REGION(0x0800, "keyboard", 0) - ROM_LOAD( "8049.kbd", 0x0000, 0x0800, CRC(bc86e349) SHA1(0b62003ab7931822f1bcac8370517c685849f62c) ) ROM_END COMP( 1985, tv955, 0, 0, tv955, tv955, tv955_state, empty_init, "TeleVideo Systems", "TeleVideo 955", MACHINE_IS_SKELETON ) diff --git a/src/mame/machine/tv955kb.cpp b/src/mame/machine/tv955kb.cpp new file mode 100644 index 00000000000..6e5c2e23557 --- /dev/null +++ b/src/mame/machine/tv955kb.cpp @@ -0,0 +1,275 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*********************************************************************************************************************************** + +TeleVideo 955 111-key serial keyboard emulation. + +Connector pinout: + 1 Chassis GND + 2 +12V DC + 3 Logic GND + 4 Keyboard TxD + 5 Terminal TxD + 6 /RESET + +************************************************************************************************************************************/ + +#include "emu.h" +#include "machine/tv955kb.h" +#include "machine/input_merger.h" + +DEFINE_DEVICE_TYPE(TV955_KEYBOARD, tv955kb_device, "tv955kb", "TeleVideo 955 Keyboard") + +tv955kb_device::tv955kb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, TV955_KEYBOARD, tag, owner, clock) + , m_txd_cb(*this) + , m_reset_cb(*this) + , m_mcu(*this, "mcu") + , m_keys(*this, "Y%u", 0U) +{ +} + +void tv955kb_device::device_resolve_objects() +{ + m_txd_cb.resolve_safe(); + m_reset_cb.resolve_safe(); +} + +void tv955kb_device::device_start() +{ +} + +WRITE_LINE_MEMBER(tv955kb_device::write_rxd) +{ + m_mcu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + +u8 tv955kb_device::keys_r() +{ + const u8 p1 = m_mcu->p1_r(); + u8 result = 0xff; + + if ((p1 & 0x0f) < 10) + result &= m_keys[p1 & 0x0f]->read(); + if ((p1 >> 4) < 6) + result &= m_keys[10 + (p1 >> 4)]->read(); + + return result; +} + +WRITE_LINE_MEMBER(tv955kb_device::bell_w) +{ + // TODO +} + +WRITE_LINE_MEMBER(tv955kb_device::txd_w) +{ + m_txd_cb(state); +} + +WRITE_LINE_MEMBER(tv955kb_device::reset_w) +{ + m_reset_cb(state); +} + +void tv955kb_device::device_add_mconfig(machine_config &config) +{ + I8049(config, m_mcu, 5.7143_MHz_XTAL); + m_mcu->p2_in_cb().set_ioport("SHIFT"); + m_mcu->p2_out_cb().set(FUNC(tv955kb_device::bell_w)).bit(6).invert(); + m_mcu->p2_out_cb().append(FUNC(tv955kb_device::txd_w)).bit(7); + m_mcu->t0_in_cb().set_ioport("FUNCT").bit(0); + m_mcu->t1_in_cb().set_ioport("FUNCT").bit(1); + m_mcu->bus_in_cb().set(FUNC(tv955kb_device::keys_r)); + + INPUT_MERGER_ALL_LOW(config, "resetctl").output_handler().set(FUNC(tv955kb_device::reset_w)); + + // TODO: bell (MC14040 clocked by ALE) +} + +static INPUT_PORTS_START(tv955kb) + PORT_START("Y0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F1)) PORT_CODE(KEYCODE_F1) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc Loc Esc") PORT_CHAR(0x1b) PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UA") // "Back Tab" according to manuals + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UB") // "Print" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(TAB)) PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('z') PORT_CHAR('Z') PORT_CODE(KEYCODE_Z) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CODE(KEYCODE_Q) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("Y1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_F3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('@') PORT_CODE(KEYCODE_2) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CODE(KEYCODE_W) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CODE(KEYCODE_R) + + PORT_START("Y2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space Bar") PORT_CHAR(' ') PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('^') PORT_CODE(KEYCODE_6) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CODE(KEYCODE_T) + 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(UCHAR_MAMEKEY(F8)) PORT_CODE(KEYCODE_F8) + + PORT_START("Y3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CODE(KEYCODE_F2) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('C') PORT_CODE(KEYCODE_C) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CODE(KEYCODE_E) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CODE(KEYCODE_F4) + + PORT_START("Y4") + 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('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F) + 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_CHAR(UCHAR_MAMEKEY(F6)) PORT_CODE(KEYCODE_F6) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CODE(KEYCODE_F7) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("Y5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CODE(KEYCODE_Y) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B) + 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_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FKeys A") PORT_CODE(KEYCODE_F9) // "F9" according to manuals + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('*') PORT_CODE(KEYCODE_8) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J) + + PORT_START("Y6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_CODE(KEYCODE_RALT) + 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_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('.') PORT_CHAR('>') PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U1") PORT_CODE(KEYCODE_F13) // "F13" according to manuals + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Blank key") PORT_CODE(KEYCODE_F12) // "F12" according to manuals + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('[') PORT_CHAR(']') PORT_CODE(KEYCODE_OPENBRACE) + + PORT_START("Y7") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR('(') PORT_CODE(KEYCODE_9) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") PORT_CODE(KEYCODE_F11) // "F11" according to manuals + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('i') PORT_CHAR('I') PORT_CODE(KEYCODE_I) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M) + + PORT_START("Y8") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\'') PORT_CHAR('"') PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('=') PORT_CHAR('+') PORT_CODE(KEYCODE_EQUALS) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U2") PORT_CODE(KEYCODE_F14) // "F14" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('`') PORT_CHAR('~') PORT_CODE(KEYCODE_TILDE) // actually between = and backslash keys + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('/') PORT_CHAR('?') PORT_CODE(KEYCODE_SLASH) + + PORT_START("Y9") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(',') PORT_CHAR('<') PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR(':') PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CHAR(')') PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FKeys B") PORT_CODE(KEYCODE_F10) // "F10" according to manuals + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('_') PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L) + + PORT_START("Y10") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CHAR(0x0a) PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + 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_NAME("U3") PORT_CODE(KEYCODE_F15) // "F15" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\\') PORT_CHAR('|') PORT_CODE(KEYCODE_BACKSLASH) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('{') PORT_CHAR('}') PORT_CODE(KEYCODE_RCONTROL) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U4") PORT_CODE(KEYCODE_F16) // "F16" according to manuals + + PORT_START("Y11") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U8") // "Char Delete" according to manuals + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Keypad CE") + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U6") // "Line Insert" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U10") // "Page Erase" according to manuals + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("Y12") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U0") // "Clear Space" according to manuals + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Del") + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Break") + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT) + + PORT_START("Y13") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U7") // "Line Erase" according to manuals + 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(3_PAD)) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U11") // "Page" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD) + 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_NAME("Set Up") // unshifted is "No Scroll" according to manuals + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("Y14") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U5") // "Char Insert" according to manuals + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(TAB_PAD)) PORT_CODE(KEYCODE_TAB_PAD) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("U9") // "Line Delete" according to manuals + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(00_PAD)) PORT_CODE(KEYCODE_00_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD) + + PORT_START("Y15") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Define Prekey") // "Send" according to manuals + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) + 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("SHIFT") + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CHAR(UCHAR_SHIFT_2) PORT_CODE(KEYCODE_LCONTROL) PORT_WRITE_LINE_DEVICE_MEMBER("resetctl", input_merger_device, in_w<0>) + PORT_BIT(0xcf, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("FUNCT") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Alpha Lock") PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funct") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CODE(KEYCODE_LALT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Reset") PORT_WRITE_LINE_DEVICE_MEMBER("resetctl", input_merger_device, in_w<1>) +INPUT_PORTS_END + +ioport_constructor tv955kb_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(tv955kb); +} + +ROM_START(tv955kb) + ROM_REGION(0x0800, "mcu", 0) + ROM_LOAD("8049.kbd", 0x0000, 0x0800, CRC(bc86e349) SHA1(0b62003ab7931822f1bcac8370517c685849f62c)) +ROM_END + +const tiny_rom_entry *tv955kb_device::device_rom_region() const +{ + return ROM_NAME(tv955kb); +} diff --git a/src/mame/machine/tv955kb.h b/src/mame/machine/tv955kb.h new file mode 100644 index 00000000000..d79f4df14ed --- /dev/null +++ b/src/mame/machine/tv955kb.h @@ -0,0 +1,59 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#ifndef MAME_MACHINE_TV955KB_H +#define MAME_MACHINE_TV955KB_H + +#pragma once + +#include "cpu/mcs48/mcs48.h" +//#include "machine/ripple_counter.h" +//#include "sound/spkrdev.h" +//#include "speaker.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tv955kb_device + +class tv955kb_device : public device_t +{ +public: + tv955kb_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + // configuration + auto txd_cb() { return m_txd_cb.bind(); } + auto reset_cb() { return m_reset_cb.bind(); } + + DECLARE_WRITE_LINE_MEMBER(write_rxd); + + static constexpr feature_type unemulated_features() { return feature::SOUND; } + +protected: + // device-specific overrides + virtual void device_resolve_objects() override; + virtual void device_start() override; + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + u8 keys_r(); + DECLARE_WRITE_LINE_MEMBER(bell_w); + DECLARE_WRITE_LINE_MEMBER(txd_w); + DECLARE_WRITE_LINE_MEMBER(reset_w); + + // line output callbacks + devcb_write_line m_txd_cb; + devcb_write_line m_reset_cb; + + required_device<mcs48_cpu_device> m_mcu; + required_ioport_array<16> m_keys; +}; + +// device type definition +DECLARE_DEVICE_TYPE(TV955_KEYBOARD, tv955kb_device) + +#endif // MAME_MACHINE_TV955KB_H |