From 0184503b860b2407c71a678b209cfd74ed97e8f0 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 2 Mar 2023 08:34:19 -0800 Subject: vectorgraphic/v4_kbd.cpp: Emulated Vector 4 keyboard. (#10944) vectorgraphic/vector4.cpp: Replaced high-level keyboard simulation. --- src/mame/vectorgraphic/v4_kbd.cpp | 325 +++++++++++++++++++++++++++++++++++++ src/mame/vectorgraphic/v4_kbd.h | 63 +++++++ src/mame/vectorgraphic/vector4.cpp | 30 ++-- 3 files changed, 400 insertions(+), 18 deletions(-) create mode 100644 src/mame/vectorgraphic/v4_kbd.cpp create mode 100644 src/mame/vectorgraphic/v4_kbd.h diff --git a/src/mame/vectorgraphic/v4_kbd.cpp b/src/mame/vectorgraphic/v4_kbd.cpp new file mode 100644 index 00000000000..f77aaf4fece --- /dev/null +++ b/src/mame/vectorgraphic/v4_kbd.cpp @@ -0,0 +1,325 @@ +// license:BSD-3-Clause +// copyright-holders:Eric Anderson +/********************************************************************** + +Vector 4 91-key keyboard + +The circuit board has printed numbers on the back. Those numbers are +used in the schematic on 7200-0001[1] p. 222 (VI A-19). The ROM uses a +lookup table to map them to an extended ASCII, p. 123 (II 6-4). Below +are the key numbers on the circuit board. + +Circuit board: +A65-02366-052 +PCB 251 +Doesn't say Key Tronic, but clearly Key Tronic. + +Row 1 +1 help +2 F1 +3 F2 +4 F3 +5 F4 +6 F5 +7 F6 +8 F7 +9 F8 +10 F9 +11 F10 +12 F11 +13 F12 +14 F13 +15 F14 +16 up +17 down +18 left +19 right + +Row 2 +20 esc +21 1 +22 2 +23 3 +24 4 +25 5 +26 6 +27 7 +28 8 +29 9 +30 0 +31 - +32 = +33 ` +34 del +35 10-key 7 +36 10-key 8 +37 10-key 9 +38 10-key - + +Row 3 +39 tab +40 q +41 w +42 e +43 r +44 t +45 y +46 u +47 i +48 o +49 p +50 [ +51 ] +52 backspace +53 10-key 4 +54 10-key 5 +55 10-key 6 +56 10-key , + +Row 4 +57 ctrl +58 caps lock +59 a +60 s +61 d +62 f +63 g +64 h +65 j +66 k +67 l +68 ; +69 ' +70 return +71 \ +72 10-key 1 +73 10-key 2 +74 10-key 3 + +Row 5 +75 left shift +76 z +77 x +78 c +79 v +80 b +81 n +82 m +83 , +84 . +85 / +86 right shift +87 line feed +88 10-key 0 +89 10-key . +90 10-key enter + +Row 6 +91 space + +1. https://archive.org/details/7200-0001-vector-4-technical-information-sep-82 + +**********************************************************************/ + +#include "emu.h" +#include "v4_kbd.h" +#include "speaker.h" + +vector4_keyboard_device::vector4_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, VECTOR4_KEYBOARD, tag, owner, clock) + , m_mcu(*this, "mcu") + , m_beeper(*this, "beeper") + , m_keys(*this, "Y%d", 0U) + , m_led(*this, "led") + , m_txd_cb(*this) + , m_column(0) + , m_p24(0) +{ +} + +void vector4_keyboard_device::device_start() +{ + save_item(NAME(m_column)); + save_item(NAME(m_p24)); +} + +void vector4_keyboard_device::device_resolve_objects() +{ + m_txd_cb.resolve_safe(); + m_led.resolve(); +} + +WRITE_LINE_MEMBER(vector4_keyboard_device::write_rxd) +{ + m_mcu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE); +} + +uint8_t vector4_keyboard_device::p1_r() +{ + if (!m_p24 || m_column >= m_keys.size()) + return 0xff; + return m_keys[m_column]->read(); +} + +void vector4_keyboard_device::p2_w(uint8_t data) +{ + if (!m_p24 && BIT(data, 4)) + m_column = m_mcu->p1_r() & 0x0f; + m_p24 = BIT(data, 4); + m_beeper->set_state(!BIT(data, 5)); + m_led = BIT(data, 6); + m_txd_cb(BIT(data, 7)); +} + +void vector4_keyboard_device::prog_map(address_map &map) +{ + map(0x000, 0x7ff).mirror(0x800).rom().region("program", 0); +} + +void vector4_keyboard_device::device_add_mconfig(machine_config &config) +{ + I8035(config, m_mcu, 3'580'000); // P8048H in EA mode + m_mcu->set_addrmap(AS_PROGRAM, &vector4_keyboard_device::prog_map); + m_mcu->p1_in_cb().set(FUNC(vector4_keyboard_device::p1_r)); + m_mcu->p2_out_cb().set(FUNC(vector4_keyboard_device::p2_w)); + + SPEAKER(config, "mono").front_center(); + // Correct frequency, but lacking harmonics + BEEP(config, m_beeper, 786).add_route(ALL_OUTPUTS, "mono", 0.125); +} + +INPUT_PORTS_START(vector4_keyboard) + PORT_START("Y0") // _ _ _ _ 58 75 57 86 + PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Left Shift") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_SHIFT_2) PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Right Shift") + + PORT_START("Y1") // 18 19 37 38 55 56 74 90 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD) + 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(COMMA_PAD)) PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("Y2") // 16 17 35 36 53 54 72 73 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP) + 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(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD) + 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(1_PAD)) PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD) + + PORT_START("Y3") // 14 15 33 34 51 52 70 71 + 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(UCHAR_MAMEKEY(F14)) PORT_CODE(KEYCODE_F14) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('`') PORT_CHAR('~') PORT_CODE(KEYCODE_TILDE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL)) PORT_CODE(KEYCODE_DEL) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(']') PORT_CHAR('}') PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x08) PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\\') PORT_CHAR('|') PORT_CODE(KEYCODE_BACKSLASH) + + PORT_START("Y4") // 78 77 80 91 79 _ 76 59 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('C') PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X) + 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(' ') PORT_CODE(KEYCODE_SPACE) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('v') PORT_CHAR('V') PORT_CODE(KEYCODE_V) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) + 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_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A) + + PORT_START("Y5") // 25 26 6 7 62 63 43 44 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('^') PORT_CODE(KEYCODE_6) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F5)) PORT_CODE(KEYCODE_F5) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F6)) PORT_CODE(KEYCODE_F6) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CODE(KEYCODE_R) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CODE(KEYCODE_T) + + PORT_START("Y6") // 23 24 4 5 60 61 41 42 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('$') PORT_CODE(KEYCODE_4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_F3) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_CODE(KEYCODE_F4) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CODE(KEYCODE_W) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CODE(KEYCODE_E) + + PORT_START("Y7") // 21 22 2 3 20 1 39 40 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1) + 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(UCHAR_MAMEKEY(F1)) PORT_CODE(KEYCODE_F1) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F2)) PORT_CODE(KEYCODE_F2) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x1b) PORT_CODE(KEYCODE_ESC) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Help") + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x09) PORT_CODE(KEYCODE_TAB) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CODE(KEYCODE_Q) + + PORT_START("Y8") // 27 28 8 9 64 65 45 46 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('&') PORT_CODE(KEYCODE_7) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('*') PORT_CODE(KEYCODE_8) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F7)) PORT_CODE(KEYCODE_F7) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F8)) PORT_CODE(KEYCODE_F8) + 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_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CODE(KEYCODE_Y) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U) + + PORT_START("Y9") // 10 11 29 30 66 67 47 48 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F9)) PORT_CODE(KEYCODE_F9) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F10)) PORT_CODE(KEYCODE_F10) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR('(') PORT_CODE(KEYCODE_9) + 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_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L) + 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('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O) + + PORT_START("Y10") // 12 13 31 32 49 69 68 50 + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F11)) PORT_CODE(KEYCODE_F11) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CODE(KEYCODE_F12) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('_') PORT_CODE(KEYCODE_MINUS) + 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('p') PORT_CHAR('P') PORT_CODE(KEYCODE_P) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\'') PORT_CHAR('"') PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR(':') PORT_CODE(KEYCODE_COLON) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('[') PORT_CHAR('{') PORT_CODE(KEYCODE_OPENBRACE) + + PORT_START("Y11") // 83 84 81 82 88 87 85 89 + 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('.') PORT_CHAR('>') PORT_CODE(KEYCODE_STOP) + 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('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x0a) PORT_CODE(KEYCODE_RALT) PORT_NAME("Line Feed") + 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(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD) // period +INPUT_PORTS_END + +ioport_constructor vector4_keyboard_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(vector4_keyboard); +} + +ROM_START(vector4_kbd) + ROM_REGION(0x800, "program", 0) + ROM_LOAD("v4_kbd_10.bin", 0x000, 0x800, CRC(3166e57b) SHA1(0023f0639e2f1d9e8860c6c4244e25fd8bf82331)) +ROM_END + +const tiny_rom_entry *vector4_keyboard_device::device_rom_region() const +{ + return ROM_NAME(vector4_kbd); +} + +DEFINE_DEVICE_TYPE(VECTOR4_KEYBOARD, vector4_keyboard_device, "vector4_kbd", "Vector 4 Keyboard") diff --git a/src/mame/vectorgraphic/v4_kbd.h b/src/mame/vectorgraphic/v4_kbd.h new file mode 100644 index 00000000000..6d897184c02 --- /dev/null +++ b/src/mame/vectorgraphic/v4_kbd.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Eric Anderson +/********************************************************************** + +Vector 4 91-key keyboard + +**********************************************************************/ + +#ifndef MAME_VECTORGRAPHIC_V4_KBD_H +#define MAME_VECTORGRAPHIC_V4_KBD_H + +#pragma once + +#include "cpu/mcs48/mcs48.h" +#include "sound/beep.h" + + +class vector4_keyboard_device : public device_t +{ +public: + // device type constructor + vector4_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + // callback configuration + auto txd_handler() { return m_txd_cb.bind(); } + + // serial line input + DECLARE_WRITE_LINE_MEMBER(write_rxd); + +protected: + // device-level overrides + void device_resolve_objects() override; + void device_start() override; + ioport_constructor device_input_ports() const override; + void device_add_mconfig(machine_config &config) override; + const tiny_rom_entry *device_rom_region() const override; + +private: + // MCU handlers + uint8_t p1_r(); + void p2_w(uint8_t data); + void leds_w(uint8_t data); + + // address maps + void prog_map(address_map &map); + void ext_map(address_map &map); + + // object finders + required_device m_mcu; + required_device m_beeper; + required_ioport_array<12> m_keys; + output_finder<> m_led; + + // output callback + devcb_write_line m_txd_cb; + + uint8_t m_column; + uint8_t m_p24; +}; + +DECLARE_DEVICE_TYPE(VECTOR4_KEYBOARD, vector4_keyboard_device) + +#endif diff --git a/src/mame/vectorgraphic/vector4.cpp b/src/mame/vectorgraphic/vector4.cpp index 0abd2d6586e..0b7518f132e 100644 --- a/src/mame/vectorgraphic/vector4.cpp +++ b/src/mame/vectorgraphic/vector4.cpp @@ -36,7 +36,6 @@ https://archive.org/details/7200-0001-vector-4-technical-information-sep-82 https://www.bitsavers.org/pdf/vectorGraphic/vector_4/7100-0001_Vector_4_Users_Manual_Feb83.pdf TODO: -- keyboard mcu - S-100 interrupts and ready - parallel port - WAIT CPU states @@ -47,6 +46,7 @@ TODO: #include "emu.h" #include "sbcvideo.h" +#include "v4_kbd.h" #include "bus/rs232/rs232.h" #include "bus/s100/s100.h" @@ -78,6 +78,7 @@ public: , m_romenbl(*this, "romenbl") , m_sbc_video(*this, "video") , m_s100(*this, "s100") + , m_uart0(*this, "uart0") { } void vector4(machine_config &config); @@ -103,6 +104,7 @@ private: memory_view m_romenbl; required_device m_sbc_video; required_device m_s100; + required_device m_uart0; }; @@ -126,7 +128,7 @@ void vector4_state::vector4_8088mem(address_map &map) void vector4_state::vector4_io(address_map &map) { map.unmap_value_high(); - map(0x00, 0x01).mirror(0xff00).rw("uart0", FUNC(i8251_device::read), FUNC(i8251_device::write)); // keyboard + map(0x00, 0x01).mirror(0xff00).rw(m_uart0, FUNC(i8251_device::read), FUNC(i8251_device::write)); // keyboard map(0x02, 0x03).mirror(0xff00).w(FUNC(vector4_state::spr_w)); // subsystem port register map(0x04, 0x05).mirror(0xff00).rw("uart1", FUNC(i8251_device::read), FUNC(i8251_device::write)); // modem map(0x06, 0x07).mirror(0xff00).rw("uart2", FUNC(i8251_device::read), FUNC(i8251_device::write)); // serial printer @@ -149,15 +151,6 @@ static void vector4_s100_devices(device_slot_interface &device) static INPUT_PORTS_START( vector4 ) INPUT_PORTS_END -// 7200-0001 page 102 (II 5-11) -DEVICE_INPUT_DEFAULTS_START(keyboard) - DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0x00ff, RS232_BAUD_300) - DEVICE_INPUT_DEFAULTS("RS232_RXBAUD", 0x00ff, RS232_BAUD_300) - DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0x00ff, RS232_DATABITS_8) - DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0x00ff, RS232_PARITY_NONE) - DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0x00ff, RS232_STOPBITS_2) -DEVICE_INPUT_DEFAULTS_END - void vector4_state::vector4(machine_config &config) { const XTAL _32m(32'640'000); @@ -201,13 +194,12 @@ void vector4_state::vector4(machine_config &config) // 7200-0001 page 210 D13, D1 clock_device &keyboard_clock(CLOCK(config, "keyboard_clock", _2mclk/26/16)); - i8251_device &uart0(I8251(config, "uart0", 0)); - rs232_port_device &rs232keyboard(RS232_PORT(config, "rs232keyboard", default_rs232_devices, "keyboard")); - keyboard_clock.signal_handler().set(uart0, FUNC(i8251_device::write_txc)); - keyboard_clock.signal_handler().append(uart0, FUNC(i8251_device::write_rxc)); - uart0.txd_handler().set(rs232keyboard, FUNC(rs232_port_device::write_txd)); - rs232keyboard.rxd_handler().set(uart0, FUNC(i8251_device::write_rxd)); - rs232keyboard.set_option_device_input_defaults("keyboard", DEVICE_INPUT_DEFAULTS_NAME(keyboard)); + I8251(config, m_uart0, 0); + vector4_keyboard_device &v4kbd(VECTOR4_KEYBOARD(config, "rs232keyboard", 0)); + keyboard_clock.signal_handler().set(m_uart0, FUNC(i8251_device::write_txc)); + keyboard_clock.signal_handler().append(m_uart0, FUNC(i8251_device::write_rxc)); + m_uart0->txd_handler().set(v4kbd, FUNC(vector4_keyboard_device::write_rxd)); + v4kbd.txd_handler().set(m_uart0, FUNC(i8251_device::write_rxd)); // D3 i8251_device &uart1(I8251(config, "uart1", 0)); @@ -248,6 +240,8 @@ void vector4_state::machine_start() m_8088cpu->space(AS_PROGRAM).install_ram(0, m_ram->mask(), m_ram->size() & 0x20000, m_ram->pointer()); for (int bank = 0; bank < (1<<5); bank++) m_rambanks[bank]->configure_entries(0, 1<<7, m_ram->pointer(), 1<<11); + // Missing from schematic, but jumper wire present on the board. + m_uart0->write_cts(0); } void vector4_state::machine_reset() -- cgit v1.2.3