summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2014-05-16 16:35:43 +0000
committer Ivan Vangelista <mesgnet@yahoo.it>2014-05-16 16:35:43 +0000
commitd1a012603cfcdd6f72a94f81e27bf97b1acc8bbd (patch)
treed2eb2bf49f9be9a52b5b197d8a1bfaf1091ee6b3
parente57098e49cf62d47b655c383f3f664f68ebb672f (diff)
pc1500.c: let's try ioport_array (nw)
-rw-r--r--src/mess/drivers/pc1500.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/src/mess/drivers/pc1500.c b/src/mess/drivers/pc1500.c
index 633b11c360c..68fa62f51e4 100644
--- a/src/mess/drivers/pc1500.c
+++ b/src/mess/drivers/pc1500.c
@@ -26,12 +26,17 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_rtc(*this, "upd1990a"),
- m_lcd_data(*this, "lcd_data") { }
+ m_lcd_data(*this, "lcd_data"),
+ m_keyboard(*this, "KEY"),
+ m_io_on(*this, "ON") { }
required_device<cpu_device> m_maincpu;
required_device<upd1990a_device> m_rtc;
required_shared_ptr<UINT8> m_lcd_data;
+ required_ioport_array<8> m_keyboard;
+ required_ioport m_io_on;
+
UINT8 m_kb_matrix;
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -67,23 +72,12 @@ READ8_MEMBER( pc1500_state::pc1500_kb_r )
UINT8 data = 0xff;
if (!started()) return 0;
-
- if (!(m_kb_matrix & 0x01))
- data &= ioport("KEY0")->read();
- if (!(m_kb_matrix & 0x02))
- data &= ioport("KEY1")->read();
- if (!(m_kb_matrix & 0x04))
- data &= ioport("KEY2")->read();
- if (!(m_kb_matrix & 0x08))
- data &= ioport("KEY3")->read();
- if (!(m_kb_matrix & 0x10))
- data &= ioport("KEY4")->read();
- if (!(m_kb_matrix & 0x20))
- data &= ioport("KEY5")->read();
- if (!(m_kb_matrix & 0x40))
- data &= ioport("KEY6")->read();
- if (!(m_kb_matrix & 0x80))
- data &= ioport("KEY7")->read();
+
+ for (int i = 0; i < 8; i++)
+ {
+ if (!BIT(m_kb_matrix, i))
+ data &= m_keyboard[i]->read();
+ }
return data;
}
@@ -134,7 +128,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_START("ON")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10)
- PORT_START("KEY0")
+ PORT_START("KEY.0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
@@ -144,7 +138,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_UP)
- PORT_START("KEY1")
+ PORT_START("KEY.1")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(".") PORT_CODE(KEYCODE_STOP)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("OFF") PORT_CODE(KEYCODE_F11)
@@ -154,7 +148,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Y") PORT_CODE(KEYCODE_X)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ST") PORT_CODE(KEYCODE_F8)
- PORT_START("KEY2")
+ PORT_START("KEY.2")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
@@ -164,7 +158,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
- PORT_START("KEY3")
+ PORT_START("KEY.3")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(")") PORT_CODE(KEYCODE_CLOSEBRACE)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("O") PORT_CODE(KEYCODE_O)
@@ -174,7 +168,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("(") PORT_CODE(KEYCODE_OPENBRACE)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("ENTER") PORT_CODE(KEYCODE_ENTER)
- PORT_START("KEY4")
+ PORT_START("KEY.4")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("+") PORT_CODE(KEYCODE_PLUS_PAD)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("*") PORT_CODE(KEYCODE_ASTERISK)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH_PAD)
@@ -184,7 +178,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RCL") PORT_CODE(KEYCODE_F7)
- PORT_START("KEY5")
+ PORT_START("KEY.5")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_EQUALS)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_LEFT)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
@@ -194,7 +188,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE)
- PORT_START("KEY6")
+ PORT_START("KEY.6")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_RIGHT)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("MODE") PORT_CODE(KEYCODE_HOME)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("CL") PORT_CODE(KEYCODE_DEL)
@@ -204,7 +198,7 @@ static INPUT_PORTS_START( pc1500 )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SML") PORT_CODE(KEYCODE_PGDN)
- PORT_START("KEY7")
+ PORT_START("KEY.7")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
@@ -248,7 +242,7 @@ READ8_MEMBER( pc1500_state::port_b_r )
data |= (m_rtc->tp_r()<<5);
data |= (m_rtc->data_out_r()<<6);
- data |= (ioport("ON")->read()<<7);
+ data |= (m_io_on->read()<<7);
return data;
}