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/machine/atarifb.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/machine/atarifb.c')
-rw-r--r-- | src/mame/machine/atarifb.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/mame/machine/atarifb.c b/src/mame/machine/atarifb.c index 6b9d913fa2c..658f34357e9 100644 --- a/src/mame/machine/atarifb.c +++ b/src/mame/machine/atarifb.c @@ -154,7 +154,7 @@ READ8_MEMBER(atarifb_state::atarifb_in0_r) (m_sign_x_2 >> 6) | (m_sign_y_1 >> 5) | (m_sign_x_1 >> 4) | - input_port_read(machine(), "IN0"); + ioport("IN0")->read(); return val; } else @@ -162,14 +162,14 @@ READ8_MEMBER(atarifb_state::atarifb_in0_r) int new_x, new_y; /* Read player 1 trackball */ - new_x = input_port_read(machine(), "IN3"); + new_x = ioport("IN3")->read(); if (new_x != m_counter_x_in0) { m_sign_x_1 = (new_x - m_counter_x_in0) & 0x80; m_counter_x_in0 = new_x; } - new_y = input_port_read(machine(), "IN2"); + new_y = ioport("IN2")->read(); if (new_y != m_counter_y_in0) { m_sign_y_1 = (new_y - m_counter_y_in0) & 0x80; @@ -186,21 +186,21 @@ READ8_MEMBER(atarifb_state::atarifb_in2_r) if ((m_CTRLD & 0x20) == 0x00) { - return input_port_read(machine(), "IN1"); + return ioport("IN1")->read(); } else { int new_x, new_y; /* Read player 2 trackball */ - new_x = input_port_read(machine(), "IN5"); + new_x = ioport("IN5")->read(); if (new_x != m_counter_x_in2) { m_sign_x_2 = (new_x - m_counter_x_in2) & 0x80; m_counter_x_in2 = new_x; } - new_y = input_port_read(machine(), "IN4"); + new_y = ioport("IN4")->read(); if (new_y != m_counter_y_in2) { m_sign_y_2 = (new_y - m_counter_y_in2) & 0x80; @@ -235,14 +235,14 @@ READ8_MEMBER(atarifb_state::atarifb4_in0_r) int new_x, new_y; /* Read player 1 trackball */ - new_x = input_port_read(machine(), "IN3"); + new_x = ioport("IN3")->read(); if (new_x != m_counter_x_in0) { m_sign_x_1 = (new_x - m_counter_x_in0) & 0x80; m_counter_x_in0 = new_x; } - new_y = input_port_read(machine(), "IN2"); + new_y = ioport("IN2")->read(); if (new_y != m_counter_y_in0) { m_sign_y_1 = (new_y - m_counter_y_in0) & 0x80; @@ -257,14 +257,14 @@ READ8_MEMBER(atarifb_state::atarifb4_in0_r) int new_x, new_y; /* Read player 2 trackball */ - new_x = input_port_read(machine(), "IN5"); + new_x = ioport("IN5")->read(); if (new_x != m_counter_x_in0b) { m_sign_x_2 = (new_x - m_counter_x_in0b) & 0x80; m_counter_x_in0b = new_x; } - new_y = input_port_read(machine(), "IN4"); + new_y = ioport("IN4")->read(); if (new_y != m_counter_y_in0b) { m_sign_y_2 = (new_y - m_counter_y_in0b) & 0x80; @@ -283,7 +283,7 @@ READ8_MEMBER(atarifb_state::atarifb4_in2_r) if ((m_CTRLD & 0x40) == 0x00) { - return input_port_read(machine(), "IN1"); + return ioport("IN1")->read(); } else if ((m_CTRLD & 0x60) == 0x60) /* LD1 and LD2 both high, return Team 2 right player (player 3) */ @@ -291,14 +291,14 @@ READ8_MEMBER(atarifb_state::atarifb4_in2_r) int new_x, new_y; /* Read player 3 trackball */ - new_x = input_port_read(machine(), "IN7"); + new_x = ioport("IN7")->read(); if (new_x != m_counter_x_in2) { m_sign_x_3 = (new_x - m_counter_x_in2) & 0x80; m_counter_x_in2 = new_x; } - new_y = input_port_read(machine(), "IN6"); + new_y = ioport("IN6")->read(); if (new_y != m_counter_y_in2) { m_sign_y_3 = (new_y - m_counter_y_in2) & 0x80; @@ -313,14 +313,14 @@ READ8_MEMBER(atarifb_state::atarifb4_in2_r) int new_x, new_y; /* Read player 4 trackball */ - new_x = input_port_read(machine(), "IN9"); + new_x = ioport("IN9")->read(); if (new_x != m_counter_x_in2b) { m_sign_x_4 = (new_x - m_counter_x_in2b) & 0x80; m_counter_x_in2b = new_x; } - new_y = input_port_read(machine(), "IN8"); + new_y = ioport("IN8")->read(); if (new_y != m_counter_y_in2b) { m_sign_y_4 = (new_y - m_counter_y_in2b) & 0x80; |