bking: Soundlatch modernization (nw)

This commit is contained in:
AJR 2017-08-31 23:57:52 -04:00
parent 796d8c8f07
commit a6682d49f1
2 changed files with 12 additions and 20 deletions

View File

@ -31,26 +31,18 @@ DIP Locations verified for:
READ8_MEMBER(bking_state::bking_sndnmi_disable_r)
{
m_sound_nmi_enable = 0;
m_soundnmi->in_w<1>(0);
return 0;
}
WRITE8_MEMBER(bking_state::bking_sndnmi_enable_w)
{
m_sound_nmi_enable = 1;
m_soundnmi->in_w<1>(1);
}
WRITE8_MEMBER(bking_state::bking_soundlatch_w)
{
int i, code = 0;
for (i = 0;i < 8;i++)
if (data & (1 << i))
code |= 0x80 >> i;
m_soundlatch->write(space, offset, code);
if (m_sound_nmi_enable)
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
m_soundlatch->write(space, offset, BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
}
WRITE8_MEMBER(bking_state::bking3_addr_l_w)
@ -347,9 +339,6 @@ void bking_state::machine_start()
save_item(NAME(m_palette_bank));
save_item(NAME(m_controller));
save_item(NAME(m_hit));
/* sound */
save_item(NAME(m_sound_nmi_enable));
}
MACHINE_START_MEMBER(bking_state,bking3)
@ -384,7 +373,7 @@ void bking_state::machine_reset()
m_hit = 0;
/* sound */
m_sound_nmi_enable = 1;
m_soundnmi->in_w<1>(0);
}
MACHINE_RESET_MEMBER(bking_state,bking3)
@ -432,6 +421,10 @@ static MACHINE_CONFIG_START( bking )
MCFG_SPEAKER_STANDARD_MONO("speaker")
MCFG_GENERIC_LATCH_8_ADD("soundlatch")
MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_device, in_w<0>))
MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
MCFG_SOUND_ADD("ay1", AY8910, XTAL_6MHz/4)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)

View File

@ -3,6 +3,7 @@
#include "machine/taito68705interface.h"
#include "machine/gen_latch.h"
#include "machine/input_merger.h"
#include "screen.h"
class bking_state : public driver_device
@ -16,7 +17,8 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
m_soundlatch(*this, "soundlatch"),
m_soundnmi(*this, "soundnmi")
{
}
@ -43,10 +45,6 @@ public:
int m_controller;
int m_hit;
/* sound-related */
int m_sound_nmi_enable;
int m_pending_nmi;
/* misc */
int m_addr_h;
int m_addr_l;
@ -58,6 +56,7 @@ public:
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_device<input_merger_device> m_soundnmi;
DECLARE_READ8_MEMBER(bking_sndnmi_disable_r);
DECLARE_WRITE8_MEMBER(bking_sndnmi_enable_w);