~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Emmanuel Kasper, Félix Arreola Rodríguez, Jordi Mallach
  • Date: 2011-05-11 21:06:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110511210650-jizvh8a6x117y9hr
Tags: 0.142-1
[ Emmanuel Kasper ]
* New upstream release
* Set NOWERROR=1 to allow compiling with gcc-4.6
* Remove fix_powerpc_build.patch, as upstream has taken it in this release
* Add gnome-video-arcade front end as a suggested package

[ Félix Arreola Rodríguez ]
* Add kfreebsd-build.patch to quilt series, to fix build on kfreebsd

[ Jordi Mallach ]
* Remove unneeded and bogus addition of --with-quilt to the dh invocation.
* Add Cesare Falco (long time Ubuntu maintainer) to Uploaders, and wrap
  them into multiple lines.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "emu.h"
2
2
#include "sound/es5506.h"
3
 
#include "includes/taito_f3.h"
4
3
#include "taito_en.h"
5
4
 
6
5
static int counter,vector_reg,imr_status;
8
7
static UINT32   es5510_gpr[0xc0];
9
8
static UINT32   es5510_gpr_latch;
10
9
static int timer_mode,m68681_imr;
 
10
static UINT32 *f3_shared_ram;
11
11
 
12
12
//static int es_tmp=1;
13
13
 
20
20
 
21
21
static READ16_HANDLER(f3_68000_share_r)
22
22
{
23
 
        if ((offset&3)==0) return (f3_shared_ram[offset/4]&0xff000000)>>16;
24
 
        if ((offset&3)==1) return (f3_shared_ram[offset/4]&0x00ff0000)>>8;
25
 
        if ((offset&3)==2) return (f3_shared_ram[offset/4]&0x0000ff00)>>0;
26
 
        return (f3_shared_ram[offset/4]&0x000000ff)<<8;
 
23
        switch (offset & 3)
 
24
        {
 
25
        case 0: return (f3_shared_ram[offset/4]&0xff000000)>>16;
 
26
        case 1: return (f3_shared_ram[offset/4]&0x00ff0000)>>8;
 
27
        case 2: return (f3_shared_ram[offset/4]&0x0000ff00)>>0;
 
28
        case 3: return (f3_shared_ram[offset/4]&0x000000ff)<<8;
 
29
        }
 
30
 
 
31
        return 0;
27
32
}
28
33
 
29
34
static WRITE16_HANDLER(f3_68000_share_w)
30
35
{
31
 
        if ((offset&3)==0) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0x00ffffff)|((data&0xff00)<<16);
32
 
        else if ((offset&3)==1) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xff00ffff)|((data&0xff00)<<8);
33
 
        else if ((offset&3)==2) f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xffff00ff)|((data&0xff00)<<0);
34
 
        else f3_shared_ram[offset/4]=(f3_shared_ram[offset/4]&0xffffff00)|((data&0xff00)>>8);
 
36
        switch (offset & 3)
 
37
        {
 
38
        case 0: f3_shared_ram[offset/4] = (f3_shared_ram[offset/4]&0x00ffffff)|((data&0xff00)<<16);
 
39
        case 1: f3_shared_ram[offset/4] = (f3_shared_ram[offset/4]&0xff00ffff)|((data&0xff00)<<8);
 
40
        case 2: f3_shared_ram[offset/4] = (f3_shared_ram[offset/4]&0xffff00ff)|((data&0xff00)<<0);
 
41
        case 3: f3_shared_ram[offset/4] = (f3_shared_ram[offset/4]&0xffffff00)|((data&0xff00)>>8);
 
42
        }
35
43
}
36
44
 
37
45
static WRITE16_HANDLER( f3_es5505_bank_w )
38
46
{
39
 
        UINT32 max_banks_this_game=(space->machine->region("ensoniq.0")->bytes()/0x200000)-1;
 
47
        UINT32 max_banks_this_game=(space->machine().region("ensoniq.0")->bytes()/0x200000)-1;
40
48
 
41
49
#if 0
42
50
{
48
56
 
49
57
        /* mask out unused bits */
50
58
        data &= max_banks_this_game;
51
 
        es5505_voice_bank_w(space->machine->device("ensoniq"),offset,data<<20);
 
59
        es5505_voice_bank_w(space->machine().device("ensoniq"),offset,data<<20);
52
60
}
53
61
 
54
62
static WRITE16_HANDLER( f3_volume_w )
74
82
        /* Only cause IRQ if the mask is set to allow it */
75
83
        if (m68681_imr & 0x08)
76
84
        {
77
 
                cpu_set_input_line_vector(timer.machine->device("audiocpu"), 6, vector_reg);
78
 
                cputag_set_input_line(timer.machine, "audiocpu", 6, ASSERT_LINE);
 
85
                device_set_input_line_vector(timer.machine().device("audiocpu"), 6, vector_reg);
 
86
                cputag_set_input_line(timer.machine(), "audiocpu", 6, ASSERT_LINE);
79
87
                imr_status |= 0x08;
80
88
        }
81
89
}
95
103
        /* IRQ ack */
96
104
        if (offset == 0x0f)
97
105
        {
98
 
                cputag_set_input_line(space->machine, "audiocpu", 6, CLEAR_LINE);
 
106
                cputag_set_input_line(space->machine(), "audiocpu", 6, CLEAR_LINE);
99
107
                return 0;
100
108
        }
101
109
 
120
128
                                case 3:
121
129
                                        logerror("Counter:  X1/Clk - divided by 16, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter*16);
122
130
                                        timer_mode=TIMER_SINGLESHOT;
123
 
                                        timer = space->machine->device<timer_device>("timer_68681");
124
 
                                        timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter*16));
 
131
                                        timer = space->machine().device<timer_device>("timer_68681");
 
132
                                        timer->adjust(downcast<cpu_device *>(&space->device())->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter*16));
125
133
                                        break;
126
134
                                case 4:
127
135
                                        logerror("Timer:  Unimplemented external IP2\n");
132
140
                                case 6:
133
141
                                        logerror("Timer:  X1/Clk, counter is %04x, so interrupt every %d cycles\n",counter,(M68000_CLOCK/M68681_CLOCK)*counter);
134
142
                                        timer_mode=TIMER_PULSE;
135
 
                                        timer = space->machine->device<timer_device>("timer_68681");
136
 
                                        timer->adjust(downcast<cpu_device *>(space->cpu)->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter), 0, downcast<cpu_device *>(space->cpu)->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter));
 
143
                                        timer = space->machine().device<timer_device>("timer_68681");
 
144
                                        timer->adjust(downcast<cpu_device *>(&space->device())->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter), 0, downcast<cpu_device *>(&space->device())->cycles_to_attotime((M68000_CLOCK/M68681_CLOCK)*counter));
137
145
                                        break;
138
146
                                case 7:
139
147
                                        logerror("Timer:  Unimplemented X1/Clk - divided by 16\n");
167
175
 
168
176
static READ16_HANDLER(es5510_dsp_r)
169
177
{
170
 
//  logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(space->cpu),offset,es5510_dsp_ram[offset]);
 
178
//  logerror("%06x: DSP read offset %04x (data is %04x)\n",cpu_get_pc(&space->device()),offset,es5510_dsp_ram[offset]);
171
179
//  if (es_tmp) return es5510_dsp_ram[offset];
172
180
/*
173
181
    switch (offset) {
179
187
*/
180
188
//  offset<<=1;
181
189
 
182
 
//if (offset<7 && es5510_dsp_ram[0]!=0xff) return space->machine->rand()%0xffff;
 
190
//if (offset<7 && es5510_dsp_ram[0]!=0xff) return space->machine().rand()%0xffff;
183
191
 
184
192
        if (offset==0x12) return 0;
185
193
 
191
199
 
192
200
static WRITE16_HANDLER(es5510_dsp_w)
193
201
{
194
 
        UINT8 *snd_mem = (UINT8 *)space->machine->region("ensoniq.0")->base();
 
202
        UINT8 *snd_mem = (UINT8 *)space->machine().region("ensoniq.0")->base();
195
203
 
196
204
//  if (offset>4 && offset!=0x80  && offset!=0xa0  && offset!=0xc0  && offset!=0xe0)
197
 
//      logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(space->cpu),offset,data);
 
205
//      logerror("%06x: DSP write offset %04x %04x\n",cpu_get_pc(&space->device()),offset,data);
198
206
 
199
207
        COMBINE_DATA(&es5510_dsp_ram[offset]);
200
208
 
232
240
 
233
241
static UINT16 *sound_ram;
234
242
 
235
 
static ADDRESS_MAP_START( f3_sound_map, ADDRESS_SPACE_PROGRAM, 16 )
 
243
static ADDRESS_MAP_START( f3_sound_map, AS_PROGRAM, 16 )
236
244
        AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_MIRROR(0x30000) AM_SHARE("share1") AM_BASE(&sound_ram)
237
245
        AM_RANGE(0x140000, 0x140fff) AM_READWRITE(f3_68000_share_r, f3_68000_share_w)
238
246
        AM_RANGE(0x200000, 0x20001f) AM_DEVREADWRITE("ensoniq", es5505_r, es5505_w)
249
257
SOUND_RESET( taito_f3_soundsystem_reset )
250
258
{
251
259
        /* Sound cpu program loads to 0xc00000 so we use a bank */
252
 
        UINT16 *ROM = (UINT16 *)machine->region("audiocpu")->base();
 
260
        UINT16 *ROM = (UINT16 *)machine.region("audiocpu")->base();
253
261
        memory_set_bankptr(machine, "bank1",&ROM[0x80000]);
254
262
        memory_set_bankptr(machine, "bank2",&ROM[0x90000]);
255
263
        memory_set_bankptr(machine, "bank3",&ROM[0xa0000]);
260
268
        sound_ram[3]=ROM[0x80003];
261
269
 
262
270
        /* reset CPU to catch any banking of startup vectors */
263
 
        machine->device("audiocpu")->reset();
 
271
        machine.device("audiocpu")->reset();
264
272
        //cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
 
273
 
 
274
        f3_shared_ram = (UINT32 *)memory_get_shared(machine, "f3_shared");
265
275
}
266
276
 
267
277
static const es5505_interface es5505_taito_f3_config =