Skip to content

Commit

Permalink
konami/viper.cpp: Simplify some recent changes
Browse files Browse the repository at this point in the history
- code1d: Remove second DS2430A (probably superfluous if first is OK)
- p9112: Use OR logic on 1-Wire outputs instead of multiplexing on access patterns
  • Loading branch information
ajrhacker committed Dec 19, 2023
1 parent a09fd45 commit 994914d
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions src/mame/konami/viper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,6 @@ class viper_state : public driver_device
}

void viper(machine_config &config);
void viper_dongle(machine_config &config);
void viper_ppp(machine_config &config);
void viper_omz(machine_config &config);
void viper_fullbody(machine_config &config);
Expand All @@ -499,7 +498,7 @@ class viper_state : public driver_device
void init_vipercf();
void init_viperhd();

int ds2430_mux_r();
int ds2430_combined_r();

protected:
virtual void machine_start() override;
Expand Down Expand Up @@ -566,7 +565,6 @@ class viper_state : public driver_device
uint8_t m_unk_serial_regs[0x80]{};
uint32_t m_sound_buffer_offset = 0U;
bool m_sound_irq_enabled = false;
bool m_ds2430_ext_select = false;

TIMER_DEVICE_CALLBACK_MEMBER(sound_timer_callback);

Expand Down Expand Up @@ -1736,7 +1734,6 @@ uint8_t viper_state::ds2430_r()
void viper_state::ds2430_w(uint8_t data)
{
m_ds2430->data_w(1);
m_ds2430_ext_select = false;
}

uint8_t viper_state::ds2430_ext_r()
Expand All @@ -1750,10 +1747,7 @@ uint8_t viper_state::ds2430_ext_r()
void viper_state::ds2430_ext_w(uint8_t data)
{
if (m_ds2430_ext.found())
{
m_ds2430_ext->data_w(1);
m_ds2430_ext_select = true;
}
}

void viper_state::unk1a_w(offs_t offset, uint64_t data, uint64_t mem_mask)
Expand Down Expand Up @@ -1894,9 +1888,10 @@ void viper_state::viper_ppp_map(address_map &map)

/*****************************************************************************/

int viper_state::ds2430_mux_r()
int viper_state::ds2430_combined_r()
{
return m_ds2430_ext_select ? m_ds2430_ext->data_r() : m_ds2430->data_r();
// Inactive DS2430A is held in reset state
return m_ds2430->data_r() || m_ds2430_ext->data_r();
}

static INPUT_PORTS_START( viper )
Expand Down Expand Up @@ -2205,7 +2200,7 @@ INPUT_PORTS_START( p9112 )
PORT_INCLUDE( p911 )

PORT_MODIFY("IN2")
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(viper_state, ds2430_mux_r)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(viper_state, ds2430_combined_r)
INPUT_PORTS_END

INPUT_PORTS_START( mfightc )
Expand Down Expand Up @@ -2437,7 +2432,6 @@ INPUT_PORTS_START( code1d )
PORT_DIPNAME( 0x08, 0x00, "Memory Card Check On Boot" ) PORT_DIPLOCATION("SW:1")
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(viper_state, ds2430_mux_r)

PORT_MODIFY("IN4")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Action Button")
Expand Down Expand Up @@ -2520,8 +2514,6 @@ void viper_state::machine_start()
save_item(NAME(m_unk_serial_regs));
save_item(NAME(m_sound_buffer_offset));
save_item(NAME(m_sound_irq_enabled));
if (m_ds2430_ext.found())
save_item(NAME(m_ds2430_ext_select));

save_item(NAME(m_epic.iack));
save_item(NAME(m_epic.eicr)); // written but never used
Expand Down Expand Up @@ -2579,7 +2571,6 @@ void viper_state::machine_reset()
m_ds2430->data_w(1);
if (m_ds2430_ext.found())
m_ds2430_ext->data_w(1);
m_ds2430_ext_select = false;
}

void viper_state::viper(machine_config &config)
Expand Down Expand Up @@ -2635,12 +2626,6 @@ void viper_state::viper(machine_config &config)
TIMER(config, "sound_timer").configure_periodic(FUNC(viper_state::sound_timer_callback), attotime::from_hz(44100.0 / 256));
}

void viper_state::viper_dongle(machine_config &config)
{
viper(config);
DS2430A(config, m_ds2430_ext);
}

void viper_state::viper_ppp(machine_config &config)
{
viper(config);
Expand Down Expand Up @@ -3352,8 +3337,8 @@ GAME(2001, ppp2nd, kviper, viper_ppp, ppp2nd, viper_state, init_viperh
GAME(2001, ppp2nda, ppp2nd, viper_ppp, ppp2nd, viper_state, init_viperhd, ROT0, "Konami", "ParaParaParadise 2nd Mix (AAA)", MACHINE_NOT_WORKING)

GAME(2001, boxingm, kviper, viper, boxingm, viper_state, init_vipercf, ROT0, "Konami", "Boxing Mania: Ashita no Joe (ver JAA)", MACHINE_NOT_WORKING)
GAME(2000, code1d, kviper, viper_dongle, code1d, viper_state, init_vipercf, ROT0, "Konami", "Code One Dispatch Ver 1.21 (ver UAD)", MACHINE_NOT_WORKING)
GAME(2000, code1db, code1d, viper_dongle, code1d, viper_state, init_vipercf, ROT0, "Konami", "Code One Dispatch Ver 1.16 (ver UAB)", MACHINE_NOT_WORKING)
GAME(2000, code1d, kviper, viper, code1d, viper_state, init_vipercf, ROT0, "Konami", "Code One Dispatch Ver 1.21 (ver UAD)", MACHINE_NOT_WORKING)
GAME(2000, code1db, code1d, viper, code1d, viper_state, init_vipercf, ROT0, "Konami", "Code One Dispatch Ver 1.16 (ver UAB)", MACHINE_NOT_WORKING)
GAME(2000, gticlub2, kviper, viper, gticlub2, viper_state, init_vipercf, ROT0, "Konami", "GTI Club: Corso Italiano (ver JAB)", MACHINE_NOT_WORKING)
GAME(2000, gticlub2ea,gticlub2, viper, gticlub2ea, viper_state, init_vipercf, ROT0, "Konami", "Driving Party: Racing in Italy (ver EAA)", MACHINE_NOT_WORKING)
GAME(2001, jpark3, kviper, viper, jpark3, viper_state, init_vipercf, ROT0, "Konami", "Jurassic Park III (ver EBC)", MACHINE_NOT_WORKING)
Expand Down

0 comments on commit 994914d

Please sign in to comment.