~ubuntu-branches/ubuntu/precise/mame/precise-proposed

« back to all changes in this revision

Viewing changes to src/mame/audio/taito_en.c

  • Committer: Package Import Robot
  • Author(s): Cesare Falco
  • Date: 2011-11-30 18:50:10 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111130185010-02hcxybht1mn082w
Tags: 0.144-0ubuntu1
* New upstream release (LP: #913550)
* mame.install:
  - Added artwork/ images to be used with -effect switch
  - Be more selective with hash/ contents
* contrib/mame.ini: added /usr/share/games/mame/artwork/ to artpath

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include "taito_en.h"
4
4
 
5
5
static int counter,vector_reg,imr_status;
6
 
static UINT16 es5510_dsp_ram[0x200];
 
6
static UINT16   es5510_dsp_ram[0x200];
7
7
static UINT32   es5510_gpr[0xc0];
 
8
static UINT32   es5510_dram[1<<24];
 
9
static UINT32   es5510_dol_latch;
 
10
static UINT32   es5510_dil_latch;
 
11
static UINT32   es5510_dadr_latch;
8
12
static UINT32   es5510_gpr_latch;
 
13
static UINT8    es5510_ram_sel;
9
14
static int timer_mode,m68681_imr;
10
 
static UINT32 *f3_shared_ram;
 
15
static UINT32   *f3_shared_ram;
11
16
 
12
17
//static int es_tmp=1;
13
18
 
59
64
        es5505_voice_bank_w(space->machine().device("ensoniq"),offset,data<<20);
60
65
}
61
66
 
62
 
static WRITE16_HANDLER( f3_volume_w )
 
67
static WRITE8_HANDLER( f3_volume_w )
63
68
{
64
 
//  static UINT16 channel[8],last_l,last_r;
65
 
//  static int latch;
66
 
 
67
 
//  if (offset==0) latch=(data>>8)&0x7;
68
 
//  if (offset==1) channel[latch]=data>>8;
69
 
 
70
 
//      if (channel[7]!=last_l) mixer_set_volume(0, (int)((float)channel[7]*1.58)); /* Left master volume */
71
 
//      if (channel[6]!=last_r) mixer_set_volume(1, (int)((float)channel[6]*1.58)); /* Right master volume */
72
 
//  last_l=channel[7];
73
 
//  last_r=channel[6];
 
69
        static UINT8 latch,ch[8];
 
70
 
 
71
        if(offset == 0)
 
72
                latch = data & 0x7;
 
73
        else
 
74
        {
 
75
                ch[latch] = data;
 
76
                if((latch & 6) == 6)
 
77
                {
 
78
                        double ch_vol;
 
79
 
 
80
                        ch_vol = (double)(ch[latch] & 0x3f);
 
81
                        ch_vol/= 63.0;
 
82
                        ch_vol*= 100.0;
 
83
                        /* Left/Right panning trusted with Arabian Magic Sound Test menu. */
 
84
                        es5505_set_channel_volume(space->machine().device("ensoniq"),(latch & 1) ^ 1,ch_vol);
 
85
                }
 
86
        }
 
87
 
 
88
        //popmessage("%02x %02x %02x %02x %02x %02x %02x %02x",ch[0],ch[1],ch[2],ch[3],ch[4],ch[5],ch[6],ch[7]);
74
89
 
75
90
        /* Channel 5 - Left Aux?  Always set to volume, but never used for panning */
76
91
        /* Channel 4 - Right Aux?  Always set to volume, but never used for panning */
77
92
        /* Channels 0, 1, 2, 3 - Unused */
 
93
 
78
94
}
79
95
 
80
96
static TIMER_DEVICE_CALLBACK( taito_en_timer_callback )
189
205
 
190
206
//if (offset<7 && es5510_dsp_ram[0]!=0xff) return space->machine().rand()%0xffff;
191
207
 
 
208
        switch(offset)
 
209
        {
 
210
                case 0x09: return (es5510_dil_latch >> 16) & 0xff;
 
211
                case 0x0a: return (es5510_dil_latch >> 8) & 0xff;
 
212
                case 0x0b: return (es5510_dil_latch >> 0) & 0xff; //TODO: docs says that this always returns 0
 
213
        }
 
214
 
192
215
        if (offset==0x12) return 0;
193
216
 
194
217
//  if (offset>4)
207
230
        COMBINE_DATA(&es5510_dsp_ram[offset]);
208
231
 
209
232
        switch (offset) {
210
 
                case 0x00: es5510_gpr_latch=(es5510_gpr_latch&0x00ffff)|((data&0xff)<<16);
211
 
                case 0x01: es5510_gpr_latch=(es5510_gpr_latch&0xff00ff)|((data&0xff)<< 8);
212
 
                case 0x02: es5510_gpr_latch=(es5510_gpr_latch&0xffff00)|((data&0xff)<< 0);
213
 
                case 0x03: break;
 
233
                case 0x00: es5510_gpr_latch=(es5510_gpr_latch&0x00ffff)|((data&0xff)<<16); break;
 
234
                case 0x01: es5510_gpr_latch=(es5510_gpr_latch&0xff00ff)|((data&0xff)<< 8); break;
 
235
                case 0x02: es5510_gpr_latch=(es5510_gpr_latch&0xffff00)|((data&0xff)<< 0); break;
 
236
 
 
237
                /* 0x03 to 0x08 INSTR Register */
 
238
                /* 0x09 to 0x0b DIL Register (r/o) */
 
239
 
 
240
                case 0x0c: es5510_dol_latch=(es5510_dol_latch&0x00ffff)|((data&0xff)<<16); break;
 
241
                case 0x0d: es5510_dol_latch=(es5510_dol_latch&0xff00ff)|((data&0xff)<< 8); break;
 
242
                case 0x0e: es5510_dol_latch=(es5510_dol_latch&0xffff00)|((data&0xff)<< 0); break; //TODO: docs says that this always returns 0xff
 
243
 
 
244
                case 0x0f:
 
245
                        es5510_dadr_latch=(es5510_dadr_latch&0x00ffff)|((data&0xff)<<16);
 
246
                        if(es5510_ram_sel)
 
247
                                es5510_dil_latch = es5510_dram[es5510_dadr_latch];
 
248
                        else
 
249
                                es5510_dram[es5510_dadr_latch] = es5510_dol_latch;
 
250
                        break;
 
251
 
 
252
                case 0x10: es5510_dadr_latch=(es5510_dadr_latch&0xff00ff)|((data&0xff)<< 8); break;
 
253
                case 0x11: es5510_dadr_latch=(es5510_dadr_latch&0xffff00)|((data&0xff)<< 0); break;
 
254
 
 
255
                /* 0x12 Host Control */
 
256
 
 
257
                case 0x14: es5510_ram_sel = data & 0x80; /* bit 6 is i/o select, everything else is undefined */break;
 
258
 
 
259
                /* 0x16 Program Counter (test purpose, r/o?) */
 
260
                /* 0x17 Internal Refresh counter (test purpose) */
 
261
                /* 0x18 Host Serial Control */
 
262
                /* 0x1f Halt enable (w) / Frame Counter (r) */
214
263
 
215
264
                case 0x80: /* Read select - GPR + INSTR */
216
265
        //      logerror("ES5510:  Read GPR/INSTR %06x (%06x)\n",data,es5510_gpr[data]);
245
294
        AM_RANGE(0x260000, 0x2601ff) AM_READWRITE(es5510_dsp_r, es5510_dsp_w)
246
295
        AM_RANGE(0x280000, 0x28001f) AM_READWRITE(f3_68681_r, f3_68681_w)
247
296
        AM_RANGE(0x300000, 0x30003f) AM_WRITE(f3_es5505_bank_w)
248
 
        AM_RANGE(0x340000, 0x340003) AM_WRITE(f3_volume_w) /* 8 channel volume control */
 
297
        AM_RANGE(0x340000, 0x340003) AM_WRITE8(f3_volume_w,0xff00) /* 8 channel volume control */
249
298
        AM_RANGE(0xc00000, 0xc1ffff) AM_ROMBANK("bank1")
250
299
        AM_RANGE(0xc20000, 0xc3ffff) AM_ROMBANK("bank2")
251
300
        AM_RANGE(0xc40000, 0xc7ffff) AM_ROMBANK("bank3")