From 3b4af26559d2f04294232506b0e52d6cf32b9434 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 31 May 2018 11:24:02 -0400 Subject: ti99_4p, ti99_4x, ti99_8: Use ioport finders for keyboard (nw) --- src/mame/drivers/ti99_4p.cpp | 14 +++++++++----- src/mame/drivers/ti99_4x.cpp | 21 ++++++++++++++------- src/mame/drivers/ti99_8.cpp | 14 ++++++-------- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/mame/drivers/ti99_4p.cpp b/src/mame/drivers/ti99_4p.cpp index 1b0d1d5dcf9..2727490c85d 100644 --- a/src/mame/drivers/ti99_4p.cpp +++ b/src/mame/drivers/ti99_4p.cpp @@ -147,7 +147,9 @@ public: m_peribox(*this, TI_PERIBOX_TAG), m_joyport(*this, TI_JOYPORT_TAG), m_scratchpad(*this, TI99_PADRAM_TAG), - m_amsram(*this, TI99_AMSRAM_TAG) + m_amsram(*this, TI99_AMSRAM_TAG), + m_keyboard(*this, "COL%u", 0U), + m_alpha(*this, "ALPHA") { } DECLARE_WRITE_LINE_MEMBER( ready_line ); @@ -199,6 +201,9 @@ private: required_device m_scratchpad; required_device m_amsram; + required_ioport_array<6> m_keyboard; + required_ioport m_alpha; + int decode_address(int address); DECLARE_READ16_MEMBER( debugger_read ); DECLARE_WRITE16_MEMBER( debugger_write ); @@ -725,7 +730,6 @@ READ8_MEMBER( ti99_4p_state::cruread ) /*************************************************************************** Keyboard/tape control ****************************************************************************/ -static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; READ8_MEMBER( ti99_4p_state::read_by_9901 ) { @@ -747,11 +751,11 @@ READ8_MEMBER( ti99_4p_state::read_by_9901 ) } else { - answer = ioport(column[m_keyboard_column])->read(); + answer = m_keyboard[m_keyboard_column]->read(); } if (m_check_alphalock) { - answer &= ~(ioport("ALPHA")->read()); + answer &= ~(m_alpha->read()); } answer = (answer << 3) | m_9901_int; break; @@ -764,7 +768,7 @@ READ8_MEMBER( ti99_4p_state::read_by_9901 ) // |1|1|1|1|0|K|K|K| if (m_keyboard_column >= m_firstjoy) answer = 0x07; - else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; + else answer = ((m_keyboard[m_keyboard_column]->read())>>5) & 0x07; answer |= 0xf0; break; diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp index 11e0bf10170..f9561b7a6c7 100644 --- a/src/mame/drivers/ti99_4x.cpp +++ b/src/mame/drivers/ti99_4x.cpp @@ -86,7 +86,11 @@ public: m_datamux(*this, TI99_DATAMUX_TAG), m_video(*this, TI_VDP_TAG), m_cassette1(*this, "cassette"), - m_cassette2(*this, "cassette2") + m_cassette2(*this, "cassette2"), + m_keyboard(*this, "COL%u", 0U), + m_alpha(*this, "ALPHA"), + m_alpha1(*this, "ALPHA1"), + m_alphabug(*this, "ALPHABUG") { } // Machine management @@ -184,6 +188,11 @@ private: required_device m_cassette1; required_device m_cassette2; + optional_ioport_array<6> m_keyboard; + optional_ioport m_alpha; + optional_ioport m_alpha1; + optional_ioport m_alphabug; + // Timer for EVPC (provided by the TMS9929A, but EVPC replaces that VDP) emu_timer *m_gromclk_timer; @@ -458,8 +467,6 @@ WRITE8_MEMBER( ti99_4x_state::external_operation ) ***************************************************************************/ -static const char *const column[] = { "COL0", "COL1", "COL2", "COL3", "COL4", "COL5" }; - READ8_MEMBER( ti99_4x_state::read_by_9901 ) { int answer=0; @@ -486,15 +493,15 @@ READ8_MEMBER( ti99_4x_state::read_by_9901 ) // the line enough to make the TMS9901 sense the low level. // A reported, feasible fix was to cut the line and insert a diode // below the Alphalock key. - if ((m_model!=MODEL_4) && (ioport("ALPHABUG")->read()!=0) ) answer |= (ioport("ALPHA")->read() | ioport("ALPHA1")->read()); + if ((m_model!=MODEL_4) && (m_alphabug->read()!=0) ) answer |= (m_alpha->read() | m_alpha1->read()); } else { - answer = ioport(column[m_keyboard_column])->read(); + answer = m_keyboard[m_keyboard_column]->read(); } if (m_check_alphalock) // never true for TI-99/4 { - answer &= ~(ioport("ALPHA")->read() | ioport("ALPHA1")->read()); + answer &= ~(m_alpha->read() | m_alpha1->read()); } answer = (answer << 3); if (m_int1 == CLEAR_LINE) answer |= 0x02; @@ -505,7 +512,7 @@ READ8_MEMBER( ti99_4x_state::read_by_9901 ) case tms9901_device::INT8_INT15: // |1|1|1|INT12|0|K|K|K| if (m_keyboard_column >= (m_model==MODEL_4? 5:6)) answer = 0x07; - else answer = ((ioport(column[m_keyboard_column])->read())>>5) & 0x07; + else answer = ((m_keyboard[m_keyboard_column]->read())>>5) & 0x07; answer |= 0xe0; if (m_model != MODEL_4 || m_int12==CLEAR_LINE) answer |= 0x10; break; diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 8ad91d0895a..1b49497785f 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -222,7 +222,8 @@ public: m_ioport(*this, TI99_IOPORT_TAG), m_mainboard(*this, TI998_MAINBOARD_TAG), m_joyport(*this, TI_JOYPORT_TAG), - m_cassette(*this, "cassette") + m_cassette(*this, "cassette"), + m_keyboard(*this, "COL%u", 0U) { } @@ -286,6 +287,8 @@ private: required_device m_mainboard; required_device m_joyport; required_device m_cassette; + + required_ioport_array<14> m_keyboard; }; /* @@ -448,11 +451,6 @@ WRITE8_MEMBER( ti99_8_state::cruwrite ) keyboard column selection.) ***************************************************************************/ -static const char *const column[] = { - "COL0", "COL1", "COL2", "COL3", "COL4", "COL5", "COL6", "COL7", - "COL8", "COL9", "COL10", "COL11", "COL12", "COL13" -}; - READ8_MEMBER( ti99_8_state::read_by_9901 ) { int answer=0; @@ -477,7 +475,7 @@ READ8_MEMBER( ti99_8_state::read_by_9901 ) } else { - answer = ioport(column[m_keyboard_column])->read(); + answer = m_keyboard[m_keyboard_column]->read(); } answer = (answer << 6); if (m_int1 == CLEAR_LINE) answer |= 0x02; @@ -502,7 +500,7 @@ READ8_MEMBER( ti99_8_state::read_by_9901 ) } else { - answer = ioport(column[m_keyboard_column])->read(); + answer = m_keyboard[m_keyboard_column]->read(); } answer = (answer >> 2) & 0x07; break; -- cgit v1.2.3