Previous 199869 Revisions Next

r32534 Saturday 4th October, 2014 at 20:00:16 UTC by hap
small cleanup
[src/mame/audio]taito_en.c taito_en.h taito_zm.h

trunk/src/mame/audio/taito_zm.h
r32533r32534
1/***************************************************************************
2
3    Taito Zoom ZSG-2 sound board
4
5***************************************************************************/
6
17#include "cpu/mn10200/mn10200.h"
28#include "cpu/tms57002/tms57002.h"
39#include "sound/zsg2.h"
r32533r32534
2733   virtual void device_reset();
2834
2935private:
30
31   // devices/pointers
36   // inherited devices/pointers
3237   required_device<mn10200_device> m_soundcpu;
3338   required_device<zsg2_device> m_zsg2;
3439
trunk/src/mame/audio/taito_en.c
r32533r32534
1111****************************************************************************/
1212
1313#include "emu.h"
14#include "machine/mb87078.h"
1514#include "taito_en.h"
1615
1716
r32533r32534
1918
2019taito_en_device::taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2120   : device_t(mconfig, TAITO_EN, "Taito Ensoniq Sound System", tag, owner, clock, "taito_en", __FILE__),
21   m_audiocpu(*this, ":audiocpu"),
22   m_ensoniq(*this, ":ensoniq"),
23   m_duart68681(*this, ":duart68681"),
24   m_mb87078(*this, ":mb87078"),
25   m_snd_shared_ram(*this, ":snd_shared"),
2226   m_es5510_dol_latch(0),
2327   m_es5510_dil_latch(0),
2428   m_es5510_dadr_latch(0),
2529   m_es5510_gpr_latch(0),
26   m_es5510_ram_sel(0),
27   m_snd_shared_ram(NULL)
30   m_es5510_ram_sel(0)
2831{
2932}
3033
r32533r32534
4245   save_item(NAME(m_es5510_dadr_latch));
4346   save_item(NAME(m_es5510_gpr_latch));
4447   save_item(NAME(m_es5510_ram_sel));
45
46   m_duart68681 = machine().device<mc68681_device>("duart68681");
4748}
4849
4950//-------------------------------------------------
r32533r32534
5960   machine().root_device().membank("bank2")->set_base(&ROM[0x90000]);
6061   machine().root_device().membank("bank3")->set_base(&ROM[0xa0000]);
6162
62   sound_ram[0]=ROM[0x80000]; /* Stack and Reset vectors */
63   sound_ram[1]=ROM[0x80001];
64   sound_ram[2]=ROM[0x80002];
65   sound_ram[3]=ROM[0x80003];
63   sound_ram[0] = ROM[0x80000]; /* Stack and Reset vectors */
64   sound_ram[1] = ROM[0x80001];
65   sound_ram[2] = ROM[0x80002];
66   sound_ram[3] = ROM[0x80003];
6667
6768   /* reset CPU to catch any banking of startup vectors */
68   machine().device("audiocpu")->reset();
69   machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
70
71   m_snd_shared_ram = (UINT32 *)machine().root_device().memshare("snd_shared")->ptr();
69   m_audiocpu->reset();
70   m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
7271}
7372
7473
r32533r32534
7877 *
7978 *************************************/
8079
81READ16_MEMBER( taito_en_device::en_68000_share_r )
80READ8_MEMBER( taito_en_device::en_68000_share_r )
8281{
8382   switch (offset & 3)
8483   {
85      case 0: return (m_snd_shared_ram[offset/4]&0xff000000)>>16;
86      case 1: return (m_snd_shared_ram[offset/4]&0x00ff0000)>>8;
87      case 2: return (m_snd_shared_ram[offset/4]&0x0000ff00)>>0;
88      case 3: return (m_snd_shared_ram[offset/4]&0x000000ff)<<8;
84      case 0: return (m_snd_shared_ram[offset/4]&0xff000000)>>24;
85      case 1: return (m_snd_shared_ram[offset/4]&0x00ff0000)>>16;
86      case 2: return (m_snd_shared_ram[offset/4]&0x0000ff00)>>8;
87      case 3: return (m_snd_shared_ram[offset/4]&0x000000ff)>>0;
8988   }
9089
9190   return 0;
9291}
9392
94WRITE16_MEMBER( taito_en_device::en_68000_share_w )
93WRITE8_MEMBER( taito_en_device::en_68000_share_w )
9594{
9695   switch (offset & 3)
9796   {
98      case 0: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0x00ffffff)|((data&0xff00)<<16);
99      case 1: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xff00ffff)|((data&0xff00)<<8);
100      case 2: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xffff00ff)|((data&0xff00)<<0);
101      case 3: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xffffff00)|((data&0xff00)>>8);
97      case 0: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0x00ffffff)|(data<<24);
98      case 1: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xff00ffff)|(data<<16);
99      case 2: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xffff00ff)|(data<<8);
100      case 3: m_snd_shared_ram[offset/4] = (m_snd_shared_ram[offset/4]&0xffffff00)|(data<<0);
102101   }
103102}
104103
r32533r32534
106105{
107106   UINT32 max_banks_this_game = (space.machine().root_device().memregion("ensoniq.0")->bytes()/0x200000)-1;
108107
109#if 0
110{
111   static char count[10];
112   count[data&7]++;
113   popmessage("%x %x %x %x %x %x %x %x (%d)",count[0]&0xf,count[1]&0xf,count[2]&0xf,count[3]&0xf,count[4]&0xf,count[5]&0xf,count[6]&0xf,count[7]&0xf, max_banks_this_game);
114}
115#endif
116
117108   /* mask out unused bits */
118109   data &= max_banks_this_game;
119   space.machine().device<es5505_device>("ensoniq")->voice_bank_w(offset,data<<20);
110   m_ensoniq->voice_bank_w(offset,data<<20);
120111}
121112
122WRITE16_MEMBER( taito_en_device::en_volume_w )
113WRITE8_MEMBER( taito_en_device::en_volume_w )
123114{
124   if (ACCESSING_BITS_8_15)
125      space.machine().device<mb87078_device>("mb87078")->data_w(data >> 8, offset ^ 1);
115   m_mb87078->data_w(data, offset ^ 1);
126116}
127117
128118
r32533r32534
136126
137127READ16_MEMBER( taito_en_device::es5510_dsp_r )
138128{
139//  logerror("%06x: DSP read offset %04x (data is %04x)\n",space.device().safe_pc(),offset,m_es5510_dsp_ram[offset]);
140//  if (es_tmp) return m_es5510_dsp_ram[offset];
141/*
142    switch (offset) {
143        case 0x00: return (m_es5510_gpr_latch>>16)&0xff;
144        case 0x01: return (m_es5510_gpr_latch>> 8)&0xff;
145        case 0x02: return (m_es5510_gpr_latch>> 0)&0xff;
146        case 0x03: return 0;
147    }
148*/
149//  offset<<=1;
150
151//if (offset<7 && m_es5510_dsp_ram[0]!=0xff) return space.machine().rand()%0xffff;
152
153   switch(offset)
129   switch (offset)
154130   {
155131      case 0x09: return (m_es5510_dil_latch >> 16) & 0xff;
156132      case 0x0a: return (m_es5510_dil_latch >> 8) & 0xff;
157      case 0x0b: return (m_es5510_dil_latch >> 0) & 0xff; //TODO: docs says that this always returns 0
133      case 0x0b: return (m_es5510_dil_latch >> 0) & 0xff; // TODO: docs says that this always returns 0
134      default: break;
158135   }
159136
160137   if (offset==0x12) return 0;
r32533r32534
241218
242219static ADDRESS_MAP_START( en_sound_map, AS_PROGRAM, 16, driver_device )
243220   AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_MIRROR(0x30000) AM_SHARE("share1")
244   AM_RANGE(0x140000, 0x140fff) AM_DEVREADWRITE("taito_en", taito_en_device, en_68000_share_r, en_68000_share_w)
221   AM_RANGE(0x140000, 0x140fff) AM_DEVREADWRITE8("taito_en", taito_en_device, en_68000_share_r, en_68000_share_w, 0xff00)
245222   AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("ensoniq", es5505_device, read, write)
246223   AM_RANGE(0x260000, 0x2601ff) AM_DEVREADWRITE("taito_en", taito_en_device, es5510_dsp_r, es5510_dsp_w) //todo: hook up cpu/es5510
247224   AM_RANGE(0x280000, 0x28001f) AM_DEVREADWRITE8("duart68681", mc68681_device, read, write, 0x00ff)
248225   AM_RANGE(0x300000, 0x30003f) AM_DEVWRITE("taito_en", taito_en_device, en_es5505_bank_w)
249   AM_RANGE(0x340000, 0x340003) AM_DEVWRITE("taito_en", taito_en_device, en_volume_w)
226   AM_RANGE(0x340000, 0x340003) AM_DEVWRITE8("taito_en", taito_en_device, en_volume_w, 0xff00)
250227   AM_RANGE(0xc00000, 0xc1ffff) AM_ROMBANK("bank1")
251228   AM_RANGE(0xc20000, 0xc3ffff) AM_ROMBANK("bank2")
252229   AM_RANGE(0xc40000, 0xc7ffff) AM_ROMBANK("bank3")
253230   AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("share1")  // mirror
254231ADDRESS_MAP_END
255232
233
256234/*************************************
257235 *
258236 *  MB87078 callback
r32533r32534
263241{
264242   if (offset > 1)
265243   {
266      machine().device<es5505_device>("ensoniq")->set_output_gain(offset & 1, data / 100.0);
244      m_ensoniq->set_output_gain(offset & 1, data / 100.0);
267245   }
268246}
269247
r32533r32534
274252 *
275253 *************************************/
276254
277
278255WRITE_LINE_MEMBER(taito_en_device::duart_irq_handler)
279256{
280257   if (state == ASSERT_LINE)
281258   {
282      machine().device("audiocpu")->execute().set_input_line_vector(M68K_IRQ_6, m_duart68681->get_irq_vector());
283      machine().device("audiocpu")->execute().set_input_line(M68K_IRQ_6, ASSERT_LINE);
259      m_audiocpu->set_input_line_vector(M68K_IRQ_6, m_duart68681->get_irq_vector());
260      m_audiocpu->set_input_line(M68K_IRQ_6, ASSERT_LINE);
284261   }
285262   else
286263   {
287      machine().device("audiocpu")->execute().set_input_line(M68K_IRQ_6, CLEAR_LINE);
264      m_audiocpu->set_input_line(M68K_IRQ_6, CLEAR_LINE);
288265   }
289266}
290267
r32533r32534
314291 *************************************/
315292
316293MACHINE_CONFIG_FRAGMENT( taito_en_sound )
294
295   /* basic machine hardware */
317296   MCFG_TAITO_EN_ADD("taito_en")
318297   MCFG_CPU_ADD("audiocpu", M68000, XTAL_30_4761MHz / 2)
319298   MCFG_CPU_PROGRAM_MAP(en_sound_map)
r32533r32534
325304   MCFG_DEVICE_ADD("mb87078", MB87078, 0)
326305   MCFG_MB87078_GAIN_CHANGED_CB(DEVWRITE8("taito_en", taito_en_device, mb87078_gain_changed))
327306
307   /* sound hardware */
328308   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
329309   MCFG_SOUND_ADD("ensoniq", ES5505, XTAL_30_4761MHz / 2)
330310   MCFG_ES5505_REGION0("ensoniq.0")
331311   MCFG_ES5505_REGION1("ensoniq.0")
332   MCFG_ES5506_CHANNELS(1)               /* channels */
312   MCFG_ES5506_CHANNELS(1)
333313   MCFG_SOUND_ROUTE(0, "lspeaker", 0.08)
334314   MCFG_SOUND_ROUTE(1, "rspeaker", 0.08)
335315MACHINE_CONFIG_END
trunk/src/mame/audio/taito_en.h
r32533r32534
1/***************************************************************************
2
3    Taito Ensoniq ES5505-based sound hardware
4
5****************************************************************************/
6
17#include "cpu/m68000/m68000.h"
28#include "sound/es5506.h"
39#include "machine/mc68681.h"
10#include "machine/mb87078.h"
411
512class taito_en_device : public device_t
613
r32533r32534
916   taito_en_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
1017   ~taito_en_device() {}
1118
12   DECLARE_READ16_MEMBER( en_68000_share_r );
13   DECLARE_WRITE16_MEMBER( en_68000_share_w );
19   DECLARE_READ8_MEMBER( en_68000_share_r );
20   DECLARE_WRITE8_MEMBER( en_68000_share_w );
1421   DECLARE_WRITE16_MEMBER( en_es5505_bank_w );
15   DECLARE_WRITE16_MEMBER( en_volume_w );
22   DECLARE_WRITE8_MEMBER( en_volume_w );
1623
1724   //todo: hook up cpu/es5510
1825   DECLARE_READ16_MEMBER( es5510_dsp_r );
r32533r32534
2835   virtual void device_reset();
2936
3037private:
31   // internal state
38   // inherited devices/pointers
39   required_device<cpu_device> m_audiocpu;
40   required_device<es5505_device> m_ensoniq;
41   required_device<mc68681_device> m_duart68681;
42   required_device<mb87078_device> m_mb87078;
43   required_shared_ptr<UINT32> m_snd_shared_ram;
3244
3345   //todo: hook up cpu/es5510
3446   UINT16   m_es5510_dsp_ram[0x200];
r32533r32534
3951   UINT32   m_es5510_dadr_latch;
4052   UINT32   m_es5510_gpr_latch;
4153   UINT8    m_es5510_ram_sel;
42
43   UINT32   *m_snd_shared_ram;
44
45   mc68681_device *m_duart68681;
46
4754};
4855
4956extern const device_type TAITO_EN;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team