some more cleanup (nw)

This commit is contained in:
Miodrag Milanovic 2013-04-12 14:58:42 +00:00
parent 37c0c76931
commit 30a5a9c958
4 changed files with 16 additions and 11 deletions

View File

@ -32,7 +32,7 @@ SAMPLES_START( meadows_sh_start )
{
meadows_state *state = device.machine().driver_data<meadows_state>();
state->m_0c00 = state->m_0c01 = state->m_0c02 = state->m_0c03 = 0;
state->m_dac = 0;
state->m_dac_data = 0;
state->m_dac_enable = 0;
state->m_channel = 0;
state->m_freq1 = state->m_freq2 = 1000;
@ -94,9 +94,9 @@ void meadows_sh_update(running_machine &machine)
state->m_dac_enable = state->m_0c03 & ENABLE_DAC;
if (state->m_dac_enable)
machine.device<dac_device>("dac")->write_unsigned8(state->m_dac);
state->m_dac->write_unsigned8(state->m_dac_data);
else
machine.device<dac_device>("dac")->write_unsigned8(0);
state->m_dac->write_unsigned8(0);
}
state->m_latched_0c01 = state->m_0c01;
@ -110,9 +110,9 @@ void meadows_sh_update(running_machine &machine)
void meadows_sh_dac_w(running_machine &machine, int data)
{
meadows_state *state = machine.driver_data<meadows_state>();
state->m_dac = data;
state->m_dac_data = data;
if (state->m_dac_enable)
machine.device<dac_device>("dac")->write_unsigned8(state->m_dac);
state->m_dac->write_unsigned8(state->m_dac_data);
else
machine.device<dac_device>("dac")->write_unsigned8(0);
state->m_dac->write_unsigned8(0);
}

View File

@ -384,7 +384,7 @@ WRITE8_MEMBER(namcos1_state::namcos1_coin_w)
static void namcos1_update_DACs(running_machine &machine)
{
namcos1_state *state = machine.driver_data<namcos1_state>();
machine.device<dac_device>("dac")->write_signed16(0x8000 + (state->m_dac0_value * state->m_dac0_gain) + (state->m_dac1_value * state->m_dac1_gain));
state->m_dac->write_signed16(0x8000 + (state->m_dac0_value * state->m_dac0_gain) + (state->m_dac1_value * state->m_dac1_gain));
}
void namcos1_init_DACs(running_machine &machine)

View File

@ -3,7 +3,7 @@
Meadows S2650 hardware
*************************************************************************/
#include "sound/dac.h"
#include "sound/samples.h"
class meadows_state : public driver_device
@ -13,11 +13,12 @@ public:
: driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu") { }
m_maincpu(*this, "maincpu"),
m_dac(*this, "dac") { }
optional_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_videoram;
UINT8 m_dac;
UINT8 m_dac_data;
int m_dac_enable;
int m_channel;
int m_freq1;
@ -52,6 +53,7 @@ public:
INTERRUPT_GEN_MEMBER(audio_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
required_device<cpu_device> m_maincpu;
optional_device<dac_device> m_dac;
};

View File

@ -1,3 +1,4 @@
#include "sound/dac.h"
#define NAMCOS1_MAX_BANK 0x400
/* Bank handler definitions */
@ -17,7 +18,8 @@ public:
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_subcpu(*this, "sub"),
m_mcu(*this, "mcu") { }
m_mcu(*this, "mcu"),
m_dac(*this, "dac") { }
int m_dac0_value;
int m_dac1_value;
@ -103,6 +105,7 @@ public:
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_mcu;
required_device<dac_device> m_dac;
};
/*----------- defined in drivers/namcos1.c -----------*/