Previous 199869 Revisions Next

r32636 Saturday 11th October, 2014 at 00:09:59 UTC by Robbbert
Untangled gottlieb audio from the arcade driver, so it becomes available for pinball.
[src/mame/audio]gottlieb.c gottlieb.h*
[src/mame/drivers]gottlieb.c
[src/mame/includes]gottlieb.h
[src/mame/video]gottlieb.c

trunk/src/mame/includes/gottlieb.h
r32635r32636
66
77***************************************************************************/
88
9#include "emu.h"
10#include "audio/gottlieb.h"
911#include "cpu/i86/i86.h"
1012#include "cpu/m6502/m6502.h"
11#include "machine/6532riot.h"
12#include "sound/dac.h"
13#include "sound/ay8910.h"
14#include "sound/sp0250.h"
1513#include "sound/samples.h"
16#include "sound/votrax.h"
1714#include "machine/ldpr8210.h"
1815
1916
20// set to 0 to enable Votrax device and disable samples
21#define USE_FAKE_VOTRAX         (1)
22
23
2417#define GOTTLIEB_VIDEO_HCOUNT   318
2518#define GOTTLIEB_VIDEO_HBLANK   256
2619#define GOTTLIEB_VIDEO_VCOUNT   256
2720#define GOTTLIEB_VIDEO_VBLANK   240
2821
2922
30//**************************************************************************
31//  GLOBAL VARIABLES
32//**************************************************************************
3323
34extern const device_type GOTTLIEB_SOUND_REV1;
35extern const device_type GOTTLIEB_SOUND_REV1_WITH_VOTRAX;
36extern const device_type GOTTLIEB_SOUND_REV2;
3724
38
39
40//**************************************************************************
41//  DEVICE CONFIGURATION MACROS
42//**************************************************************************
43
44#define MCFG_GOTTLIEB_SOUND_R1_ADD(_tag) \
45   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1, 0)
46#define MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX(_tag) \
47   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1_WITH_VOTRAX, 0)
48
49#define MCFG_GOTTLIEB_SOUND_R2_ADD(_tag) \
50   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0)
51#define MCFG_GOTTLIEB_SOUND_R2_ADD_COBRAM3(_tag) \
52   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) \
53   gottlieb_sound_r2_device::static_enable_cobram3_mods(*device);
54
55
56//**************************************************************************
57//  TYPE DEFINITIONS
58//**************************************************************************
59
60// ======================> gottlieb_sound_r1_device
61
62// rev 1 sound board, with unpopulated VOTRAX
63class gottlieb_sound_r1_device :    public device_t,
64                           public device_mixer_interface
65{
66public:
67   // construction/destruction
68   gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
69   gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool populate_votrax);
70
71   // read/write
72   DECLARE_WRITE8_MEMBER( write );
73
74   // internal communications
75   DECLARE_WRITE_LINE_MEMBER( snd_interrupt );
76   DECLARE_WRITE8_MEMBER( r6532_portb_w );
77   DECLARE_WRITE8_MEMBER( votrax_data_w );
78   DECLARE_WRITE8_MEMBER( speech_clock_dac_w );
79   DECLARE_WRITE_LINE_MEMBER( votrax_request );
80
81protected:
82   // device-level overrides
83   virtual machine_config_constructor device_mconfig_additions() const;
84   virtual ioport_constructor device_input_ports() const;
85   virtual void device_start();
86
87private:
88   // devices
89   required_device<m6502_device>       m_audiocpu;
90   required_device<riot6532_device>    m_riot;
91   required_device<dac_device>         m_dac;
92   optional_device<votrax_sc01_device> m_votrax;
93
94   // internal state
95   //bool            m_populate_votrax;
96   UINT8           m_last_speech_clock;
97
98#if USE_FAKE_VOTRAX
99protected:
100   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
101private:
102   void fake_votrax_data_w(UINT8 data);
103   void trigger_sample(UINT8 data);
104   optional_device<samples_device> m_samples;
105   UINT8 m_score_sample;
106   UINT8 m_random_offset;
107   UINT8 m_votrax_queue[100];
108   UINT8 m_votrax_queuepos;
109#endif
110};
111
112// fully populated rev 1 sound board
113class gottlieb_sound_r1_with_votrax_device : public gottlieb_sound_r1_device
114{
115public:
116   // construction/destruction
117   gottlieb_sound_r1_with_votrax_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
118
119protected:
120   // device-level overrides
121   virtual machine_config_constructor device_mconfig_additions() const;
122   virtual ioport_constructor device_input_ports() const;
123};
124
125
126// ======================> gottlieb_sound_r2_device
127
128// fully populated rev 2 sound board
129class gottlieb_sound_r2_device :    public device_t,
130                           public device_mixer_interface
131{
132public:
133   // construction/destruction
134   gottlieb_sound_r2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
135
136   // static configuration helpers
137   static void static_enable_cobram3_mods(device_t &device);
138
139   // read/write
140   DECLARE_WRITE8_MEMBER( write );
141
142   // internal communications
143   DECLARE_READ8_MEMBER( speech_data_r );
144   DECLARE_READ8_MEMBER( audio_data_r );
145   DECLARE_WRITE8_MEMBER( signal_audio_nmi_w );
146   DECLARE_WRITE8_MEMBER( nmi_rate_w );
147   CUSTOM_INPUT_MEMBER( speech_drq_custom_r );
148   DECLARE_WRITE8_MEMBER( dac_w );
149   DECLARE_WRITE8_MEMBER( speech_control_w );
150   DECLARE_WRITE8_MEMBER( sp0250_latch_w );
151   DECLARE_WRITE8_MEMBER( psg_latch_w );
152
153protected:
154   // device-level overrides
155   virtual machine_config_constructor device_mconfig_additions() const;
156   virtual ioport_constructor device_input_ports() const;
157   virtual void device_start();
158   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
159
160private:
161   // internal helpers
162   void nmi_timer_adjust();
163   void nmi_state_update();
164
165   // timer IDs
166   enum
167   {
168      TID_NMI_GENERATE,
169      TID_NMI_CLEAR,
170      TID_SOUND_LATCH_WRITE
171   };
172
173   // devices
174   required_device<m6502_device>   m_audiocpu;
175   required_device<m6502_device>   m_speechcpu;
176   required_device<dac_device>     m_dac;
177   required_device<ay8913_device>  m_ay1;
178   required_device<ay8913_device>  m_ay2;
179   optional_device<sp0250_device>  m_sp0250;
180
181   // internal state
182   bool        m_cobram3_mod;
183   emu_timer * m_nmi_timer;
184   UINT8       m_nmi_rate;
185   UINT8       m_nmi_state;
186   UINT8       m_audiocpu_latch;
187   UINT8       m_speechcpu_latch;
188   UINT8       m_speech_control;
189   UINT8       m_last_command;
190   UINT8       m_dac_data[2];
191   UINT8       m_psg_latch;
192   UINT8       m_psg_data_latch;
193   UINT8       m_sp0250_latch;
194};
195
196
19725// ======================> gottlieb_state
19826
19927// shared driver state
r32635r32636
311139protected:
312140   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
313141};
314
315/*----------- defined in audio/gottlieb.c -----------*/
316
317MACHINE_CONFIG_EXTERN( qbert_knocker );
318
319#if USE_FAKE_VOTRAX
320MACHINE_CONFIG_EXTERN( reactor_samples );
321MACHINE_CONFIG_EXTERN( qbert_samples );
322#endif
trunk/src/mame/video/gottlieb.c
r32635r32636
44
55***************************************************************************/
66
7#include "emu.h"
87#include "includes/gottlieb.h"
98#include "video/resnet.h"
109
trunk/src/mame/drivers/gottlieb.c
r32635r32636
194194
195195***************************************************************************/
196196
197#include "emu.h"
198#include "machine/6532riot.h"
199#include "sound/ay8910.h"
200#include "sound/dac.h"
201#include "sound/samples.h"
197#include "includes/gottlieb.h"
202198#include "machine/nvram.h"
203#include "includes/gottlieb.h"
204199
205200
206201#define LOG_AUDIO_DECODE    (0)
r32635r32636
642637
643638
644639
640
641//**************************************************************************
642//  QBERT MECHANICAL KNOCKER
643//**************************************************************************
644
645//-------------------------------------------------
646//  qbert cabinets have a mechanical knocker near the floor,
647//  MAME simulates this with a sample.
648//  (like all MAME samples, it is optional. If you actually have
649//   a real kicker/knocker, hook it up via output "knocker0")
650//-------------------------------------------------
651
652void gottlieb_state::qbert_knocker(UINT8 knock)
653{
654   output_set_value("knocker0", knock);
655
656   // start sound on rising edge
657   if (knock & ~m_knocker_prev)
658      m_knocker_sample->start(0, 0);
659   m_knocker_prev = knock;
660}
661
662static const char *const qbert_knocker_names[] =
663{
664   "*qbert",
665   "knocker",
666   0   /* end of array */
667};
668
669MACHINE_CONFIG_FRAGMENT( qbert_knocker )
670   MCFG_SPEAKER_ADD("knocker", 0.0, 0.0, 1.0)
671
672   MCFG_SOUND_ADD("knocker_sam", SAMPLES, 0)
673   MCFG_SAMPLES_CHANNELS(1)
674   MCFG_SAMPLES_NAMES(qbert_knocker_names)
675   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "knocker", 1.0)
676MACHINE_CONFIG_END
677
678
679
645680/*************************************
646681*
647682*  Interrupt generation
trunk/src/mame/audio/gottlieb.c
r32635r32636
22// copyright-holders:Aaron Giles
33/***************************************************************************
44
5    gottlieb.h
5    gottlieb.c
66
77    Gottlieb 6502-based sound hardware implementations.
88
r32635r32636
1010
1111***************************************************************************/
1212
13#include "emu.h"
14#include "includes/gottlieb.h"
13#include "audio/gottlieb.h"
1514
1615
1716#define SOUND1_CLOCK        XTAL_3_579545MHz
r32635r32636
247246#endif
248247
249248
250
251249//**************************************************************************
252//  QBERT MECHANICAL KNOCKER
253//**************************************************************************
254
255//-------------------------------------------------
256//  qbert cabinets have a mechanical knocker near the floor,
257//  MAME simulates this with a sample.
258//  (like all MAME samples, it is optional. If you actually have
259//   a real kicker/knocker, hook it up via output "knocker0")
260//-------------------------------------------------
261
262void gottlieb_state::qbert_knocker(UINT8 knock)
263{
264   output_set_value("knocker0", knock);
265
266   // start sound on rising edge
267   if (knock & ~m_knocker_prev)
268      m_knocker_sample->start(0, 0);
269   m_knocker_prev = knock;
270}
271
272static const char *const qbert_knocker_names[] =
273{
274   "*qbert",
275   "knocker",
276   0   /* end of array */
277};
278
279MACHINE_CONFIG_FRAGMENT( qbert_knocker )
280   MCFG_SPEAKER_ADD("knocker", 0.0, 0.0, 1.0)
281
282   MCFG_SOUND_ADD("knocker_sam", SAMPLES, 0)
283   MCFG_SAMPLES_CHANNELS(1)
284   MCFG_SAMPLES_NAMES(qbert_knocker_names)
285   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "knocker", 1.0)
286MACHINE_CONFIG_END
287
288
289
290//**************************************************************************
291250//  REV 1 SOUND BOARD: 6502 + DAC
292251//**************************************************************************
293252
trunk/src/mame/audio/gottlieb.h
r0r32636
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
3/***************************************************************************
4
5    Gottlieb hardware
6
7***************************************************************************/
8
9#include "emu.h"
10#include "cpu/m6502/m6502.h"
11#include "machine/6532riot.h"
12#include "sound/dac.h"
13#include "sound/ay8910.h"
14#include "sound/sp0250.h"
15#include "sound/votrax.h"
16
17
18// set to 0 to enable Votrax device and disable samples
19#define USE_FAKE_VOTRAX         (1)
20
21
22
23//**************************************************************************
24//  GLOBAL VARIABLES
25//**************************************************************************
26
27extern const device_type GOTTLIEB_SOUND_REV1;
28extern const device_type GOTTLIEB_SOUND_REV1_WITH_VOTRAX;
29extern const device_type GOTTLIEB_SOUND_REV2;
30
31
32
33//**************************************************************************
34//  DEVICE CONFIGURATION MACROS
35//**************************************************************************
36
37#define MCFG_GOTTLIEB_SOUND_R1_ADD(_tag) \
38   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1, 0)
39#define MCFG_GOTTLIEB_SOUND_R1_ADD_VOTRAX(_tag) \
40   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV1_WITH_VOTRAX, 0)
41
42#define MCFG_GOTTLIEB_SOUND_R2_ADD(_tag) \
43   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0)
44#define MCFG_GOTTLIEB_SOUND_R2_ADD_COBRAM3(_tag) \
45   MCFG_DEVICE_ADD(_tag, GOTTLIEB_SOUND_REV2, 0) \
46   gottlieb_sound_r2_device::static_enable_cobram3_mods(*device);
47
48
49//**************************************************************************
50//  TYPE DEFINITIONS
51//**************************************************************************
52
53// ======================> gottlieb_sound_r1_device
54
55// rev 1 sound board, with unpopulated VOTRAX
56class gottlieb_sound_r1_device : public device_t, public device_mixer_interface
57{
58public:
59   // construction/destruction
60   gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
61   gottlieb_sound_r1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock, bool populate_votrax);
62
63   // read/write
64   DECLARE_WRITE8_MEMBER( write );
65
66   // internal communications
67   DECLARE_WRITE_LINE_MEMBER( snd_interrupt );
68   DECLARE_WRITE8_MEMBER( r6532_portb_w );
69   DECLARE_WRITE8_MEMBER( votrax_data_w );
70   DECLARE_WRITE8_MEMBER( speech_clock_dac_w );
71   DECLARE_WRITE_LINE_MEMBER( votrax_request );
72
73protected:
74   // device-level overrides
75   virtual machine_config_constructor device_mconfig_additions() const;
76   virtual ioport_constructor device_input_ports() const;
77   virtual void device_start();
78
79private:
80   // devices
81   required_device<m6502_device>       m_audiocpu;
82   required_device<riot6532_device>    m_riot;
83   required_device<dac_device>         m_dac;
84   optional_device<votrax_sc01_device> m_votrax;
85
86   // internal state
87   //bool            m_populate_votrax;
88   UINT8           m_last_speech_clock;
89
90#if USE_FAKE_VOTRAX
91protected:
92   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
93private:
94   void fake_votrax_data_w(UINT8 data);
95   void trigger_sample(UINT8 data);
96   optional_device<samples_device> m_samples;
97   UINT8 m_score_sample;
98   UINT8 m_random_offset;
99   UINT8 m_votrax_queue[100];
100   UINT8 m_votrax_queuepos;
101#endif
102};
103
104// fully populated rev 1 sound board
105class gottlieb_sound_r1_with_votrax_device : public gottlieb_sound_r1_device
106{
107public:
108   // construction/destruction
109   gottlieb_sound_r1_with_votrax_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
110
111protected:
112   // device-level overrides
113   virtual machine_config_constructor device_mconfig_additions() const;
114   virtual ioport_constructor device_input_ports() const;
115};
116
117
118// ======================> gottlieb_sound_r2_device
119
120// fully populated rev 2 sound board
121class gottlieb_sound_r2_device : public device_t, public device_mixer_interface
122{
123public:
124   // construction/destruction
125   gottlieb_sound_r2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
126
127   // static configuration helpers
128   static void static_enable_cobram3_mods(device_t &device);
129
130   // read/write
131   DECLARE_WRITE8_MEMBER( write );
132
133   // internal communications
134   DECLARE_READ8_MEMBER( speech_data_r );
135   DECLARE_READ8_MEMBER( audio_data_r );
136   DECLARE_WRITE8_MEMBER( signal_audio_nmi_w );
137   DECLARE_WRITE8_MEMBER( nmi_rate_w );
138   CUSTOM_INPUT_MEMBER( speech_drq_custom_r );
139   DECLARE_WRITE8_MEMBER( dac_w );
140   DECLARE_WRITE8_MEMBER( speech_control_w );
141   DECLARE_WRITE8_MEMBER( sp0250_latch_w );
142   DECLARE_WRITE8_MEMBER( psg_latch_w );
143
144protected:
145   // device-level overrides
146   virtual machine_config_constructor device_mconfig_additions() const;
147   virtual ioport_constructor device_input_ports() const;
148   virtual void device_start();
149   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
150
151private:
152   // internal helpers
153   void nmi_timer_adjust();
154   void nmi_state_update();
155
156   // timer IDs
157   enum
158   {
159      TID_NMI_GENERATE,
160      TID_NMI_CLEAR,
161      TID_SOUND_LATCH_WRITE
162   };
163
164   // devices
165   required_device<m6502_device>   m_audiocpu;
166   required_device<m6502_device>   m_speechcpu;
167   required_device<dac_device>     m_dac;
168   required_device<ay8913_device>  m_ay1;
169   required_device<ay8913_device>  m_ay2;
170   optional_device<sp0250_device>  m_sp0250;
171
172   // internal state
173   bool        m_cobram3_mod;
174   emu_timer * m_nmi_timer;
175   UINT8       m_nmi_rate;
176   UINT8       m_nmi_state;
177   UINT8       m_audiocpu_latch;
178   UINT8       m_speechcpu_latch;
179   UINT8       m_speech_control;
180   UINT8       m_last_command;
181   UINT8       m_dac_data[2];
182   UINT8       m_psg_latch;
183   UINT8       m_psg_data_latch;
184   UINT8       m_sp0250_latch;
185};
186
187
188/*----------- defined in audio/gottlieb.c -----------*/
189
190#if USE_FAKE_VOTRAX
191MACHINE_CONFIG_EXTERN( reactor_samples );
192MACHINE_CONFIG_EXTERN( qbert_samples );
193#endif
Property changes on: trunk/src/mame/audio/gottlieb.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain

Previous 199869 Revisions Next


© 1997-2024 The MAME Team