summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2019-07-09 22:29:03 -0400
committerGravatarGravatar AJR <ajrhacker@users.noreply.github.com>2019-07-09 22:32:47 -0400
commit2cd43e6b7ce0c1fbcad506f33172c3403a923164 (patch) (github)
treec4e53a45e2858afa614d8ef3fe761abecfc952d5
parent3ef1192468d0b9da3339415a4b562ef08f6e7ab2 (diff)
downloadmame-2cd43e6b7ce0c1fbcad506f33172c3403a923164.tar.bz2
mame-2cd43e6b7ce0c1fbcad506f33172c3403a923164.zip
itech32.cpp: Use generic latch device for sound communications; add second latch to 68EC020 systems
This is an attempted fix for MT #7098. It might not be enough, but it at least undoes c8342d71185707847804b266e73679cdb6508daf's inversion of CPU order.
-rw-r--r--src/mame/drivers/itech32.cpp51
-rw-r--r--src/mame/includes/itech32.h9
2 files changed, 27 insertions, 33 deletions
diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp
index b200acf039f..d11c61cf430 100644
--- a/src/mame/drivers/itech32.cpp
+++ b/src/mame/drivers/itech32.cpp
@@ -357,6 +357,7 @@ Notes:
#include "cpu/m68000/m68000.h"
#include "cpu/m6809/m6809.h"
#include "cpu/tms32031/tms32031.h"
+#include "machine/input_merger.h"
#include "machine/nvram.h"
#include "machine/watchdog.h"
@@ -425,9 +426,7 @@ void itech32_state::machine_start()
save_item(NAME(m_xint_state));
save_item(NAME(m_qint_state));
save_item(NAME(m_irq_base));
- save_item(NAME(m_sound_data));
save_item(NAME(m_sound_return));
- save_item(NAME(m_sound_int_state));
save_item(NAME(m_special_result));
save_item(NAME(m_p1_effx));
save_item(NAME(m_p1_effy));
@@ -443,9 +442,7 @@ void itech32_state::machine_start()
void itech32_state::machine_reset()
{
m_vint_state = m_xint_state = m_qint_state = 0;
- m_sound_data = 0;
m_sound_return = 0;
- m_sound_int_state = 0;
}
void drivedge_state::machine_start()
@@ -493,7 +490,7 @@ void itech32_state::color_w(u8 data)
CUSTOM_INPUT_MEMBER(itech32_state::special_port_r)
{
- if (m_sound_int_state)
+ if (m_soundlatch->pending_r())
m_special_result ^= 1;
return m_special_result;
@@ -670,17 +667,13 @@ void itech32_state::sound_bank_w(u8 data)
*
*************************************/
-TIMER_CALLBACK_MEMBER(itech32_state::delayed_sound_data_w)
-{
- m_sound_data = param;
- m_sound_int_state = 1;
- m_soundcpu->set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
-}
-
-
void itech32_state::sound_data_w(u8 data)
{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech32_state::delayed_sound_data_w),this), data & 0xff);
+ // seems hacky, but sound CPU should lose fewer bytes this way
+ if (m_soundlatch2.found() && m_soundlatch->pending_r())
+ m_soundlatch2->write(data);
+ else
+ m_soundlatch->write(data);
}
@@ -690,14 +683,6 @@ u8 itech32_state::sound_return_r()
}
-u8 itech32_state::sound_data_r()
-{
- m_soundcpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
- m_sound_int_state = 0;
- return m_sound_data;
-}
-
-
void itech32_state::sound_return_w(u8 data)
{
m_sound_return = data;
@@ -706,7 +691,7 @@ void itech32_state::sound_return_w(u8 data)
u8 itech32_state::sound_data_buffer_r()
{
- return 0;
+ return m_soundlatch->pending_r() << 7;
}
@@ -1039,7 +1024,7 @@ void itech32_state::itech020_map(address_map &map)
void itech32_state::sound_map(address_map &map)
{
map(0x0000, 0x0000).w(FUNC(itech32_state::sound_return_w));
- map(0x0400, 0x0400).r(FUNC(itech32_state::sound_data_r));
+ map(0x0400, 0x0400).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0x0800, 0x083f).mirror(0x80).rw("ensoniq", FUNC(es5506_device::read), FUNC(es5506_device::write));
map(0x0c00, 0x0c00).w(FUNC(itech32_state::sound_bank_w));
map(0x1000, 0x1000).nopw(); /* noisy */
@@ -1053,7 +1038,8 @@ void itech32_state::sound_map(address_map &map)
/*------ Rev 2 sound board memory layout ------*/
void itech32_state::sound_020_map(address_map &map)
{
- map(0x0000, 0x0000).mirror(0x400).r(FUNC(itech32_state::sound_data_r));
+ map(0x0000, 0x0000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
+ map(0x0400, 0x0400).r(m_soundlatch2, FUNC(generic_latch_8_device::read));
map(0x0800, 0x083f).mirror(0x80).rw("ensoniq", FUNC(es5506_device::read), FUNC(es5506_device::write));
map(0x0c00, 0x0c00).w(FUNC(itech32_state::sound_bank_w));
map(0x1400, 0x1400).w(FUNC(itech32_state::firq_clear_w));
@@ -1671,6 +1657,8 @@ void itech32_state::base_devices(machine_config &config)
MC6809E(config, m_soundcpu, SOUND_CLOCK/8); // EF68B09EP
m_soundcpu->set_addrmap(AS_PROGRAM, &itech32_state::sound_map);
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_soundcpu, INPUT_LINE_IRQ0);
+
nvram_device &nvram(NVRAM(config, "nvram"));
nvram.set_custom_handler(FUNC(itech32_state::nvram_init));
@@ -1732,8 +1720,6 @@ void itech32_state::bloodstm(machine_config &config)
void drivedge_state::drivedge(machine_config &config)
{
- base_devices(config);
-
/* basic machine hardware */
M68EC020(config, m_maincpu, CPU020_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &drivedge_state::main_map);
@@ -1744,6 +1730,7 @@ void drivedge_state::drivedge(machine_config &config)
TMS32031(config, m_dsp[1], TMS_CLOCK);
m_dsp[1]->set_addrmap(AS_PROGRAM, &drivedge_state::tms2_map);
+ base_devices(config);
m_palette->set_format(palette_device::xBGR_888, 32768);
via(config);
@@ -1766,14 +1753,20 @@ void drivedge_state::drivedge(machine_config &config)
void itech32_state::sftm(machine_config &config)
{
- base_devices(config);
-
M68EC020(config, m_maincpu, CPU020_CLOCK);
m_maincpu->set_addrmap(AS_PROGRAM, &itech32_state::itech020_map);
+ base_devices(config);
+
m_soundcpu->set_addrmap(AS_PROGRAM, &itech32_state::sound_020_map);
m_soundcpu->set_periodic_int(FUNC(itech32_state::irq1_line_assert), attotime::from_hz(4*60));
+ INPUT_MERGER_ANY_HIGH(config, "soundirq").output_handler().set_inputline(m_soundcpu, M6809_IRQ_LINE);
+ m_soundlatch->data_pending_callback().set("soundirq", FUNC(input_merger_device::in_w<0>));
+
+ GENERIC_LATCH_8(config, m_soundlatch2);
+ m_soundlatch2->data_pending_callback().set("soundirq", FUNC(input_merger_device::in_w<1>));
+
m_palette->set_format(palette_device::xRGB_888, 32768);
}
diff --git a/src/mame/includes/itech32.h b/src/mame/includes/itech32.h
index c8d32026c41..0dd727808d0 100644
--- a/src/mame/includes/itech32.h
+++ b/src/mame/includes/itech32.h
@@ -12,6 +12,7 @@
#pragma once
#include "machine/6522via.h"
+#include "machine/gen_latch.h"
#include "machine/nvram.h"
#include "machine/ticket.h"
#include "machine/timekpr.h"
@@ -39,6 +40,8 @@ public:
m_palette(*this, "palette"),
m_ticket(*this, "ticket"),
m_timekeeper(*this, "m48t02"),
+ m_soundlatch(*this, "soundlatch"),
+ m_soundlatch2(*this, "soundlatch2"),
m_main_ram(*this, "main_ram", 0),
m_nvram(*this, "nvram", 0),
m_video(*this, "video", 0),
@@ -83,6 +86,8 @@ protected:
required_device<palette_device> m_palette;
required_device<ticket_dispenser_device> m_ticket;
optional_device<timekeeper_device> m_timekeeper;
+ required_device<generic_latch_8_device> m_soundlatch;
+ optional_device<generic_latch_8_device> m_soundlatch2;
optional_shared_ptr<u16> m_main_ram;
optional_shared_ptr<u16> m_nvram;
@@ -99,9 +104,7 @@ protected:
u8 m_xint_state;
u8 m_qint_state;
u8 m_irq_base;
- u8 m_sound_data;
u8 m_sound_return;
- u8 m_sound_int_state;
offs_t m_itech020_prot_address;
int m_special_result;
int m_p1_effx;
@@ -148,7 +151,6 @@ protected:
void sound_bank_w(u8 data);
void sound_data_w(u8 data);
u8 sound_return_r();
- u8 sound_data_r();
void sound_return_w(u8 data);
u8 sound_data_buffer_r();
void sound_control_w(u8 data);
@@ -177,7 +179,6 @@ protected:
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
WRITE_LINE_MEMBER(generate_int1);
- TIMER_CALLBACK_MEMBER(delayed_sound_data_w);
TIMER_CALLBACK_MEMBER(scanline_interrupt);
inline offs_t compute_safe_address(int x, int y);
inline void disable_clipping();