mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
taitosj: Added synchronize calls on soundlatch write and bit7 clear, as well as for writing and clearing the secondary sound semaphore. Use input_merge for both nmi enable and the secondary semaphore. Added sound cpu mirroring. [Lord Nightmare]
This commit is contained in:
parent
5a8f4874ae
commit
2fc4b8e1c0
@ -175,21 +175,13 @@ TODO:
|
||||
|
||||
WRITE8_MEMBER(taitosj_state::taitosj_sndnmi_msk_w)
|
||||
{
|
||||
m_sndnmi_disable = (data & 1);
|
||||
if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
else
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
/* B0 is the sound nmi enable, active low */
|
||||
m_soundnmi->in_w<0>((~data)&1);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(taitosj_state::sound_command_w)
|
||||
WRITE8_MEMBER(taitosj_state::soundlatch_w)
|
||||
{
|
||||
m_sound_cmd_written = true;
|
||||
m_soundlatch->write(space,0,data);
|
||||
if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
else
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(taitosj_state::soundlatch_w_cb), this), data);
|
||||
}
|
||||
|
||||
|
||||
@ -199,13 +191,9 @@ WRITE8_MEMBER(taitosj_state::input_port_4_f0_w)
|
||||
}
|
||||
|
||||
// EPORT2
|
||||
WRITE8_MEMBER(taitosj_state::sound_semaphore_w)
|
||||
WRITE8_MEMBER(taitosj_state::sound_semaphore2_w)
|
||||
{
|
||||
m_sound_semaphore = (data & 1);
|
||||
if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
else
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(taitosj_state::sound_semaphore2_w_cb), this), data);
|
||||
}
|
||||
|
||||
CUSTOM_INPUT_MEMBER(taitosj_state::input_port_4_f0_r)
|
||||
@ -243,8 +231,8 @@ static ADDRESS_MAP_START( taitosj_main_nomcu_map, AS_PROGRAM, 8, taitosj_state )
|
||||
AM_RANGE(0xd506, 0xd507) AM_MIRROR(0x00f0) AM_WRITEONLY AM_SHARE("colorbank")
|
||||
AM_RANGE(0xd508, 0xd508) AM_MIRROR(0x00f0) AM_WRITE(taitosj_collision_reg_clear_w)
|
||||
AM_RANGE(0xd509, 0xd50a) AM_MIRROR(0x00f0) AM_WRITEONLY AM_SHARE("gfxpointer")
|
||||
AM_RANGE(0xd50b, 0xd50b) AM_MIRROR(0x00f0) AM_WRITE(sound_command_w)
|
||||
AM_RANGE(0xd50c, 0xd50c) AM_MIRROR(0x00f0) AM_WRITE(sound_semaphore_w)
|
||||
AM_RANGE(0xd50b, 0xd50b) AM_MIRROR(0x00f0) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xd50c, 0xd50c) AM_MIRROR(0x00f0) AM_WRITE(sound_semaphore2_w)
|
||||
AM_RANGE(0xd50d, 0xd50d) AM_MIRROR(0x00f0) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w)
|
||||
AM_RANGE(0xd50e, 0xd50e) AM_MIRROR(0x00f0) AM_WRITE(taitosj_bankswitch_w)
|
||||
AM_RANGE(0xd50f, 0xd50f) AM_MIRROR(0x00f0) AM_WRITENOP
|
||||
@ -313,8 +301,8 @@ static ADDRESS_MAP_START( kikstart_main_map, AS_PROGRAM, 8, taitosj_state )
|
||||
AM_RANGE(0xd40f, 0xd40f) AM_DEVREAD("ay1", ay8910_device, data_r) /* DSW2 and DSW3 */
|
||||
AM_RANGE(0xd508, 0xd508) AM_WRITE(taitosj_collision_reg_clear_w)
|
||||
AM_RANGE(0xd509, 0xd50a) AM_WRITEONLY AM_SHARE("gfxpointer")
|
||||
AM_RANGE(0xd50b, 0xd50b) AM_WRITE(sound_command_w)
|
||||
AM_RANGE(0xd50c, 0xd50c) AM_WRITE(sound_semaphore_w)
|
||||
AM_RANGE(0xd50b, 0xd50b) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xd50c, 0xd50c) AM_WRITE(sound_semaphore2_w)
|
||||
AM_RANGE(0xd50d, 0xd50d) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w)
|
||||
AM_RANGE(0xd50e, 0xd50e) AM_WRITE(taitosj_bankswitch_w)
|
||||
AM_RANGE(0xd600, 0xd600) AM_WRITEONLY AM_SHARE("video_mode")
|
||||
@ -322,47 +310,75 @@ static ADDRESS_MAP_START( kikstart_main_map, AS_PROGRAM, 8, taitosj_state )
|
||||
AM_RANGE(0xe000, 0xefff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
// RD5000
|
||||
READ8_MEMBER(taitosj_state::sound_command_r)
|
||||
TIMER_CALLBACK_MEMBER(taitosj_state::soundlatch_w_cb)
|
||||
{
|
||||
m_sound_cmd_written = false;
|
||||
return m_soundlatch->read(space,0);
|
||||
if (m_soundlatch_flag && (m_soundlatch_data != param))
|
||||
logerror("Warning: soundlatch written before being read. Previous: %02x, new: %02x\n", m_soundlatch_data, param);
|
||||
m_soundlatch_data = param;
|
||||
m_soundlatch_flag = true;
|
||||
m_soundnmi->in_w<1>(1);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(taitosj_state::soundlatch_clear7_w_cb)
|
||||
{
|
||||
if (m_soundlatch_flag)
|
||||
logerror("Warning: soundlatch bit 7 cleared before being read. Previous: %02x, new: %02x\n", m_soundlatch_data, m_soundlatch_data&0x7f);
|
||||
m_soundlatch_data &= 0x7F;
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(taitosj_state::sound_semaphore2_w_cb)
|
||||
{
|
||||
m_sound_semaphore2 = (param&1);
|
||||
m_soundnmi2->in_w<1>((param&1));
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(taitosj_state::sound_semaphore2_clear_w_cb)
|
||||
{
|
||||
m_sound_semaphore2 = false;
|
||||
m_soundnmi2->in_w<1>(0);
|
||||
}
|
||||
|
||||
// RD5000
|
||||
READ8_MEMBER(taitosj_state::soundlatch_r)
|
||||
{
|
||||
if (!machine().side_effect_disabled())
|
||||
{
|
||||
m_soundlatch_flag = false;
|
||||
m_soundnmi->in_w<1>(0);
|
||||
}
|
||||
return m_soundlatch_data;
|
||||
}
|
||||
|
||||
// RD5001
|
||||
READ8_MEMBER(taitosj_state::sound_status_r)
|
||||
READ8_MEMBER(taitosj_state::soundlatch_flags_r)
|
||||
{
|
||||
return (m_sound_cmd_written == true ? 8 : 0) | (m_sound_semaphore == true ? 4 : 0) | 3;
|
||||
return (m_soundlatch_flag?8:0) | (m_sound_semaphore2?4:0) | 3;
|
||||
}
|
||||
|
||||
// WR5000
|
||||
WRITE8_MEMBER(taitosj_state::sound_command_ack_w)
|
||||
WRITE8_MEMBER(taitosj_state::soundlatch_clear7_w)
|
||||
{
|
||||
m_soundlatch->write(space,0, m_soundlatch->read(space,0) & 0x7f);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(taitosj_state::soundlatch_clear7_w_cb), this), data);
|
||||
}
|
||||
|
||||
// WR5001
|
||||
WRITE8_MEMBER(taitosj_state::sound_semaphore_clear_w)
|
||||
WRITE8_MEMBER(taitosj_state::sound_semaphore2_clear_w)
|
||||
{
|
||||
m_sound_semaphore = false;
|
||||
if ((m_sound_cmd_written && (!m_sndnmi_disable)) || m_sound_semaphore)
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
|
||||
else
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
|
||||
machine().scheduler().synchronize(timer_expired_delegate(FUNC(taitosj_state::sound_semaphore2_clear_w_cb), this), data);
|
||||
}
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( taitosj_audio_map, AS_PROGRAM, 8, taitosj_state )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x43ff) AM_RAM
|
||||
AM_RANGE(0x4800, 0x4801) AM_DEVWRITE("ay2", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4801, 0x4801) AM_DEVREAD("ay2", ay8910_device, data_r)
|
||||
AM_RANGE(0x4802, 0x4803) AM_DEVWRITE("ay3", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4803, 0x4803) AM_DEVREAD("ay3", ay8910_device, data_r)
|
||||
AM_RANGE(0x4804, 0x4805) AM_DEVWRITE("ay4", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4805, 0x4805) AM_DEVREAD("ay4", ay8910_device, data_r)
|
||||
AM_RANGE(0x5000, 0x5000) AM_READWRITE(sound_command_r, sound_command_ack_w)
|
||||
AM_RANGE(0x5001, 0x5001) AM_READWRITE(sound_status_r, sound_semaphore_clear_w)
|
||||
AM_RANGE(0x4800, 0x4801) AM_MIRROR(0x07f8) AM_DEVWRITE("ay2", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4801, 0x4801) AM_MIRROR(0x07f8) AM_DEVREAD("ay2", ay8910_device, data_r)
|
||||
AM_RANGE(0x4802, 0x4803) AM_MIRROR(0x07f8) AM_DEVWRITE("ay3", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4803, 0x4803) AM_MIRROR(0x07f8) AM_DEVREAD("ay3", ay8910_device, data_r)
|
||||
AM_RANGE(0x4804, 0x4805) AM_MIRROR(0x07fa) AM_DEVWRITE("ay4", ay8910_device, address_data_w)
|
||||
AM_RANGE(0x4805, 0x4805) AM_MIRROR(0x07fa) AM_DEVREAD("ay4", ay8910_device, data_r)
|
||||
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x07fc) AM_READWRITE(soundlatch_r, soundlatch_clear7_w)
|
||||
AM_RANGE(0x5001, 0x5001) AM_MIRROR(0x07fc) AM_READWRITE(soundlatch_flags_r, sound_semaphore2_clear_w)
|
||||
AM_RANGE(0xe000, 0xefff) AM_ROM /* space for diagnostic ROM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -1768,7 +1784,11 @@ static MACHINE_CONFIG_START( nomcu )
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("speaker")
|
||||
|
||||
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
|
||||
MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(DEVWRITELINE("soundnmi2", input_merger_device, in_w<0>))
|
||||
|
||||
MCFG_INPUT_MERGER_ANY_HIGH("soundnmi2")
|
||||
MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
|
||||
|
||||
MCFG_SOUND_ADD("ay1", AY8910, XTAL_6MHz/4) // 6mhz/4 on GAME board, AY-3-8910 @ IC53 (this is the only AY which uses proper mixing resistors, the 3 below have outputs tied together)
|
||||
MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW2"))
|
||||
@ -2758,8 +2778,13 @@ ROM_END
|
||||
|
||||
void taitosj_state::reset_common()
|
||||
{
|
||||
m_sndnmi_disable = false; // ay-3-8910 resets all registers to 0 on reset
|
||||
m_sound_semaphore = false;
|
||||
m_sound_semaphore2 = false;
|
||||
m_soundnmi2->in_w<1>(0);
|
||||
m_soundlatch_data = 0xff;
|
||||
m_soundlatch_flag = false;
|
||||
m_soundnmi->in_w<1>(0);
|
||||
m_soundnmi->in_w<0>(0);
|
||||
m_sound_semaphore2 = false;
|
||||
m_ay1->set_output_gain(0, 0.0); // 3 outputs for Ay1 since it doesn't use tied together outs
|
||||
m_ay1->set_output_gain(1, 0.0);
|
||||
m_ay1->set_output_gain(2, 0.0);
|
||||
@ -2775,9 +2800,9 @@ void taitosj_state::reset_common()
|
||||
|
||||
void taitosj_state::init_common()
|
||||
{
|
||||
save_item(NAME(m_sndnmi_disable));
|
||||
save_item(NAME(m_sound_cmd_written));
|
||||
save_item(NAME(m_sound_semaphore));
|
||||
save_item(NAME(m_soundlatch_data));
|
||||
save_item(NAME(m_soundlatch_flag));
|
||||
save_item(NAME(m_sound_semaphore2));
|
||||
save_item(NAME(m_input_port_4_f0));
|
||||
save_item(NAME(m_kikstart_gears));
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "machine/taitosjsec.h"
|
||||
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/gen_latch.h"
|
||||
|
||||
#include "sound/dac.h"
|
||||
@ -34,6 +35,8 @@ public:
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_mcu(*this, "bmcu"),
|
||||
m_soundnmi(*this, "soundnmi"),
|
||||
m_soundnmi2(*this, "soundnmi2"),
|
||||
m_dac(*this, "dac"),
|
||||
m_dacvol(*this, "dacvol"),
|
||||
m_ay1(*this, "ay1"),
|
||||
@ -42,13 +45,8 @@ public:
|
||||
m_ay4(*this, "ay4"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_soundlatch(*this, "soundlatch") { }
|
||||
m_palette(*this, "palette") { }
|
||||
|
||||
typedef void (taitosj_state::*copy_layer_func_t)(bitmap_ind16 &,
|
||||
const rectangle &, int, int *, rectangle *);
|
||||
uint8_t m_input_port_4_f0;
|
||||
uint8_t m_kikstart_gears[2];
|
||||
required_shared_ptr<uint8_t> m_videoram_1;
|
||||
required_shared_ptr<uint8_t> m_videoram_2;
|
||||
required_shared_ptr<uint8_t> m_videoram_3;
|
||||
@ -63,24 +61,49 @@ public:
|
||||
required_shared_ptr<uint8_t> m_video_priority;
|
||||
required_shared_ptr<uint8_t> m_collision_reg;
|
||||
optional_shared_ptr<uint8_t> m_kikstart_scrollram;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<taito_sj_security_mcu_device> m_mcu;
|
||||
required_device<input_merger_device> m_soundnmi;
|
||||
required_device<input_merger_device> m_soundnmi2;
|
||||
required_device<dac_8bit_r2r_device> m_dac;
|
||||
required_device<discrete_device> m_dacvol;
|
||||
required_device<ay8910_device> m_ay1;
|
||||
required_device<ay8910_device> m_ay2;
|
||||
required_device<ay8910_device> m_ay3;
|
||||
required_device<ay8910_device> m_ay4;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
typedef void (taitosj_state::*copy_layer_func_t)(bitmap_ind16 &,
|
||||
const rectangle &, int, int *, rectangle *);
|
||||
uint8_t m_input_port_4_f0;
|
||||
uint8_t m_kikstart_gears[2];
|
||||
|
||||
uint8_t m_spacecr_prot_value;
|
||||
uint8_t m_protection_value;
|
||||
uint32_t m_address;
|
||||
bool m_sndnmi_disable; // AKA "CIOB0" on schematic, bit 0 of AY-3-8910 @ IC50 Port B
|
||||
bool m_sound_cmd_written; // 74ls74 1/2 @ GAME BOARD IC42
|
||||
bool m_sound_semaphore; // 74ls74 2/2 @ GAME BOARD IC42
|
||||
uint8_t m_soundlatch_data;
|
||||
bool m_soundlatch_flag; // 74ls74 1/2 @ GAME BOARD IC42
|
||||
bool m_sound_semaphore2; // 74ls74 2/2 @ GAME BOARD IC42
|
||||
bitmap_ind16 m_layer_bitmap[3];
|
||||
bitmap_ind16 m_sprite_sprite_collbitmap1;
|
||||
bitmap_ind16 m_sprite_sprite_collbitmap2;
|
||||
bitmap_ind16 m_sprite_layer_collbitmap1;
|
||||
bitmap_ind16 m_sprite_layer_collbitmap2[3];
|
||||
int m_draw_order[32][4];
|
||||
DECLARE_WRITE8_MEMBER(sound_command_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_command_w);
|
||||
DECLARE_READ8_MEMBER(sound_command_r);
|
||||
DECLARE_READ8_MEMBER(sound_status_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_semaphore_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_semaphore_clear_w);
|
||||
DECLARE_WRITE8_MEMBER(soundlatch_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_semaphore2_w);
|
||||
TIMER_CALLBACK_MEMBER(soundlatch_w_cb);
|
||||
TIMER_CALLBACK_MEMBER(soundlatch_clear7_w_cb);
|
||||
TIMER_CALLBACK_MEMBER(sound_semaphore2_w_cb);
|
||||
TIMER_CALLBACK_MEMBER(sound_semaphore2_clear_w_cb);
|
||||
DECLARE_READ8_MEMBER(soundlatch_r);
|
||||
DECLARE_WRITE8_MEMBER(soundlatch_clear7_w);
|
||||
DECLARE_READ8_MEMBER(soundlatch_flags_r);
|
||||
DECLARE_WRITE8_MEMBER(sound_semaphore2_clear_w);
|
||||
DECLARE_WRITE8_MEMBER(taitosj_bankswitch_w);
|
||||
DECLARE_READ8_MEMBER(taitosj_fake_data_r);
|
||||
DECLARE_WRITE8_MEMBER(taitosj_fake_data_w);
|
||||
@ -131,17 +154,4 @@ public:
|
||||
void copy_layer(bitmap_ind16 &bitmap, const rectangle &cliprect,copy_layer_func_t copy_layer_func, int which, int *sprites_on, rectangle *sprite_areas);
|
||||
void copy_layers(bitmap_ind16 &bitmap, const rectangle &cliprect,copy_layer_func_t copy_layer_func, int *sprites_on, rectangle *sprite_areas);
|
||||
int video_update_common(bitmap_ind16 &bitmap, const rectangle &cliprect, copy_layer_func_t copy_layer_func);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
optional_device<taito_sj_security_mcu_device> m_mcu;
|
||||
required_device<dac_8bit_r2r_device> m_dac;
|
||||
required_device<discrete_device> m_dacvol;
|
||||
required_device<ay8910_device> m_ay1;
|
||||
required_device<ay8910_device> m_ay2;
|
||||
required_device<ay8910_device> m_ay3;
|
||||
required_device<ay8910_device> m_ay4;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user