diff options
author | 2014-10-11 00:09:59 +0000 | |
---|---|---|
committer | 2014-10-11 00:09:59 +0000 | |
commit | 4c4c3b484c609197f16cd5546b2da8a0829849c9 (patch) | |
tree | e0185740144c4e0bf2b324945babb82c0cd9237e | |
parent | 2b7bf5c0c780aff03beb2f66da345f6645718fda (diff) |
Untangled gottlieb audio from the arcade driver, so it becomes available for pinball.
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | src/mame/audio/gottlieb.c | 45 | ||||
-rw-r--r-- | src/mame/audio/gottlieb.h | 193 | ||||
-rw-r--r-- | src/mame/drivers/gottlieb.c | 47 | ||||
-rw-r--r-- | src/mame/includes/gottlieb.h | 185 | ||||
-rw-r--r-- | src/mame/video/gottlieb.c | 1 |
6 files changed, 239 insertions, 233 deletions
diff --git a/.gitattributes b/.gitattributes index be895f146b2..60f385af576 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4462,6 +4462,7 @@ src/mame/audio/geebee.c svneol=native#text/plain src/mame/audio/gomoku.c svneol=native#text/plain src/mame/audio/gorf.c svneol=native#text/plain src/mame/audio/gottlieb.c svneol=native#text/plain +src/mame/audio/gottlieb.h svneol=native#text/plain src/mame/audio/gotya.c svneol=native#text/plain src/mame/audio/grchamp.c svneol=native#text/plain src/mame/audio/gridlee.c svneol=native#text/plain diff --git a/src/mame/audio/gottlieb.c b/src/mame/audio/gottlieb.c index e563543646a..f015d775cba 100644 --- a/src/mame/audio/gottlieb.c +++ b/src/mame/audio/gottlieb.c @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles /*************************************************************************** - gottlieb.h + gottlieb.c Gottlieb 6502-based sound hardware implementations. @@ -10,8 +10,7 @@ ***************************************************************************/ -#include "emu.h" -#include "includes/gottlieb.h" +#include "audio/gottlieb.h" #define SOUND1_CLOCK XTAL_3_579545MHz @@ -247,46 +246,6 @@ MACHINE_CONFIG_END #endif - -//************************************************************************** -// QBERT MECHANICAL KNOCKER -//************************************************************************** - -//------------------------------------------------- -// qbert cabinets have a mechanical knocker near the floor, -// MAME simulates this with a sample. -// (like all MAME samples, it is optional. If you actually have -// a real kicker/knocker, hook it up via output "knocker0") -//------------------------------------------------- - -void gottlieb_state::qbert_knocker(UINT8 knock) -{ - output_set_value("knocker0", knock); - - // start sound on rising edge - if (knock & ~m_knocker_prev) - m_knocker_sample->start(0, 0); - m_knocker_prev = knock; -} - -static const char *const qbert_knocker_names[] = -{ - "*qbert", - "knocker", - 0 /* end of array */ -}; - -MACHINE_CONFIG_FRAGMENT( qbert_knocker ) - MCFG_SPEAKER_ADD("knocker", 0.0, 0.0, 1.0) - - MCFG_SOUND_ADD("knocker_sam", SAMPLES, 0) - MCFG_SAMPLES_CHANNELS(1) - MCFG_SAMPLES_NAMES(qbert_knocker_names) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "knocker", 1.0) -MACHINE_CONFIG_END - - - //************************************************************************** // REV 1 SOUND BOARD: 6502 + DAC //************************************************************************** diff --git a/src/mame/audio/gottlieb.h b/src/mame/audio/gottlieb.h new file mode 100644 index 00000000000..9bb20f10531 --- /dev/null +++ b/src/mame/audio/gottlieb.h @@ -0,0 +1,193 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +/*************************************************************************** + + Gottlieb hardware + +***************************************************************************/ + +#include "emu.h" +#include "cpu/m6502/m6502.h" +#include "machine/6532riot.h" +#include "sound/dac.h" +#include "sound/ay8910.h" +#include "sound/sp0250.h" +#include "sound/votrax.h" + + +// set to 0 to enable Votrax device and disable samples +#define USE_FAKE_VOTRAX (1) + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +extern const device_type GOTTLIEB_SOUND_REV1; +extern const device_type GOTTLIEB_SOUND_REV1_WITH_VOTRAX; +extern const device_type GOTTLIEB_SOUND_REV2; + + + +//************************************************************************** +// DEVICE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_GOTTLIEB_SOUND_R1_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1, 0) +#define MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX(_tag) \ + MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1_WITH_VOTRAX, 0) + +#define MCFG_GOTTLIEB_SOUND_R2_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) +#define MCFG_GOTTLIEB_SOUND_R2_ADD_COBRAM3(_tag) \ + MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) \ + gottlieb_sound_r2_device::static_enable_cobram3_mods(*device); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> gottlieb_sound_r1_device + +// rev 1 sound board, with unpopulated VOTRAX +class gottlieb_sound_r1_device : public device_t, public device_mixer_interface +{ +public: + // construction/destruction + gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool populate_votrax); + + // read/write + DECLARE_WRITE8_MEMBER( write ); + + // internal communications + DECLARE_WRITE_LINE_MEMBER( snd_interrupt ); + DECLARE_WRITE8_MEMBER( r6532_portb_w ); + DECLARE_WRITE8_MEMBER( votrax_data_w ); + DECLARE_WRITE8_MEMBER( speech_clock_dac_w ); + DECLARE_WRITE_LINE_MEMBER( votrax_request ); + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + +private: + // devices + required_device<m6502_device> m_audiocpu; + required_device<riot6532_device> m_riot; + required_device<dac_device> m_dac; + optional_device<votrax_sc01_device> m_votrax; + + // internal state + //bool m_populate_votrax; + UINT8 m_last_speech_clock; + +#if USE_FAKE_VOTRAX +protected: + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); +private: + void fake_votrax_data_w(UINT8 data); + void trigger_sample(UINT8 data); + optional_device<samples_device> m_samples; + UINT8 m_score_sample; + UINT8 m_random_offset; + UINT8 m_votrax_queue[100]; + UINT8 m_votrax_queuepos; +#endif +}; + +// fully populated rev 1 sound board +class gottlieb_sound_r1_with_votrax_device : public gottlieb_sound_r1_device +{ +public: + // construction/destruction + gottlieb_sound_r1_with_votrax_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; +}; + + +// ======================> gottlieb_sound_r2_device + +// fully populated rev 2 sound board +class gottlieb_sound_r2_device : public device_t, public device_mixer_interface +{ +public: + // construction/destruction + gottlieb_sound_r2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // static configuration helpers + static void static_enable_cobram3_mods(device_t &device); + + // read/write + DECLARE_WRITE8_MEMBER( write ); + + // internal communications + DECLARE_READ8_MEMBER( speech_data_r ); + DECLARE_READ8_MEMBER( audio_data_r ); + DECLARE_WRITE8_MEMBER( signal_audio_nmi_w ); + DECLARE_WRITE8_MEMBER( nmi_rate_w ); + CUSTOM_INPUT_MEMBER( speech_drq_custom_r ); + DECLARE_WRITE8_MEMBER( dac_w ); + DECLARE_WRITE8_MEMBER( speech_control_w ); + DECLARE_WRITE8_MEMBER( sp0250_latch_w ); + DECLARE_WRITE8_MEMBER( psg_latch_w ); + +protected: + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + virtual void device_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + +private: + // internal helpers + void nmi_timer_adjust(); + void nmi_state_update(); + + // timer IDs + enum + { + TID_NMI_GENERATE, + TID_NMI_CLEAR, + TID_SOUND_LATCH_WRITE + }; + + // devices + required_device<m6502_device> m_audiocpu; + required_device<m6502_device> m_speechcpu; + required_device<dac_device> m_dac; + required_device<ay8913_device> m_ay1; + required_device<ay8913_device> m_ay2; + optional_device<sp0250_device> m_sp0250; + + // internal state + bool m_cobram3_mod; + emu_timer * m_nmi_timer; + UINT8 m_nmi_rate; + UINT8 m_nmi_state; + UINT8 m_audiocpu_latch; + UINT8 m_speechcpu_latch; + UINT8 m_speech_control; + UINT8 m_last_command; + UINT8 m_dac_data[2]; + UINT8 m_psg_latch; + UINT8 m_psg_data_latch; + UINT8 m_sp0250_latch; +}; + + +/*----------- defined in audio/gottlieb.c -----------*/ + +#if USE_FAKE_VOTRAX +MACHINE_CONFIG_EXTERN( reactor_samples ); +MACHINE_CONFIG_EXTERN( qbert_samples ); +#endif diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 85827497788..ab1f8a5711d 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -194,13 +194,8 @@ VBlank duration: 1/VSYNC * (16/256) = 1017.6 us ***************************************************************************/ -#include "emu.h" -#include "machine/6532riot.h" -#include "sound/ay8910.h" -#include "sound/dac.h" -#include "sound/samples.h" -#include "machine/nvram.h" #include "includes/gottlieb.h" +#include "machine/nvram.h" #define LOG_AUDIO_DECODE (0) @@ -642,6 +637,46 @@ void gottlieb_state::laserdisc_audio_process(laserdisc_device &device, int sampl + +//************************************************************************** +// QBERT MECHANICAL KNOCKER +//************************************************************************** + +//------------------------------------------------- +// qbert cabinets have a mechanical knocker near the floor, +// MAME simulates this with a sample. +// (like all MAME samples, it is optional. If you actually have +// a real kicker/knocker, hook it up via output "knocker0") +//------------------------------------------------- + +void gottlieb_state::qbert_knocker(UINT8 knock) +{ + output_set_value("knocker0", knock); + + // start sound on rising edge + if (knock & ~m_knocker_prev) + m_knocker_sample->start(0, 0); + m_knocker_prev = knock; +} + +static const char *const qbert_knocker_names[] = +{ + "*qbert", + "knocker", + 0 /* end of array */ +}; + +MACHINE_CONFIG_FRAGMENT( qbert_knocker ) + MCFG_SPEAKER_ADD("knocker", 0.0, 0.0, 1.0) + + MCFG_SOUND_ADD("knocker_sam", SAMPLES, 0) + MCFG_SAMPLES_CHANNELS(1) + MCFG_SAMPLES_NAMES(qbert_knocker_names) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "knocker", 1.0) +MACHINE_CONFIG_END + + + /************************************* * * Interrupt generation diff --git a/src/mame/includes/gottlieb.h b/src/mame/includes/gottlieb.h index 936a5f9de11..00cf3bfae74 100644 --- a/src/mame/includes/gottlieb.h +++ b/src/mame/includes/gottlieb.h @@ -6,192 +6,20 @@ ***************************************************************************/ +#include "emu.h" +#include "audio/gottlieb.h" #include "cpu/i86/i86.h" #include "cpu/m6502/m6502.h" -#include "machine/6532riot.h" -#include "sound/dac.h" -#include "sound/ay8910.h" -#include "sound/sp0250.h" #include "sound/samples.h" -#include "sound/votrax.h" #include "machine/ldpr8210.h" -// set to 0 to enable Votrax device and disable samples -#define USE_FAKE_VOTRAX (1) - - #define GOTTLIEB_VIDEO_HCOUNT 318 #define GOTTLIEB_VIDEO_HBLANK 256 #define GOTTLIEB_VIDEO_VCOUNT 256 #define GOTTLIEB_VIDEO_VBLANK 240 -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -extern const device_type GOTTLIEB_SOUND_REV1; -extern const device_type GOTTLIEB_SOUND_REV1_WITH_VOTRAX; -extern const device_type GOTTLIEB_SOUND_REV2; - - - -//************************************************************************** -// DEVICE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_GOTTLIEB_SOUND_R1_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1, 0) -#define MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX(_tag) \ - MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1_WITH_VOTRAX, 0) - -#define MCFG_GOTTLIEB_SOUND_R2_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) -#define MCFG_GOTTLIEB_SOUND_R2_ADD_COBRAM3(_tag) \ - MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) \ - gottlieb_sound_r2_device::static_enable_cobram3_mods(*device); - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> gottlieb_sound_r1_device - -// rev 1 sound board, with unpopulated VOTRAX -class gottlieb_sound_r1_device : public device_t, - public device_mixer_interface -{ -public: - // construction/destruction - gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool populate_votrax); - - // read/write - DECLARE_WRITE8_MEMBER( write ); - - // internal communications - DECLARE_WRITE_LINE_MEMBER( snd_interrupt ); - DECLARE_WRITE8_MEMBER( r6532_portb_w ); - DECLARE_WRITE8_MEMBER( votrax_data_w ); - DECLARE_WRITE8_MEMBER( speech_clock_dac_w ); - DECLARE_WRITE_LINE_MEMBER( votrax_request ); - -protected: - // device-level overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - -private: - // devices - required_device<m6502_device> m_audiocpu; - required_device<riot6532_device> m_riot; - required_device<dac_device> m_dac; - optional_device<votrax_sc01_device> m_votrax; - - // internal state - //bool m_populate_votrax; - UINT8 m_last_speech_clock; - -#if USE_FAKE_VOTRAX -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); -private: - void fake_votrax_data_w(UINT8 data); - void trigger_sample(UINT8 data); - optional_device<samples_device> m_samples; - UINT8 m_score_sample; - UINT8 m_random_offset; - UINT8 m_votrax_queue[100]; - UINT8 m_votrax_queuepos; -#endif -}; - -// fully populated rev 1 sound board -class gottlieb_sound_r1_with_votrax_device : public gottlieb_sound_r1_device -{ -public: - // construction/destruction - gottlieb_sound_r1_with_votrax_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -protected: - // device-level overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; -}; - - -// ======================> gottlieb_sound_r2_device - -// fully populated rev 2 sound board -class gottlieb_sound_r2_device : public device_t, - public device_mixer_interface -{ -public: - // construction/destruction - gottlieb_sound_r2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // static configuration helpers - static void static_enable_cobram3_mods(device_t &device); - - // read/write - DECLARE_WRITE8_MEMBER( write ); - - // internal communications - DECLARE_READ8_MEMBER( speech_data_r ); - DECLARE_READ8_MEMBER( audio_data_r ); - DECLARE_WRITE8_MEMBER( signal_audio_nmi_w ); - DECLARE_WRITE8_MEMBER( nmi_rate_w ); - CUSTOM_INPUT_MEMBER( speech_drq_custom_r ); - DECLARE_WRITE8_MEMBER( dac_w ); - DECLARE_WRITE8_MEMBER( speech_control_w ); - DECLARE_WRITE8_MEMBER( sp0250_latch_w ); - DECLARE_WRITE8_MEMBER( psg_latch_w ); - -protected: - // device-level overrides - virtual machine_config_constructor device_mconfig_additions() const; - virtual ioport_constructor device_input_ports() const; - virtual void device_start(); - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); - -private: - // internal helpers - void nmi_timer_adjust(); - void nmi_state_update(); - - // timer IDs - enum - { - TID_NMI_GENERATE, - TID_NMI_CLEAR, - TID_SOUND_LATCH_WRITE - }; - - // devices - required_device<m6502_device> m_audiocpu; - required_device<m6502_device> m_speechcpu; - required_device<dac_device> m_dac; - required_device<ay8913_device> m_ay1; - required_device<ay8913_device> m_ay2; - optional_device<sp0250_device> m_sp0250; - - // internal state - bool m_cobram3_mod; - emu_timer * m_nmi_timer; - UINT8 m_nmi_rate; - UINT8 m_nmi_state; - UINT8 m_audiocpu_latch; - UINT8 m_speechcpu_latch; - UINT8 m_speech_control; - UINT8 m_last_command; - UINT8 m_dac_data[2]; - UINT8 m_psg_latch; - UINT8 m_psg_data_latch; - UINT8 m_sp0250_latch; -}; // ======================> gottlieb_state @@ -311,12 +139,3 @@ public: protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; - -/*----------- defined in audio/gottlieb.c -----------*/ - -MACHINE_CONFIG_EXTERN( qbert_knocker ); - -#if USE_FAKE_VOTRAX -MACHINE_CONFIG_EXTERN( reactor_samples ); -MACHINE_CONFIG_EXTERN( qbert_samples ); -#endif diff --git a/src/mame/video/gottlieb.c b/src/mame/video/gottlieb.c index 0208b7422fb..63c41d75c47 100644 --- a/src/mame/video/gottlieb.c +++ b/src/mame/video/gottlieb.c @@ -4,7 +4,6 @@ ***************************************************************************/ -#include "emu.h" #include "includes/gottlieb.h" #include "video/resnet.h" |