Skip to content

Commit b799b66

Browse files
committed
simplify ioport reads for the control panel buttons
1 parent db5af29 commit b799b66

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

src/mame/technics/kn5000.cpp

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ class kn5000_state : public driver_device
106106
, m_checking_device_led_cn11(*this, "checking_device_led_cn11")
107107
, m_extension(*this, "extension")
108108
, m_extension_view(*this, "extension_view")
109+
, m_CPL_SEG(*this, "CPL_SEG%u", 0U)
110+
, m_CPR_SEG(*this, "CPR_SEG%u", 0U)
109111
, m_CPL_LED(*this, "CPL_%u", 0U)
110112
, m_CPR_LED(*this, "CPR_%u", 0U)
111113
, m_led_row(0)
@@ -125,6 +127,8 @@ class kn5000_state : public driver_device
125127
required_device<kn5000_extension_device> m_extension;
126128
memory_view m_extension_view;
127129

130+
required_ioport_array<11> m_CPL_SEG; // buttons on "Control Panel Left" PCB
131+
required_ioport_array<11> m_CPR_SEG; // buttons on "Control Panel Right" PCB
128132
output_finder<50> m_CPL_LED;
129133
output_finder<69> m_CPR_LED;
130134
uint8_t m_led_row;
@@ -457,44 +461,12 @@ INPUT_PORTS_END
457461

458462
uint8_t kn5000_state::cpanel_left_buttons_r(offs_t offset)
459463
{
460-
switch (offset)
461-
{
462-
case 0: return ioport("CPL_SEG0")->read(); break;
463-
case 1: return ioport("CPL_SEG1")->read(); break;
464-
case 2: return ioport("CPL_SEG2")->read(); break;
465-
case 3: return ioport("CPL_SEG3")->read(); break;
466-
case 4: return ioport("CPL_SEG4")->read(); break;
467-
case 5: return ioport("CPL_SEG5")->read(); break;
468-
case 6: return ioport("CPL_SEG6")->read(); break;
469-
case 7: return ioport("CPL_SEG7")->read(); break;
470-
case 8: return ioport("CPL_SEG8")->read(); break;
471-
case 9: return ioport("CPL_SEG9")->read(); break;
472-
case 10: return ioport("CPL_SEG10")->read(); break;
473-
default:
474-
return 0x00;
475-
break;
476-
}
464+
return m_CPL_SEG[offset]->read();
477465
}
478466

479467
uint8_t kn5000_state::cpanel_right_buttons_r(offs_t offset)
480468
{
481-
switch (offset)
482-
{
483-
case 0: return ioport("CPR_SEG0")->read(); break;
484-
case 1: return ioport("CPR_SEG1")->read(); break;
485-
case 2: return ioport("CPR_SEG2")->read(); break;
486-
case 3: return ioport("CPR_SEG3")->read(); break;
487-
case 4: return ioport("CPR_SEG4")->read(); break;
488-
case 5: return ioport("CPR_SEG5")->read(); break;
489-
case 6: return ioport("CPR_SEG6")->read(); break;
490-
case 7: return ioport("CPR_SEG7")->read(); break;
491-
case 8: return ioport("CPR_SEG8")->read(); break;
492-
case 9: return ioport("CPR_SEG9")->read(); break;
493-
case 10: return ioport("CPR_SEG10")->read(); break;
494-
default:
495-
return 0x00;
496-
break;
497-
}
469+
return m_CPR_SEG[offset]->read();
498470
}
499471

500472

0 commit comments

Comments
 (0)