zodiack: use 2 separate soundlatches instead of a shared one, decrease sound nmi frequency for dogfight

This commit is contained in:
hap 2024-11-22 20:03:40 +01:00
parent f46efbf607
commit a6a4997dc3
2 changed files with 83 additions and 64 deletions

View File

@ -342,4 +342,3 @@ ROM_END
// written as "Akazukin" on title screen & instruction panel flyer.
GAME( 1983, akazukin, 0, akazukin, akazukin, akazukin_state, empty_init, ROT0, "Sigma", "Akazukin (Japan)", MACHINE_SUPPORTS_SAVE )

View File

@ -113,14 +113,15 @@ namespace {
class zodiack_state : public driver_device
{
public:
zodiack_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
zodiack_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_soundlatch(*this, "soundlatch")
m_soundlatch(*this, "soundlatch%u", 0)
{ }
void zodiack(machine_config &config);
void dogfight(machine_config &config);
void percuss(machine_config &config);
protected:
@ -129,21 +130,22 @@ protected:
private:
void nmi_mask_w(uint8_t data);
void irq_mask_w(uint8_t data);
void sound_nmi_enable_w(uint8_t data);
void master_soundlatch_w(uint8_t data);
void control_w(uint8_t data);
// devices
required_device<z80_device> m_maincpu;
required_device<z80_device> m_audiocpu;
required_device<generic_latch_8_device> m_soundlatch;
required_device_array<generic_latch_8_device, 2> m_soundlatch;
// state
uint8_t m_main_nmi_enabled = 0;
uint8_t m_main_irq_enabled = 0;
uint8_t m_sound_nmi_enabled = 0;
INTERRUPT_GEN_MEMBER(sound_nmi_gen);
void vblank_main_nmi_w(int state);
void vblank(int state);
void io_map(address_map &map) ATTR_COLD;
void main_map(address_map &map) ATTR_COLD;
@ -155,15 +157,23 @@ void zodiack_state::nmi_mask_w(uint8_t data)
m_main_nmi_enabled = (data & 1) ^ 1;
}
void zodiack_state::irq_mask_w(uint8_t data)
{
m_main_irq_enabled = data & 1;
}
void zodiack_state::sound_nmi_enable_w(uint8_t data)
{
m_sound_nmi_enabled = data & 1;
}
void zodiack_state::vblank_main_nmi_w(int state)
void zodiack_state::vblank(int state)
{
if (state && m_main_nmi_enabled)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
if (state && m_main_irq_enabled)
m_maincpu->set_input_line(0, HOLD_LINE);
}
INTERRUPT_GEN_MEMBER(zodiack_state::sound_nmi_gen)
@ -172,13 +182,6 @@ INTERRUPT_GEN_MEMBER(zodiack_state::sound_nmi_gen)
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
void zodiack_state::master_soundlatch_w(uint8_t data)
{
m_soundlatch->write(data);
m_audiocpu->set_input_line(0, HOLD_LINE);
}
void zodiack_state::control_w(uint8_t data)
{
// Bit 0-1 - coin counters
@ -196,10 +199,11 @@ void zodiack_state::main_map(address_map &map)
map(0x6082, 0x6082).portr("DSW1");
map(0x6083, 0x6083).portr("IN0");
map(0x6084, 0x6084).portr("IN1");
map(0x6090, 0x6090).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(FUNC(zodiack_state::master_soundlatch_w));
map(0x7000, 0x7000).nopr().w("watchdog", FUNC(watchdog_timer_device::reset_w)); // NOP???
map(0x6090, 0x6090).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)).w(m_soundlatch[0], FUNC(generic_latch_8_device::write));
map(0x7000, 0x7000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w));
map(0x7100, 0x7100).w(FUNC(zodiack_state::nmi_mask_w));
map(0x7200, 0x7200).w("videopcb", FUNC(orca_ovg_40c_device::flipscreen_w));
map(0x8000, 0x8000).w(FUNC(zodiack_state::irq_mask_w));
map(0x9000, 0x903f).ram().w("videopcb", FUNC(orca_ovg_40c_device::attributes_w)).share("videopcb:attributeram");
map(0x9040, 0x905f).ram().share("videopcb:spriteram");
map(0x9060, 0x907f).ram().share("videopcb:bulletsram");
@ -214,7 +218,7 @@ void zodiack_state::sound_map(address_map &map)
map(0x0000, 0x1fff).rom();
map(0x2000, 0x23ff).ram();
map(0x4000, 0x4000).w(FUNC(zodiack_state::sound_nmi_enable_w));
map(0x6000, 0x6000).rw(m_soundlatch, FUNC(generic_latch_8_device::read), FUNC(generic_latch_8_device::write));
map(0x6000, 0x6000).r(m_soundlatch[0], FUNC(generic_latch_8_device::read)).w(m_soundlatch[1], FUNC(generic_latch_8_device::write));
}
void zodiack_state::io_map(address_map &map)
@ -538,14 +542,16 @@ INPUT_PORTS_END
void zodiack_state::machine_start()
{
save_item(NAME(m_sound_nmi_enabled));
save_item(NAME(m_main_nmi_enabled));
save_item(NAME(m_main_irq_enabled));
save_item(NAME(m_sound_nmi_enabled));
}
void zodiack_state::machine_reset()
{
m_sound_nmi_enabled = 0;
m_main_nmi_enabled = 0;
m_main_irq_enabled = 0;
m_sound_nmi_enabled = 0;
}
@ -555,16 +561,18 @@ void zodiack_state::zodiack(machine_config &config)
// basic machine hardware
Z80(config, m_maincpu, XTAL(18'432'000) / 6);
m_maincpu->set_addrmap(AS_PROGRAM, &zodiack_state::main_map);
m_maincpu->set_periodic_int(FUNC(zodiack_state::irq0_line_hold), attotime::from_hz(1 * 60)); // sound related - unknown source, timing is guessed
Z80(config, m_audiocpu, XTAL(18'432'000) / 6);
m_audiocpu->set_addrmap(AS_PROGRAM, &zodiack_state::sound_map);
m_audiocpu->set_addrmap(AS_IO, &zodiack_state::io_map);
m_audiocpu->set_periodic_int(FUNC(zodiack_state::sound_nmi_gen), attotime::from_hz(8 * 60)); // sound tempo - unknown source, timing is guessed
config.set_maximum_quantum(attotime::from_hz(600));
WATCHDOG_TIMER(config, "watchdog");
SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(zodiack_state::vblank_main_nmi_w));
// video hardware
SCREEN(config, "screen", SCREEN_TYPE_RASTER).screen_vblank().set(FUNC(zodiack_state::vblank));
orca_ovg_40c_device &videopcb(ORCA_OVG_40C(config, "videopcb", 0));
videopcb.set_screen("screen");
@ -572,7 +580,10 @@ void zodiack_state::zodiack(machine_config &config)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, m_soundlatch[0]);
m_soundlatch[0]->data_pending_callback().set_inputline(m_audiocpu, 0);
GENERIC_LATCH_8(config, m_soundlatch[1]);
AY8910(config, "aysnd", XTAL(18'432'000) / 12).add_route(ALL_OUTPUTS, "mono", 0.50);
}
@ -585,11 +596,20 @@ void zodiack_state::percuss(machine_config &config)
videopcb.set_percuss_hardware(true);
}
void zodiack_state::dogfight(machine_config &config)
{
zodiack(config);
m_audiocpu->set_periodic_int(FUNC(zodiack_state::sound_nmi_gen), attotime::from_hz(4 * 60)); // 4 interrupts per frame
}
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( zodiack )
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "ovg30c.2", 0x0000, 0x2000, CRC(a2125e99) SHA1(00ae4ed2c7b6895d2dc58aa2fc51c25b6428e4ba) )
@ -715,9 +735,9 @@ ROM_END
} // anonymous namespace
GAME( 1983, zodiack, 0, zodiack, zodiack, zodiack_state, empty_init, ROT270, "Orca (Esco Trading Co., Inc. license)", "Zodiack", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */
GAME( 1983, dogfight, 0, zodiack, dogfight, zodiack_state, empty_init, ROT270, "Orca / Thunderbolt", "Dog Fight (Thunderbolt)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */
GAME( 1982, moguchan, 0, percuss, moguchan, zodiack_state, empty_init, ROT270, "Orca (Eastern Commerce Inc. license)", "Mogu Chan (bootleg?)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) /* license copyright taken from ROM string at $0b5c */
GAME( 1983, zodiack, 0, zodiack, zodiack, zodiack_state, empty_init, ROT270, "Orca (Esco Trading Co., Inc. license)", "Zodiack", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) // bullet color needs to be verified
GAME( 1983, dogfight, 0, dogfight, dogfight, zodiack_state, empty_init, ROT270, "Orca / Thunderbolt", "Dog Fight (Thunderbolt)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, moguchan, 0, percuss, moguchan, zodiack_state, empty_init, ROT270, "Orca (Eastern Commerce Inc. license)", "Mogu Chan (bootleg?)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // license copyright taken from ROM string at $0b5c
GAME( 1981, percuss, 0, percuss, percuss, zodiack_state, empty_init, ROT270, "Orca", "The Percussor", MACHINE_SUPPORTS_SAVE )
GAME( 1982, bounty, 0, percuss, bounty, zodiack_state, empty_init, ROT180, "Orca", "The Bounty (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, bounty2, bounty, percuss, bounty, zodiack_state, empty_init, ROT180, "Orca", "The Bounty (set 2)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // seems to use a different memory map