summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/segaxbd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/segaxbd.cpp')
-rw-r--r--src/mame/drivers/segaxbd.cpp81
1 files changed, 19 insertions, 62 deletions
diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp
index 7c695f20413..fc2de312927 100644
--- a/src/mame/drivers/segaxbd.cpp
+++ b/src/mame/drivers/segaxbd.cpp
@@ -294,7 +294,6 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, device_type type, co
, m_sprites(*this, "sprites")
, m_segaic16vid(*this, "segaic16vid")
, m_segaic16road(*this, "segaic16road")
- , m_soundlatch(*this, "soundlatch")
, m_subram0(*this, "subram0")
, m_road_priority(1)
, m_scanline_timer(nullptr)
@@ -348,7 +347,7 @@ void segaxbd_state::device_reset()
m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaxbd_state::m68k_reset_callback),this));
// start timers to track interrupts
- m_scanline_timer->adjust(m_screen->time_until_pos(1), 1);
+ m_scanline_timer->adjust(m_screen->time_until_pos(0), 0);
}
@@ -452,28 +451,18 @@ const auto SOUND_CLOCK = XTAL(16'000'000);
//**************************************************************************
//-------------------------------------------------
-// timer_ack_callback - acknowledge a timer chip
-// interrupt signal
+// timer_irq_w - handle the interrupt signal from
+// the timer chip
//-------------------------------------------------
-void segaxbd_state::timer_ack_callback()
+WRITE_LINE_MEMBER(segaxbd_state::timer_irq_w)
{
- // clear the timer IRQ
- m_timer_irq_state = 0;
+ // set/clear the timer IRQ
+ m_timer_irq_state = (state == ASSERT_LINE);
update_main_irqs();
}
-//-------------------------------------------------
-// sound_data_w - write data to the sound CPU
-//-------------------------------------------------
-
-WRITE8_MEMBER(segaxbd_state::sound_data_w)
-{
- synchronize(TID_SOUND_WRITE, data);
-}
-
-
//**************************************************************************
// MAIN CPU READ/WRITE CALLBACKS
@@ -632,22 +621,6 @@ WRITE16_MEMBER( segaxbd_state::smgp_excs_w )
//**************************************************************************
-// SOUND Z80 CPU READ/WRITE CALLBACKS
-//**************************************************************************
-
-//-------------------------------------------------
-// sound_data_r - read latched sound data
-//-------------------------------------------------
-
-READ8_MEMBER( segaxbd_state::sound_data_r )
-{
- m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
- return m_soundlatch->read(space, 0);
-}
-
-
-
-//**************************************************************************
// DRIVER OVERRIDES
//**************************************************************************
@@ -659,48 +632,30 @@ void segaxbd_state::device_timer(emu_timer &timer, device_timer_id id, int param
{
switch (id)
{
- case TID_SOUND_WRITE:
- m_soundlatch->write(m_soundcpu->space(AS_PROGRAM), 0, param);
- m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
-
- // if an extra sound board is attached, do an nmi there as well
- if (m_soundcpu2 != nullptr)
- m_soundcpu2->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
- break;
-
case TID_SCANLINE:
{
int scanline = param;
- int next_scanline = (scanline + 2) % 262;
- bool update = false;
+ int next_scanline = (scanline + 1) % 262;
- // clock the timer and set the IRQ if something happened
- if ((scanline % 2) != 0 && m_cmptimer_1->clock())
- m_timer_irq_state = 1, update = true;
+ // clock the timer with V0
+ m_cmptimer_1->exck_w(scanline % 2);
// set VBLANK on scanline 223
if (scanline == 223)
{
m_vblank_irq_state = 1;
- update = true;
m_subcpu->set_input_line(4, ASSERT_LINE);
- next_scanline = scanline + 1;
+ update_main_irqs();
}
// clear VBLANK on scanline 224
else if (scanline == 224)
{
m_vblank_irq_state = 0;
- update = true;
m_subcpu->set_input_line(4, CLEAR_LINE);
- next_scanline = scanline + 1;
- }
-
- // update IRQs on the main CPU
- if (update)
update_main_irqs();
+ }
- // come back in 2 scanlines
m_scanline_timer->adjust(m_screen->time_until_pos(next_scanline), next_scanline);
break;
}
@@ -1035,7 +990,7 @@ void segaxbd_state::sound_portmap(address_map &map)
map.unmap_value_high();
map.global_mask(0xff);
map(0x00, 0x01).mirror(0x3e).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
- map(0x40, 0x40).mirror(0x3f).r(this, FUNC(segaxbd_state::sound_data_r));
+ map(0x40, 0x40).mirror(0x3f).r("cmptimer_main", FUNC(sega_315_5250_compare_timer_device::zread));
}
@@ -1059,7 +1014,7 @@ void segaxbd_state::smgp_sound2_portmap(address_map &map)
{
map.unmap_value_high();
map.global_mask(0xff);
- map(0x40, 0x40).mirror(0x3f).r(this, FUNC(segaxbd_state::sound_data_r));
+ map(0x40, 0x40).mirror(0x3f).r("cmptimer_main", FUNC(sega_315_5250_compare_timer_device::zread));
}
@@ -1728,8 +1683,8 @@ MACHINE_CONFIG_START(segaxbd_state::xboard_base_mconfig )
MCFG_SEGA_315_5249_DIVIDER_ADD("divider_subx")
MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_main")
- MCFG_SEGA_315_5250_TIMER_ACK(segaxbd_state, timer_ack_callback)
- MCFG_SEGA_315_5250_SOUND_WRITE_CALLBACK(WRITE8(*this, segaxbd_state, sound_data_w))
+ MCFG_SEGA_315_5250_68KINT_CALLBACK(WRITELINE(*this, segaxbd_state, timer_irq_w))
+ MCFG_SEGA_315_5250_ZINT_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI))
MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_subx")
@@ -1765,8 +1720,6 @@ MACHINE_CONFIG_START(segaxbd_state::xboard_base_mconfig )
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- MCFG_GENERIC_LATCH_8_ADD("soundlatch")
-
MCFG_DEVICE_ADD("ymsnd", YM2151, SOUND_CLOCK/4)
MCFG_YM2151_IRQ_HANDLER(INPUTLINE("soundcpu", 0))
MCFG_SOUND_ROUTE(0, "lspeaker", 0.43)
@@ -1945,6 +1898,10 @@ MACHINE_CONFIG_START(segaxbd_smgp_fd1094_state::device_add_mconfig)
MCFG_DEVICE_PROGRAM_MAP(smgp_airdrive_map)
MCFG_DEVICE_IO_MAP(smgp_airdrive_portmap)
+ MCFG_DEVICE_MODIFY("cmptimer_main")
+ MCFG_SEGA_315_5250_ZINT_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI))
+ MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("soundcpu2", INPUT_LINE_NMI))
+
MCFG_DEVICE_MODIFY("iochip_0")
MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, smgp_motor_r))
MCFG_CXD1095_OUT_PORTB_CB(WRITE8(*this, segaxbd_state, smgp_motor_w))