diff options
author | Aaron Giles <aaron@aarongiles.com> | 2012-05-03 09:00:08 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2012-05-03 09:00:08 +0000 |
commit | 2a88e54278acc526c11dba7961204f234f1f6e05 (patch) | |
tree | 1d78e932e47bb535e7e56ddac05232cdf551c3a1 /src/mame/drivers/kingdrby.c | |
parent | 605a48921b48e0127ff0330f1e895dcf16d084fb (diff) |
ioport.c C++ conversion. Mostly internal changes, with no
intended differences from previous behavior. For drivers,
the main change is that input_port_read() no longer exists.
Instead, the port must be fetched from the appropriate device,
and then read() is called.
For member functions, this is actually simpler/cleaner:
value = ioport("tag")->read()
For legacy functions which have a driver_data state, it goes:
value = state->ioport("tag")->read()
For other legacy functions, they need to fetch the root device:
value = machine.root_device().ioport("tag")->read()
The other big change for drivers is that IPT_VBLANK is gone.
Instead, it has been replaced by a device line callback on the
screen device. There's a new macro PORT_VBLANK("tag") which
automatically points things to the right spot.
Here's a set of imperfect search & replace strings to convert
the input_port_read calls and fix up IPT_VBLANK:
input_port_read( *\( *)(machine\(\)) *, *([^)]+ *\))
ioport\1\3->read\(\)
input_port_read( *\( *)(.*machine[()]*) *, *([^)]+ *\))
\2\.root_device\(\)\.ioport\1\3->read\(\)
(state = .*driver_data[^}]+)space->machine\(\)\.root_device\(\)\.
\1state->
(state = .*driver_data[^}]+)device->machine\(\)\.root_device\(\)\.
\1state->
input_port_read_safe( *\( *)(machine\(\)) *, *([^,]+), *([^)]+\))
ioport\1\3->read_safe\(\4\)
IPT_VBLANK( *\))
IPT_CUSTOM\1 PORT_VBLANK("screen")
Diffstat (limited to 'src/mame/drivers/kingdrby.c')
-rw-r--r-- | src/mame/drivers/kingdrby.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mame/drivers/kingdrby.c b/src/mame/drivers/kingdrby.c index bb1a27465ce..aef06cf7dde 100644 --- a/src/mame/drivers/kingdrby.c +++ b/src/mame/drivers/kingdrby.c @@ -267,7 +267,7 @@ WRITE8_MEMBER(kingdrby_state::sc0_attr_w) static READ8_DEVICE_HANDLER( hopper_io_r ) { kingdrby_state *state = device->machine().driver_data<kingdrby_state>(); - return (input_port_read(device->machine(),"HPIO") & 0x3f) | state->m_p1_hopper | state->m_p2_hopper; + return (state->ioport("HPIO")->read() & 0x3f) | state->m_p1_hopper | state->m_p2_hopper; } static WRITE8_DEVICE_HANDLER( hopper_io_w ) @@ -300,9 +300,9 @@ static READ8_DEVICE_HANDLER( input_mux_r ) { kingdrby_state *state = device->machine().driver_data<kingdrby_state>(); if(state->m_mux_data & 0x80) - return input_port_read(device->machine(),"MUX0"); + return state->ioport("MUX0")->read(); else - return input_port_read(device->machine(),"MUX1"); + return state->ioport("MUX1")->read(); } static READ8_DEVICE_HANDLER( key_matrix_r ) @@ -310,8 +310,8 @@ static READ8_DEVICE_HANDLER( key_matrix_r ) UINT16 p1_val,p2_val; UINT8 p1_res,p2_res; - p1_val = input_port_read(device->machine(),"KEY_1P"); - p2_val = input_port_read(device->machine(),"KEY_2P"); + p1_val = device->machine().root_device().ioport("KEY_1P")->read(); + p2_val = device->machine().root_device().ioport("KEY_2P")->read(); p1_res = 0; p2_res = 0; @@ -556,7 +556,7 @@ static INPUT_PORTS_START( kingdrby ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SPECIAL ) //2p hopper i/o PORT_START("IN1") // ppi0 (5001) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK ) //? + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") //? PORT_DIPNAME( 0x02, 0x02, "IN1" ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -739,7 +739,7 @@ static INPUT_PORTS_START( kingdrbb ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("IN1") // ppi0 (5001) - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VBLANK ) //? + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") //? PORT_DIPNAME( 0x02, 0x02, "IN1" ) PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |