~ubuntu-branches/debian/wheezy/mame/wheezy

« back to all changes in this revision

Viewing changes to src/mame/drivers/fantland.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:
61
61
 
62
62
static WRITE8_HANDLER( fantland_nmi_enable_w )
63
63
{
64
 
        fantland_state *state = space->machine->driver_data<fantland_state>();
65
 
        state->nmi_enable = data;
 
64
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
65
        state->m_nmi_enable = data;
66
66
 
67
 
        if ((state->nmi_enable != 0) && (state->nmi_enable != 8))
68
 
                logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(space->cpu), data);
 
67
        if ((state->m_nmi_enable != 0) && (state->m_nmi_enable != 8))
 
68
                logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space->device()), data);
69
69
}
70
70
 
71
71
static WRITE16_HANDLER( fantland_nmi_enable_16_w )
76
76
 
77
77
static WRITE8_HANDLER( fantland_soundlatch_w )
78
78
{
79
 
        fantland_state *state = space->machine->driver_data<fantland_state>();
 
79
        fantland_state *state = space->machine().driver_data<fantland_state>();
80
80
        soundlatch_w(space, 0, data);
81
 
        cpu_set_input_line(state->audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
 
81
        device_set_input_line(state->m_audio_cpu, INPUT_LINE_NMI, PULSE_LINE);
82
82
}
83
83
 
84
84
static WRITE16_HANDLER( fantland_soundlatch_16_w )
93
93
 
94
94
static READ16_HANDLER( spriteram_16_r )
95
95
{
96
 
        UINT8 *spriteram = space->machine->generic.spriteram.u8;
 
96
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
97
        UINT8 *spriteram = state->m_spriteram;
97
98
        return spriteram[2 * offset + 0] | (spriteram[2 * offset + 1] << 8);
98
99
}
99
100
 
100
101
static READ16_HANDLER( spriteram2_16_r )
101
102
{
102
 
        UINT8 *spriteram_2 = space->machine->generic.spriteram2.u8;
 
103
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
104
        UINT8 *spriteram_2 = state->m_spriteram2;
103
105
        return spriteram_2[2 * offset + 0] | (spriteram_2[2 * offset + 1] << 8);
104
106
}
105
107
 
106
108
static WRITE16_HANDLER( spriteram_16_w )
107
109
{
108
 
        UINT8 *spriteram = space->machine->generic.spriteram.u8;
 
110
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
111
        UINT8 *spriteram = state->m_spriteram;
109
112
        if (ACCESSING_BITS_0_7)
110
113
                spriteram[2 * offset + 0] = data;
111
114
        if (ACCESSING_BITS_8_15)
114
117
 
115
118
static WRITE16_HANDLER( spriteram2_16_w )
116
119
{
117
 
        UINT8 *spriteram_2 = space->machine->generic.spriteram2.u8;
 
120
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
121
        UINT8 *spriteram_2 = state->m_spriteram2;
118
122
        if (ACCESSING_BITS_0_7)
119
123
                spriteram_2[2 * offset + 0] = data;
120
124
        if (ACCESSING_BITS_8_15)
121
125
                spriteram_2[2 * offset + 1] = data >> 8;
122
126
}
123
127
 
124
 
static ADDRESS_MAP_START( fantland_map, ADDRESS_SPACE_PROGRAM, 16 )
 
128
static ADDRESS_MAP_START( fantland_map, AS_PROGRAM, 16 )
125
129
        AM_RANGE( 0x00000, 0x07fff ) AM_RAM
126
130
        AM_RANGE( 0x08000, 0x7ffff ) AM_ROM
127
131
 
130
134
        AM_RANGE( 0xa3000, 0xa3001 ) AM_READ_PORT("a3000") AM_WRITE( fantland_nmi_enable_16_w )
131
135
        AM_RANGE( 0xa3002, 0xa3003 ) AM_READ_PORT("a3002") AM_WRITE( fantland_soundlatch_16_w )
132
136
 
133
 
        AM_RANGE( 0xa4000, 0xa67ff ) AM_READWRITE( spriteram_16_r,  spriteram_16_w  ) AM_BASE_GENERIC( spriteram )
134
 
        AM_RANGE( 0xc0000, 0xcffff ) AM_READWRITE( spriteram2_16_r, spriteram2_16_w ) AM_BASE_GENERIC( spriteram2 )
 
137
        AM_RANGE( 0xa4000, 0xa67ff ) AM_READWRITE( spriteram_16_r,  spriteram_16_w  ) AM_BASE_MEMBER(fantland_state, m_spriteram)
 
138
        AM_RANGE( 0xc0000, 0xcffff ) AM_READWRITE( spriteram2_16_r, spriteram2_16_w ) AM_BASE_MEMBER(fantland_state, m_spriteram2)
135
139
 
136
140
        AM_RANGE( 0xe0000, 0xfffff ) AM_ROM
137
141
ADDRESS_MAP_END
141
145
                                Galaxy Gunners
142
146
***************************************************************************/
143
147
 
144
 
static ADDRESS_MAP_START( galaxygn_map, ADDRESS_SPACE_PROGRAM, 8 )
 
148
static ADDRESS_MAP_START( galaxygn_map, AS_PROGRAM, 8 )
145
149
        AM_RANGE( 0x00000, 0x07fff ) AM_RAM
146
150
        AM_RANGE( 0x10000, 0x2ffff ) AM_ROM
147
151
 
152
156
        AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT("DSW1") AM_WRITE( fantland_soundlatch_w )
153
157
        AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT("P2")
154
158
 
155
 
        AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE_GENERIC( spriteram )
156
 
        AM_RANGE( 0x60000, 0x6ffff ) AM_RAM AM_BASE_GENERIC( spriteram2 )
 
159
        AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram)
 
160
        AM_RANGE( 0x60000, 0x6ffff ) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram2)
157
161
 
158
162
        AM_RANGE( 0x70000, 0x7ffff ) AM_ROM
159
163
        AM_RANGE( 0xf0000, 0xfffff ) AM_ROM
166
170
 
167
171
static WRITE8_HANDLER( borntofi_nmi_enable_w )
168
172
{
169
 
        fantland_state *state = space->machine->driver_data<fantland_state>();
170
 
        state->nmi_enable = data;
 
173
        fantland_state *state = space->machine().driver_data<fantland_state>();
 
174
        state->m_nmi_enable = data;
171
175
 
172
176
        // data & 0x31 changes when lightgun fires
173
177
 
174
 
        if ((state->nmi_enable != 0) && (state->nmi_enable != 8))
175
 
                logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(space->cpu), data);
 
178
        if ((state->m_nmi_enable != 0) && (state->m_nmi_enable != 8))
 
179
                logerror("CPU #0 PC = %04X: nmi_enable = %02x\n", cpu_get_pc(&space->device()), data);
176
180
 
177
181
//  popmessage("%02X", data);
178
182
}
180
184
// Trackball doesn't work correctly
181
185
static READ8_HANDLER( borntofi_inputs_r )
182
186
{
183
 
        fantland_state *state = space->machine->driver_data<fantland_state>();
 
187
        fantland_state *state = space->machine().driver_data<fantland_state>();
184
188
        int x, y, f;
185
189
 
186
 
        switch (input_port_read(space->machine, "Controls") & 0x03)
 
190
        switch (input_port_read(space->machine(), "Controls") & 0x03)
187
191
        {
188
192
                case 3:
189
 
                case 1: return input_port_read(space->machine, offset ? "P2_GUN" : "P1_GUN");   // Lightgun buttons
190
 
                case 2: return input_port_read(space->machine, offset ? "P2_JOY" : "P1_JOY");   // Joystick
 
193
                case 1: return input_port_read(space->machine(), offset ? "P2_GUN" : "P1_GUN"); // Lightgun buttons
 
194
                case 2: return input_port_read(space->machine(), offset ? "P2_JOY" : "P1_JOY"); // Joystick
191
195
        }
192
196
 
193
197
        // Trackball
194
198
 
195
 
        x = input_port_read(space->machine, offset ? "P2 Trackball X" : "P1 Trackball X");
196
 
        y = input_port_read(space->machine, offset ? "P2 Trackball Y" : "P1 Trackball Y");
197
 
        f = space->machine->primary_screen->frame_number();
 
199
        x = input_port_read(space->machine(), offset ? "P2 Trackball X" : "P1 Trackball X");
 
200
        y = input_port_read(space->machine(), offset ? "P2 Trackball Y" : "P1 Trackball Y");
 
201
        f = space->machine().primary_screen->frame_number();
198
202
 
199
 
        state->input_ret[offset] = (state->input_ret[offset] & 0x14) | (input_port_read(space->machine, offset ? "P2_TRACK" : "P1_TRACK") & 0xc3);
 
203
        state->m_input_ret[offset] = (state->m_input_ret[offset] & 0x14) | (input_port_read(space->machine(), offset ? "P2_TRACK" : "P1_TRACK") & 0xc3);
200
204
 
201
205
        x = (x & 0x7f) - (x & 0x80);
202
206
        y = (y & 0x7f) - (y & 0x80);
203
207
 
204
 
        if (state->old_x[offset] > 0)
205
 
        {
206
 
                state->input_ret[offset] = (state->input_ret[offset] ^ 0x04) | ((state->input_ret[offset] & 0x04) << 1);
207
 
                state->old_x[offset]--;
208
 
        }
209
 
        else if (state->old_x[offset] < 0)
210
 
        {
211
 
                state->input_ret[offset] = (state->input_ret[offset] ^ 0x04) | (((~state->input_ret[offset]) & 0x04) << 1);
212
 
                state->old_x[offset]++;
213
 
        }
214
 
 
215
 
        if (state->old_y[offset] > 0)
216
 
        {
217
 
                state->input_ret[offset] = (state->input_ret[offset] ^ 0x10) | ((state->input_ret[offset] & 0x10) << 1);
218
 
                state->old_y[offset]--;
219
 
        }
220
 
        else if (state->old_y[offset] < 0)
221
 
        {
222
 
                state->input_ret[offset] = (state->input_ret[offset] ^ 0x10) | (((~state->input_ret[offset]) & 0x10) << 1);
223
 
                state->old_y[offset]++;
224
 
        }
225
 
 
226
 
//  if (offset == 0)    popmessage("x %02d y %02d", state->old_x[offset], state->old_y[offset]);
227
 
 
228
 
        if ((f - state->old_f[offset]) > 0)
229
 
        {
230
 
                state->old_x[offset] = x;
231
 
                state->old_y[offset] = y;
232
 
                state->old_f[offset] = f;
233
 
        }
234
 
 
235
 
        return state->input_ret[offset];
 
208
        if (state->m_old_x[offset] > 0)
 
209
        {
 
210
                state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x04) | ((state->m_input_ret[offset] & 0x04) << 1);
 
211
                state->m_old_x[offset]--;
 
212
        }
 
213
        else if (state->m_old_x[offset] < 0)
 
214
        {
 
215
                state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x04) | (((~state->m_input_ret[offset]) & 0x04) << 1);
 
216
                state->m_old_x[offset]++;
 
217
        }
 
218
 
 
219
        if (state->m_old_y[offset] > 0)
 
220
        {
 
221
                state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x10) | ((state->m_input_ret[offset] & 0x10) << 1);
 
222
                state->m_old_y[offset]--;
 
223
        }
 
224
        else if (state->m_old_y[offset] < 0)
 
225
        {
 
226
                state->m_input_ret[offset] = (state->m_input_ret[offset] ^ 0x10) | (((~state->m_input_ret[offset]) & 0x10) << 1);
 
227
                state->m_old_y[offset]++;
 
228
        }
 
229
 
 
230
//  if (offset == 0)    popmessage("x %02d y %02d", state->m_old_x[offset], state->m_old_y[offset]);
 
231
 
 
232
        if ((f - state->m_old_f[offset]) > 0)
 
233
        {
 
234
                state->m_old_x[offset] = x;
 
235
                state->m_old_y[offset] = y;
 
236
                state->m_old_f[offset] = f;
 
237
        }
 
238
 
 
239
        return state->m_input_ret[offset];
236
240
}
237
241
 
238
 
static ADDRESS_MAP_START( borntofi_map, ADDRESS_SPACE_PROGRAM, 8 )
 
242
static ADDRESS_MAP_START( borntofi_map, AS_PROGRAM, 8 )
239
243
        AM_RANGE( 0x00000, 0x07fff ) AM_RAM
240
244
        AM_RANGE( 0x10000, 0x2ffff ) AM_ROM
241
245
 
244
248
        AM_RANGE( 0x53002, 0x53002 ) AM_READ_PORT( "DSW" ) AM_WRITE( fantland_soundlatch_w )
245
249
        AM_RANGE( 0x53003, 0x53003 ) AM_READ_PORT( "Controls" )
246
250
 
247
 
        AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE_GENERIC( spriteram )
 
251
        AM_RANGE( 0x54000, 0x567ff ) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram)
248
252
 
249
253
        AM_RANGE( 0x57000, 0x57000 ) AM_READ_PORT( "P1 Lightgun Y" )
250
254
        AM_RANGE( 0x57001, 0x57001 ) AM_READ_PORT( "P1 Lightgun X" )
251
255
        AM_RANGE( 0x57002, 0x57002 ) AM_READ_PORT( "P2 Lightgun Y" )
252
256
        AM_RANGE( 0x57003, 0x57003 ) AM_READ_PORT( "P2 Lightgun X" )
253
257
 
254
 
        AM_RANGE( 0x60000, 0x6ffff ) AM_RAM AM_BASE_GENERIC( spriteram2 )
 
258
        AM_RANGE( 0x60000, 0x6ffff ) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram2)
255
259
 
256
260
        AM_RANGE( 0x70000, 0x7ffff ) AM_ROM
257
261
        AM_RANGE( 0xf0000, 0xfffff ) AM_ROM
262
266
                           Wheels Runner
263
267
***************************************************************************/
264
268
 
265
 
static ADDRESS_MAP_START( wheelrun_map, ADDRESS_SPACE_PROGRAM, 8 )
 
269
static ADDRESS_MAP_START( wheelrun_map, AS_PROGRAM, 8 )
266
270
        AM_RANGE(0x00000, 0x07fff) AM_RAM
267
271
 
268
272
        AM_RANGE(0x30000, 0x3ffff) AM_ROM
275
279
        AM_RANGE(0x53002, 0x53002) AM_READ_PORT( "53002" ) AM_WRITE( fantland_soundlatch_w )
276
280
        AM_RANGE(0x53003, 0x53003) AM_READ_PORT( "53003" ) AM_WRITENOP
277
281
 
278
 
        AM_RANGE(0x54000, 0x567ff) AM_RAM AM_BASE_GENERIC(spriteram     )
279
 
        AM_RANGE(0x60000, 0x6ffff) AM_RAM AM_BASE_GENERIC(spriteram2    )
 
282
        AM_RANGE(0x54000, 0x567ff) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram)
 
283
        AM_RANGE(0x60000, 0x6ffff) AM_RAM AM_BASE_MEMBER(fantland_state, m_spriteram2)
280
284
 
281
285
        AM_RANGE(0xf0000, 0xfffff) AM_ROM
282
286
ADDRESS_MAP_END
289
293
 
290
294
***************************************************************************/
291
295
 
292
 
static ADDRESS_MAP_START( fantland_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
296
static ADDRESS_MAP_START( fantland_sound_map, AS_PROGRAM, 8 )
293
297
        AM_RANGE( 0x00000, 0x01fff ) AM_RAM
294
298
        AM_RANGE( 0x80000, 0x9ffff ) AM_ROM
295
299
        AM_RANGE( 0xc0000, 0xfffff ) AM_ROM
296
300
ADDRESS_MAP_END
297
301
 
298
 
static ADDRESS_MAP_START( fantland_sound_iomap, ADDRESS_SPACE_IO, 8 )
 
302
static ADDRESS_MAP_START( fantland_sound_iomap, AS_IO, 8 )
299
303
        AM_RANGE( 0x0080, 0x0080 ) AM_READ( soundlatch_r )
300
304
        AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE( "ymsnd", ym2151_r, ym2151_w )
301
305
        AM_RANGE( 0x0180, 0x0180 ) AM_DEVWRITE( "dac", dac_w )
302
306
ADDRESS_MAP_END
303
307
 
304
 
static ADDRESS_MAP_START( galaxygn_sound_iomap, ADDRESS_SPACE_IO, 8 )
 
308
static ADDRESS_MAP_START( galaxygn_sound_iomap, AS_IO, 8 )
305
309
        AM_RANGE( 0x0080, 0x0080 ) AM_READ( soundlatch_r )
306
310
        AM_RANGE( 0x0100, 0x0101 ) AM_DEVREADWRITE( "ymsnd", ym2151_r, ym2151_w )
307
311
ADDRESS_MAP_END
313
317
 
314
318
static void borntofi_adpcm_start( device_t *device, int voice )
315
319
{
316
 
        fantland_state *state = device->machine->driver_data<fantland_state>();
 
320
        fantland_state *state = device->machine().driver_data<fantland_state>();
317
321
        msm5205_reset_w(device, 0);
318
 
        state->adpcm_playing[voice] = 1;
319
 
        state->adpcm_nibble[voice] = 0;
320
 
//  logerror("%s: adpcm start = %06x, stop = %06x\n", cpuexec_describe_context(device->machine), state->adpcm_addr[0][voice], state->adpcm_addr[1][voice]);
 
322
        state->m_adpcm_playing[voice] = 1;
 
323
        state->m_adpcm_nibble[voice] = 0;
 
324
//  logerror("%s: adpcm start = %06x, stop = %06x\n", device->machine().describe_context(), state->m_adpcm_addr[0][voice], state->m_adpcm_addr[1][voice]);
321
325
}
322
326
 
323
327
static void borntofi_adpcm_stop( device_t *device, int voice )
324
328
{
325
 
        fantland_state *state = device->machine->driver_data<fantland_state>();
 
329
        fantland_state *state = device->machine().driver_data<fantland_state>();
326
330
        msm5205_reset_w(device, 1);
327
 
        state->adpcm_playing[voice] = 0;
 
331
        state->m_adpcm_playing[voice] = 0;
328
332
}
329
333
 
330
334
static WRITE8_HANDLER( borntofi_msm5205_w )
331
335
{
332
 
        fantland_state *state = space->machine->driver_data<fantland_state>();
 
336
        fantland_state *state = space->machine().driver_data<fantland_state>();
333
337
        int voice = offset / 8;
334
338
        int reg = offset % 8;
335
339
        device_t *msm;
337
341
        switch (voice)
338
342
        {
339
343
                default:
340
 
                case 0: msm = state->msm1; break;
341
 
                case 1: msm = state->msm2; break;
342
 
                case 2: msm = state->msm3; break;
343
 
                case 3: msm = state->msm4; break;
 
344
                case 0: msm = state->m_msm1; break;
 
345
                case 1: msm = state->m_msm2; break;
 
346
                case 2: msm = state->m_msm3; break;
 
347
                case 3: msm = state->m_msm4; break;
344
348
        }
345
349
 
346
350
        if (reg == 0)
350
354
                {
351
355
                        case 0x00:              borntofi_adpcm_stop(msm, voice); break;
352
356
                        case 0x03:              borntofi_adpcm_start(msm, voice); break;
353
 
                        default:                logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(space->cpu), reg, data);
 
357
                        default:                logerror("CPU #0 PC = %04X: adpcm reg %d <- %02x\n", cpu_get_pc(&space->device()), reg, data);
354
358
                }
355
359
        }
356
360
        else
358
362
                int shift = (reg - 1) * 4;
359
363
                int mask = ~(0xf << shift);
360
364
 
361
 
                state->adpcm_addr[0][voice] = (state->adpcm_addr[0][voice] & mask) | (((data & 0xf0) >> 4) << shift);
362
 
                state->adpcm_addr[1][voice] = (state->adpcm_addr[1][voice] & mask) | (((data & 0x0f) >> 0) << shift);
 
365
                state->m_adpcm_addr[0][voice] = (state->m_adpcm_addr[0][voice] & mask) | (((data & 0xf0) >> 4) << shift);
 
366
                state->m_adpcm_addr[1][voice] = (state->m_adpcm_addr[1][voice] & mask) | (((data & 0x0f) >> 0) << shift);
363
367
        }
364
368
}
365
369
 
366
370
static void borntofi_adpcm_int( device_t *device, int voice )
367
371
{
368
 
        fantland_state *state = device->machine->driver_data<fantland_state>();
 
372
        fantland_state *state = device->machine().driver_data<fantland_state>();
369
373
        UINT8 *rom;
370
374
        size_t len;
371
375
        int start, stop;
372
376
 
373
 
        if (!state->adpcm_playing[voice])
 
377
        if (!state->m_adpcm_playing[voice])
374
378
                return;
375
379
 
376
 
        rom = device->machine->region("adpcm")->base();
377
 
        len = device->machine->region("adpcm")->bytes() * 2;
 
380
        rom = device->machine().region("adpcm")->base();
 
381
        len = device->machine().region("adpcm")->bytes() * 2;
378
382
 
379
 
        start = state->adpcm_addr[0][voice] + state->adpcm_nibble[voice];
380
 
        stop = state->adpcm_addr[1][voice];
 
383
        start = state->m_adpcm_addr[0][voice] + state->m_adpcm_nibble[voice];
 
384
        stop = state->m_adpcm_addr[1][voice];
381
385
 
382
386
        if (start >= len)
383
387
        {
393
397
        else
394
398
        {
395
399
                msm5205_data_w(device, rom[start / 2] >> ((start & 1) * 4));
396
 
                state->adpcm_nibble[voice]++;
 
400
                state->m_adpcm_nibble[voice]++;
397
401
        }
398
402
}
399
403
 
403
407
static void borntofi_adpcm_int_3(device_t *device) { borntofi_adpcm_int(device, 3); }
404
408
 
405
409
 
406
 
static ADDRESS_MAP_START( borntofi_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
410
static ADDRESS_MAP_START( borntofi_sound_map, AS_PROGRAM, 8 )
407
411
        AM_RANGE( 0x00000, 0x003ff ) AM_RAM
408
412
        AM_RANGE( 0x04000, 0x04000 ) AM_READ(soundlatch_r)
409
413
        AM_RANGE( 0x04000, 0x0401f ) AM_WRITE(borntofi_msm5205_w)
416
420
                           Wheels Runner
417
421
***************************************************************************/
418
422
 
419
 
static ADDRESS_MAP_START( wheelrun_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
 
423
static ADDRESS_MAP_START( wheelrun_sound_map, AS_PROGRAM, 8 )
420
424
        AM_RANGE(0x0000, 0x7fff) AM_ROM
421
425
        AM_RANGE(0x8000, 0x87ff) AM_RAM
422
426
        AM_RANGE(0xa000, 0xa001) AM_DEVREADWRITE("ymsnd", ym3526_r, ym3526_w )
650
654
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )    PORT_CONDITION("Controls", 0x03, PORTCOND_EQUALS, 0x02) PORT_PLAYER(2)
651
655
 
652
656
        PORT_START("DSW")       /* 53002 */
653
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
 
657
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )          PORT_DIPLOCATION("DSW1:1,2,3")
654
658
        PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
655
659
        PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
656
660
        PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
658
662
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
659
663
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
660
664
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
661
 
        PORT_DIPSETTING(    0x00, "Invulnerability" )
662
 
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
 
665
        PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
 
666
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION("DSW1:4")
663
667
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
664
668
        PORT_DIPSETTING(    0x08, DEF_STR( On ) )
665
 
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
 
669
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("DSW1:5")
666
670
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
667
671
        PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
668
 
        PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
 
672
        PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("DSW1:6,7")
669
673
        PORT_DIPSETTING(    0x60, DEF_STR( Normal ) )
670
 
        PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
671
 
        PORT_DIPSETTING(    0x20, DEF_STR( Harder ) )
672
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
673
 
        PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
 
674
        PORT_DIPSETTING(    0x40, DEF_STR( Medium ) )
 
675
        PORT_DIPSETTING(    0x20, DEF_STR( Medium_Hard ) )
 
676
        PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
 
677
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Service_Mode ) )     PORT_DIPLOCATION("DSW1:8")
 
678
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
 
679
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
 
680
 
 
681
//  PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
674
682
 
675
683
        PORT_START( "Controls" )        /* IN7 - 53003 */
676
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Controls ) )
 
684
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Controls ) )         PORT_DIPLOCATION("DSW2:1,2")
677
685
//  PORT_DIPSETTING(    0x01, "Lightgun" )
678
686
        PORT_DIPSETTING(    0x03, "Lightgun" )
679
687
        PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
680
688
        PORT_DIPSETTING(    0x02, DEF_STR( Joystick ) )
681
 
        PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )  // tested
 
689
        PORT_DIPNAME( 0x04, 0x04, "Sound Test" )                PORT_DIPLOCATION("DSW2:3")
682
690
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
683
691
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
684
 
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
685
 
        PORT_DIPSETTING(    0x08, "180" )
686
 
        PORT_DIPSETTING(    0x00, "0" )
687
 
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
688
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
689
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
690
 
        PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
691
 
        PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
692
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
693
 
        PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
694
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
695
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
696
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
697
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
698
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
 
692
        PORT_DIPNAME( 0x08, 0x08, "Free Bullets" )              PORT_DIPLOCATION("DSW2:4")
 
693
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
 
694
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
 
695
        PORT_DIPUNUSED_DIPLOC( 0x10, 0x0010, "DSW2:5" )
 
696
        PORT_DIPUNUSED_DIPLOC( 0x20, 0x0020, "DSW2:6" )
 
697
        PORT_DIPUNUSED_DIPLOC( 0x40, 0x0040, "DSW2:7" )
 
698
        PORT_DIPUNUSED_DIPLOC( 0x80, 0x0080, "DSW2:8" )
699
699
 
700
700
        PORT_START("P1 Lightgun Y")             /* 57000 */
701
701
        PORT_BIT( 0xff, 0xb0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, (352.0 - 12) / 352, 12.0 / 352, 0) PORT_MINMAX(0x80,0xfc) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_PLAYER(1)
730
730
static CUSTOM_INPUT( wheelrun_wheel_r )
731
731
{
732
732
        int player = (FPTR)param;
733
 
        int delta = input_port_read(field->port->machine, player ? "WHEEL1" : "WHEEL0");
 
733
        int delta = input_port_read(field->port->machine(), player ? "WHEEL1" : "WHEEL0");
734
734
        delta = (delta & 0x7f) - (delta & 0x80) + 4;
735
735
 
736
736
        if              (delta > 7)     delta = 7;
827
827
 
828
828
static MACHINE_START( fantland )
829
829
{
830
 
        fantland_state *state = machine->driver_data<fantland_state>();
831
 
 
832
 
        state->audio_cpu = machine->device("audiocpu");
833
 
 
834
 
        state_save_register_global(machine, state->nmi_enable);
 
830
        fantland_state *state = machine.driver_data<fantland_state>();
 
831
 
 
832
        state->m_audio_cpu = machine.device("audiocpu");
 
833
 
 
834
        state->save_item(NAME(state->m_nmi_enable));
835
835
}
836
836
 
837
837
static MACHINE_RESET( fantland )
838
838
{
839
 
        fantland_state *state = machine->driver_data<fantland_state>();
840
 
        state->nmi_enable = 0;
 
839
        fantland_state *state = machine.driver_data<fantland_state>();
 
840
        state->m_nmi_enable = 0;
841
841
}
842
842
 
843
843
static INTERRUPT_GEN( fantland_irq )
844
844
{
845
 
        fantland_state *state = device->machine->driver_data<fantland_state>();
846
 
        if (state->nmi_enable & 8)
847
 
                cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
 
845
        fantland_state *state = device->machine().driver_data<fantland_state>();
 
846
        if (state->m_nmi_enable & 8)
 
847
                device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
848
848
}
849
849
 
850
850
static INTERRUPT_GEN( fantland_sound_irq )
851
851
{
852
 
        cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x80 / 4);
 
852
        device_set_input_line_and_vector(device, 0, HOLD_LINE, 0x80 / 4);
853
853
}
854
854
 
855
855
static MACHINE_CONFIG_START( fantland, fantland_state )
868
868
        MCFG_MACHINE_START(fantland)
869
869
        MCFG_MACHINE_RESET(fantland)
870
870
 
871
 
        MCFG_QUANTUM_TIME(HZ(8000))     // sound irq must feed the DAC at 8kHz
 
871
        MCFG_QUANTUM_TIME(attotime::from_hz(8000))      // sound irq must feed the DAC at 8kHz
872
872
 
873
873
        /* video hardware */
874
874
        MCFG_SCREEN_ADD("screen", RASTER)
877
877
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
878
878
        MCFG_SCREEN_SIZE(352,256)
879
879
        MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
 
880
        MCFG_SCREEN_UPDATE(fantland)
880
881
 
881
882
        MCFG_GFXDECODE(fantland)
882
883
        MCFG_PALETTE_LENGTH(256)
883
884
 
884
 
        MCFG_VIDEO_UPDATE(fantland)
885
885
 
886
886
        /* sound hardware */
887
887
        MCFG_SPEAKER_STANDARD_MONO("mono")
897
897
 
898
898
static void galaxygn_sound_irq( device_t *device, int line )
899
899
{
900
 
        fantland_state *state = device->machine->driver_data<fantland_state>();
901
 
        cpu_set_input_line_and_vector(state->audio_cpu, 0, line ? ASSERT_LINE : CLEAR_LINE, 0x80/4);
 
900
        fantland_state *state = device->machine().driver_data<fantland_state>();
 
901
        device_set_input_line_and_vector(state->m_audio_cpu, 0, line ? ASSERT_LINE : CLEAR_LINE, 0x80/4);
902
902
}
903
903
 
904
904
static const ym2151_interface galaxygn_ym2151_interface =
928
928
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
929
929
        MCFG_SCREEN_SIZE(352,256)
930
930
        MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
 
931
        MCFG_SCREEN_UPDATE(fantland)
931
932
 
932
933
        MCFG_GFXDECODE(fantland)
933
934
        MCFG_PALETTE_LENGTH(256)
934
935
 
935
 
        MCFG_VIDEO_UPDATE(fantland)
936
 
 
937
936
        /* sound hardware */
938
937
        MCFG_SPEAKER_STANDARD_MONO("mono")
939
938
 
968
967
 
969
968
static MACHINE_START( borntofi )
970
969
{
971
 
        fantland_state *state = machine->driver_data<fantland_state>();
 
970
        fantland_state *state = machine.driver_data<fantland_state>();
972
971
 
973
972
        MACHINE_START_CALL(fantland);
974
973
 
975
 
        state->msm1 = machine->device("msm1");
976
 
        state->msm2 = machine->device("msm2");
977
 
        state->msm3 = machine->device("msm3");
978
 
        state->msm4 = machine->device("msm4");
 
974
        state->m_msm1 = machine.device("msm1");
 
975
        state->m_msm2 = machine.device("msm2");
 
976
        state->m_msm3 = machine.device("msm3");
 
977
        state->m_msm4 = machine.device("msm4");
979
978
 
980
 
        state_save_register_global_array(machine, state->old_x);
981
 
        state_save_register_global_array(machine, state->old_y);
982
 
        state_save_register_global_array(machine, state->old_f);
983
 
        state_save_register_global_array(machine, state->input_ret);
984
 
        state_save_register_global_array(machine, state->adpcm_playing);
985
 
        state_save_register_global_array(machine, state->adpcm_addr[0]);
986
 
        state_save_register_global_array(machine, state->adpcm_addr[1]);
987
 
        state_save_register_global_array(machine, state->adpcm_nibble);
 
979
        state->save_item(NAME(state->m_old_x));
 
980
        state->save_item(NAME(state->m_old_y));
 
981
        state->save_item(NAME(state->m_old_f));
 
982
        state->save_item(NAME(state->m_input_ret));
 
983
        state->save_item(NAME(state->m_adpcm_playing));
 
984
        state->save_item(NAME(state->m_adpcm_addr[0]));
 
985
        state->save_item(NAME(state->m_adpcm_addr[1]));
 
986
        state->save_item(NAME(state->m_adpcm_nibble));
988
987
}
989
988
 
990
989
static MACHINE_RESET( borntofi )
991
990
{
992
 
        fantland_state *state = machine->driver_data<fantland_state>();
 
991
        fantland_state *state = machine.driver_data<fantland_state>();
993
992
        int i;
994
993
 
995
994
        MACHINE_RESET_CALL(fantland);
996
995
 
997
996
        for (i = 0; i < 2; i++)
998
997
        {
999
 
                state->old_x[i] = 0;
1000
 
                state->old_y[i] = 0;
1001
 
                state->old_f[i] = 0;
1002
 
                state->input_ret[i] = 0;
 
998
                state->m_old_x[i] = 0;
 
999
                state->m_old_y[i] = 0;
 
1000
                state->m_old_f[i] = 0;
 
1001
                state->m_input_ret[i] = 0;
1003
1002
        }
1004
1003
 
1005
1004
        for (i = 0; i < 4; i++)
1006
1005
        {
1007
 
                state->adpcm_playing[i] = 1;
1008
 
                state->adpcm_addr[0][i] = 0;
1009
 
                state->adpcm_addr[1][i] = 0;
1010
 
                state->adpcm_nibble[i] = 0;
 
1006
                state->m_adpcm_playing[i] = 1;
 
1007
                state->m_adpcm_addr[0][i] = 0;
 
1008
                state->m_adpcm_addr[1][i] = 0;
 
1009
                state->m_adpcm_nibble[i] = 0;
1011
1010
        }
1012
1011
 
1013
 
        borntofi_adpcm_stop(machine->device("msm1"), 0);
1014
 
        borntofi_adpcm_stop(machine->device("msm2"), 1);
1015
 
        borntofi_adpcm_stop(machine->device("msm3"), 2);
1016
 
        borntofi_adpcm_stop(machine->device("msm4"), 3);
 
1012
        borntofi_adpcm_stop(machine.device("msm1"), 0);
 
1013
        borntofi_adpcm_stop(machine.device("msm2"), 1);
 
1014
        borntofi_adpcm_stop(machine.device("msm3"), 2);
 
1015
        borntofi_adpcm_stop(machine.device("msm4"), 3);
1017
1016
}
1018
1017
 
1019
1018
static MACHINE_CONFIG_START( borntofi, fantland_state )
1036
1035
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1037
1036
        MCFG_SCREEN_SIZE(352,256)
1038
1037
        MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
 
1038
        MCFG_SCREEN_UPDATE(fantland)
1039
1039
 
1040
1040
        MCFG_GFXDECODE(fantland)
1041
1041
        MCFG_PALETTE_LENGTH(256)
1042
1042
 
1043
 
        MCFG_VIDEO_UPDATE(fantland)
1044
 
 
1045
1043
        /* sound hardware */
1046
1044
        MCFG_SPEAKER_STANDARD_MONO("mono")
1047
1045
 
1055
1053
 
1056
1054
static void wheelrun_ym3526_irqhandler( device_t *device, int state )
1057
1055
{
1058
 
        fantland_state *driver = device->machine->driver_data<fantland_state>();
1059
 
        cpu_set_input_line(driver->audio_cpu, INPUT_LINE_IRQ0, state);
 
1056
        fantland_state *driver = device->machine().driver_data<fantland_state>();
 
1057
        device_set_input_line(driver->m_audio_cpu, INPUT_LINE_IRQ0, state);
1060
1058
}
1061
1059
 
1062
1060
static const ym3526_interface wheelrun_ym3526_interface =
1085
1083
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1086
1084
        MCFG_SCREEN_SIZE(256,224)
1087
1085
        MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1)
 
1086
        MCFG_SCREEN_UPDATE(fantland)
1088
1087
 
1089
1088
        MCFG_GFXDECODE(fantland)
1090
1089
        MCFG_PALETTE_LENGTH(256)
1091
1090
 
1092
 
        MCFG_VIDEO_UPDATE(fantland)
1093
 
 
1094
1091
        /* sound hardware */
1095
1092
        MCFG_SPEAKER_STANDARD_MONO("mono")
1096
1093
 
1456
1453
GAME( 19??, fantland,  0,        fantland, fantland, 0, ROT0,  "Electronic Devices Italy",  "Fantasy Land (set 1)", GAME_SUPPORTS_SAVE )
1457
1454
GAME( 19??, fantlanda, fantland, fantland, fantland, 0, ROT0,  "Electronic Devices Italy",  "Fantasy Land (set 2)", GAME_SUPPORTS_SAVE )
1458
1455
GAME( 19??, wheelrun,  0,        wheelrun, wheelrun, 0, ROT0,  "International Games",       "Wheels Runner",        GAME_SUPPORTS_SAVE )
1459
 
GAME( 1989, galaxygn,  0,        galaxygn, galaxygn, 0, ROT90, "Electronics Devices Italy", "Galaxy Gunners",       GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
 
1456
GAME( 1989, galaxygn,  0,        galaxygn, galaxygn, 0, ROT90, "Electronic Devices Italy",  "Galaxy Gunners",       GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )