diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2012-04-06 14:29:31 +0000 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2012-04-06 14:29:31 +0000 |
commit | 3541b5c3513664684e43577fb9c5a4ae6177d600 (patch) | |
tree | ff0676de43d473f4ba5b5ecd7b3f92a84d70f448 /src/mame/machine/atarifb.c | |
parent | 7818ba99ea894304b5c6e804c3e1f87327f21fcd (diff) |
MAME going modern part 7 (no whatsnew)
Diffstat (limited to 'src/mame/machine/atarifb.c')
-rw-r--r-- | src/mame/machine/atarifb.c | 229 |
1 files changed, 110 insertions, 119 deletions
diff --git a/src/mame/machine/atarifb.c b/src/mame/machine/atarifb.c index b47fb59147a..6b9d913fa2c 100644 --- a/src/mame/machine/atarifb.c +++ b/src/mame/machine/atarifb.c @@ -9,12 +9,11 @@ #include "sound/discrete.h" -WRITE8_HANDLER( atarifb_out1_w ) +WRITE8_MEMBER(atarifb_state::atarifb_out1_w) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); - state->m_CTRLD = data; + m_CTRLD = data; discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit @@ -23,28 +22,26 @@ WRITE8_HANDLER( atarifb_out1_w ) } -WRITE8_HANDLER( atarifb4_out1_w ) +WRITE8_MEMBER(atarifb_state::atarifb4_out1_w) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); - state->m_CTRLD = data; + m_CTRLD = data; discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker - coin_counter_w(space->machine(), 1, data & 0x80); + coin_counter_w(machine(), 1, data & 0x80); } -WRITE8_HANDLER( abaseb_out1_w ) +WRITE8_MEMBER(atarifb_state::abaseb_out1_w) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); - state->m_CTRLD = data; + m_CTRLD = data; discrete_sound_w(discrete, ATARIFB_WHISTLE_EN, data & 0x01); // Whistle discrete_sound_w(discrete, ATARIFB_HIT_EN, data & 0x02); // Hit @@ -54,24 +51,23 @@ WRITE8_HANDLER( abaseb_out1_w ) if (data & 0x80) { /* Invert video */ - palette_set_color(space->machine(), 1, MAKE_RGB(0x00,0x00,0x00)); /* black */ - palette_set_color(space->machine(), 0, MAKE_RGB(0xff,0xff,0xff)); /* white */ + palette_set_color(machine(), 1, MAKE_RGB(0x00,0x00,0x00)); /* black */ + palette_set_color(machine(), 0, MAKE_RGB(0xff,0xff,0xff)); /* white */ } else { /* Regular video */ - palette_set_color(space->machine(), 0, MAKE_RGB(0x00,0x00,0x00)); /* black */ - palette_set_color(space->machine(), 1, MAKE_RGB(0xff,0xff,0xff)); /* white */ + palette_set_color(machine(), 0, MAKE_RGB(0x00,0x00,0x00)); /* black */ + palette_set_color(machine(), 1, MAKE_RGB(0xff,0xff,0xff)); /* white */ } } -WRITE8_HANDLER( soccer_out1_w ) +WRITE8_MEMBER(atarifb_state::soccer_out1_w) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); - state->m_CTRLD = data; + m_CTRLD = data; /* bit 0 = whistle */ /* bit 1 = hit */ @@ -86,30 +82,30 @@ WRITE8_HANDLER( soccer_out1_w ) discrete_sound_w(discrete, ATARIFB_ATTRACT_EN, data & 0x10); // Attract discrete_sound_w(discrete, ATARIFB_NOISE_EN, data & 0x04); // Noise Enable / Kicker -// set_led_status(space->machine(), 0, data & 0x10); // !!!!!!!!!! Is this correct???? - set_led_status(space->machine(), 1, data & 0x80); +// set_led_status(machine(), 0, data & 0x10); // !!!!!!!!!! Is this correct???? + set_led_status(machine(), 1, data & 0x80); } -WRITE8_HANDLER( atarifb_out2_w ) +WRITE8_MEMBER(atarifb_state::atarifb_out2_w) { - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); discrete_sound_w(discrete, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd - coin_counter_w (space->machine(), 0, data & 0x10); + coin_counter_w (machine(), 0, data & 0x10); } -WRITE8_HANDLER( soccer_out2_w ) +WRITE8_MEMBER(atarifb_state::soccer_out2_w) { - device_t *discrete = space->machine().device("discrete"); + device_t *discrete = machine().device("discrete"); discrete_sound_w(discrete, ATARIFB_CROWD_DATA, data & 0x0f); // Crowd - coin_counter_w (space->machine(), 0, data & 0x10); - coin_counter_w (space->machine(), 1, data & 0x20); - coin_counter_w (space->machine(), 2, data & 0x40); + coin_counter_w (machine(), 0, data & 0x10); + coin_counter_w (machine(), 1, data & 0x20); + coin_counter_w (machine(), 2, data & 0x40); } @@ -121,10 +117,9 @@ WRITE8_HANDLER( soccer_out2_w ) *************************************/ /* FIXME: almost surely not tied with screen vertical position */ -WRITE8_HANDLER( atarifb_out3_w ) +WRITE8_MEMBER(atarifb_state::atarifb_out3_w) { - //atarifb_state *state = space->machine().driver_data<atarifb_state>(); - int loop = space->machine().primary_screen->vpos() >= 123; + int loop = machine().primary_screen->vpos() >= 123; switch (loop) { @@ -149,18 +144,17 @@ WRITE8_HANDLER( atarifb_out3_w ) } -READ8_HANDLER( atarifb_in0_r ) +READ8_MEMBER(atarifb_state::atarifb_in0_r) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - if ((state->m_CTRLD & 0x20) == 0x00) + if ((m_CTRLD & 0x20) == 0x00) { int val; - val = (state->m_sign_y_2 >> 7) | - (state->m_sign_x_2 >> 6) | - (state->m_sign_y_1 >> 5) | - (state->m_sign_x_1 >> 4) | - input_port_read(space->machine(), "IN0"); + val = (m_sign_y_2 >> 7) | + (m_sign_x_2 >> 6) | + (m_sign_y_1 >> 5) | + (m_sign_x_1 >> 4) | + input_port_read(machine(), "IN0"); return val; } else @@ -168,175 +162,172 @@ READ8_HANDLER( atarifb_in0_r ) int new_x, new_y; /* Read player 1 trackball */ - new_x = input_port_read(space->machine(), "IN3"); - if (new_x != state->m_counter_x_in0) + new_x = input_port_read(machine(), "IN3"); + if (new_x != m_counter_x_in0) { - state->m_sign_x_1 = (new_x - state->m_counter_x_in0) & 0x80; - state->m_counter_x_in0 = new_x; + m_sign_x_1 = (new_x - m_counter_x_in0) & 0x80; + m_counter_x_in0 = new_x; } - new_y = input_port_read(space->machine(), "IN2"); - if (new_y != state->m_counter_y_in0) + new_y = input_port_read(machine(), "IN2"); + if (new_y != m_counter_y_in0) { - state->m_sign_y_1 = (new_y - state->m_counter_y_in0) & 0x80; - state->m_counter_y_in0 = new_y; + m_sign_y_1 = (new_y - m_counter_y_in0) & 0x80; + m_counter_y_in0 = new_y; } - return (((state->m_counter_y_in0 & 0x0f) << 4) | (state->m_counter_x_in0 & 0x0f)); + return (((m_counter_y_in0 & 0x0f) << 4) | (m_counter_x_in0 & 0x0f)); } } -READ8_HANDLER( atarifb_in2_r ) +READ8_MEMBER(atarifb_state::atarifb_in2_r) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - if ((state->m_CTRLD & 0x20) == 0x00) + if ((m_CTRLD & 0x20) == 0x00) { - return input_port_read(space->machine(), "IN1"); + return input_port_read(machine(), "IN1"); } else { int new_x, new_y; /* Read player 2 trackball */ - new_x = input_port_read(space->machine(), "IN5"); - if (new_x != state->m_counter_x_in2) + new_x = input_port_read(machine(), "IN5"); + if (new_x != m_counter_x_in2) { - state->m_sign_x_2 = (new_x - state->m_counter_x_in2) & 0x80; - state->m_counter_x_in2 = new_x; + m_sign_x_2 = (new_x - m_counter_x_in2) & 0x80; + m_counter_x_in2 = new_x; } - new_y = input_port_read(space->machine(), "IN4"); - if (new_y != state->m_counter_y_in2) + new_y = input_port_read(machine(), "IN4"); + if (new_y != m_counter_y_in2) { - state->m_sign_y_2 = (new_y - state->m_counter_y_in2) & 0x80; - state->m_counter_y_in2 = new_y; + m_sign_y_2 = (new_y - m_counter_y_in2) & 0x80; + m_counter_y_in2 = new_y; } - return (((state->m_counter_y_in2 & 0x0f) << 4) | (state->m_counter_x_in2 & 0x0f)); + return (((m_counter_y_in2 & 0x0f) << 4) | (m_counter_x_in2 & 0x0f)); } } -READ8_HANDLER( atarifb4_in0_r ) +READ8_MEMBER(atarifb_state::atarifb4_in0_r) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); /* LD1 and LD2 low, return sign bits */ - if ((state->m_CTRLD & 0x60) == 0x00) + if ((m_CTRLD & 0x60) == 0x00) { int val; - val = (state->m_sign_x_4 >> 7) | - (state->m_sign_y_4 >> 6) | - (state->m_sign_x_2 >> 5) | - (state->m_sign_y_2 >> 4) | - (state->m_sign_x_3 >> 3) | - (state->m_sign_y_3 >> 2) | - (state->m_sign_x_1 >> 1) | - (state->m_sign_y_1 >> 0); + val = (m_sign_x_4 >> 7) | + (m_sign_y_4 >> 6) | + (m_sign_x_2 >> 5) | + (m_sign_y_2 >> 4) | + (m_sign_x_3 >> 3) | + (m_sign_y_3 >> 2) | + (m_sign_x_1 >> 1) | + (m_sign_y_1 >> 0); return val; } - else if ((state->m_CTRLD & 0x60) == 0x60) + else if ((m_CTRLD & 0x60) == 0x60) /* LD1 and LD2 both high, return Team 1 right player (player 1) */ { int new_x, new_y; /* Read player 1 trackball */ - new_x = input_port_read(space->machine(), "IN3"); - if (new_x != state->m_counter_x_in0) + new_x = input_port_read(machine(), "IN3"); + if (new_x != m_counter_x_in0) { - state->m_sign_x_1 = (new_x - state->m_counter_x_in0) & 0x80; - state->m_counter_x_in0 = new_x; + m_sign_x_1 = (new_x - m_counter_x_in0) & 0x80; + m_counter_x_in0 = new_x; } - new_y = input_port_read(space->machine(), "IN2"); - if (new_y != state->m_counter_y_in0) + new_y = input_port_read(machine(), "IN2"); + if (new_y != m_counter_y_in0) { - state->m_sign_y_1 = (new_y - state->m_counter_y_in0) & 0x80; - state->m_counter_y_in0 = new_y; + m_sign_y_1 = (new_y - m_counter_y_in0) & 0x80; + m_counter_y_in0 = new_y; } - return (((state->m_counter_y_in0 & 0x0f) << 4) | (state->m_counter_x_in0 & 0x0f)); + return (((m_counter_y_in0 & 0x0f) << 4) | (m_counter_x_in0 & 0x0f)); } - else if ((state->m_CTRLD & 0x60) == 0x40) + else if ((m_CTRLD & 0x60) == 0x40) /* LD1 high, LD2 low, return Team 1 left player (player 2) */ { int new_x, new_y; /* Read player 2 trackball */ - new_x = input_port_read(space->machine(), "IN5"); - if (new_x != state->m_counter_x_in0b) + new_x = input_port_read(machine(), "IN5"); + if (new_x != m_counter_x_in0b) { - state->m_sign_x_2 = (new_x - state->m_counter_x_in0b) & 0x80; - state->m_counter_x_in0b = new_x; + m_sign_x_2 = (new_x - m_counter_x_in0b) & 0x80; + m_counter_x_in0b = new_x; } - new_y = input_port_read(space->machine(), "IN4"); - if (new_y != state->m_counter_y_in0b) + new_y = input_port_read(machine(), "IN4"); + if (new_y != m_counter_y_in0b) { - state->m_sign_y_2 = (new_y - state->m_counter_y_in0b) & 0x80; - state->m_counter_y_in0b = new_y; + m_sign_y_2 = (new_y - m_counter_y_in0b) & 0x80; + m_counter_y_in0b = new_y; } - return (((state->m_counter_y_in0b & 0x0f) << 4) | (state->m_counter_x_in0b & 0x0f)); + return (((m_counter_y_in0b & 0x0f) << 4) | (m_counter_x_in0b & 0x0f)); } else return 0; } -READ8_HANDLER( atarifb4_in2_r ) +READ8_MEMBER(atarifb_state::atarifb4_in2_r) { - atarifb_state *state = space->machine().driver_data<atarifb_state>(); - if ((state->m_CTRLD & 0x40) == 0x00) + if ((m_CTRLD & 0x40) == 0x00) { - return input_port_read(space->machine(), "IN1"); + return input_port_read(machine(), "IN1"); } - else if ((state->m_CTRLD & 0x60) == 0x60) + else if ((m_CTRLD & 0x60) == 0x60) /* LD1 and LD2 both high, return Team 2 right player (player 3) */ { int new_x, new_y; /* Read player 3 trackball */ - new_x = input_port_read(space->machine(), "IN7"); - if (new_x != state->m_counter_x_in2) + new_x = input_port_read(machine(), "IN7"); + if (new_x != m_counter_x_in2) { - state->m_sign_x_3 = (new_x - state->m_counter_x_in2) & 0x80; - state->m_counter_x_in2 = new_x; + m_sign_x_3 = (new_x - m_counter_x_in2) & 0x80; + m_counter_x_in2 = new_x; } - new_y = input_port_read(space->machine(), "IN6"); - if (new_y != state->m_counter_y_in2) + new_y = input_port_read(machine(), "IN6"); + if (new_y != m_counter_y_in2) { - state->m_sign_y_3 = (new_y - state->m_counter_y_in2) & 0x80; - state->m_counter_y_in2 = new_y; + m_sign_y_3 = (new_y - m_counter_y_in2) & 0x80; + m_counter_y_in2 = new_y; } - return (((state->m_counter_y_in2 & 0x0f) << 4) | (state->m_counter_x_in2 & 0x0f)); + return (((m_counter_y_in2 & 0x0f) << 4) | (m_counter_x_in2 & 0x0f)); } - else if ((state->m_CTRLD & 0x60) == 0x40) + else if ((m_CTRLD & 0x60) == 0x40) /* LD1 high, LD2 low, return Team 2 left player (player 4) */ { int new_x, new_y; /* Read player 4 trackball */ - new_x = input_port_read(space->machine(), "IN9"); - if (new_x != state->m_counter_x_in2b) + new_x = input_port_read(machine(), "IN9"); + if (new_x != m_counter_x_in2b) { - state->m_sign_x_4 = (new_x - state->m_counter_x_in2b) & 0x80; - state->m_counter_x_in2b = new_x; + m_sign_x_4 = (new_x - m_counter_x_in2b) & 0x80; + m_counter_x_in2b = new_x; } - new_y = input_port_read(space->machine(), "IN8"); - if (new_y != state->m_counter_y_in2b) + new_y = input_port_read(machine(), "IN8"); + if (new_y != m_counter_y_in2b) { - state->m_sign_y_4 = (new_y - state->m_counter_y_in2b) & 0x80; - state->m_counter_y_in2b = new_y; + m_sign_y_4 = (new_y - m_counter_y_in2b) & 0x80; + m_counter_y_in2b = new_y; } - return (((state->m_counter_y_in2b & 0x0f) << 4) | (state->m_counter_x_in2b & 0x0f)); + return (((m_counter_y_in2b & 0x0f) << 4) | (m_counter_x_in2b & 0x0f)); } else return 0; |