From e7ea0ac7a5345bf37bce83fed6d1cf3f98eea0af Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Thu, 11 Dec 2014 19:50:37 +0200 Subject: (MESS) victor9k: Keyboard WIP. (nw) --- src/mess/includes/victor9k.h | 2 +- src/mess/machine/victor9kb.c | 131 ++++++++++++++++++++----------------------- src/mess/machine/victor9kb.h | 22 ++++---- 3 files changed, 75 insertions(+), 80 deletions(-) diff --git a/src/mess/includes/victor9k.h b/src/mess/includes/victor9k.h index aabcbc930ec..f27f07fd501 100644 --- a/src/mess/includes/victor9k.h +++ b/src/mess/includes/victor9k.h @@ -94,7 +94,7 @@ public: required_device m_cvsd; required_device m_crtc; required_device m_ram; - required_device m_kb; + required_device m_kb; required_device m_fdc; required_device m_centronics; required_device m_rs232a; diff --git a/src/mess/machine/victor9kb.c b/src/mess/machine/victor9kb.c index a598e233216..e001eeb1da4 100644 --- a/src/mess/machine/victor9kb.c +++ b/src/mess/machine/victor9kb.c @@ -25,7 +25,7 @@ Marking on PCB back: A65-02307-201D 007 | X X X X X X X X X X X X X X X X X X X X | | X X marking X X X X X X X X | |----------------------------------------------------------------------------------------| - + Notes: All IC's shown. @@ -54,7 +54,7 @@ Notes: /3Y 6 | | 9 4A GND 7 |_______| 8 /4Y - + P8021 Pinout ------------------ _____ _____ @@ -134,7 +134,7 @@ RESET 17 - 10uf capacitor - VCC P20 26 - 22-908 pin 19 (/CLR) AND 22-950 pin 5 (/STB) AND (804x chip pin 35, P24) P21 27 - 74LS14 pin 9 (4A) AND (804x chip pin 36, P25) VCC 28 - VCC - + 74LS14 to elsewhere connections ------------------------------- 1A 1 - 100 Ohm resistor - J1 pin 4 @@ -152,7 +152,7 @@ RESET 17 - 10uf capacitor - VCC 6A 13 - 74LS14 pin 10 VCC 14 - VCC - + J1 (aka CN1) connections: ------------------------- 1 - VCC @@ -212,7 +212,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S09 - UNUSED (under the [8] key, no metal contact on key) S10 - [9] S11 - [10] - + S12 - CLR/HOME S13 - (Degree symbol U+00B0)/(+- symbol U+00B1)/(Pi symbol U+03C0) S14 - !/1/| @@ -234,7 +234,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S30 - % (white keypad key) S31 - (division symbol U+00F7) (white keypad key) S32 - (multiplication symbol U+00D7) (white keypad key) - + S33 - (up arrow, SCRL, down arrow)//VTAB S34 - TAB//BACK S35 - Q @@ -256,7 +256,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S51 - 8 (white keypad key) S52 - 9 (white keypad key) S53 - - (white keypad key) - + S54 - (OFF,RVS,ON)//ESC S55 - LOCK//CAPS LOCK S56 - A @@ -278,7 +278,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S72 - 5 (white keypad key) S73 - 6 (white keypad key) S74 - + (white keypad key) - + S75 - (OFF,UNDL,ON) S76 - SHIFT (left shift) S77 - UNUSED (under the left SHIFT key, no metal contact on key) @@ -299,7 +299,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S92 - 2 (white keypad key) S93 - 3 (white keypad key) S94 - ENTER (white keypad key) - + S95 - RPT S96 - ALT S97 - (spacebar) @@ -310,7 +310,7 @@ Key Layout (USA Variant): (the S0x markings appear on the back of the PCB) S102 - 00 (white keypad key) ('double zero') S103 - . (white keypad key) S104 - UNUSED (under the ENTER (keypad) key, no metal contact on key) - + Note that the five unused key contacts: S09, S47, S67, S77 and S104 may be used on international variants of the Victor 9000/Sirius 1 Keyboard. @@ -324,7 +324,7 @@ V V V V V V V V V Y0 12 13 33 34 54 55 75 76 Y1 14 15 35 36 56 57 77 78 Y2 16 17 37 38 58 59 79 80 -Y3 18 19 39 40 60 61 81 82 +Y3 18 19 39 40 60 61 81 82 Y4 20 21 41 42 62 63 83 84 Y5 22 23 43 44 64 65 85 86 Y6 24 25 45 46 66 67 87 88 @@ -345,7 +345,9 @@ Y11 104 103 102 101 100 99 98 97 // MACROS / CONSTANTS //************************************************************************** -#define I8021_TAG "z3" +#define I8021_TAG "z3" + +#define LOG 0 @@ -353,7 +355,7 @@ Y11 104 103 102 101 100 99 98 97 // DEVICE DEFINITIONS //************************************************************************** -const device_type VICTOR9K_KEYBOARD = &device_creator; +const device_type VICTOR9K_KEYBOARD = &device_creator; //------------------------------------------------- @@ -370,7 +372,7 @@ ROM_END // rom_region - device-specific ROM region //------------------------------------------------- -const rom_entry *victor9k_keyboard_device::device_rom_region() const +const rom_entry *victor_9000_keyboard_t::device_rom_region() const { return ROM_NAME( victor9k_keyboard ); } @@ -380,7 +382,7 @@ const rom_entry *victor9k_keyboard_device::device_rom_region() const // ADDRESS_MAP( kb_io ) //------------------------------------------------- -static ADDRESS_MAP_START( victor9k_keyboard_io, AS_IO, 8, victor9k_keyboard_device ) +static ADDRESS_MAP_START( victor9k_keyboard_io, AS_IO, 8, victor_9000_keyboard_t ) AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w) AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w) AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r) @@ -402,7 +404,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor victor9k_keyboard_device::device_mconfig_additions() const +machine_config_constructor victor_9000_keyboard_t::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( victor9k_keyboard ); } @@ -474,14 +476,14 @@ INPUT_PORTS_START( victor9k_keyboard ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_START("Y6") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_START("Y7") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) @@ -549,7 +551,7 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor victor9k_keyboard_device::device_input_ports() const +ioport_constructor victor_9000_keyboard_t::device_input_ports() const { return INPUT_PORTS_NAME( victor9k_keyboard ); } @@ -561,10 +563,10 @@ ioport_constructor victor9k_keyboard_device::device_input_ports() const //************************************************************************** //------------------------------------------------- -// victor9k_keyboard_device - constructor +// victor_9000_keyboard_t - constructor //------------------------------------------------- -victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : +victor_9000_keyboard_t::victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock, "victor9kb", __FILE__), m_maincpu(*this, I8021_TAG), m_y0(*this, "Y0"), @@ -580,8 +582,8 @@ victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig m_ya(*this, "YA"), m_yb(*this, "YB"), m_yc(*this, "YC"), - m_kbrdy_handler(*this), - m_kbdata_handler(*this), + m_kbrdy_cb(*this), + m_kbdata_cb(*this), m_y(0), m_kbrdy(-1), m_kbdata(-1), @@ -594,37 +596,32 @@ victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig // device_start - device-specific startup //------------------------------------------------- -void victor9k_keyboard_device::device_start() +void victor_9000_keyboard_t::device_start() { // resolve callbacks - m_kbrdy_handler.resolve_safe(); - m_kbdata_handler.resolve_safe(); + m_kbrdy_cb.resolve_safe(); + m_kbdata_cb.resolve_safe(); // state saving + save_item(NAME(m_p1)); save_item(NAME(m_y)); + save_item(NAME(m_stb)); + save_item(NAME(m_y12)); save_item(NAME(m_kbrdy)); save_item(NAME(m_kbdata)); save_item(NAME(m_kback)); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void victor9k_keyboard_device::device_reset() -{ -} - - //------------------------------------------------- // kback_w - //------------------------------------------------- -WRITE_LINE_MEMBER( victor9k_keyboard_device::kback_w ) +WRITE_LINE_MEMBER( victor_9000_keyboard_t::kback_w ) { - //logerror("KBACK %u\n", state); - m_kback = state; + if (LOG) logerror("KBACK %u\n", state); + + m_kback = !state; } @@ -632,7 +629,7 @@ WRITE_LINE_MEMBER( victor9k_keyboard_device::kback_w ) // kb_p1_r - //------------------------------------------------- -READ8_MEMBER( victor9k_keyboard_device::kb_p1_r ) +READ8_MEMBER( victor_9000_keyboard_t::kb_p1_r ) { UINT8 data = 0xff; @@ -650,7 +647,11 @@ READ8_MEMBER( victor9k_keyboard_device::kb_p1_r ) case 9: data &= m_y9->read(); break; case 0xa: data &= m_ya->read(); break; case 0xb: data &= m_yb->read(); break; - case 0xc: data &= m_yc->read(); break; + } + + if (!m_y12) + { + data &= m_yc->read(); } return data; @@ -661,14 +662,9 @@ READ8_MEMBER( victor9k_keyboard_device::kb_p1_r ) // kb_p1_w - //------------------------------------------------- -WRITE8_MEMBER( victor9k_keyboard_device::kb_p1_w ) +WRITE8_MEMBER( victor_9000_keyboard_t::kb_p1_w ) { - if ((data & 0xf0) == 0x20) - { - m_y = data & 0x0f; - } - - //logerror("%s P1 %02x\n", machine().describe_context(), data); + m_p1 = data; } @@ -676,36 +672,33 @@ WRITE8_MEMBER( victor9k_keyboard_device::kb_p1_w ) // kb_p2_w - //------------------------------------------------- -WRITE8_MEMBER( victor9k_keyboard_device::kb_p2_w ) +WRITE8_MEMBER( victor_9000_keyboard_t::kb_p2_w ) { /* bit description - P20 ? + P20 22-908 CLR, 22-950 STB P21 KBRDY - P22 ? + P22 Y12 P23 KBDATA */ - int kbrdy = BIT(data, 1); - - if (m_kbrdy != kbrdy) + // keyboard rows 0-11 + if (!BIT(data, 0)) { - m_kbrdy = kbrdy; - m_kbrdy_handler(m_kbrdy); + m_y = m_p1 & 0x0f; } - int kbdata = BIT(data, 3); + // keyboard row 12 + m_y12 = BIT(data, 2); - if (m_kbdata != kbdata) - { - m_kbdata = kbdata; - m_kbdata_handler(m_kbdata); - } + // keyboard ready + m_kbrdy_cb(BIT(data, 1)); - //logerror("%s P2 %01x\n", machine().describe_context(), data&0x0f); + // keyboard data + m_kbdata_cb(BIT(data, 3)); } @@ -713,7 +706,7 @@ WRITE8_MEMBER( victor9k_keyboard_device::kb_p2_w ) // kb_t1_r - //------------------------------------------------- -READ8_MEMBER( victor9k_keyboard_device::kb_t1_r ) +READ8_MEMBER( victor_9000_keyboard_t::kb_t1_r ) { return m_kback; } diff --git a/src/mess/machine/victor9kb.h b/src/mess/machine/victor9kb.h index 76bbd17171c..787080095d5 100644 --- a/src/mess/machine/victor9kb.h +++ b/src/mess/machine/victor9kb.h @@ -25,26 +25,26 @@ //************************************************************************** #define MCFG_VICTOR9K_KBRDY_HANDLER(_devcb) \ - devcb = &victor9k_keyboard_device::set_kbrdy_handler(*device, DEVCB_##_devcb); + devcb = &victor_9000_keyboard_t::set_kbrdy_cb(*device, DEVCB_##_devcb); #define MCFG_VICTOR9K_KBDATA_HANDLER(_devcb) \ - devcb = &victor9k_keyboard_device::set_kbdata_handler(*device, DEVCB_##_devcb); + devcb = &victor_9000_keyboard_t::set_kbdata_cb(*device, DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> victor9k_keyboard_device +// ======================> victor_9000_keyboard_t -class victor9k_keyboard_device : public device_t +class victor_9000_keyboard_t : public device_t { public: // construction/destruction - victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + victor_9000_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - template static devcb_base &set_kbrdy_handler(device_t &device, _Object object) { return downcast(device).m_kbrdy_handler.set_callback(object); } - template static devcb_base &set_kbdata_handler(device_t &device, _Object object) { return downcast(device).m_kbdata_handler.set_callback(object); } + template static devcb_base &set_kbrdy_cb(device_t &device, _Object object) { return downcast(device).m_kbrdy_cb.set_callback(object); } + template static devcb_base &set_kbdata_cb(device_t &device, _Object object) { return downcast(device).m_kbdata_cb.set_callback(object); } // optional information overrides virtual const rom_entry *device_rom_region() const; @@ -62,7 +62,6 @@ public: protected: // device-level overrides virtual void device_start(); - virtual void device_reset(); private: required_device m_maincpu; @@ -80,10 +79,13 @@ private: required_ioport m_yb; required_ioport m_yc; - devcb_write_line m_kbrdy_handler; - devcb_write_line m_kbdata_handler; + devcb_write_line m_kbrdy_cb; + devcb_write_line m_kbdata_cb; + UINT8 m_p1; UINT8 m_y; + int m_stb; + int m_y12; int m_kbrdy; int m_kbdata; int m_kback; -- cgit v1.2.3