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

« back to all changes in this revision

Viewing changes to src/mame/drivers/atarigt.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:
37
37
 *
38
38
 *************************************/
39
39
 
40
 
static void cage_irq_callback(running_machine *machine, int reason);
 
40
static void cage_irq_callback(running_machine &machine, int reason);
41
41
 
42
42
 
43
43
 
47
47
 *
48
48
 *************************************/
49
49
 
50
 
static void update_interrupts(running_machine *machine)
 
50
static void update_interrupts(running_machine &machine)
51
51
{
52
 
        atarigt_state *state = machine->driver_data<atarigt_state>();
53
 
        cputag_set_input_line(machine, "maincpu", 3, state->sound_int_state    ? ASSERT_LINE : CLEAR_LINE);
54
 
        cputag_set_input_line(machine, "maincpu", 4, state->video_int_state    ? ASSERT_LINE : CLEAR_LINE);
55
 
        cputag_set_input_line(machine, "maincpu", 6, state->scanline_int_state ? ASSERT_LINE : CLEAR_LINE);
 
52
        atarigt_state *state = machine.driver_data<atarigt_state>();
 
53
        cputag_set_input_line(machine, "maincpu", 3, state->m_sound_int_state    ? ASSERT_LINE : CLEAR_LINE);
 
54
        cputag_set_input_line(machine, "maincpu", 4, state->m_video_int_state    ? ASSERT_LINE : CLEAR_LINE);
 
55
        cputag_set_input_line(machine, "maincpu", 6, state->m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE);
56
56
}
57
57
 
58
58
 
64
64
 
65
65
static MACHINE_RESET( atarigt )
66
66
{
67
 
        atarigt_state *state = machine->driver_data<atarigt_state>();
 
67
        atarigt_state *state = machine.driver_data<atarigt_state>();
68
68
 
69
69
        atarigen_eeprom_reset(state);
70
70
        atarigen_interrupt_reset(state, update_interrupts);
71
 
        atarigen_scanline_timer_reset(*machine->primary_screen, atarigt_scanline_update, 8);
 
71
        atarigen_scanline_timer_reset(*machine.primary_screen, atarigt_scanline_update, 8);
72
72
}
73
73
 
74
74
 
79
79
 *
80
80
 *************************************/
81
81
 
82
 
static void cage_irq_callback(running_machine *machine, int reason)
 
82
static void cage_irq_callback(running_machine &machine, int reason)
83
83
{
84
 
        address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
 
84
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
85
85
 
86
86
        if (reason)
87
 
                atarigen_sound_int_gen(machine->device("maincpu"));
 
87
                atarigen_sound_int_gen(machine.device("maincpu"));
88
88
        else
89
89
                atarigen_sound_int_ack_w(space,0,0,0xffff);
90
90
}
99
99
 
100
100
static READ32_HANDLER( special_port2_r )
101
101
{
102
 
        int temp = input_port_read(space->machine, "SERVICE");
 
102
        int temp = input_port_read(space->machine(), "SERVICE");
103
103
        temp ^= 0x0001;         /* /A2DRDY always high for now */
104
104
        temp ^= 0x0008;         /* A2D.EOC always high for now */
105
105
        return (temp << 16) | temp;
108
108
 
109
109
static READ32_HANDLER( special_port3_r )
110
110
{
111
 
        atarigt_state *state = space->machine->driver_data<atarigt_state>();
112
 
        int temp = input_port_read(space->machine, "COIN");
113
 
        if (state->video_int_state) temp ^= 0x0001;
114
 
        if (state->scanline_int_state) temp ^= 0x0002;
 
111
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
 
112
        int temp = input_port_read(space->machine(), "COIN");
 
113
        if (state->m_video_int_state) temp ^= 0x0001;
 
114
        if (state->m_scanline_int_state) temp ^= 0x0002;
115
115
        return (temp << 16) | temp;
116
116
}
117
117
 
156
156
        compute_fake_pots(pots);
157
157
        return (pots[0] << 24) | (pots[3] << 8);
158
158
#else
159
 
        return (input_port_read(space->machine, "AN1") << 24) | (input_port_read(space->machine, "AN2") << 8);
 
159
        return (input_port_read(space->machine(), "AN1") << 24) | (input_port_read(space->machine(), "AN2") << 8);
160
160
#endif
161
161
}
162
162
 
168
168
        compute_fake_pots(pots);
169
169
        return (pots[2] << 24) | (pots[1] << 8);
170
170
#else
171
 
        return (input_port_read(space->machine, "AN3") << 24) | (input_port_read(space->machine, "AN4") << 8);
 
171
        return (input_port_read(space->machine(), "AN3") << 24) | (input_port_read(space->machine(), "AN4") << 8);
172
172
#endif
173
173
}
174
174
 
196
196
        /* upper byte */
197
197
        if (ACCESSING_BITS_24_31)
198
198
        {
 
199
                atarigt_state *state = space->machine().driver_data<atarigt_state>();
 
200
 
199
201
                /* bits 13-11 are the MO control bits */
200
 
                atarirle_control_w(space->machine, 0, (data >> 27) & 7);
 
202
                atarirle_control_w(state->m_rle, (data >> 27) & 7);
201
203
        }
202
204
 
203
205
        if (ACCESSING_BITS_16_23)
204
206
        {
205
207
//      cage_reset_w(data & 0x00100000);
206
 
                coin_counter_w(space->machine, 0, data & 0x00080000);
207
 
                coin_counter_w(space->machine, 1, data & 0x00010000);
 
208
                coin_counter_w(space->machine(), 0, data & 0x00080000);
 
209
                coin_counter_w(space->machine(), 1, data & 0x00010000);
208
210
        }
209
211
}
210
212
 
211
213
 
212
214
static WRITE32_HANDLER( mo_command_w )
213
215
{
214
 
        atarigt_state *state = space->machine->driver_data<atarigt_state>();
215
 
        COMBINE_DATA(state->mo_command);
 
216
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
 
217
        COMBINE_DATA(state->m_mo_command);
216
218
        if (ACCESSING_BITS_0_15)
217
 
                atarirle_command_w(0, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
 
219
                atarirle_command_w(state->m_rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
218
220
}
219
221
 
220
222
 
246
248
static WRITE32_HANDLER( sound_data_w )
247
249
{
248
250
        if (ACCESSING_BITS_0_15)
249
 
                cage_control_w(space->machine, data);
 
251
                cage_control_w(space->machine(), data);
250
252
        if (ACCESSING_BITS_16_31)
251
253
                main_to_cage_w(data >> 16);
252
254
}
259
261
 *
260
262
 *************************************/
261
263
 
262
 
#define ADDRSEQ_COUNT   4
263
 
 
264
 
static offs_t protaddr[ADDRSEQ_COUNT];
265
 
static UINT8 protmode;
266
 
static UINT16 protresult;
267
 
static UINT8 protdata[0x800];
268
 
 
269
 
static UINT8 ignore_writes = 0;
270
 
 
271
 
static void tmek_update_mode(offs_t offset)
 
264
 
 
265
 
 
266
static void tmek_update_mode(atarigt_state *state, offs_t offset)
272
267
{
273
268
        int i;
274
269
 
275
270
        /* pop us into the readseq */
276
271
        for (i = 0; i < ADDRSEQ_COUNT - 1; i++)
277
 
                protaddr[i] = protaddr[i + 1];
278
 
        protaddr[ADDRSEQ_COUNT - 1] = offset;
 
272
                state->m_protaddr[i] = state->m_protaddr[i + 1];
 
273
        state->m_protaddr[ADDRSEQ_COUNT - 1] = offset;
279
274
 
280
275
}
281
276
 
282
277
 
283
278
static void tmek_protection_w(address_space *space, offs_t offset, UINT16 data)
284
279
{
 
280
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
285
281
/*
286
282
    T-Mek init:
287
283
        ($387C0) = $0001
290
286
        Read ($38488)
291
287
*/
292
288
 
293
 
        if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", cpu_get_previouspc(space->cpu), offset, data);
 
289
        if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data);
294
290
 
295
291
        /* track accesses */
296
 
        tmek_update_mode(offset);
 
292
        tmek_update_mode(state, offset);
297
293
 
298
294
        switch (offset)
299
295
        {
300
296
                case 0xdb0000:
301
 
                        ignore_writes = (data == 0x18);
 
297
                        state->m_ignore_writes = (data == 0x18);
302
298
                        break;
303
299
        }
304
300
}
305
301
 
306
302
static void tmek_protection_r(address_space *space, offs_t offset, UINT16 *data)
307
303
{
308
 
        if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", cpu_get_previouspc(space->cpu), offset);
 
304
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
 
305
        if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", cpu_get_previouspc(&space->device()), offset);
309
306
 
310
307
        /* track accesses */
311
 
        tmek_update_mode(offset);
 
308
        tmek_update_mode(state, offset);
312
309
 
313
310
        /* handle specific reads */
314
311
        switch (offset)
316
313
                /* status register; the code spins on this waiting for the high bit to be set */
317
314
                case 0xdb8700:
318
315
                case 0xdb87c0:
319
 
//          if (protmode != 0)
 
316
//          if (state->m_protmode != 0)
320
317
                        {
321
318
                                *data = -1;//0x8000;
322
319
                        }
332
329
 *
333
330
 *************************************/
334
331
 
335
 
static void primage_update_mode(offs_t offset)
 
332
static void primage_update_mode(atarigt_state *state, offs_t offset)
336
333
{
337
334
        int i;
338
335
 
339
336
        /* pop us into the readseq */
340
337
        for (i = 0; i < ADDRSEQ_COUNT - 1; i++)
341
 
                protaddr[i] = protaddr[i + 1];
342
 
        protaddr[ADDRSEQ_COUNT - 1] = offset;
 
338
                state->m_protaddr[i] = state->m_protaddr[i + 1];
 
339
        state->m_protaddr[ADDRSEQ_COUNT - 1] = offset;
343
340
 
344
341
        /* check for particular sequences */
345
 
        if (!protmode)
 
342
        if (!state->m_protmode)
346
343
        {
347
344
                /* this is from the code at $20f90 */
348
 
                if (protaddr[1] == 0xdcc7c4 && protaddr[2] == 0xdcc7c4 && protaddr[3] == 0xdc4010)
 
345
                if (state->m_protaddr[1] == 0xdcc7c4 && state->m_protaddr[2] == 0xdcc7c4 && state->m_protaddr[3] == 0xdc4010)
349
346
                {
350
347
                        if (LOG_PROTECTION) logerror("prot:Entering mode 1\n");
351
 
                        protmode = 1;
 
348
                        state->m_protmode = 1;
352
349
                }
353
350
 
354
351
                /* this is from the code at $27592 */
355
 
                if (protaddr[0] == 0xdcc7ca && protaddr[1] == 0xdcc7ca && protaddr[2] == 0xdcc7c6 && protaddr[3] == 0xdc4022)
 
352
                if (state->m_protaddr[0] == 0xdcc7ca && state->m_protaddr[1] == 0xdcc7ca && state->m_protaddr[2] == 0xdcc7c6 && state->m_protaddr[3] == 0xdc4022)
356
353
                {
357
354
                        if (LOG_PROTECTION) logerror("prot:Entering mode 2\n");
358
 
                        protmode = 2;
 
355
                        state->m_protmode = 2;
359
356
                }
360
357
 
361
358
                /* this is from the code at $3d8dc */
362
 
                if (protaddr[0] == 0xdcc7c0 && protaddr[1] == 0xdcc7c0 && protaddr[2] == 0xdc80f2 && protaddr[3] == 0xdc7af2)
 
359
                if (state->m_protaddr[0] == 0xdcc7c0 && state->m_protaddr[1] == 0xdcc7c0 && state->m_protaddr[2] == 0xdc80f2 && state->m_protaddr[3] == 0xdc7af2)
363
360
                {
364
361
                        if (LOG_PROTECTION) logerror("prot:Entering mode 3\n");
365
 
                        protmode = 3;
 
362
                        state->m_protmode = 3;
366
363
                }
367
364
        }
368
365
}
371
368
 
372
369
static void primrage_protection_w(address_space *space, offs_t offset, UINT16 data)
373
370
{
 
371
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
374
372
        if (LOG_PROTECTION)
375
373
        {
376
 
        UINT32 pc = cpu_get_previouspc(space->cpu);
 
374
        UINT32 pc = cpu_get_previouspc(&space->device());
377
375
        switch (pc)
378
376
        {
379
377
                /* protection code from 20f90 - 21000 */
406
404
 
407
405
                /* catch anything else */
408
406
                default:
409
 
                        logerror("%06X:Unknown protection W@%06X = %04X\n", cpu_get_previouspc(space->cpu), offset, data);
 
407
                        logerror("%06X:Unknown protection W@%06X = %04X\n", cpu_get_previouspc(&space->device()), offset, data);
410
408
                        break;
411
409
        }
412
410
        }
414
412
/* mask = 0x78fff */
415
413
 
416
414
        /* track accesses */
417
 
        primage_update_mode(offset);
 
415
        primage_update_mode(state, offset);
418
416
 
419
417
        /* check for certain read sequences */
420
 
        if (protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(protdata) * 2)
421
 
                protdata[(offset - 0xdc7800) / 2] = data;
 
418
        if (state->m_protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(state->m_protdata) * 2)
 
419
                state->m_protdata[(offset - 0xdc7800) / 2] = data;
422
420
 
423
 
        if (protmode == 2)
 
421
        if (state->m_protmode == 2)
424
422
        {
425
423
                int temp = (offset - 0xdc7800) / 2;
426
424
                if (LOG_PROTECTION) logerror("prot:mode 2 param = %04X\n", temp);
427
 
                protresult = temp * 0x6915 + 0x6915;
 
425
                state->m_protresult = temp * 0x6915 + 0x6915;
428
426
        }
429
427
 
430
 
        if (protmode == 3)
 
428
        if (state->m_protmode == 3)
431
429
        {
432
430
                if (offset == 0xdc4700)
433
431
                {
434
432
                        if (LOG_PROTECTION) logerror("prot:Clearing mode 3\n");
435
 
                        protmode = 0;
 
433
                        state->m_protmode = 0;
436
434
                }
437
435
        }
438
436
}
441
439
 
442
440
static void primrage_protection_r(address_space *space, offs_t offset, UINT16 *data)
443
441
{
 
442
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
444
443
        /* track accesses */
445
 
        primage_update_mode(offset);
 
444
        primage_update_mode(state, offset);
446
445
 
447
446
if (LOG_PROTECTION)
448
447
{
449
 
        UINT32 pc = cpu_get_previouspc(space->cpu);
 
448
        UINT32 pc = cpu_get_previouspc(&space->device());
450
449
        UINT32 p1, p2, a6;
451
450
        switch (pc)
452
451
        {
466
465
                case 0x275bc:
467
466
                        break;
468
467
                case 0x275cc:
469
 
                        a6 = cpu_get_reg(space->cpu, M68K_A6);
 
468
                        a6 = cpu_get_reg(&space->device(), M68K_A6);
470
469
                        p1 = (space->read_word(a6+8) << 16) | space->read_word(a6+10);
471
470
                        p2 = (space->read_word(a6+12) << 16) | space->read_word(a6+14);
472
471
                        logerror("Known Protection @ 275BC(%08X, %08X): R@%06X ", p1, p2, offset);
484
483
 
485
484
                /* protection code from 3d8dc - 3d95a */
486
485
                case 0x3d8f4:
487
 
                        a6 = cpu_get_reg(space->cpu, M68K_A6);
 
486
                        a6 = cpu_get_reg(&space->device(), M68K_A6);
488
487
                        p1 = (space->read_word(a6+12) << 16) | space->read_word(a6+14);
489
488
                        logerror("Known Protection @ 3D8F4(%08X): R@%06X ", p1, offset);
490
489
                        break;
495
494
 
496
495
                /* protection code from 437fa - 43860 */
497
496
                case 0x43814:
498
 
                        a6 = cpu_get_reg(space->cpu, M68K_A6);
 
497
                        a6 = cpu_get_reg(&space->device(), M68K_A6);
499
498
                        p1 = space->read_dword(a6+14) & 0xffffff;
500
499
                        logerror("Known Protection @ 43814(%08X): R@%06X ", p1, offset);
501
500
                        break;
509
508
 
510
509
                /* catch anything else */
511
510
                default:
512
 
                        logerror("%06X:Unknown protection R@%06X\n", cpu_get_previouspc(space->cpu), offset);
 
511
                        logerror("%06X:Unknown protection R@%06X\n", cpu_get_previouspc(&space->device()), offset);
513
512
                        break;
514
513
        }
515
514
}
519
518
        {
520
519
                /* status register; the code spins on this waiting for the high bit to be set */
521
520
                case 0xdc4700:
522
 
//          if (protmode != 0)
 
521
//          if (state->m_protmode != 0)
523
522
                        {
524
523
                                *data = 0x8000;
525
524
                        }
527
526
 
528
527
                /* some kind of result register */
529
528
                case 0xdcc7c2:
530
 
                        if (protmode == 2)
 
529
                        if (state->m_protmode == 2)
531
530
                        {
532
 
                                *data = protresult;
533
 
                                protmode = 0;
 
531
                                *data = state->m_protresult;
 
532
                                state->m_protmode = 0;
534
533
                        if (LOG_PROTECTION) logerror("prot:Clearing mode 2\n");
535
534
                        }
536
535
                        break;
537
536
 
538
537
                case 0xdcc7c4:
539
 
                        if (protmode == 1)
 
538
                        if (state->m_protmode == 1)
540
539
                        {
541
 
                                protmode = 0;
 
540
                                state->m_protmode = 0;
542
541
                        if (LOG_PROTECTION) logerror("prot:Clearing mode 1\n");
543
542
                        }
544
543
                        break;
555
554
 
556
555
static READ32_HANDLER( colorram_protection_r )
557
556
{
558
 
        atarigt_state *state = space->machine->driver_data<atarigt_state>();
 
557
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
559
558
        offs_t address = 0xd80000 + offset * 4;
560
559
        UINT32 result32 = 0;
561
560
        UINT16 result;
563
562
        if (ACCESSING_BITS_16_31)
564
563
        {
565
564
                result = atarigt_colorram_r(state, address);
566
 
                (*state->protection_r)(space, address, &result);
 
565
                (*state->m_protection_r)(space, address, &result);
567
566
                result32 |= result << 16;
568
567
        }
569
568
        if (ACCESSING_BITS_0_15)
570
569
        {
571
570
                result = atarigt_colorram_r(state, address + 2);
572
 
                (*state->protection_r)(space, address + 2, &result);
 
571
                (*state->m_protection_r)(space, address + 2, &result);
573
572
                result32 |= result;
574
573
        }
575
574
 
579
578
 
580
579
static WRITE32_HANDLER( colorram_protection_w )
581
580
{
582
 
        atarigt_state *state = space->machine->driver_data<atarigt_state>();
 
581
        atarigt_state *state = space->machine().driver_data<atarigt_state>();
583
582
        offs_t address = 0xd80000 + offset * 4;
584
583
 
585
584
        if (ACCESSING_BITS_16_31)
586
585
        {
587
 
                if (!ignore_writes)
 
586
                if (!state->m_ignore_writes)
588
587
                        atarigt_colorram_w(state, address, data >> 16, mem_mask >> 16);
589
 
                (*state->protection_w)(space, address, data >> 16);
 
588
                (*state->m_protection_w)(space, address, data >> 16);
590
589
        }
591
590
        if (ACCESSING_BITS_0_15)
592
591
        {
593
 
                if (!ignore_writes)
 
592
                if (!state->m_ignore_writes)
594
593
                        atarigt_colorram_w(state, address + 2, data, mem_mask);
595
 
                (*state->protection_w)(space, address + 2, data);
 
594
                (*state->m_protection_w)(space, address + 2, data);
596
595
        }
597
596
}
598
597
 
604
603
 *
605
604
 *************************************/
606
605
 
607
 
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 )
 
606
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 32 )
608
607
        AM_RANGE(0x000000, 0x1fffff) AM_ROM
609
608
        AM_RANGE(0xc00000, 0xc00003) AM_READWRITE(sound_data_r, sound_data_w)
610
609
        AM_RANGE(0xd00014, 0xd00017) AM_READ(analog_port0_r)
611
610
        AM_RANGE(0xd0001c, 0xd0001f) AM_READ(analog_port1_r)
612
611
        AM_RANGE(0xd20000, 0xd20fff) AM_READWRITE(atarigen_eeprom_upper32_r, atarigen_eeprom32_w) AM_SHARE("eeprom")
613
612
        AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE(atarigen_eeprom_enable32_w)
614
 
        AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(atarigen_playfield32_w) AM_BASE_MEMBER(atarigt_state, playfield32)
615
 
        AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(atarigen_alpha32_w) AM_BASE_MEMBER(atarigt_state, alpha32)
616
 
        AM_RANGE(0xd78000, 0xd78fff) AM_WRITE(atarirle_0_spriteram32_w) AM_BASE(&atarirle_0_spriteram32)
617
 
        AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarigt_state, mo_command)
 
613
        AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(atarigen_playfield32_w) AM_BASE_MEMBER(atarigt_state, m_playfield32)
 
614
        AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(atarigen_alpha32_w) AM_BASE_MEMBER(atarigt_state, m_alpha32)
 
615
        AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE("rle", atarirle_spriteram32_r, atarirle_spriteram32_w)
 
616
        AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarigt_state, m_mo_command)
618
617
        AM_RANGE(0xd70000, 0xd7ffff) AM_RAM
619
 
        AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(colorram_protection_r, colorram_protection_w) AM_BASE_MEMBER(atarigt_state, colorram)
 
618
        AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(colorram_protection_r, colorram_protection_w) AM_BASE_MEMBER(atarigt_state, m_colorram)
620
619
        AM_RANGE(0xe04000, 0xe04003) AM_WRITE(led_w)
621
620
        AM_RANGE(0xe08000, 0xe08003) AM_WRITE(latch_w)
622
621
        AM_RANGE(0xe0a000, 0xe0a003) AM_WRITE(atarigen_scanline_int_ack32_w)
783
782
GFXDECODE_END
784
783
 
785
784
 
 
785
static const atarirle_desc modesc =
 
786
{
 
787
        "gfx3",         /* region where the GFX data lives */
 
788
        256,            /* number of entries in sprite RAM */
 
789
        0,                      /* left clip coordinate */
 
790
        0,                      /* right clip coordinate */
 
791
 
 
792
        0x0000,         /* base palette entry */
 
793
        0x1000,         /* maximum number of colors */
 
794
 
 
795
        {{ 0x7fff,0,0,0,0,0,0,0 }},     /* mask for the code index */
 
796
        {{ 0,0x0ff0,0,0,0,0,0,0 }},     /* mask for the color */
 
797
        {{ 0,0,0xffc0,0,0,0,0,0 }},     /* mask for the X position */
 
798
        {{ 0,0,0,0xffc0,0,0,0,0 }},     /* mask for the Y position */
 
799
        {{ 0,0,0,0,0xffff,0,0,0 }},     /* mask for the scale factor */
 
800
        {{ 0x8000,0,0,0,0,0,0,0 }},     /* mask for the horizontal flip */
 
801
        {{ 0,0,0,0,0,0,0x00ff,0 }},     /* mask for the order */
 
802
        {{ 0,0x0e00,0,0,0,0,0,0 }},     /* mask for the priority */
 
803
        {{ 0,0x8000,0,0,0,0,0,0 }}      /* mask for the VRAM target */
 
804
};
 
805
 
 
806
 
786
807
 
787
808
/*************************************
788
809
 *
812
833
        /* note: these parameters are from published specs, not derived */
813
834
        /* the board uses a pair of GALs to determine H and V parameters */
814
835
        MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
 
836
        MCFG_SCREEN_UPDATE(atarigt)
 
837
        MCFG_SCREEN_EOF(atarigt)
815
838
 
816
839
        MCFG_VIDEO_START(atarigt)
817
 
        MCFG_VIDEO_EOF(atarirle)
818
 
        MCFG_VIDEO_UPDATE(atarigt)
 
840
 
 
841
        MCFG_ATARIRLE_ADD("rle", modesc)
819
842
 
820
843
        /* sound hardware */
821
844
        MCFG_FRAGMENT_ADD(cage)
1057
1080
        ROM_LOAD32_BYTE( "pgm3", 0x00003, 0x20000, CRC(28b0e210) SHA1(7567671beecc7d30e9d4b61cf7d3448bb1dbb072) )
1058
1081
 
1059
1082
        ROM_REGION32_LE( 0x200000, "cageboot", 0 )      /* TMS320C31 boot ROM */
1060
 
        ROM_LOAD32_BYTE( "0078", 0x000000, 0x080000, NO_DUMP CRC(314d736f) SHA1(b23946fde6ea47d6a6e3430a9df4b06d453a94c8) )
 
1083
        ROM_LOAD32_BYTE( "0078", 0x000000, 0x080000, BAD_DUMP CRC(314d736f) SHA1(b23946fde6ea47d6a6e3430a9df4b06d453a94c8) ) // not dumped from this pcb, rom taken from another set instead
1061
1084
 
1062
1085
        ROM_REGION32_LE( 0x1000000, "cage", 0 ) /* TMS320C31 sound ROMs */
1063
1086
        ROM_LOAD32_WORD( "0077",  0x400000, 0x200000, CRC(8f650f8b) SHA1(e3b48ff4e2093d709134b6bf62cecd101ab5cef4) )
1227
1250
 
1228
1251
static WRITE32_HANDLER( tmek_pf_w )
1229
1252
{
1230
 
        offs_t pc = cpu_get_pc(space->cpu);
 
1253
        offs_t pc = cpu_get_pc(&space->device());
1231
1254
 
1232
1255
        /* protected version */
1233
1256
        if (pc == 0x2EB3C || pc == 0x2EB48)
1234
1257
        {
1235
 
                logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(space->cpu), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(space->cpu, M68K_A4) - 2);
 
1258
                logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space->device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space->device(), M68K_A4) - 2);
1236
1259
                /* skip these writes to make more stuff visible */
1237
1260
                return;
1238
1261
        }
1239
1262
 
1240
1263
        /* unprotected version */
1241
1264
        if (pc == 0x25834 || pc == 0x25860)
1242
 
                logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(space->cpu), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(space->cpu, M68K_A3) - 2);
 
1265
                logerror("%06X:PFW@%06X = %08X & %08X (src=%06X)\n", cpu_get_pc(&space->device()), 0xd72000 + offset*4, data, mem_mask, (UINT32)cpu_get_reg(&space->device(), M68K_A3) - 2);
1243
1266
 
1244
1267
        atarigen_playfield32_w(space, offset, data, mem_mask);
1245
1268
}
1246
1269
 
1247
1270
static DRIVER_INIT( tmek )
1248
1271
{
1249
 
        atarigt_state *state = machine->driver_data<atarigt_state>();
 
1272
        atarigt_state *state = machine.driver_data<atarigt_state>();
1250
1273
 
1251
 
        state->eeprom_default = NULL;
1252
 
        state->is_primrage = 0;
 
1274
        state->m_eeprom_default = NULL;
 
1275
        state->m_is_primrage = 0;
1253
1276
 
1254
1277
        cage_init(machine, 0x4fad);
1255
1278
        cage_set_irq_handler(cage_irq_callback);
1256
1279
 
1257
1280
        /* setup protection */
1258
 
        state->protection_r = tmek_protection_r;
1259
 
        state->protection_w = tmek_protection_w;
 
1281
        state->m_protection_r = tmek_protection_r;
 
1282
        state->m_protection_w = tmek_protection_w;
1260
1283
 
1261
1284
        /* temp hack */
1262
 
        memory_install_write32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xd72000, 0xd75fff, 0, 0, tmek_pf_w);
 
1285
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xd72000, 0xd75fff, FUNC(tmek_pf_w));
1263
1286
}
1264
1287
 
1265
1288
 
1266
 
static void primrage_init_common(running_machine *machine, offs_t cage_speedup)
 
1289
static void primrage_init_common(running_machine &machine, offs_t cage_speedup)
1267
1290
{
1268
 
        atarigt_state *state = machine->driver_data<atarigt_state>();
 
1291
        atarigt_state *state = machine.driver_data<atarigt_state>();
1269
1292
 
1270
 
        state->eeprom_default = NULL;
1271
 
        state->is_primrage = 1;
 
1293
        state->m_eeprom_default = NULL;
 
1294
        state->m_is_primrage = 1;
1272
1295
 
1273
1296
        cage_init(machine, cage_speedup);
1274
1297
        cage_set_irq_handler(cage_irq_callback);
1275
1298
 
1276
1299
        /* install protection */
1277
 
        state->protection_r = primrage_protection_r;
1278
 
        state->protection_w = primrage_protection_w;
 
1300
        state->m_protection_r = primrage_protection_r;
 
1301
        state->m_protection_w = primrage_protection_w;
1279
1302
}
1280
1303
 
1281
1304
static DRIVER_INIT( primrage ) { primrage_init_common(machine, 0x42f2); }