snk6502: improve sound encapsulation and fix BGM (nw)

Still could be a lot better:
* Frequency/rate should be set in config, not reset handlers
* Speech should be moved into a separate device for the games that have it
* Probably should be specialisations for sasuke and satansat
* Not all games have three channels
This commit is contained in:
Vas Crabb 2018-06-02 15:01:03 +10:00
parent 91e39b1e68
commit e64244db48
5 changed files with 899 additions and 684 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,16 +19,20 @@ class snk6502_sound_device : public device_t, public device_sound_interface
public:
snk6502_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER( sasuke_sound_w );
DECLARE_WRITE8_MEMBER( satansat_sound_w );
DECLARE_WRITE8_MEMBER( vanguard_sound_w );
DECLARE_WRITE8_MEMBER( vanguard_speech_w );
DECLARE_WRITE8_MEMBER( fantasy_sound_w );
DECLARE_WRITE8_MEMBER( fantasy_speech_w );
DECLARE_CUSTOM_INPUT_MEMBER(music0_playing);
void set_music_clock(double clock_time);
void set_music_freq(int freq);
int music0_playing();
void set_music_clock(double clock_time);
void set_channel_base(int channel, int base, int mask = 0xff);
void mute_channel(int channel);
void unmute_channel(int channel);
void set_sound0_stop_on_rollover(int value) { m_sound0_stop_on_rollover = value; }
void speech_w(uint8_t data, const uint16_t *table, int start);
void build_waveform(int channel, int mask);
void sasuke_build_waveform(int mask);
void satansat_build_waveform(int mask);
protected:
// device-level overrides
@ -58,31 +62,133 @@ private:
int32_t m_tone_clock;
sound_stream * m_tone_stream;
optional_device<sn76477_device> m_sn76477_2;
optional_device<discrete_device> m_discrete;
optional_device<samples_device> m_samples;
required_memory_region m_rom;
int m_sound0_stop_on_rollover;
uint8_t m_last_port1;
int m_hd38880_cmd;
uint32_t m_hd38880_addr;
int m_hd38880_data_bytes;
double m_hd38880_speed;
inline void validate_tone_channel(int channel);
void sasuke_build_waveform(int mask);
void satansat_build_waveform(int mask);
void build_waveform(int channel, int mask);
void speech_w(uint8_t data, const uint16_t *table, int start);
void validate_tone_channel(int channel);
};
DECLARE_DEVICE_TYPE(SNK6502, snk6502_sound_device)
DISCRETE_SOUND_EXTERN( fantasy_discrete );
class vanguard_sound_device : public device_t
{
public:
vanguard_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
extern char const *const sasuke_sample_names[];
extern char const *const vanguard_sample_names[];
extern char const *const fantasy_sample_names[];
DECLARE_WRITE8_MEMBER( sound_w );
DECLARE_WRITE8_MEMBER( speech_w );
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
private:
required_device<snk6502_sound_device> m_custom;
required_device<sn76477_device> m_sn76477_2;
required_device<samples_device> m_samples;
uint8_t m_last_port1;
};
class fantasy_sound_device : public device_t
{
public:
fantasy_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER( sound_w );
DECLARE_WRITE8_MEMBER( speech_w );
protected:
fantasy_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
required_device<snk6502_sound_device> m_custom;
private:
required_device<discrete_device> m_discrete;
uint8_t m_last_port1;
};
class nibbler_sound_device : public fantasy_sound_device
{
public:
nibbler_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
};
class pballoon_sound_device : public fantasy_sound_device
{
public:
pballoon_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_reset() override;
};
class sasuke_sound_device : public device_t
{
public:
sasuke_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER(sound_w);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
private:
required_device<snk6502_sound_device> m_custom;
required_device<samples_device> m_samples;
uint8_t m_last_port1;
};
class satansat_sound_device : public device_t
{
public:
satansat_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_WRITE8_MEMBER(sound_w);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
private:
required_device<snk6502_sound_device> m_custom;
required_device<samples_device> m_samples;
uint8_t m_last_port1;
};
DECLARE_DEVICE_TYPE(SNK6502_SOUND, snk6502_sound_device)
DECLARE_DEVICE_TYPE(VANGUARD_SOUND, vanguard_sound_device)
DECLARE_DEVICE_TYPE(FANTASY_SOUND, fantasy_sound_device)
DECLARE_DEVICE_TYPE(NIBBLER_SOUND, nibbler_sound_device)
DECLARE_DEVICE_TYPE(PBALLOON_SOUND, pballoon_sound_device)
DECLARE_DEVICE_TYPE(SASUKE_SOUND, sasuke_sound_device)
DECLARE_DEVICE_TYPE(SATANSAT_SOUND, satansat_sound_device)
#endif // MAME_AUDIO_SNK6502_H

View File

@ -330,11 +330,6 @@ void snk6502_state::sasuke_start_counter()
*
*************************************/
CUSTOM_INPUT_MEMBER(snk6502_state::snk6502_music0_r)
{
return (m_sound->music0_playing() ? 0x01 : 0x00);
}
CUSTOM_INPUT_MEMBER(snk6502_state::sasuke_count_r)
{
return (m_sasuke_counter >> 4);
@ -357,7 +352,7 @@ void snk6502_state::sasuke_map(address_map &map)
map(0x3000, 0x3000).w("crtc", FUNC(mc6845_device::address_w));
map(0x3001, 0x3001).w("crtc", FUNC(mc6845_device::register_w));
map(0x4000, 0x8fff).rom();
map(0xb000, 0xb001).w(m_sound, FUNC(snk6502_sound_device::sasuke_sound_w));
map(0xb000, 0xb001).w("snk6502", FUNC(sasuke_sound_device::sound_w));
map(0xb002, 0xb002).w(this, FUNC(snk6502_state::satansat_b002_w)); /* flip screen & irq enable */
map(0xb003, 0xb003).w(this, FUNC(snk6502_state::satansat_backcolor_w));
map(0xb004, 0xb004).portr("IN0");
@ -377,7 +372,7 @@ void snk6502_state::satansat_map(address_map &map)
map(0x3000, 0x3000).w("crtc", FUNC(mc6845_device::address_w));
map(0x3001, 0x3001).w("crtc", FUNC(mc6845_device::register_w));
map(0x4000, 0x9fff).rom();
map(0xb000, 0xb001).w(m_sound, FUNC(snk6502_sound_device::satansat_sound_w));
map(0xb000, 0xb001).w("snk6502", FUNC(satansat_sound_device::sound_w));
map(0xb002, 0xb002).w(this, FUNC(snk6502_state::satansat_b002_w)); /* flip screen & irq enable */
map(0xb003, 0xb003).w(this, FUNC(snk6502_state::satansat_backcolor_w));
map(0xb004, 0xb004).portr("IN0");
@ -396,7 +391,7 @@ void snk6502_state::vanguard_map(address_map &map)
map(0x1000, 0x1fff).ram().w(this, FUNC(snk6502_state::charram_w)).share("charram");
map(0x3000, 0x3000).w("crtc", FUNC(mc6845_device::address_w));
map(0x3001, 0x3001).w("crtc", FUNC(mc6845_device::register_w));
map(0x3100, 0x3102).w(m_sound, FUNC(snk6502_sound_device::vanguard_sound_w));
map(0x3100, 0x3102).w("snk6502", FUNC(vanguard_sound_device::sound_w));
map(0x3103, 0x3103).w(this, FUNC(snk6502_state::flipscreen_w));
map(0x3104, 0x3104).portr("IN0");
map(0x3105, 0x3105).portr("IN1");
@ -404,51 +399,51 @@ void snk6502_state::vanguard_map(address_map &map)
map(0x3107, 0x3107).portr("IN2");
map(0x3200, 0x3200).w(this, FUNC(snk6502_state::scrollx_w));
map(0x3300, 0x3300).w(this, FUNC(snk6502_state::scrolly_w));
map(0x3400, 0x3400).w(m_sound, FUNC(snk6502_sound_device::vanguard_speech_w)); // speech
map(0x3400, 0x3400).w("snk6502", FUNC(vanguard_sound_device::speech_w)); // speech
map(0x4000, 0xbfff).rom();
map(0xf000, 0xffff).rom(); /* for the reset / interrupt vectors */
}
void snk6502_state::fantasy_map(address_map &map)
void fantasy_state::fantasy_map(address_map &map)
{
map(0x0000, 0x03ff).ram();
map(0x0400, 0x07ff).ram().w(this, FUNC(snk6502_state::videoram2_w)).share("videoram2");
map(0x0800, 0x0bff).ram().w(this, FUNC(snk6502_state::videoram_w)).share("videoram");
map(0x0c00, 0x0fff).ram().w(this, FUNC(snk6502_state::colorram_w)).share("colorram");
map(0x1000, 0x1fff).ram().w(this, FUNC(snk6502_state::charram_w)).share("charram");
map(0x0400, 0x07ff).ram().w(this, FUNC(fantasy_state::videoram2_w)).share("videoram2");
map(0x0800, 0x0bff).ram().w(this, FUNC(fantasy_state::videoram_w)).share("videoram");
map(0x0c00, 0x0fff).ram().w(this, FUNC(fantasy_state::colorram_w)).share("colorram");
map(0x1000, 0x1fff).ram().w(this, FUNC(fantasy_state::charram_w)).share("charram");
map(0x2000, 0x2000).w("crtc", FUNC(mc6845_device::address_w));
map(0x2001, 0x2001).w("crtc", FUNC(mc6845_device::register_w));
map(0x2100, 0x2102).w(m_sound, FUNC(snk6502_sound_device::fantasy_sound_w));
map(0x2103, 0x2103).w(this, FUNC(snk6502_state::fantasy_flipscreen_w)); // affects both video and sound
map(0x2100, 0x2102).w("snk6502", FUNC(fantasy_sound_device::sound_w));
map(0x2103, 0x2103).w(this, FUNC(fantasy_state::fantasy_flipscreen_w)); // affects both video and sound
map(0x2104, 0x2104).portr("IN0");
map(0x2105, 0x2105).portr("IN1");
map(0x2106, 0x2106).portr("DSW");
map(0x2107, 0x2107).portr("IN2");
map(0x2200, 0x2200).w(this, FUNC(snk6502_state::scrollx_w));
map(0x2300, 0x2300).w(this, FUNC(snk6502_state::scrolly_w));
map(0x2400, 0x2400).w(m_sound, FUNC(snk6502_sound_device::fantasy_speech_w)); // speech
map(0x2200, 0x2200).w(this, FUNC(fantasy_state::scrollx_w));
map(0x2300, 0x2300).w(this, FUNC(fantasy_state::scrolly_w));
map(0x2400, 0x2400).w("snk6502", FUNC(fantasy_sound_device::speech_w)); // speech
map(0x3000, 0xbfff).rom();
map(0xf000, 0xffff).rom();
}
void snk6502_state::pballoon_map(address_map &map)
void fantasy_state::pballoon_map(address_map &map)
{
map(0x0000, 0x03ff).ram();
map(0x0400, 0x07ff).ram().w(this, FUNC(snk6502_state::videoram2_w)).share("videoram2");
map(0x0800, 0x0bff).ram().w(this, FUNC(snk6502_state::videoram_w)).share("videoram");
map(0x0c00, 0x0fff).ram().w(this, FUNC(snk6502_state::colorram_w)).share("colorram");
map(0x1000, 0x1fff).ram().w(this, FUNC(snk6502_state::charram_w)).share("charram");
map(0x0400, 0x07ff).ram().w(this, FUNC(fantasy_state::videoram2_w)).share("videoram2");
map(0x0800, 0x0bff).ram().w(this, FUNC(fantasy_state::videoram_w)).share("videoram");
map(0x0c00, 0x0fff).ram().w(this, FUNC(fantasy_state::colorram_w)).share("colorram");
map(0x1000, 0x1fff).ram().w(this, FUNC(fantasy_state::charram_w)).share("charram");
map(0x3000, 0x9fff).rom();
map(0xb000, 0xb000).w("crtc", FUNC(mc6845_device::address_w));
map(0xb001, 0xb001).w("crtc", FUNC(mc6845_device::register_w));
map(0xb100, 0xb102).w(m_sound, FUNC(snk6502_sound_device::fantasy_sound_w));
map(0xb103, 0xb103).w(this, FUNC(snk6502_state::fantasy_flipscreen_w)); // affects both video and sound
map(0xb100, 0xb102).w("snk6502", FUNC(fantasy_sound_device::sound_w));
map(0xb103, 0xb103).w(this, FUNC(fantasy_state::fantasy_flipscreen_w)); // affects both video and sound
map(0xb104, 0xb104).portr("IN0");
map(0xb105, 0xb105).portr("IN1");
map(0xb106, 0xb106).portr("DSW");
map(0xb107, 0xb107).portr("IN2");
map(0xb200, 0xb200).w(this, FUNC(snk6502_state::scrollx_w));
map(0xb300, 0xb300).w(this, FUNC(snk6502_state::scrolly_w));
map(0xb200, 0xb200).w(this, FUNC(fantasy_state::scrollx_w));
map(0xb300, 0xb300).w(this, FUNC(fantasy_state::scrolly_w));
map(0xf000, 0xffff).rom();
}
@ -534,7 +529,7 @@ static INPUT_PORTS_START( satansat )
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x7c, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk6502_state,snk6502_music0_r, nullptr) /* music0 playing */
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER("snk6502:custom", snk6502_sound_device,music0_playing, nullptr) /* music0 playing */
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, snk6502_state,coin_inserted, 0)
@ -599,7 +594,7 @@ static INPUT_PORTS_START( vanguard )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL /* fire left */
PORT_MODIFY("IN2")
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, snk6502_state,snk6502_music0_r, nullptr) /* music0 playing */
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER("snk6502:custom", snk6502_sound_device,music0_playing, nullptr) /* music0 playing */
INPUT_PORTS_END
static INPUT_PORTS_START( fantasy )
@ -797,35 +792,9 @@ INTERRUPT_GEN_MEMBER(snk6502_state::snk6502_interrupt)
MACHINE_RESET_MEMBER(snk6502_state,sasuke)
{
m_sound->set_music_clock(M_LN2 * (RES_K(18) + RES_K(1)) * CAP_U(1));
// adjusted (measured through audio recording of pcb)
m_sound->set_music_freq(35300);
sasuke_start_counter();
}
MACHINE_RESET_MEMBER(snk6502_state,satansat)
{
// same as sasuke (assumption?)
// NOTE: this was set before sasuke was adjusted to a lower freq, please don't modify until measured/confirmed on pcb
m_sound->set_music_freq(38000);
sasuke_start_counter();
}
MACHINE_RESET_MEMBER(snk6502_state,vanguard)
{
// 41.6 Hz update (measured)
m_sound->set_music_clock(1 / 41.6);
}
MACHINE_RESET_MEMBER(snk6502_state,pballoon)
{
// 40.3 Hz update (measured)
m_sound->set_music_clock(1 / 40.3);
}
/*************************************
*
@ -865,67 +834,7 @@ MACHINE_CONFIG_START(snk6502_state::sasuke)
MCFG_TIMER_DRIVER_ADD_PERIODIC("sasuke_timer", snk6502_state, sasuke_update_counter, attotime::from_hz(MASTER_CLOCK / 8))
// sound hardware
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("snk6502", SNK6502, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("samples", SAMPLES)
MCFG_SAMPLES_CHANNELS(4)
MCFG_SAMPLES_NAMES(sasuke_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.12)
MCFG_DEVICE_ADD("sn76477.1", SN76477)
// ic48 GND: 2,22,26,27,28 +5V: 1,15,25
MCFG_SN76477_NOISE_PARAMS(RES_K(470), RES_K(150), CAP_P(4700)) // noise + filter
MCFG_SN76477_DECAY_RES(RES_K(22)) // decay_res
MCFG_SN76477_ATTACK_PARAMS(CAP_U(10), RES_K(10)) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(100)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(47)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, 0, 0) // VCO volt + cap + res: N/C
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage: N/C
MCFG_SN76477_SLF_PARAMS(0, RES_K(10)) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(CAP_U(2.2), RES_K(100)) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(1, 0) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("sn76477.2", SN76477)
// ic51 GND: 2,26,27 +5V: 1,15,22,25,28
MCFG_SN76477_NOISE_PARAMS(RES_K(340), RES_K(47), CAP_P(100)) // noise + filter
MCFG_SN76477_DECAY_RES(RES_K(470)) // decay_res
MCFG_SN76477_ATTACK_PARAMS(CAP_U(4.7), RES_K(10)) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(100)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(47)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, CAP_P(220), RES_K(1000)) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage: N/C
MCFG_SN76477_SLF_PARAMS(0, RES_K(220)) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(CAP_U(22), RES_K(47)) // oneshot caps + res
MCFG_SN76477_VCO_MODE(1) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(1, 1) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("sn76477.3", SN76477)
// ic52 GND: 2,22,27,28 +5V: 1,15,25,26
MCFG_SN76477_NOISE_PARAMS(RES_K(330), RES_K(47), CAP_P(100)) // noise + filter
MCFG_SN76477_DECAY_RES(RES_K(1)) // decay_res
MCFG_SN76477_ATTACK_PARAMS(0, RES_K(1)) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(100)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(47)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, CAP_P(1000), RES_K(1000)) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage: N/C
MCFG_SN76477_SLF_PARAMS(CAP_U(1), RES_K(10)) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(CAP_U(2.2), RES_K(150)) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(1, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(1, 0) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("snk6502", SASUKE_SOUND, 0)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::satansat)
@ -934,36 +843,11 @@ MACHINE_CONFIG_START(snk6502_state::satansat)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(satansat_map)
MCFG_MACHINE_RESET_OVERRIDE(snk6502_state,satansat)
// video hardware
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_satansat)
// sound hardware
MCFG_DEVICE_MODIFY("samples")
MCFG_SAMPLES_CHANNELS(3)
MCFG_SAMPLES_NAMES(vanguard_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_DEVICE_REPLACE("sn76477.1", SN76477)
// ??? GND: 2,26,27 +5V: 15,25
MCFG_SN76477_NOISE_PARAMS(RES_K(470), RES_M(1.5), CAP_P(220)) // noise + filter
MCFG_SN76477_DECAY_RES(0) // decay_res
MCFG_SN76477_ATTACK_PARAMS(0, 0) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(47)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(47)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, 0, 0) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage
MCFG_SN76477_SLF_PARAMS(0, 0) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(0, 0) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(1, 1) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MCFG_DEVICE_REMOVE("sn76477.2")
MCFG_DEVICE_REMOVE("sn76477.3")
MCFG_DEVICE_REPLACE("snk6502", SATANSAT_SOUND, 0)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::vanguard)
@ -974,10 +858,7 @@ MACHINE_CONFIG_START(snk6502_state::vanguard)
MCFG_DEVICE_PROGRAM_MAP(vanguard_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", snk6502_state, snk6502_interrupt)
MCFG_MACHINE_RESET_OVERRIDE(snk6502_state,vanguard)
// video hardware
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE((MASTER_CLOCK / 16) / (45 * 32 * 8))
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -997,104 +878,38 @@ MACHINE_CONFIG_START(snk6502_state::vanguard)
MCFG_MC6845_CHAR_WIDTH(8)
// sound hardware
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("snk6502", SNK6502, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("samples", SAMPLES)
MCFG_SAMPLES_CHANNELS(3)
MCFG_SAMPLES_NAMES(vanguard_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_DEVICE_ADD("sn76477.1", SN76477)
// SHOT A GND: 2,9,26,27 +5V: 15,25
MCFG_SN76477_NOISE_PARAMS(RES_K(470), RES_M(1.5), CAP_P(220)) // noise + filter
MCFG_SN76477_DECAY_RES(0) // decay_res
MCFG_SN76477_ATTACK_PARAMS(0, 0) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(47)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(4.7)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, 0, 0) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage
MCFG_SN76477_SLF_PARAMS(0, 0) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(0, 0) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(1, 1) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_DEVICE_ADD("sn76477.2", SN76477)
// SHOT B GND: 1,2,26,27 +5V: 15,25,28
MCFG_SN76477_NOISE_PARAMS(RES_K(10), RES_K(30), 0) // noise + filter
MCFG_SN76477_DECAY_RES(0) // decay_res
MCFG_SN76477_ATTACK_PARAMS(0, 0) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(47)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(4.7)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, 0, 0) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage
MCFG_SN76477_SLF_PARAMS(0, 0) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(0, 0) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
MCFG_SN76477_ENVELOPE_PARAMS(0, 1) // envelope 1, 2
MCFG_SN76477_ENABLE(1) // enable
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_DEVICE_ADD("snk6502", VANGUARD_SOUND, 0)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::fantasy)
MACHINE_CONFIG_START(fantasy_state::fantasy)
vanguard(config);
// basic machine hardware
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(fantasy_map)
// sound hardware
MCFG_DEVICE_MODIFY("samples")
MCFG_SAMPLES_CHANNELS(1)
MCFG_SAMPLES_NAMES(fantasy_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
MCFG_DEVICE_REPLACE("sn76477.1", SN76477)
// BOMB GND: 2,9,26,27 +5V: 15,25
MCFG_SN76477_NOISE_PARAMS(RES_K(470), RES_M(1.5), CAP_P(220)) // noise + filter
MCFG_SN76477_DECAY_RES(0) // decay_res
MCFG_SN76477_ATTACK_PARAMS(0, 0) // attack_decay_cap + attack_res
MCFG_SN76477_AMP_RES(RES_K(470)) // amplitude_res
MCFG_SN76477_FEEDBACK_RES(RES_K(4.7)) // feedback_res
MCFG_SN76477_VCO_PARAMS(0, 0, 0) // VCO volt + cap + res
MCFG_SN76477_PITCH_VOLTAGE(0) // pitch_voltage
MCFG_SN76477_SLF_PARAMS(0, 0) // slf caps + res
MCFG_SN76477_ONESHOT_PARAMS(0, 0) // oneshot caps + res
MCFG_SN76477_VCO_MODE(0) // VCO mode
MCFG_SN76477_MIXER_PARAMS(0, 1, 0) // mixer A, B, C
// schematic does not show pin 1 grounded, but it must be.
// otherwise it is using the VCO for the envelope, but the VCO is not hooked up
MCFG_SN76477_ENVELOPE_PARAMS(0, 1) // envelope 1, 2
MCFG_SN76477_ENABLE(0) // enable
MCFG_SOUND_ROUTE(0, "discrete", 1.0, 0)
MCFG_DEVICE_ADD("discrete", DISCRETE, fantasy_discrete)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
MCFG_DEVICE_REMOVE("sn76477.2")
MCFG_DEVICE_REPLACE("snk6502", FANTASY_SOUND, 0)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::nibbler)
MACHINE_CONFIG_START(fantasy_state::nibbler)
fantasy(config);
// sound hardware
MCFG_DEVICE_REMOVE("samples")
MCFG_DEVICE_REPLACE("snk6502", NIBBLER_SOUND, 0)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::pballoon)
MACHINE_CONFIG_START(fantasy_state::pballoon)
nibbler(config);
// basic machine hardware
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(pballoon_map)
MCFG_MACHINE_RESET_OVERRIDE(snk6502_state,pballoon)
MCFG_VIDEO_START_OVERRIDE(snk6502_state, pballoon)
MCFG_VIDEO_START_OVERRIDE(snk6502_state, pballoon )
// sound hardware
MCFG_DEVICE_REPLACE("snk6502", PBALLOON_SOUND, 0)
MACHINE_CONFIG_END
@ -1715,16 +1530,16 @@ GAME( 1981, satansatind, satansat, satansat, satansat, snk6502_state, empty_init
GAME( 1981, vanguard, 0, vanguard, vanguard, snk6502_state, empty_init, ROT90, "SNK", "Vanguard (SNK)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, vanguardc, vanguard, vanguard, vanguard, snk6502_state, empty_init, ROT90, "SNK (Centuri license)", "Vanguard (Centuri)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, vanguardj, vanguard, vanguard, vanguard, snk6502_state, empty_init, ROT90, "SNK", "Vanguard (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, fantasyu, 0, fantasy, fantasyu, snk6502_state, empty_init, ROT90, "SNK (Rock-Ola license)", "Fantasy (US)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, fantasyg, fantasyu, fantasy, fantasy, snk6502_state, empty_init, ROT90, "SNK", "Fantasy (Germany, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // bootleg?
GAME( 1981, fantasyg2, fantasyu, fantasy, fantasy, snk6502_state, empty_init, ROT90, "SNK", "Fantasy (Germany, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // bootleg?
GAME( 1981, fantasyj, fantasyu, fantasy, fantasyu, snk6502_state, empty_init, ROT90, "SNK", "Fantasy (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1982, pballoon, 0, pballoon, pballoon, snk6502_state, empty_init, ROT90, "SNK", "Pioneer Balloon", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pballoonr, pballoon, pballoon, pballoon, snk6502_state, empty_init, ROT90, "SNK (Rock-Ola license)", "Pioneer Balloon (Rock-Ola license)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler, 0, nibbler, nibbler, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 9)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibblera, nibbler, nibbler, nibbler, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 9, alternate set)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler8, nibbler, nibbler, nibbler8, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 8)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler7, nibbler, nibbler, nibbler8, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 7)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler6, nibbler, nibbler, nibbler6, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 6)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibblerp, nibbler, nibbler, nibbler6, snk6502_state, empty_init, ROT90, "Rock-Ola", "Nibbler (Pioneer Balloon conversion - rev 6)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, nibblero, nibbler, nibbler, nibbler8, snk6502_state, empty_init, ROT90, "Rock-Ola (Olympia license)", "Nibbler (Olympia - rev 8)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, fantasyu, 0, fantasy, fantasyu, fantasy_state, empty_init, ROT90, "SNK (Rock-Ola license)", "Fantasy (US)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1981, fantasyg, fantasyu, fantasy, fantasy, fantasy_state, empty_init, ROT90, "SNK", "Fantasy (Germany, set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // bootleg?
GAME( 1981, fantasyg2, fantasyu, fantasy, fantasy, fantasy_state, empty_init, ROT90, "SNK", "Fantasy (Germany, set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // bootleg?
GAME( 1981, fantasyj, fantasyu, fantasy, fantasyu, fantasy_state, empty_init, ROT90, "SNK", "Fantasy (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1982, pballoon, 0, pballoon, pballoon, fantasy_state, empty_init, ROT90, "SNK", "Pioneer Balloon", MACHINE_SUPPORTS_SAVE )
GAME( 1982, pballoonr, pballoon, pballoon, pballoon, fantasy_state, empty_init, ROT90, "SNK (Rock-Ola license)", "Pioneer Balloon (Rock-Ola license)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler, 0, nibbler, nibbler, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 9)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibblera, nibbler, nibbler, nibbler, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 9, alternate set)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler8, nibbler, nibbler, nibbler8, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 8)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler7, nibbler, nibbler, nibbler8, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 7)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibbler6, nibbler, nibbler, nibbler6, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (rev 6)", MACHINE_SUPPORTS_SAVE )
GAME( 1982, nibblerp, nibbler, nibbler, nibbler6, fantasy_state, empty_init, ROT90, "Rock-Ola", "Nibbler (Pioneer Balloon conversion - rev 6)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, nibblero, nibbler, nibbler, nibbler8, fantasy_state, empty_init, ROT90, "Rock-Ola (Olympia license)", "Nibbler (Olympia - rev 8)", MACHINE_SUPPORTS_SAVE )

View File

@ -12,24 +12,23 @@
#include "machine/timer.h"
class snk6502_sound_device;
class fantasy_sound_device;
class snk6502_state : public driver_device
{
public:
snk6502_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
snk6502_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_sound(*this, "snk6502"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_videoram2(*this, "videoram2"),
m_colorram(*this, "colorram"),
m_charram(*this, "charram") { }
m_charram(*this, "charram")
{ }
required_device<cpu_device> m_maincpu;
required_device<snk6502_sound_device> m_sound;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@ -55,11 +54,9 @@ public:
DECLARE_WRITE8_MEMBER(scrollx_w);
DECLARE_WRITE8_MEMBER(scrolly_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_WRITE8_MEMBER(fantasy_flipscreen_w);
DECLARE_WRITE8_MEMBER(satansat_b002_w);
DECLARE_WRITE8_MEMBER(satansat_backcolor_w);
DECLARE_CUSTOM_INPUT_MEMBER(snk6502_music0_r);
DECLARE_CUSTOM_INPUT_MEMBER(sasuke_count_r);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
@ -72,11 +69,8 @@ public:
DECLARE_MACHINE_RESET(sasuke);
DECLARE_VIDEO_START(satansat);
DECLARE_PALETTE_INIT(satansat);
DECLARE_MACHINE_RESET(vanguard);
DECLARE_VIDEO_START(snk6502);
DECLARE_PALETTE_INIT(snk6502);
DECLARE_MACHINE_RESET(satansat);
DECLARE_MACHINE_RESET(pballoon);
DECLARE_VIDEO_START(pballoon);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -87,17 +81,35 @@ public:
void sasuke_start_counter();
void postload();
void pballoon(machine_config &config);
void nibbler(machine_config &config);
void satansat(machine_config &config);
void fantasy(machine_config &config);
void vanguard(machine_config &config);
void sasuke(machine_config &config);
void fantasy_map(address_map &map);
void pballoon_map(address_map &map);
void sasuke_map(address_map &map);
void satansat_map(address_map &map);
void vanguard_map(address_map &map);
};
class fantasy_state : public snk6502_state
{
public:
fantasy_state(const machine_config &mconfig, device_type type, const char *tag) :
snk6502_state(mconfig, type, tag),
m_sound(*this, "snk6502")
{
}
void fantasy(machine_config &config);
void nibbler(machine_config &config);
void pballoon(machine_config &config);
protected:
DECLARE_WRITE8_MEMBER(fantasy_flipscreen_w);
void fantasy_map(address_map &map);
void pballoon_map(address_map &map);
private:
required_device<fantasy_sound_device> m_sound;
};
#endif // MAME_INCLUDES_SNK6502_H

View File

@ -137,9 +137,9 @@ WRITE8_MEMBER(snk6502_state::flipscreen_w)
}
}
WRITE8_MEMBER(snk6502_state::fantasy_flipscreen_w)
WRITE8_MEMBER(fantasy_state::fantasy_flipscreen_w)
{
m_sound->fantasy_sound_w(space, offset | 0x03, data, mem_mask);
m_sound->sound_w(space, offset | 0x03, data, mem_mask);
flipscreen_w(space, offset, data, mem_mask);
}