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

« back to all changes in this revision

Viewing changes to src/mame/drivers/mpu4.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Emmanuel Kasper, Jordi Mallach
  • Date: 2012-06-05 20:02:23 UTC
  • mfrom: (0.3.1) (0.1.4)
  • Revision ID: package-import@ubuntu.com-20120605200223-gnlpogjrg6oqe9md
Tags: 0.146-1
[ Emmanuel Kasper ]
* New upstream release
* Drop patch to fix man pages section and patches to link with flac 
  and jpeg system lib: all this has been pushed upstream by Cesare Falco
* Add DM-Upload-Allowed: yes field.

[ Jordi Mallach ]
* Create a "gnu" TARGETOS stanza that defines NO_AFFINITY_NP.
* Stop setting TARGETOS to "unix" in d/rules. It should be autodetected,
  and set to the appropriate value.
* mame_manpage_section.patch: Change mame's manpage section to 6 (games),
  in the TH declaration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
464
464
 
465
465
        /* init rom bank, some games don't set this, and will assume bank 0,set 0 */
466
466
        {
467
 
                UINT8 *rom = machine.region("maincpu")->base();
468
 
 
469
 
                memory_configure_bank(machine, "bank1", 0, 8, &rom[0x01000], 0x10000);
470
 
 
471
 
                memory_set_bank(machine, "bank1", 0);
 
467
                UINT8 *rom = state->memregion("maincpu")->base();
 
468
 
 
469
                state->membank("bank1")->configure_entries(0, 8, &rom[0x01000], 0x10000);
 
470
 
 
471
                state->membank("bank1")->set_entry(0);
472
472
                machine.device("maincpu")->reset();
473
473
        }
474
474
}
517
517
The controls for it exist however, in the form of the Soundboard PIA CB2 pin, which is
518
518
used in some cabinets instead of the main control.
519
519
*/
520
 
static WRITE8_HANDLER( bankswitch_w )
 
520
WRITE8_MEMBER(mpu4_state::bankswitch_w)
521
521
{
522
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
523
522
//  printf("bank %02x\n", data);
524
523
 
525
 
        state->m_pageval = (data & 0x03);
526
 
        memory_set_bank(space->machine(), "bank1", (state->m_pageval + (state->m_pageset ? 4 : 0)) & 0x07);
527
 
}
528
 
 
529
 
 
530
 
static READ8_HANDLER( bankswitch_r )
531
 
{
532
 
        return memory_get_bank(space->machine(), "bank1");
533
 
}
534
 
 
535
 
 
536
 
static WRITE8_HANDLER( bankset_w )
537
 
{
538
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
539
 
        state->m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
540
 
        memory_set_bank(space->machine(), "bank1", (state->m_pageval + (state->m_pageset ? 4 : 0)) & 0x07);
 
524
        m_pageval = (data & 0x03);
 
525
        membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
 
526
}
 
527
 
 
528
 
 
529
READ8_MEMBER(mpu4_state::bankswitch_r)
 
530
{
 
531
        return membank("bank1")->entry();
 
532
}
 
533
 
 
534
 
 
535
WRITE8_MEMBER(mpu4_state::bankset_w)
 
536
{
 
537
        m_pageval = (data - 2);//writes 2 and 3, to represent 0 and 1 - a hangover from the half page design?
 
538
        membank("bank1")->set_entry((m_pageval + (m_pageset ? 4 : 0)) & 0x07);
541
539
}
542
540
 
543
541
 
912
910
        }
913
911
        LOG(("%s: IC5 PIA Read of Port A (AUX1)\n",device->machine().describe_context()));
914
912
 
915
 
        return input_port_read(device->machine(), "AUX1")|state->m_aux1_input;
 
913
        return device->machine().root_device().ioport("AUX1")->read()|state->m_aux1_input;
916
914
}
917
915
 
918
916
static WRITE8_DEVICE_HANDLER( pia_ic5_porta_w )
1101
1099
        coin_lockout_w(device->machine(), 1, (pia_ic5->b_output() & 0x02) );
1102
1100
        coin_lockout_w(device->machine(), 2, (pia_ic5->b_output() & 0x04) );
1103
1101
        coin_lockout_w(device->machine(), 3, (pia_ic5->b_output() & 0x08) );
1104
 
        return input_port_read(device->machine(), "AUX2") | state->m_aux2_input;
 
1102
        return device->machine().root_device().ioport("AUX2")->read() | state->m_aux2_input;
1105
1103
}
1106
1104
 
1107
1105
 
1417
1415
/* The orange inputs are polled twice as often as the black ones, for reasons of efficiency.
1418
1416
   This is achieved via connecting every input line to an AND gate, thus allowing two strobes
1419
1417
   to represent each orange input bank (strobes are active low). */
1420
 
        pia_ic5->cb1_w(input_port_read(device->machine(), "AUX2") & 0x80);
1421
 
        return input_port_read(device->machine(), portnames[state->m_input_strobe]);
 
1418
        pia_ic5->cb1_w(device->machine().root_device().ioport("AUX2")->read() & 0x80);
 
1419
        return device->machine().root_device().ioport(portnames[state->m_input_strobe])->read();
1422
1420
}
1423
1421
 
1424
1422
 
1562
1560
        if (mstate->m_bwb_bank)
1563
1561
        {
1564
1562
                mstate->m_pageval = state;
1565
 
                memory_set_bank(device->machine(), "bank1", (mstate->m_pageval + (mstate->m_pageset ? 4 : 0)) & 0x07);
 
1563
                mstate->membank("bank1")->set_entry((mstate->m_pageval + (mstate->m_pageset ? 4 : 0)) & 0x07);
1566
1564
        }
1567
1565
}
1568
1566
 
1616
1614
/* This is a bit of a cheat - since we don't clock into the OKI chip directly, we need to
1617
1615
calculate the oscillation frequency in advance. We're running the timer for interrupt
1618
1616
purposes, but the frequency calculation is done by plucking the values out as they are written.*/
1619
 
WRITE8_HANDLER( ic3ss_w )
 
1617
WRITE8_MEMBER(mpu4_state::ic3ss_w)
1620
1618
{
1621
 
        device_t *ic3ss = space->machine().device("ptm_ic3ss");
1622
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
 
1619
        device_t *ic3ss = machine().device("ptm_ic3ss");
1623
1620
        downcast<ptm6840_device *>(ic3ss)->write(offset,data);
1624
 
        device_t *msm6376 = space->machine().device("msm6376");
 
1621
        device_t *msm6376 = machine().device("msm6376");
1625
1622
 
1626
1623
        if (offset == 3)
1627
1624
        {
1628
 
                state->m_t1 = data;
 
1625
                m_t1 = data;
1629
1626
        }
1630
1627
        if (offset == 6)
1631
1628
        {
1632
 
                state->m_t3h = data;
 
1629
                m_t3h = data;
1633
1630
        }
1634
1631
        if (offset == 7)
1635
1632
        {
1636
 
                state->m_t3l = data;
 
1633
                m_t3l = data;
1637
1634
        }
1638
1635
 
1639
 
        float num = (1720000/((state->m_t3l + 1)*(state->m_t3h + 1)));
1640
 
        float denom1 = ((state->m_t3h *(state->m_t3l + 1)+ 1)/(2*(state->m_t1 + 1)));
 
1636
        float num = (1720000/((m_t3l + 1)*(m_t3h + 1)));
 
1637
        float denom1 = ((m_t3h *(m_t3l + 1)+ 1)/(2*(m_t1 + 1)));
1641
1638
 
1642
1639
        int denom2 = denom1 +0.5;//need to round up, this gives same precision as chip
1643
1640
        int freq=num*denom2;
2357
2354
*/
2358
2355
 
2359
2356
 
2360
 
static WRITE8_HANDLER( characteriser_w )
 
2357
WRITE8_MEMBER(mpu4_state::characteriser_w)
2361
2358
{
2362
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
2363
2359
        int x;
2364
2360
        int call=data;
2365
 
        LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space->device()),offset,data));
2366
 
        if (!state->m_current_chr_table)
 
2361
        LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", cpu_get_previouspc(&space.device()),offset,data));
 
2362
        if (!m_current_chr_table)
2367
2363
        {
2368
 
                logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
 
2364
                logerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
2369
2365
                return;
2370
2366
        }
2371
2367
 
2376
2372
                {
2377
2373
                        if (call == 0)
2378
2374
                        {
2379
 
                                state->m_prot_col = 0;
 
2375
                                m_prot_col = 0;
2380
2376
                        }
2381
2377
                        else
2382
2378
                        {
2383
 
                                for (x = state->m_prot_col; x < 64; x++)
 
2379
                                for (x = m_prot_col; x < 64; x++)
2384
2380
                                {
2385
 
                                        if      (state->m_current_chr_table[(x)].call == call)
 
2381
                                        if      (m_current_chr_table[(x)].call == call)
2386
2382
                                        {
2387
 
                                                state->m_prot_col = x;
2388
 
                                                LOG_CHR(("Characteriser find column %02X\n",state->m_prot_col));
 
2383
                                                m_prot_col = x;
 
2384
                                                LOG_CHR(("Characteriser find column %02X\n",m_prot_col));
2389
2385
                                                break;
2390
2386
                                        }
2391
2387
                                }
2399
2395
                // Rather than the search strategy, we can map the calls directly here. Note that they are hex versions of the square number series
2400
2396
                {
2401
2397
                        case 0x00:
2402
 
                        state->m_lamp_col = 0;
 
2398
                        m_lamp_col = 0;
2403
2399
                        break;
2404
2400
                        case 0x01:
2405
 
                        state->m_lamp_col = 1;
 
2401
                        m_lamp_col = 1;
2406
2402
                        break;
2407
2403
                        case 0x04:
2408
 
                        state->m_lamp_col = 2;
 
2404
                        m_lamp_col = 2;
2409
2405
                        break;
2410
2406
                        case 0x09:
2411
 
                        state->m_lamp_col = 3;
 
2407
                        m_lamp_col = 3;
2412
2408
                        break;
2413
2409
                        case 0x10:
2414
 
                        state->m_lamp_col = 4;
 
2410
                        m_lamp_col = 4;
2415
2411
                        break;
2416
2412
                        case 0x19:
2417
 
                        state->m_lamp_col = 5;
 
2413
                        m_lamp_col = 5;
2418
2414
                        break;
2419
2415
                        case 0x24:
2420
 
                        state->m_lamp_col = 6;
 
2416
                        m_lamp_col = 6;
2421
2417
                        break;
2422
2418
                        case 0x31:
2423
 
                        state->m_lamp_col = 7;
 
2419
                        m_lamp_col = 7;
2424
2420
                        break;
2425
2421
                }
2426
 
                LOG_CHR(("Characteriser find 2 column %02X\n",state->m_lamp_col));
 
2422
                LOG_CHR(("Characteriser find 2 column %02X\n",m_lamp_col));
2427
2423
        }
2428
2424
}
2429
2425
 
2430
2426
 
2431
 
static READ8_HANDLER( characteriser_r )
 
2427
READ8_MEMBER(mpu4_state::characteriser_r)
2432
2428
{
2433
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
2434
 
        if (!state->m_current_chr_table)
 
2429
        if (!m_current_chr_table)
2435
2430
        {
2436
 
                logerror("No Characteriser Table @ %04x", cpu_get_previouspc(&space->device()));
 
2431
                logerror("No Characteriser Table @ %04x", cpu_get_previouspc(&space.device()));
2437
2432
 
2438
2433
                /* a cheat ... many early games use a standard check */
2439
 
                int addr = cpu_get_reg(&space->device(), M6809_X);
 
2434
                int addr = cpu_get_reg(&space.device(), M6809_X);
2440
2435
                if ((addr>=0x800) && (addr<=0xfff)) return 0x00; // prevent recursion, only care about ram/rom areas for this cheat.
2441
2436
 
2442
 
                UINT8 ret = space->read_byte(addr);
 
2437
                UINT8 ret = space.read_byte(addr);
2443
2438
                logerror(" (returning %02x)",ret);
2444
2439
 
2445
2440
                logerror("\n");
2450
2445
        LOG_CHR(("Characteriser read offset %02X \n",offset));
2451
2446
        if (offset == 0)
2452
2447
        {
2453
 
                LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_prot_col].response));
2454
 
                return state->m_current_chr_table[state->m_prot_col].response;
 
2448
                LOG_CHR(("Characteriser read data %02X \n",m_current_chr_table[m_prot_col].response));
 
2449
                return m_current_chr_table[m_prot_col].response;
2455
2450
        }
2456
2451
        if (offset == 3)
2457
2452
        {
2458
 
                LOG_CHR(("Characteriser read data off 3 %02X \n",state->m_current_chr_table[state->m_lamp_col+64].response));
2459
 
                return state->m_current_chr_table[state->m_lamp_col+64].response;
 
2453
                LOG_CHR(("Characteriser read data off 3 %02X \n",m_current_chr_table[m_lamp_col+64].response));
 
2454
                return m_current_chr_table[m_lamp_col+64].response;
2460
2455
        }
2461
2456
        return 0;
2462
2457
}
2499
2494
*/
2500
2495
 
2501
2496
 
2502
 
static WRITE8_HANDLER( bwb_characteriser_w )
 
2497
WRITE8_MEMBER(mpu4_state::bwb_characteriser_w)
2503
2498
{
2504
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
2505
2499
        int x;
2506
2500
        int call=data;
2507
 
        LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space->device()),offset,data));
2508
 
        if (!state->m_current_chr_table)
2509
 
                fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space->device()));
 
2501
        LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", cpu_get_previouspc(&space.device()),offset,data));
 
2502
        if (!m_current_chr_table)
 
2503
                fatalerror("No Characteriser Table @ %04x\n", cpu_get_previouspc(&space.device()));
2510
2504
 
2511
2505
        if ((offset & 0x3f)== 0)//initialisation is always at 0x800
2512
2506
        {
2513
 
                if (!state->m_chr_state)
 
2507
                if (!m_chr_state)
2514
2508
                {
2515
 
                        state->m_chr_state=1;
2516
 
                        state->m_chr_counter=0;
 
2509
                        m_chr_state=1;
 
2510
                        m_chr_counter=0;
2517
2511
                }
2518
2512
                if (call == 0)
2519
2513
                {
2520
 
                        state->m_init_col ++;
 
2514
                        m_init_col ++;
2521
2515
                }
2522
2516
                else
2523
2517
                {
2524
 
                        state->m_init_col =0;
 
2518
                        m_init_col =0;
2525
2519
                }
2526
2520
        }
2527
2521
 
2528
 
        state->m_chr_value = space->machine().rand();
 
2522
        m_chr_value = machine().rand();
2529
2523
        for (x = 0; x < 4; x++)
2530
2524
        {
2531
 
                if      (state->m_current_chr_table[(x)].call == call)
 
2525
                if      (m_current_chr_table[(x)].call == call)
2532
2526
                {
2533
2527
                        if (x == 0) // reinit
2534
2528
                        {
2535
 
                                state->m_bwb_return = 0;
 
2529
                                m_bwb_return = 0;
2536
2530
                        }
2537
 
                        state->m_chr_value = bwb_chr_table_common[(state->m_bwb_return)];
2538
 
                        state->m_bwb_return++;
 
2531
                        m_chr_value = bwb_chr_table_common[(m_bwb_return)];
 
2532
                        m_bwb_return++;
2539
2533
                        break;
2540
2534
                }
2541
2535
        }
2542
2536
}
2543
2537
 
2544
 
static READ8_HANDLER( bwb_characteriser_r )
 
2538
READ8_MEMBER(mpu4_state::bwb_characteriser_r)
2545
2539
{
2546
 
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
2547
2540
 
2548
2541
        LOG_CHR(("Characteriser read offset %02X \n",offset));
2549
2542
 
2550
2543
 
2551
2544
        if (offset ==0)
2552
2545
        {
2553
 
                switch (state->m_chr_counter)
 
2546
                switch (m_chr_counter)
2554
2547
                {
2555
2548
                        case 6:
2556
2549
                        case 13:
2558
2551
                        case 27:
2559
2552
                        case 34:
2560
2553
                        {
2561
 
                                return state->m_bwb_chr_table1[(((state->m_chr_counter + 1) / 7) - 1)].response;
 
2554
                                return m_bwb_chr_table1[(((m_chr_counter + 1) / 7) - 1)].response;
2562
2555
                                break;
2563
2556
                        }
2564
2557
                        default:
2565
2558
                        {
2566
 
                                if (state->m_chr_counter > 34)
 
2559
                                if (m_chr_counter > 34)
2567
2560
                                {
2568
 
                                        state->m_chr_counter = 35;
2569
 
                                        state->m_chr_state = 2;
 
2561
                                        m_chr_counter = 35;
 
2562
                                        m_chr_state = 2;
2570
2563
                                }
2571
 
                                state->m_chr_counter ++;
2572
 
                                return state->m_chr_value;
 
2564
                                m_chr_counter ++;
 
2565
                                return m_chr_value;
2573
2566
                        }
2574
2567
                }
2575
2568
        }
2576
2569
        else
2577
2570
        {
2578
 
                return state->m_chr_value;
 
2571
                return m_chr_value;
2579
2572
        }
2580
2573
}
2581
2574
 
2582
2575
/* Common configurations */
2583
2576
 
2584
 
static WRITE8_HANDLER( mpu4_ym2413_w )
 
2577
WRITE8_MEMBER(mpu4_state::mpu4_ym2413_w)
2585
2578
{
2586
 
        device_t *ym = space->machine().device("ym2413");
 
2579
        device_t *ym = machine().device("ym2413");
2587
2580
        if (ym) ym2413_w(ym,offset,data);
2588
2581
}
2589
2582
 
2590
 
static READ8_HANDLER( mpu4_ym2413_r )
 
2583
READ8_MEMBER(mpu4_state::mpu4_ym2413_r)
2591
2584
{
2592
 
//  device_t *ym = space->machine().device("ym2413");
 
2585
//  device_t *ym = machine().device("ym2413");
2593
2586
//  return ym2413_read(ym,offset);
2594
2587
        return 0xff;
2595
2588
}
2597
2590
 
2598
2591
void mpu4_install_mod4yam_space(address_space *space)
2599
2592
{
2600
 
        space->install_legacy_read_handler(0x0880, 0x0882, FUNC(mpu4_ym2413_r));
2601
 
        space->install_legacy_write_handler(0x0880, 0x0881, FUNC(mpu4_ym2413_w));
 
2593
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
 
2594
        space->install_read_handler(0x0880, 0x0882, read8_delegate(FUNC(mpu4_state::mpu4_ym2413_r),state));
 
2595
        space->install_write_handler(0x0880, 0x0881, write8_delegate(FUNC(mpu4_state::mpu4_ym2413_w),state));
2602
2596
}
2603
2597
 
2604
2598
void mpu4_install_mod4oki_space(address_space *space)
2605
2599
{
 
2600
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
2606
2601
        pia6821_device *pia_ic4ss = space->machine().device<pia6821_device>("pia_ic4ss");
2607
2602
        ptm6840_device *ptm_ic3ss = space->machine().device<ptm6840_device>("ptm_ic3ss");
2608
2603
 
2609
2604
        space->install_readwrite_handler(0x0880, 0x0883, 0, 0, read8_delegate(FUNC(pia6821_device::read), pia_ic4ss), write8_delegate(FUNC(pia6821_device::write), pia_ic4ss));
2610
2605
        space->install_read_handler(0x08c0, 0x08c7, 0, 0, read8_delegate(FUNC(ptm6840_device::read), ptm_ic3ss));
2611
 
        space->install_legacy_write_handler(0x08c0, 0x08c7, 0, 0, FUNC(ic3ss_w));
 
2606
        space->install_write_handler(0x08c0, 0x08c7, 0, 0, write8_delegate(FUNC(mpu4_state::ic3ss_w),state));
2612
2607
}
2613
2608
 
2614
2609
void mpu4_install_mod4bwb_space(address_space *space)
2615
2610
{
2616
 
        space->install_legacy_readwrite_handler(0x0810, 0x0810, 0, 0, FUNC(bwb_characteriser_r),FUNC(bwb_characteriser_w));
 
2611
        mpu4_state *state = space->machine().driver_data<mpu4_state>();
 
2612
        space->install_readwrite_handler(0x0810, 0x0810, 0, 0, read8_delegate(FUNC(mpu4_state::bwb_characteriser_r),state),write8_delegate(FUNC(mpu4_state::bwb_characteriser_w),state));
2617
2613
        mpu4_install_mod4oki_space(space);
2618
2614
}
2619
2615
 
2639
2635
        {
2640
2636
                stepper_config(machine, n, &barcrest_reel_interface);
2641
2637
        }
2642
 
        awp_reel_setup();
2643
2638
}
2644
2639
 
2645
2640
MACHINE_START( mod2     )
2779
2774
        stepper_config(machine, 4, &barcrest_opto1_interface);
2780
2775
        stepper_config(machine, 5, &barcrest_opto1_interface);
2781
2776
 
2782
 
        awp_reel_setup();
2783
2777
        state->m_current_chr_table = oldtmr_data;
2784
2778
}
2785
2779
 
2872
2866
        mpu4_state *state = machine.driver_data<mpu4_state>();
2873
2867
        DRIVER_INIT_CALL(m4default);
2874
2868
        state->m_bwb_bank=1;
2875
 
        space->install_legacy_write_handler(0x0858, 0x0858, 0, 0, FUNC(bankswitch_w));
2876
 
        space->install_legacy_write_handler(0x0878, 0x0878, 0, 0, FUNC(bankset_w));
 
2869
        space->install_write_handler(0x0858, 0x0858, 0, 0, write8_delegate(FUNC(mpu4_state::bankswitch_w),state));
 
2870
        space->install_write_handler(0x0878, 0x0878, 0, 0, write8_delegate(FUNC(mpu4_state::bankset_w),state));
2877
2871
}
2878
2872
 
2879
 
static READ8_HANDLER( crystal_sound_r )
 
2873
READ8_MEMBER(mpu4_state::crystal_sound_r)
2880
2874
{
2881
 
        return space->machine().rand();
 
2875
        return machine().rand();
2882
2876
}
2883
2877
 
2884
 
static WRITE8_HANDLER( crystal_sound_w )
 
2878
WRITE8_MEMBER(mpu4_state::crystal_sound_w)
2885
2879
{
2886
2880
        printf("crystal_sound_w %02x\n",data);
2887
2881
}
2889
2883
static DRIVER_INIT (m_frkstn)
2890
2884
{
2891
2885
        address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
2892
 
 
 
2886
        mpu4_state *state = machine.driver_data<mpu4_state>();
2893
2887
        DRIVER_INIT_CALL(m4default_bigbank);
2894
 
        space->install_legacy_read_handler(0x0880, 0x0880, 0, 0, FUNC(crystal_sound_r));
2895
 
        space->install_legacy_write_handler(0x0881, 0x0881, 0, 0, FUNC(crystal_sound_w));
 
2888
        space->install_read_handler(0x0880, 0x0880, 0, 0, read8_delegate(FUNC(mpu4_state::crystal_sound_r),state));
 
2889
        space->install_write_handler(0x0881, 0x0881, 0, 0, write8_delegate(FUNC(mpu4_state::crystal_sound_w),state));
2896
2890
}
2897
2891
 
2898
2892
/* generate a 50 Hz signal (based on an RC time) */
2908
2902
        update_meters(state);//run at 100Hz to sync with PIAs
2909
2903
}
2910
2904
 
2911
 
static ADDRESS_MAP_START( mpu4_memmap, AS_PROGRAM, 8 )
 
2905
static ADDRESS_MAP_START( mpu4_memmap, AS_PROGRAM, 8, mpu4_state )
2912
2906
        AM_RANGE(0x0000, 0x07ff) AM_RAM AM_SHARE("nvram")
2913
2907
        AM_RANGE(0x0800, 0x0810) AM_READWRITE(characteriser_r,characteriser_w)
2914
2908
        AM_RANGE(0x0850, 0x0850) AM_READWRITE(bankswitch_r,bankswitch_w)        /* write bank (rom page select) */
2915
 
/*  AM_RANGE(0x08e0, 0x08e7) AM_READWRITE(68681_duart_r,68681_duart_w) */ //Runs hoppers
2916
 
        AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE_MODERN("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
2917
 
        AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE_MODERN("pia_ic3", pia6821_device, read, write)         /* PIA6821 IC3 */
2918
 
        AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE_MODERN("pia_ic4", pia6821_device, read, write)         /* PIA6821 IC4 */
2919
 
        AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE_MODERN("pia_ic5", pia6821_device, read, write)         /* PIA6821 IC5 */
2920
 
        AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE_MODERN("pia_ic6", pia6821_device, read, write)         /* PIA6821 IC6 */
2921
 
        AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE_MODERN("pia_ic7", pia6821_device, read, write)         /* PIA6821 IC7 */
2922
 
        AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE_MODERN("pia_ic8", pia6821_device, read, write)         /* PIA6821 IC8 */
 
2909
/*  AM_RANGE(0x08e0, 0x08e7) AM_READWRITE_LEGACY(68681_duart_r,68681_duart_w) */ //Runs hoppers
 
2910
        AM_RANGE(0x0900, 0x0907) AM_DEVREADWRITE("ptm_ic2", ptm6840_device, read, write)/* PTM6840 IC2 */
 
2911
        AM_RANGE(0x0a00, 0x0a03) AM_DEVREADWRITE("pia_ic3", pia6821_device, read, write)                /* PIA6821 IC3 */
 
2912
        AM_RANGE(0x0b00, 0x0b03) AM_DEVREADWRITE("pia_ic4", pia6821_device, read, write)                /* PIA6821 IC4 */
 
2913
        AM_RANGE(0x0c00, 0x0c03) AM_DEVREADWRITE("pia_ic5", pia6821_device, read, write)                /* PIA6821 IC5 */
 
2914
        AM_RANGE(0x0d00, 0x0d03) AM_DEVREADWRITE("pia_ic6", pia6821_device, read, write)                /* PIA6821 IC6 */
 
2915
        AM_RANGE(0x0e00, 0x0e03) AM_DEVREADWRITE("pia_ic7", pia6821_device, read, write)                /* PIA6821 IC7 */
 
2916
        AM_RANGE(0x0f00, 0x0f03) AM_DEVREADWRITE("pia_ic8", pia6821_device, read, write)                /* PIA6821 IC8 */
2923
2917
        AM_RANGE(0x1000, 0xffff) AM_ROMBANK("bank1")    /* 64k  paged ROM (4 pages)  */
2924
2918
ADDRESS_MAP_END
2925
2919
 
10887
10881
        ROM_LOAD( "sv_20a__.4_1", 0x0000, 0x020000, CRC(0e790ae8) SHA1(48f055f3f1f5d3392b7fba1c5c30624c1f230327) )
10888
10882
        ROM_LOAD( "sv_20sb_.4_1", 0x0000, 0x020000, CRC(e88c1c29) SHA1(49d180068e4ae9cb65a58e65b4e1ac4d6657ae1d) )
10889
10883
        ROM_LOAD( "svi20___.4_1", 0x0000, 0x020000, CRC(643037ed) SHA1(d4063faba3069625474dd761f9ad2dcf2f710a19) )
 
10884
        ROM_LOAD( "sinbadbwb1_1game.bin", 0x0000, 0x020000, CRC(cfe152a7) SHA1(b8ecfa8b763d04515b65eb902c18dba7198191c3) )
10890
10885
 
10891
10886
        ROM_REGION( 0x180000, "msm6376", ROMREGION_ERASE00 )
10892
 
        /* missing? */
 
10887
        //These were with the last listed set, though I have no reason to believe they aren't valid for all BwB Sinbad games
 
10888
        ROM_LOAD( "sinbadbwb1_2snd.bin", 0x000000, 0x080000, CRC(2ee60ce6) SHA1(865860639e8471f97ace0beac2f4c7fddb8ca97c) )
 
10889
        ROM_LOAD( "sinbadbwb1_3snd.bin", 0x000000, 0x080000, CRC(7701e5cc) SHA1(4f9ff91f2b6b15a9c08396b52fc8509ba476ed8d) )
10893
10890
ROM_END
10894
10891
 
10895
10892
 
15234
15231
DRIVER_INIT( crystal )
15235
15232
{
15236
15233
        DRIVER_INIT_CALL(m_frkstn);
15237
 
        descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
 
15234
        descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0x00);
15238
15235
}
15239
15236
 
15240
15237
DRIVER_INIT( crystali )
15241
15238
{
15242
15239
        DRIVER_INIT_CALL(m_frkstn);
15243
 
        descramble_crystal(machine.region( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
 
15240
        descramble_crystal(machine.root_device().memregion( "maincpu" )->base(), 0x0000, 0x10000, 0xff); // invert after decrypt?!
15244
15241
}
15245
15242
 
15246
15243