various drivers: a few more output().set_value() removals

This commit is contained in:
Ivan Vangelista 2023-08-30 17:09:13 +02:00
parent 4b8555ff72
commit 2eede25426
9 changed files with 298 additions and 148 deletions

View File

@ -551,8 +551,6 @@ void abc99_device::led_w(uint8_t data)
{
if (m_led_en) return;
machine().output().set_value("led0", !BIT(data, 2));
m_leds[LED_1] = BIT(data, 0);
m_leds[LED_2] = BIT(data, 1);
m_leds[LED_3] = BIT(data, 2);

View File

@ -226,7 +226,9 @@ public:
m_sw1_1(*this, "maincpu:sw1_1"),
m_sw1_2(*this, "maincpu:sw1_2"),
m_sw1_3(*this, "maincpu:sw1_3"),
m_sw1_4(*this, "maincpu:sw1_4")
m_sw1_4(*this, "maincpu:sw1_4"),
m_serve_led_output(*this, "serve_led"),
m_lamp_credit_output(*this, "lamp_credit%u", 1U)
{
}
required_device<netlist_mame_analog_output_device> m_led_serve;
@ -241,17 +243,12 @@ public:
NETDEV_ANALOG_CALLBACK_MEMBER(serve_cb)
{
output().set_value("serve_led", (data < 3.5) ? 1 : 0);
m_serve_led_output = (data < 3.5) ? 1 : 0;
}
NETDEV_ANALOG_CALLBACK_MEMBER(credit1_cb)
template <uint8_t Which> NETDEV_ANALOG_CALLBACK_MEMBER(credit_cb)
{
output().set_value("lamp_credit1", (data < 2.0) ? 0 : 1);
}
NETDEV_ANALOG_CALLBACK_MEMBER(credit2_cb)
{
output().set_value("lamp_credit2", (data < 2.0) ? 0 : 1);
m_lamp_credit_output[Which] = (data < 2.0) ? 0 : 1;
}
NETDEV_ANALOG_CALLBACK_MEMBER(coin_counter_cb)
@ -271,12 +268,13 @@ public:
protected:
// driver_device overrides
virtual void machine_start() override { };
virtual void machine_start() override { m_serve_led_output.resolve(); m_lamp_credit_output.resolve(); };
virtual void machine_reset() override { };
virtual void video_start() override { };
private:
output_finder<> m_serve_led_output;
output_finder<2> m_lamp_credit_output;
};
class rebound_state : public ttl_mono_state
@ -286,6 +284,7 @@ public:
: ttl_mono_state(mconfig, type, tag)
, m_sw1a(*this, "maincpu:dsw1a")
, m_sw1b(*this, "maincpu:dsw1b")
, m_credit_led(*this, "credit_led")
{
}
@ -297,7 +296,7 @@ public:
NETDEV_ANALOG_CALLBACK_MEMBER(led_credit_cb)
{
output().set_value("credit_led", (data < 3.5) ? 1 : 0);
m_credit_led = (data < 3.5) ? 1 : 0;
}
NETDEV_ANALOG_CALLBACK_MEMBER(coin_counter_cb)
@ -310,12 +309,12 @@ public:
protected:
// driver_device overrides
virtual void machine_start() override { };
virtual void machine_start() override { m_credit_led.resolve(); };
virtual void machine_reset() override { };
virtual void video_start() override { };
private:
output_finder<> m_credit_led;
};
@ -527,8 +526,8 @@ void breakout_state::breakout(machine_config &config)
// Leds and lamps
NETLIST_ANALOG_OUTPUT(config, "maincpu:led_serve", 0).set_params("CON_P", FUNC(breakout_state::serve_cb));
NETLIST_ANALOG_OUTPUT(config, "maincpu:lamp_credit1", 0).set_params("CON_CREDIT1", FUNC(breakout_state::credit1_cb));
NETLIST_ANALOG_OUTPUT(config, "maincpu:lamp_credit2", 0).set_params("CON_CREDIT2", FUNC(breakout_state::credit2_cb));
NETLIST_ANALOG_OUTPUT(config, "maincpu:lamp_credit1", 0).set_params("CON_CREDIT1", FUNC(breakout_state::credit_cb<0>));
NETLIST_ANALOG_OUTPUT(config, "maincpu:lamp_credit2", 0).set_params("CON_CREDIT2", FUNC(breakout_state::credit_cb<1>));
NETLIST_ANALOG_OUTPUT(config, "maincpu:coin_counter", 0).set_params("CON_T", FUNC(breakout_state::coin_counter_cb));
/* video hardware */

View File

@ -2406,7 +2406,27 @@ void mw8080bw_state::phantom2(machine_config &config)
*
*************************************/
uint8_t mw8080bw_state::bowler_shift_result_r()
void bowler_state::machine_start()
{
mw8080bw_state::machine_start();
m_200_left_light.resolve();
m_200_right_light.resolve();
m_400_left_light.resolve();
m_400_right_light.resolve();
m_500_left_light.resolve();
m_500_right_light.resolve();
m_700_light.resolve();
m_x_left_light.resolve();
m_x_right_light.resolve();
m_regulation_game_light.resolve();
m_flash_game_light.resolve();
m_straight_ball_light.resolve();
m_hook_ball_light.resolve();
m_select_game_light.resolve();
}
uint8_t bowler_state::shift_result_r()
{
/* ZV - not too sure why this is needed, I don't see
anything unusual on the schematics that would cause
@ -2415,48 +2435,48 @@ uint8_t mw8080bw_state::bowler_shift_result_r()
return ~m_mb14241->shift_result_r();
}
void mw8080bw_state::bowler_lights_1_w(uint8_t data)
void bowler_state::lights_1_w(uint8_t data)
{
output().set_value("200_LEFT_LIGHT", (data >> 0) & 0x01);
m_200_left_light = BIT(data, 0);
output().set_value("400_LEFT_LIGHT", (data >> 1) & 0x01);
m_400_left_light = BIT(data, 1);
output().set_value("500_LEFT_LIGHT", (data >> 2) & 0x01);
m_500_left_light = BIT(data, 2);
output().set_value("700_LIGHT", (data >> 3) & 0x01);
m_700_light = BIT(data, 3);
output().set_value("500_RIGHT_LIGHT", (data >> 4) & 0x01);
m_500_right_light = BIT(data, 4);
output().set_value("400_RIGHT_LIGHT", (data >> 5) & 0x01);
m_400_right_light = BIT(data, 5);
output().set_value("200_RIGHT_LIGHT", (data >> 6) & 0x01);
m_200_right_light = BIT(data, 6);
output().set_value("X_LEFT_LIGHT", (data >> 7) & 0x01);
output().set_value("X_RIGHT_LIGHT", (data >> 7) & 0x01);
m_x_left_light = BIT(data, 7);
m_x_right_light = BIT(data, 7);
}
void mw8080bw_state::bowler_lights_2_w(uint8_t data)
void bowler_state::lights_2_w(uint8_t data)
{
output().set_value("REGULATION_GAME_LIGHT", ( data >> 0) & 0x01);
output().set_value("FLASH_GAME_LIGHT", (~data >> 0) & 0x01);
m_regulation_game_light = BIT(data, 0);
m_flash_game_light = BIT(~data, 0);
output().set_value("STRAIGHT_BALL_LIGHT", ( data >> 1) & 0x01);
m_straight_ball_light = BIT(data, 1);
output().set_value("HOOK_BALL_LIGHT", ( data >> 2) & 0x01);
m_hook_ball_light = BIT(data, 2);
output().set_value("SELECT_GAME_LIGHT", ( data >> 3) & 0x01);
m_select_game_light = BIT(data, 3);
/* D4-D7 are not connected */
}
void mw8080bw_state::bowler_io_map(address_map &map)
void bowler_state::io_map(address_map &map)
{
map.global_mask(0xf); /* no masking on the reads, all 4 bits are decoded */
map(0x01, 0x01).r(FUNC(mw8080bw_state::bowler_shift_result_r));
map(0x01, 0x01).r(FUNC(bowler_state::shift_result_r));
map(0x02, 0x02).portr("IN0");
map(0x03, 0x03).r(FUNC(mw8080bw_state::mw8080bw_shift_result_rev_r));
map(0x03, 0x03).r(FUNC(bowler_state::mw8080bw_shift_result_rev_r));
map(0x04, 0x04).portr("IN1");
map(0x05, 0x05).portr("IN2");
map(0x06, 0x06).portr("IN3");
@ -2464,14 +2484,14 @@ void mw8080bw_state::bowler_io_map(address_map &map)
map(0x01, 0x01).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x05, 0x05).w(FUNC(mw8080bw_state::bowler_audio_1_w));
map(0x06, 0x06).w(FUNC(mw8080bw_state::bowler_audio_2_w));
map(0x07, 0x07).w(FUNC(mw8080bw_state::bowler_lights_1_w));
map(0x08, 0x08).w(FUNC(mw8080bw_state::bowler_audio_3_w));
map(0x09, 0x09).w(FUNC(mw8080bw_state::bowler_audio_4_w));
map(0x0a, 0x0a).w(FUNC(mw8080bw_state::bowler_audio_5_w));
map(0x0e, 0x0e).w(FUNC(mw8080bw_state::bowler_lights_2_w));
map(0x0f, 0x0f).w(FUNC(mw8080bw_state::bowler_audio_6_w));
map(0x05, 0x05).w(FUNC(bowler_state::audio_1_w));
map(0x06, 0x06).w(FUNC(bowler_state::audio_2_w));
map(0x07, 0x07).w(FUNC(bowler_state::lights_1_w));
map(0x08, 0x08).w(FUNC(bowler_state::audio_3_w));
map(0x09, 0x09).w(FUNC(bowler_state::audio_4_w));
map(0x0a, 0x0a).w(FUNC(bowler_state::audio_5_w));
map(0x0e, 0x0e).w(FUNC(bowler_state::lights_2_w));
map(0x0f, 0x0f).w(FUNC(bowler_state::audio_6_w));
}
@ -2517,12 +2537,12 @@ static INPUT_PORTS_START( bowler )
INPUT_PORTS_END
void mw8080bw_state::bowler(machine_config &config)
void bowler_state::bowler(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::bowler_io_map);
m_maincpu->set_addrmap(AS_IO, &bowler_state::io_map);
WATCHDOG_TIMER(config, m_watchdog).set_time(255 * attotime::from_hz(MW8080BW_60HZ));
@ -2530,7 +2550,7 @@ void mw8080bw_state::bowler(machine_config &config)
MB14241(config, m_mb14241);
/* audio hardware */
bowler_audio(config);
audio(config);
}
@ -3229,7 +3249,7 @@ ROM_END
/* 644 */ GAME( 1977, dogpatch, 0, dogpatch, dogpatch, mw8080bw_state, empty_init, ROT0, "Midway", "Dog Patch", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* 645 */ GAMEL( 1980, spcenctr, 0, spcenctr, spcenctr, spcenctr_state, empty_init, ROT0, "Midway", "Space Encounters", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_spcenctr )
/* 652 */ GAMEL( 1979, phantom2, 0, phantom2, phantom2, mw8080bw_state, empty_init, ROT0, "Midway", "Phantom II", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_phantom2 )
/* 730 */ GAME( 1978, bowler, 0, bowler, bowler, mw8080bw_state, empty_init, ROT90, "Midway", "Bowling Alley", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* 730 */ GAME( 1978, bowler, 0, bowler, bowler, bowler_state, empty_init, ROT90, "Midway", "Bowling Alley", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
/* 739 */ GAMEL( 1978, invaders, 0, invaders, invaders, invaders_state, empty_init, ROT270, "Taito / Midway", "Space Invaders / Space Invaders M", MACHINE_SUPPORTS_SAVE, layout_invaders )
/* 742 */ GAME( 1978, blueshrk, 0, blueshrk, blueshrk, mw8080bw_state, empty_init, ROT0, "Midway", "Blue Shark", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1978, blueshrkmr, blueshrk, blueshrk, blueshrk, mw8080bw_state, empty_init, ROT0, "bootleg (Model Racing)", "Blue Shark (Model Racing bootleg, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )

View File

@ -56,7 +56,6 @@ public:
{ }
void blueshrk(machine_config &config);
void bowler(machine_config &config);
void checkmat(machine_config &config);
void dogpatch(machine_config &config);
void invad2ct(machine_config &config);
@ -112,14 +111,6 @@ private:
void maze_coin_counter_w(uint8_t data);
void maze_io_w(offs_t offset, uint8_t data);
void checkmat_io_w(offs_t offset, uint8_t data);
uint8_t bowler_shift_result_r();
void bowler_lights_1_w(uint8_t data);
void bowler_lights_2_w(uint8_t data);
void bowler_audio_2_w(uint8_t data);
void bowler_audio_3_w(uint8_t data);
void bowler_audio_4_w(uint8_t data);
void bowler_audio_5_w(uint8_t data);
void bowler_audio_6_w(uint8_t data);
DECLARE_MACHINE_START(maze);
DECLARE_MACHINE_START(phantom2);
uint32_t screen_update_phantom2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@ -130,7 +121,6 @@ private:
void checkmat_audio_w(uint8_t data);
void shuffle_audio_1_w(uint8_t data);
void shuffle_audio_2_w(uint8_t data);
void bowler_audio_1_w(uint8_t data);
void blueshrk_audio_w(uint8_t data);
void maze_update_discrete();
void maze_write_discrete(uint8_t maze_tone_timing_state);
@ -139,14 +129,12 @@ private:
uint8_t tornbase_get_cabinet_type();
void blueshrk_audio(machine_config &config);
void bowler_audio(machine_config &config);
void checkmat_audio(machine_config &config);
void maze_audio(machine_config &config);
void shuffle_audio(machine_config &config);
void tornbase_audio(machine_config &config);
void blueshrk_io_map(address_map &map);
void bowler_io_map(address_map &map);
void checkmat_io_map(address_map &map);
void dogpatch_io_map(address_map &map);
void invad2ct_io_map(address_map &map);
@ -422,6 +410,64 @@ private:
void io_map(address_map &map);
};
class bowler_state : public mw8080bw_state
{
public:
bowler_state(machine_config const &mconfig, device_type type, char const *tag) :
mw8080bw_state(mconfig, type, tag),
m_200_left_light(*this, "200_LEFT_LIGHT"),
m_200_right_light(*this, "200_RIGHT_LIGHT"),
m_400_left_light(*this, "400_LEFT_LIGHT"),
m_400_right_light(*this, "400_RIGHT_LIGHT"),
m_500_left_light(*this, "500_LEFT_LIGHT"),
m_500_right_light(*this, "500_RIGHT_LIGHT"),
m_700_light(*this, "700_LIGHT"),
m_x_left_light(*this, "X_LEFT_LIGHT"),
m_x_right_light(*this, "X_RIGHT_LIGHT"),
m_regulation_game_light(*this, "REGULATION_GAME_LIGHT"),
m_flash_game_light(*this, "FLASH_GAME_LIGHT"),
m_straight_ball_light(*this, "STRAIGHT_BALL_LIGHT"),
m_hook_ball_light(*this, "HOOK_BALL_LIGHT"),
m_select_game_light(*this, "SELECT_GAME_LIGHT")
{
}
void bowler(machine_config &config);
protected:
virtual void machine_start() override;
private:
output_finder<> m_200_left_light;
output_finder<> m_200_right_light;
output_finder<> m_400_left_light;
output_finder<> m_400_right_light;
output_finder<> m_500_left_light;
output_finder<> m_500_right_light;
output_finder<> m_700_light;
output_finder<> m_x_left_light;
output_finder<> m_x_right_light;
output_finder<> m_regulation_game_light;
output_finder<> m_flash_game_light;
output_finder<> m_straight_ball_light;
output_finder<> m_hook_ball_light;
output_finder<> m_select_game_light;
uint8_t shift_result_r();
void lights_1_w(uint8_t data);
void lights_2_w(uint8_t data);
void audio_1_w(uint8_t data);
void audio_2_w(uint8_t data);
void audio_3_w(uint8_t data);
void audio_4_w(uint8_t data);
void audio_5_w(uint8_t data);
void audio_6_w(uint8_t data);
void audio(machine_config &config);
void io_map(address_map &map);
};
#define TORNBASE_CAB_TYPE_UPRIGHT_OLD (0)
#define TORNBASE_CAB_TYPE_UPRIGHT_NEW (1)

View File

@ -4522,7 +4522,7 @@ static DISCRETE_SOUND_START(bowler_discrete)
DISCRETE_SOUND_END
void mw8080bw_state::bowler_audio(machine_config &config)
void bowler_state::audio(machine_config &config)
{
SPEAKER(config, "mono").front_center();
@ -4531,7 +4531,7 @@ void mw8080bw_state::bowler_audio(machine_config &config)
}
void mw8080bw_state::bowler_audio_1_w(uint8_t data)
void bowler_state::audio_1_w(uint8_t data)
{
/* D0 - selects controller on the cocktail PCB */
@ -4551,7 +4551,7 @@ void mw8080bw_state::bowler_audio_1_w(uint8_t data)
}
void mw8080bw_state::bowler_audio_2_w(uint8_t data)
void bowler_state::audio_2_w(uint8_t data)
{
/* set BALL ROLLING SOUND FREQ(data & 0x0f)
0, if no rolling, 0x08 used during ball return */
@ -4565,28 +4565,28 @@ void mw8080bw_state::bowler_audio_2_w(uint8_t data)
}
void mw8080bw_state::bowler_audio_3_w(uint8_t data)
void bowler_state::audio_3_w(uint8_t data)
{
/* regardless of the data, enable BALL HITS PIN 1 sound
(top circuit on the schematics) */
}
void mw8080bw_state::bowler_audio_4_w(uint8_t data)
void bowler_state::audio_4_w(uint8_t data)
{
/* regardless of the data, enable BALL HITS PIN 2 sound
(bottom circuit on the schematics) */
}
void mw8080bw_state::bowler_audio_5_w(uint8_t data)
void bowler_state::audio_5_w(uint8_t data)
{
/* not sure, appears to me triggered alongside the two
BALL HITS PIN sounds */
}
void mw8080bw_state::bowler_audio_6_w(uint8_t data)
void bowler_state::audio_6_w(uint8_t data)
{
/* D0 is not connected */

View File

@ -51,14 +51,24 @@ public:
, m_ay(*this, "aysnd")
, m_eeprom(*this, "eeprom")
, m_digits(*this, "digit%u", 0U)
, m_hopper(*this, "Hopper", 1U)
, m_gameover(*this, "GameOver")
, m_title(*this, "Title")
, m_credit(*this, "Credit")
, m_ss(*this, "SS")
, m_c_lock(*this, "C_LOCK")
, m_sv(*this, "SV")
, m_fbv(*this, "FBV")
, m_rv(*this, "RV")
{ }
void fireball(machine_config &config);
private:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
void fireball_map(address_map &map);
void fireball_io_map(address_map &map);
@ -88,6 +98,15 @@ private:
required_device<ay8912_device> m_ay;
required_device<eeprom_serial_x24c44_device> m_eeprom;
output_finder<8> m_digits;
output_finder<3> m_hopper;
output_finder<> m_gameover;
output_finder<> m_title;
output_finder<> m_credit;
output_finder<> m_ss;
output_finder<> m_c_lock;
output_finder<> m_sv;
output_finder<> m_fbv;
output_finder<> m_rv;
};
@ -126,9 +145,9 @@ void fireball_state::io_00_w(uint8_t data)
LOGMASKED(LOG_OUTPUT, "write to 0x00 IO (X11-X11A) %02X\n", data & 0xf0);
output().set_value("Hopper1", BIT(data, 4));
output().set_value("Hopper2", BIT(data, 5));
output().set_value("Hopper3", BIT(data, 6));
m_hopper[0] = BIT(data, 4);
m_hopper[1] = BIT(data, 5);
m_hopper[2] = BIT(data, 6);
}
@ -143,14 +162,14 @@ void fireball_state::io_02_w(uint8_t data)
{
LOGMASKED(LOG_OUTPUT, "write to 0x00 IO (X7-X9) %02X\n", data);
output().set_value("GameOver", BIT(data, 0));
output().set_value("Title", BIT(data, 1));
output().set_value("Credit", BIT(data, 2));
output().set_value("SS", BIT(data, 3));
output().set_value("C_LOCK", BIT(~data, 4));
output().set_value("SV", BIT(data, 5));
output().set_value("FBV", BIT(data, 6));
output().set_value("RV", BIT(data, 7));
m_gameover = BIT(data, 0);
m_title = BIT(data, 1);
m_credit = BIT(data, 2);
m_ss = BIT(data, 3);
m_c_lock = BIT(~data, 4);
m_sv = BIT(data, 5);
m_fbv = BIT(data, 6);
m_rv = BIT(data, 7);
}
@ -425,6 +444,15 @@ INPUT_PORTS_END
void fireball_state::machine_start()
{
m_digits.resolve();
m_hopper.resolve();
m_gameover.resolve();
m_title.resolve();
m_credit.resolve();
m_ss.resolve();
m_c_lock.resolve();
m_sv.resolve();
m_fbv.resolve();
m_rv.resolve();
}
void fireball_state::machine_reset()
@ -433,18 +461,18 @@ void fireball_state::machine_reset()
m_digits[5] = 0x3f;
m_digits[6] = 0x3f;
output().set_value("Hopper1", 0);
output().set_value("Hopper2", 0);
output().set_value("Hopper3", 0);
m_hopper[0] = 0;
m_hopper[1] = 0;
m_hopper[2] = 0;
output().set_value("GameOver", 0);
output().set_value("Title", 0);
output().set_value("Credit", 0);
output().set_value("SS", 0);
output().set_value("C_LOCK", 0);
output().set_value("SV", 0);
output().set_value("FBV", 0);
output().set_value("RV", 0);
m_gameover = 0;
m_title = 0;
m_credit = 0;
m_ss = 0;
m_c_lock = 0;
m_sv = 0;
m_fbv = 0;
m_rv = 0;
}

View File

@ -123,7 +123,7 @@ void namcoc65_device::namcos2_mcu_analog_ctrl_w(uint8_t data)
m_mcu_analog_data = m_port_analog_in_cb[7]();
break;
default:
//output().set_value("anunk",data);
//logerror("anunk: %02x\n", data);
break;
}

View File

@ -293,6 +293,27 @@ void segaybd_state::output2_w(uint8_t data)
// DRIVER OVERRIDES
//**************************************************************************
void segaybd_state::machine_start()
{
m_start_lamp.resolve();
m_right_motor_position.resolve();
m_right_motor_position_nor.resolve();
m_right_motor_speed.resolve();
m_left_motor_position.resolve();
m_left_motor_position_nor.resolve();
m_left_motor_speed.resolve();
m_danger_lamp.resolve();
m_crash_lamp.resolve();
m_emergency_stop_lamp.resolve();
m_bank_data_raw.resolve();
m_vibration_motor.resolve();
m_bank_motor_position.resolve();
m_upright_wheel_motor.resolve();
m_left_start_lamp.resolve();
m_right_start_lamp.resolve();
m_gun_recoil.resolve();
}
//-------------------------------------------------
// machine_reset - reset the state of the machine
//-------------------------------------------------
@ -417,7 +438,7 @@ TIMER_CALLBACK_MEMBER(segaybd_state::irq2_gen_tick)
void segaybd_state::gforce2_output_cb1(uint16_t data)
{
logerror("gforce2_output_cb1: '%02X'\n", data & 0xFF);
logerror("gforce2_output_cb1: '%02X'\n", data & 0xff);
//bits 4, 5, and 7 seem to be used to multiplex the "LIMITSW" port signals
//The exact mapping of these signals is yet not perfectly understood.
//You can observe how this value changes when switching pages in the
@ -431,7 +452,7 @@ void segaybd_state::gforce2_output_cb1(uint16_t data)
void segaybd_state::gforce2_output_cb2(uint16_t data)
{
output().set_value("start_lamp", BIT(data, 2));
m_start_lamp = BIT(data, 2);
}
@ -444,28 +465,28 @@ void segaybd_state::gloc_output_cb1(uint16_t data)
{
if (data < 32)
{
output().set_value("right_motor_position", data);
m_right_motor_position = data;
// normalization here prevents strange data from being transferred
// we do this because for some odd reason
// gloc starts with one piston all up and one all down.... at least data-wise it does
if (data > 1 && data < 29)
output().set_value("right_motor_position_nor", data);
m_right_motor_position_nor = data;
}
if (data < 40 && data > 31)
output().set_value("right_motor_speed", data - 32);
m_right_motor_speed = data - 32;
if (data < 96 && data > 63)
{
output().set_value("left_motor_position", data);
m_left_motor_position = data;
// normalized version... you know... for the kids
if ((data - 64) > 1 && (data - 64) < 29)
output().set_value("left_motor_position_nor", data - 64);
m_left_motor_position_nor = data - 64;
}
if (data < 104 && data > 95)
output().set_value("left_motor_speed", data - 96);
m_left_motor_speed = data - 96;
}
@ -476,9 +497,9 @@ void segaybd_state::gloc_output_cb1(uint16_t data)
void segaybd_state::gloc_output_cb2(uint16_t data)
{
output().set_value("start_lamp", BIT(data, 2));
output().set_value("danger_lamp", BIT(data, 5));
output().set_value("crash_lamp", BIT(data, 6));
m_start_lamp = BIT(data, 2);
m_danger_lamp = BIT(data, 5);
m_crash_lamp = BIT(data, 6);
}
@ -490,9 +511,9 @@ void segaybd_state::gloc_output_cb2(uint16_t data)
void segaybd_state::r360_output_cb2(uint16_t data)
{
// r360 cabinet
output().set_value("start_lamp", BIT(data, 2));
m_start_lamp = BIT(data, 2);
// even though the same output is used, I've split them to avoid confusion.
output().set_value("emergency_stop_lamp", BIT(data, 2));
m_emergency_stop_lamp = BIT(data, 2);
}
@ -516,44 +537,44 @@ void segaybd_state::pdrift_output_cb1(uint16_t data)
// moving left
{
// in this rare instance, the bottom bits are used for positional data
output().set_value("bank_data_raw", data);
output().set_value("vibration_motor", 0);
m_bank_data_raw = data;
m_vibration_motor = 0;
switch (m_pdrift_bank)
// we want to go left one step at a time
{
case 1:
// all left
output().set_value("bank_motor_position", 1);
m_bank_motor_position = 1;
m_pdrift_bank = 1;
break;
case 2:
output().set_value("bank_motor_position", 1);
m_bank_motor_position = 1;
m_pdrift_bank = 1;
break;
case 3:
output().set_value("bank_motor_position", 2);
m_bank_motor_position = 2;
m_pdrift_bank = 2;
break;
case 4:
// centered
output().set_value("bank_motor_position", 3);
m_bank_motor_position = 3;
m_pdrift_bank = 3;
break;
case 5:
output().set_value("bank_motor_position", 4);
m_bank_motor_position = 4;
m_pdrift_bank = 4;
break;
case 6:
output().set_value("bank_motor_position", 5);
m_bank_motor_position = 5;
m_pdrift_bank = 5;
break;
case 7:
// all right
output().set_value("bank_motor_position", 6);
m_bank_motor_position = 6;
m_pdrift_bank = 6;
break;
default:
output().set_value("bank_motor_position", 4);
m_bank_motor_position = 4;
m_pdrift_bank = 4;
break;
}
@ -563,44 +584,44 @@ void segaybd_state::pdrift_output_cb1(uint16_t data)
// moving right
{
// in this rare instance, the bottom bits are used for positional data
output().set_value("bank_data_raw", data);
output().set_value("vibration_motor", 0);
m_bank_data_raw = data;
m_vibration_motor = 0;
switch (m_pdrift_bank)
// we want to go right one step at a time
{
case 1:
// all left
output().set_value("bank_motor_position", 2);
m_bank_motor_position = 2;
m_pdrift_bank = 2;
break;
case 2:
output().set_value("bank_motor_position", 3);
m_bank_motor_position = 3;
m_pdrift_bank = 3;
break;
case 3:
output().set_value("bank_motor_position", 4);
m_bank_motor_position = 4;
m_pdrift_bank = 4;
break;
case 4:
// centered
output().set_value("bank_motor_position", 5);
m_bank_motor_position = 5;
m_pdrift_bank = 5;
break;
case 5:
output().set_value("bank_motor_position", 6);
m_bank_motor_position = 6;
m_pdrift_bank = 6;
break;
case 6:
output().set_value("bank_motor_position", 7);
m_bank_motor_position = 7;
m_pdrift_bank = 7;
break;
case 7:
// all right
output().set_value("bank_motor_position", 7);
m_bank_motor_position = 7;
m_pdrift_bank = 7;
break;
default:
output().set_value("bank_motor_position", 4);
m_bank_motor_position = 4;
m_pdrift_bank = 4;
break;
@ -610,11 +631,11 @@ void segaybd_state::pdrift_output_cb1(uint16_t data)
else
{
// the vibration value uses the first few bits to give a number between 0 and 7
output().set_value("vibration_motor", data & 7);
m_vibration_motor = data & 7;
// normalize the data and subtract the vibration value from it*/
m_pdrift_bank = data - (data & 7);
output().set_value("bank_data_raw", m_pdrift_bank & 0xFF);
m_bank_data_raw = m_pdrift_bank & 0xff;
// position values from left to right
// 56 48 40 120 72 80 88
@ -622,31 +643,31 @@ void segaybd_state::pdrift_output_cb1(uint16_t data)
// the normalized values we'll use
// 1 2 3 4 5 6 7
switch (m_pdrift_bank & 0xFF)
switch (m_pdrift_bank & 0xff)
{
case 56:
// all left
output().set_value("bank_motor_position", 1);
m_bank_motor_position = 1;
break;
case 48:
output().set_value("bank_motor_position", 2);
m_bank_motor_position = 2;
break;
case 40:
output().set_value("bank_motor_position", 3);
m_bank_motor_position = 3;
break;
case 120:
// centered
output().set_value("bank_motor_position", 4);
m_bank_motor_position = 4;
break;
case 72:
output().set_value("bank_motor_position", 5);
m_bank_motor_position = 5;
break;
case 80:
output().set_value("bank_motor_position", 6);
m_bank_motor_position = 6;
break;
case 88:
// all right
output().set_value("bank_motor_position", 7);
m_bank_motor_position = 7;
break;
// these are the only valid values but 24 pops up sometimes when we crash
}
@ -662,8 +683,8 @@ void segaybd_state::pdrift_output_cb1(uint16_t data)
void segaybd_state::pdrift_output_cb2(uint16_t data)
{
output().set_value("start_lamp", BIT(data, 2));
output().set_value("upright_wheel_motor", BIT(data, 1));
m_start_lamp = BIT(data, 2);
m_upright_wheel_motor = BIT(data, 1);
}
@ -674,11 +695,11 @@ void segaybd_state::pdrift_output_cb2(uint16_t data)
void segaybd_state::rchase_output_cb2(uint16_t data)
{
output().set_value("left_start_lamp", BIT(data, 2));
output().set_value("right_start_lamp", BIT(data, 1));
m_left_start_lamp = BIT(data, 2);
m_right_start_lamp = BIT(data, 1);
output().set_value("P1_Gun_Recoil", BIT(data, 6));
output().set_value("P2_Gun_Recoil", BIT(data, 5));
m_gun_recoil[0] = BIT(data, 6);
m_gun_recoil[1] = BIT(data, 5);
}
@ -2912,8 +2933,8 @@ void segaybd_state::init_gloc()
m_output_cb1 = output_delegate(&segaybd_state::gloc_output_cb1, this);
m_output_cb2 = output_delegate(&segaybd_state::gloc_output_cb2, this);
output().set_value("left_motor_position_nor", 16);
output().set_value("right_motor_position_nor", 16);
m_left_motor_position_nor = 16;
m_right_motor_position_nor = 16;
}
void segaybd_state::init_r360()

View File

@ -37,6 +37,23 @@ public:
, m_ysprites(*this, "ysprites")
, m_segaic16vid(*this, "segaic16vid")
, m_adc_ports(*this, "ADC.%u", 0)
, m_start_lamp(*this, "start_lamp")
, m_right_motor_position(*this, "right_motor_position")
, m_right_motor_position_nor(*this, "right_motor_position_nor")
, m_right_motor_speed(*this, "right_motor_speed")
, m_left_motor_position(*this, "left_motor_position")
, m_left_motor_position_nor(*this, "left_motor_position_nor")
, m_left_motor_speed(*this, "left_motor_speed")
, m_danger_lamp(*this, "danger_lamp")
, m_crash_lamp(*this, "crash_lamp")
, m_emergency_stop_lamp(*this, "emergency_stop_lamp")
, m_bank_data_raw(*this, "bank_data_raw")
, m_vibration_motor(*this, "vibration_motor")
, m_bank_motor_position(*this, "bank_motor_position")
, m_upright_wheel_motor(*this, "upright_wheel_motor")
, m_left_start_lamp(*this, "left_start_lamp")
, m_right_start_lamp(*this, "right_start_lamp")
, m_gun_recoil(*this, "P%_Gun_Recoil", 1U)
{
}
@ -52,6 +69,12 @@ public:
void init_rchase();
void init_gloc();
protected:
// device overrides
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
// main CPU read/write handlers
void output1_w(uint8_t data);
@ -95,10 +118,6 @@ private:
// internal types
typedef delegate<void (uint16_t)> output_delegate;
// device overrides
virtual void machine_reset() override;
virtual void video_start() override;
// internal helpers
TIMER_CALLBACK_MEMBER(irq2_gen_tick);
void update_irqs();
@ -118,6 +137,25 @@ private:
// input ports
optional_ioport_array<6> m_adc_ports;
// outputs
output_finder<> m_start_lamp;
output_finder<> m_right_motor_position;
output_finder<> m_right_motor_position_nor;
output_finder<> m_right_motor_speed;
output_finder<> m_left_motor_position;
output_finder<> m_left_motor_position_nor;
output_finder<> m_left_motor_speed;
output_finder<> m_danger_lamp;
output_finder<> m_crash_lamp;
output_finder<> m_emergency_stop_lamp;
output_finder<> m_bank_data_raw;
output_finder<> m_vibration_motor;
output_finder<> m_bank_motor_position;
output_finder<> m_upright_wheel_motor;
output_finder<> m_left_start_lamp;
output_finder<> m_right_start_lamp;
output_finder<2> m_gun_recoil;
// configuration
output_delegate m_output_cb1;
output_delegate m_output_cb2;