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

« back to all changes in this revision

Viewing changes to src/mame/drivers/taitogn.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:
357
357
 
358
358
        UINT32 m_coin_info;
359
359
        UINT32 m_mux_data;
 
360
        DECLARE_WRITE32_MEMBER(rf5c296_io_w);
 
361
        DECLARE_READ32_MEMBER(rf5c296_io_r);
 
362
        DECLARE_READ32_MEMBER(rf5c296_mem_r);
 
363
        DECLARE_WRITE32_MEMBER(rf5c296_mem_w);
 
364
        DECLARE_READ32_MEMBER(flash_subbios_r);
 
365
        DECLARE_WRITE32_MEMBER(flash_subbios_w);
 
366
        DECLARE_READ32_MEMBER(flash_mn102_r);
 
367
        DECLARE_WRITE32_MEMBER(flash_mn102_w);
 
368
        DECLARE_READ32_MEMBER(flash_s1_r);
 
369
        DECLARE_WRITE32_MEMBER(flash_s1_w);
 
370
        DECLARE_READ32_MEMBER(flash_s2_r);
 
371
        DECLARE_WRITE32_MEMBER(flash_s2_w);
 
372
        DECLARE_READ32_MEMBER(flash_s3_r);
 
373
        DECLARE_WRITE32_MEMBER(flash_s3_w);
 
374
        DECLARE_READ32_MEMBER(control_r);
 
375
        DECLARE_WRITE32_MEMBER(control_w);
 
376
        DECLARE_WRITE32_MEMBER(control2_w);
 
377
        DECLARE_READ32_MEMBER(control3_r);
 
378
        DECLARE_WRITE32_MEMBER(control3_w);
 
379
        DECLARE_READ32_MEMBER(gn_1fb70000_r);
 
380
        DECLARE_WRITE32_MEMBER(gn_1fb70000_w);
 
381
        DECLARE_READ32_MEMBER(hack1_r);
 
382
        DECLARE_READ32_MEMBER(znsecsel_r);
 
383
        DECLARE_WRITE32_MEMBER(znsecsel_w);
 
384
        DECLARE_READ32_MEMBER(boardconfig_r);
 
385
        DECLARE_WRITE32_MEMBER(coin_w);
 
386
        DECLARE_READ32_MEMBER(coin_r);
 
387
        DECLARE_READ32_MEMBER(gnet_mahjong_panel_r);
360
388
};
361
389
 
362
390
 
390
418
        return 0x00;
391
419
}
392
420
 
393
 
static WRITE32_HANDLER(rf5c296_io_w)
 
421
WRITE32_MEMBER(taitogn_state::rf5c296_io_w)
394
422
{
395
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
396
423
 
397
424
        if(offset < 2) {
398
 
                ide_controller32_pcmcia_w(space->machine().device(":card"), offset, data, mem_mask);
 
425
                ide_controller32_pcmcia_w(machine().device(":card"), offset, data, mem_mask);
399
426
                return;
400
427
        }
401
428
 
402
429
        if(offset == 0x3e0/4) {
403
430
                if(ACCESSING_BITS_0_7)
404
 
                        state->m_rf5c296_reg = data;
 
431
                        m_rf5c296_reg = data;
405
432
                if(ACCESSING_BITS_8_15)
406
 
                        rf5c296_reg_w(space->machine(), state->m_rf5c296_reg, data >> 8);
 
433
                        rf5c296_reg_w(machine(), m_rf5c296_reg, data >> 8);
407
434
        }
408
435
}
409
436
 
410
 
static READ32_HANDLER(rf5c296_io_r)
 
437
READ32_MEMBER(taitogn_state::rf5c296_io_r)
411
438
{
412
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
413
439
 
414
440
        if(offset < 2)
415
 
                return ide_controller32_pcmcia_r(space->machine().device(":card"), offset, mem_mask);
 
441
                return ide_controller32_pcmcia_r(machine().device(":card"), offset, mem_mask);
416
442
 
417
443
        offset *= 4;
418
444
 
419
445
        if(offset == 0x3e0/4) {
420
446
                UINT32 res = 0xffff0000;
421
447
                if(ACCESSING_BITS_0_7)
422
 
                        res |= state->m_rf5c296_reg;
 
448
                        res |= m_rf5c296_reg;
423
449
                if(ACCESSING_BITS_8_15)
424
 
                        res |= rf5c296_reg_r(space->machine(), state->m_rf5c296_reg) << 8;
 
450
                        res |= rf5c296_reg_r(machine(), m_rf5c296_reg) << 8;
425
451
                return res;
426
452
        }
427
453
 
430
456
 
431
457
// Hardcoded to reach the pcmcia CIS
432
458
 
433
 
static READ32_HANDLER(rf5c296_mem_r)
 
459
READ32_MEMBER(taitogn_state::rf5c296_mem_r)
434
460
{
435
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
436
461
 
437
462
        if(offset < 0x80)
438
 
                return (state->m_cis[offset*2+1] << 16) | state->m_cis[offset*2];
 
463
                return (m_cis[offset*2+1] << 16) | m_cis[offset*2];
439
464
 
440
465
        switch(offset) {
441
466
        case 0x080: return 0x00800041;
442
467
        case 0x081: return 0x0000002e;
443
 
        case 0x100: return state->m_locked ? 0x00010000 : 0;
 
468
        case 0x100: return m_locked ? 0x00010000 : 0;
444
469
        default:
445
470
                return 0;
446
471
        }
447
472
}
448
473
 
449
 
static WRITE32_HANDLER(rf5c296_mem_w)
 
474
WRITE32_MEMBER(taitogn_state::rf5c296_mem_w)
450
475
{
451
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
452
476
 
453
477
        if(offset >= 0x140 && offset <= 0x144) {
454
 
                UINT8 key[5];
 
478
                dynamic_buffer key;
 
479
 
455
480
                int pos = (offset - 0x140)*2;
456
481
                UINT8 v, k;
457
482
                if(ACCESSING_BITS_16_23) {
459
484
                        pos++;
460
485
                } else
461
486
                        v = data;
462
 
                chd_get_metadata(get_disk_handle(space->machine(), ":card"), HARD_DISK_KEY_METADATA_TAG, 0, key, 5, 0, 0, 0);
463
 
                k = pos < 5 ? key[pos] : 0;
 
487
                get_disk_handle(machine(), ":drive_0")->read_metadata(HARD_DISK_KEY_METADATA_TAG, 0, key);
 
488
                k = pos < key.count() ? key[pos] : 0;
464
489
                if(v == k)
465
 
                        state->m_locked &= ~(1 << pos);
 
490
                        m_locked &= ~(1 << pos);
466
491
                else
467
 
                        state->m_locked |= 1 << pos;
468
 
                if (!state->m_locked) {
469
 
                        ide_set_gnet_readlock (space->machine().device(":card"), 0);
 
492
                        m_locked |= 1 << pos;
 
493
                if (!m_locked) {
 
494
                        ide_set_gnet_readlock (machine().device(":card"), 0);
470
495
                }
471
496
        }
472
497
}
495
520
}
496
521
 
497
522
 
498
 
static READ32_HANDLER(flash_subbios_r)
499
 
{
500
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
501
 
 
502
 
        return gen_flash_r(state->m_biosflash, offset, mem_mask);
503
 
}
504
 
 
505
 
static WRITE32_HANDLER(flash_subbios_w)
506
 
{
507
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
508
 
 
509
 
        gen_flash_w(state->m_biosflash, offset, data, mem_mask);
510
 
}
511
 
 
512
 
static READ32_HANDLER(flash_mn102_r)
513
 
{
514
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
515
 
 
516
 
        return gen_flash_r(state->m_pgmflash, offset, mem_mask);
517
 
}
518
 
 
519
 
static WRITE32_HANDLER(flash_mn102_w)
520
 
{
521
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
522
 
 
523
 
        gen_flash_w(state->m_pgmflash, offset, data, mem_mask);
524
 
}
525
 
 
526
 
static READ32_HANDLER(flash_s1_r)
527
 
{
528
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
529
 
 
530
 
        return gen_flash_r(state->m_sndflash[0], offset, mem_mask);
531
 
}
532
 
 
533
 
static WRITE32_HANDLER(flash_s1_w)
534
 
{
535
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
536
 
 
537
 
        gen_flash_w(state->m_sndflash[0], offset, data, mem_mask);
538
 
}
539
 
 
540
 
static READ32_HANDLER(flash_s2_r)
541
 
{
542
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
543
 
 
544
 
        return gen_flash_r(state->m_sndflash[1], offset, mem_mask);
545
 
}
546
 
 
547
 
static WRITE32_HANDLER(flash_s2_w)
548
 
{
549
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
550
 
 
551
 
        gen_flash_w(state->m_sndflash[1], offset, data, mem_mask);
552
 
}
553
 
 
554
 
static READ32_HANDLER(flash_s3_r)
555
 
{
556
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
557
 
 
558
 
        return gen_flash_r(state->m_sndflash[2], offset, mem_mask);
559
 
}
560
 
 
561
 
static WRITE32_HANDLER(flash_s3_w)
562
 
{
563
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
564
 
 
565
 
        gen_flash_w(state->m_sndflash[2], offset, data, mem_mask);
 
523
READ32_MEMBER(taitogn_state::flash_subbios_r)
 
524
{
 
525
 
 
526
        return gen_flash_r(m_biosflash, offset, mem_mask);
 
527
}
 
528
 
 
529
WRITE32_MEMBER(taitogn_state::flash_subbios_w)
 
530
{
 
531
 
 
532
        gen_flash_w(m_biosflash, offset, data, mem_mask);
 
533
}
 
534
 
 
535
READ32_MEMBER(taitogn_state::flash_mn102_r)
 
536
{
 
537
 
 
538
        return gen_flash_r(m_pgmflash, offset, mem_mask);
 
539
}
 
540
 
 
541
WRITE32_MEMBER(taitogn_state::flash_mn102_w)
 
542
{
 
543
 
 
544
        gen_flash_w(m_pgmflash, offset, data, mem_mask);
 
545
}
 
546
 
 
547
READ32_MEMBER(taitogn_state::flash_s1_r)
 
548
{
 
549
 
 
550
        return gen_flash_r(m_sndflash[0], offset, mem_mask);
 
551
}
 
552
 
 
553
WRITE32_MEMBER(taitogn_state::flash_s1_w)
 
554
{
 
555
 
 
556
        gen_flash_w(m_sndflash[0], offset, data, mem_mask);
 
557
}
 
558
 
 
559
READ32_MEMBER(taitogn_state::flash_s2_r)
 
560
{
 
561
 
 
562
        return gen_flash_r(m_sndflash[1], offset, mem_mask);
 
563
}
 
564
 
 
565
WRITE32_MEMBER(taitogn_state::flash_s2_w)
 
566
{
 
567
 
 
568
        gen_flash_w(m_sndflash[1], offset, data, mem_mask);
 
569
}
 
570
 
 
571
READ32_MEMBER(taitogn_state::flash_s3_r)
 
572
{
 
573
 
 
574
        return gen_flash_r(m_sndflash[2], offset, mem_mask);
 
575
}
 
576
 
 
577
WRITE32_MEMBER(taitogn_state::flash_s3_w)
 
578
{
 
579
 
 
580
        gen_flash_w(m_sndflash[2], offset, data, mem_mask);
566
581
}
567
582
 
568
583
static void install_handlers(running_machine &machine, int mode)
569
584
{
 
585
        taitogn_state *state = machine.driver_data<taitogn_state>();
570
586
        address_space *a = machine.device("maincpu")->memory().space(AS_PROGRAM);
571
587
        if(mode == 0) {
572
588
                // Mode 0 has access to the subbios, the mn102 flash and the rf5c296 mem zone
573
 
                a->install_legacy_readwrite_handler(0x1f000000, 0x1f1fffff, FUNC(flash_subbios_r), FUNC(flash_subbios_w));
574
 
                a->install_legacy_readwrite_handler(0x1f200000, 0x1f2fffff, FUNC(rf5c296_mem_r), FUNC(rf5c296_mem_w));
575
 
                a->install_legacy_readwrite_handler(0x1f300000, 0x1f37ffff, FUNC(flash_mn102_r), FUNC(flash_mn102_w));
 
589
                a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_subbios_r),state), write32_delegate(FUNC(taitogn_state::flash_subbios_w),state));
 
590
                a->install_readwrite_handler(0x1f200000, 0x1f2fffff, read32_delegate(FUNC(taitogn_state::rf5c296_mem_r),state), write32_delegate(FUNC(taitogn_state::rf5c296_mem_w),state));
 
591
                a->install_readwrite_handler(0x1f300000, 0x1f37ffff, read32_delegate(FUNC(taitogn_state::flash_mn102_r),state), write32_delegate(FUNC(taitogn_state::flash_mn102_w),state));
576
592
                a->nop_readwrite(0x1f380000, 0x1f5fffff);
577
593
 
578
594
        } else {
579
595
                // Mode 1 has access to the 3 samples flashes
580
 
                a->install_legacy_readwrite_handler(0x1f000000, 0x1f1fffff, FUNC(flash_s1_r), FUNC(flash_s1_w));
581
 
                a->install_legacy_readwrite_handler(0x1f200000, 0x1f3fffff, FUNC(flash_s2_r), FUNC(flash_s2_w));
582
 
                a->install_legacy_readwrite_handler(0x1f400000, 0x1f5fffff, FUNC(flash_s3_r), FUNC(flash_s3_w));
 
596
                a->install_readwrite_handler(0x1f000000, 0x1f1fffff, read32_delegate(FUNC(taitogn_state::flash_s1_r),state), write32_delegate(FUNC(taitogn_state::flash_s1_w),state));
 
597
                a->install_readwrite_handler(0x1f200000, 0x1f3fffff, read32_delegate(FUNC(taitogn_state::flash_s2_r),state), write32_delegate(FUNC(taitogn_state::flash_s2_w),state));
 
598
                a->install_readwrite_handler(0x1f400000, 0x1f5fffff, read32_delegate(FUNC(taitogn_state::flash_s3_r),state), write32_delegate(FUNC(taitogn_state::flash_s3_w),state));
583
599
        }
584
600
}
585
601
 
586
602
// Misc. controls
587
603
 
588
 
static READ32_HANDLER(control_r)
 
604
READ32_MEMBER(taitogn_state::control_r)
589
605
{
590
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
591
606
 
592
 
        //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, space->machine().describe_context());
593
 
        return state->m_control;
 
607
        //      fprintf(stderr, "gn_r %08x @ %08x (%s)\n", 0x1fb00000+4*offset, mem_mask, machine().describe_context());
 
608
        return m_control;
594
609
}
595
610
 
596
 
static WRITE32_HANDLER(control_w)
 
611
WRITE32_MEMBER(taitogn_state::control_w)
597
612
{
598
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
599
613
 
600
614
        // 20 = watchdog
601
615
        // 04 = select bank
603
617
        // According to the rom code, bits 1-0 may be part of the bank
604
618
        // selection too, but they're always 0.
605
619
 
606
 
        UINT32 p = state->m_control;
607
 
        device_t *mb3773 = space->machine().device("mb3773");
608
 
 
609
 
        COMBINE_DATA(&state->m_control);
610
 
 
611
 
        mb3773_set_ck(mb3773, (state->m_control & 0x20) >> 5);
 
620
        UINT32 p = m_control;
 
621
        device_t *mb3773 = machine().device("mb3773");
 
622
 
 
623
        COMBINE_DATA(&m_control);
 
624
 
 
625
        mb3773_set_ck(mb3773, (m_control & 0x20) >> 5);
612
626
 
613
627
#if 0
614
628
        if((p ^ control) & ~0x20)
620
634
                                control & 0x04 ? 'f' : '-',
621
635
                                control & 0x02 ? '1' : '0',
622
636
                                control & 0x01 ? '1' : '0',
623
 
                                space->machine().describe_context());
 
637
                                machine().describe_context());
624
638
#endif
625
639
 
626
 
        if((p ^ state->m_control) & 0x04)
627
 
                install_handlers(space->machine(), state->m_control & 4 ? 1 : 0);
628
 
}
629
 
 
630
 
static WRITE32_HANDLER(control2_w)
631
 
{
632
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
633
 
 
634
 
        COMBINE_DATA(&state->m_control2);
635
 
}
636
 
 
637
 
static READ32_HANDLER(control3_r)
638
 
{
639
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
640
 
 
641
 
        return state->m_control3;
642
 
}
643
 
 
644
 
static WRITE32_HANDLER(control3_w)
645
 
{
646
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
647
 
 
648
 
        COMBINE_DATA(&state->m_control3);
649
 
}
650
 
 
651
 
static READ32_HANDLER(gn_1fb70000_r)
 
640
        if((p ^ m_control) & 0x04)
 
641
                install_handlers(machine(), m_control & 4 ? 1 : 0);
 
642
}
 
643
 
 
644
WRITE32_MEMBER(taitogn_state::control2_w)
 
645
{
 
646
 
 
647
        COMBINE_DATA(&m_control2);
 
648
}
 
649
 
 
650
READ32_MEMBER(taitogn_state::control3_r)
 
651
{
 
652
 
 
653
        return m_control3;
 
654
}
 
655
 
 
656
WRITE32_MEMBER(taitogn_state::control3_w)
 
657
{
 
658
 
 
659
        COMBINE_DATA(&m_control3);
 
660
}
 
661
 
 
662
READ32_MEMBER(taitogn_state::gn_1fb70000_r)
652
663
{
653
664
        // (1328) 1348 tests mask 0002, 8 times.
654
665
        // Called by 1434, exit at 143c
660
671
        return 2;
661
672
}
662
673
 
663
 
static WRITE32_HANDLER(gn_1fb70000_w)
 
674
WRITE32_MEMBER(taitogn_state::gn_1fb70000_w)
664
675
{
665
676
        // Writes 0 or 1 all the time, it *may* have somthing to do with
666
677
        // i/o port width, but then maybe not
667
678
}
668
679
 
669
 
static READ32_HANDLER(hack1_r)
 
680
READ32_MEMBER(taitogn_state::hack1_r)
670
681
{
671
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
672
682
 
673
 
        state->m_v = state->m_v ^ 8;
 
683
        m_v = m_v ^ 8;
674
684
        // Probably something to do with sound
675
 
        return state->m_v;
 
685
        return m_v;
676
686
}
677
687
 
678
688
 
682
692
static const UINT8 tt10[ 8 ] = { 0x80, 0x20, 0x38, 0x08, 0xf1, 0x03, 0xfe, 0xfc };
683
693
static const UINT8 tt16[ 8 ] = { 0xc0, 0x04, 0xf9, 0xe1, 0x60, 0x70, 0xf2, 0x02 };
684
694
 
685
 
static READ32_HANDLER( znsecsel_r )
 
695
READ32_MEMBER(taitogn_state::znsecsel_r)
686
696
{
687
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
688
697
 
689
 
        return state->m_n_znsecsel;
 
698
        return m_n_znsecsel;
690
699
}
691
700
 
692
701
static void sio_znsec0_handler( running_machine &machine, int n_data )
745
754
        {
746
755
                if( state->m_b_lastclock )
747
756
                {
748
 
                        int bit = ( ( input_port_read(machine, "DSW") >> state->m_n_dip_bit ) & 1 );
 
757
                        int bit = ( ( state->ioport("DSW")->read() >> state->m_n_dip_bit ) & 1 );
749
758
                        psx_sio_input( machine, 0, PSX_SIO_IN_DATA, bit * PSX_SIO_IN_DATA );
750
759
                        state->m_n_dip_bit++;
751
760
                        state->m_n_dip_bit &= 7;
758
767
        }
759
768
}
760
769
 
761
 
static WRITE32_HANDLER( znsecsel_w )
 
770
WRITE32_MEMBER(taitogn_state::znsecsel_w)
762
771
{
763
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
764
 
 
765
 
        COMBINE_DATA( &state->m_n_znsecsel );
766
 
 
767
 
        if( ( state->m_n_znsecsel & 0x80 ) == 0 )
 
772
 
 
773
        COMBINE_DATA( &m_n_znsecsel );
 
774
 
 
775
        if( ( m_n_znsecsel & 0x80 ) == 0 )
768
776
        {
769
 
                        psx_sio_install_handler( space->machine(), 0, sio_pad_handler );
770
 
                        psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
 
777
                        psx_sio_install_handler( machine(), 0, sio_pad_handler );
 
778
                        psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
771
779
        }
772
 
        else if( ( state->m_n_znsecsel & 0x08 ) == 0 )
 
780
        else if( ( m_n_znsecsel & 0x08 ) == 0 )
773
781
        {
774
782
                        znsec_start( 1 );
775
 
                        psx_sio_install_handler( space->machine(), 0, sio_znsec1_handler );
776
 
                        psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
 
783
                        psx_sio_install_handler( machine(), 0, sio_znsec1_handler );
 
784
                        psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
777
785
        }
778
 
        else if( ( state->m_n_znsecsel & 0x04 ) == 0 )
 
786
        else if( ( m_n_znsecsel & 0x04 ) == 0 )
779
787
        {
780
788
                        znsec_start( 0 );
781
 
                        psx_sio_install_handler( space->machine(), 0, sio_znsec0_handler );
782
 
                        psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
 
789
                        psx_sio_install_handler( machine(), 0, sio_znsec0_handler );
 
790
                        psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
783
791
        }
784
792
        else
785
793
        {
786
 
                        state->m_n_dip_bit = 0;
787
 
                        state->m_b_lastclock = 1;
788
 
 
789
 
                        psx_sio_install_handler( space->machine(), 0, sio_dip_handler );
790
 
                        psx_sio_input( space->machine(), 0, PSX_SIO_IN_DSR, 0 );
791
 
 
792
 
                        state->m_dip_timer->adjust( downcast<cpu_device *>(&space->device())->cycles_to_attotime( 100 ), 1 );
 
794
                        m_n_dip_bit = 0;
 
795
                        m_b_lastclock = 1;
 
796
 
 
797
                        psx_sio_install_handler( machine(), 0, sio_dip_handler );
 
798
                        psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, 0 );
 
799
 
 
800
                        m_dip_timer->adjust( downcast<cpu_device *>(&space.device())->cycles_to_attotime( 100 ), 1 );
793
801
        }
794
802
}
795
803
 
806
814
}
807
815
 
808
816
 
809
 
static READ32_HANDLER( boardconfig_r )
 
817
READ32_MEMBER(taitogn_state::boardconfig_r)
810
818
{
811
819
        /*
812
820
    ------00 mem=4M
831
839
}
832
840
 
833
841
 
834
 
static WRITE32_HANDLER( coin_w )
 
842
WRITE32_MEMBER(taitogn_state::coin_w)
835
843
{
836
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
837
844
 
838
845
        /* 0x01=counter
839
846
       0x02=coin lock 1
841
848
       0x20=coin lock 2
842
849
       0x80=??
843
850
    */
844
 
        COMBINE_DATA (&state->m_coin_info);
 
851
        COMBINE_DATA (&m_coin_info);
845
852
}
846
853
 
847
 
static READ32_HANDLER( coin_r )
 
854
READ32_MEMBER(taitogn_state::coin_r)
848
855
{
849
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
850
856
 
851
 
        return state->m_coin_info;
 
857
        return m_coin_info;
852
858
}
853
859
 
854
860
/* mahjong panel handler (for Usagi & Mahjong Oh) */
855
 
static READ32_HANDLER( gnet_mahjong_panel_r )
 
861
READ32_MEMBER(taitogn_state::gnet_mahjong_panel_r)
856
862
{
857
 
        taitogn_state *state = space->machine().driver_data<taitogn_state>();
858
 
 
859
 
        state->m_mux_data = state->m_coin_info;
860
 
        state->m_mux_data &= 0xcc;
861
 
 
862
 
        switch(state->m_mux_data)
 
863
 
 
864
        m_mux_data = m_coin_info;
 
865
        m_mux_data &= 0xcc;
 
866
 
 
867
        switch(m_mux_data)
863
868
        {
864
 
                case 0x04: return input_port_read(space->machine(), "KEY0");
865
 
                case 0x08: return input_port_read(space->machine(), "KEY1");
866
 
                case 0x40: return input_port_read(space->machine(), "KEY2");
867
 
                case 0x80: return input_port_read(space->machine(), "KEY3");
 
869
                case 0x04: return ioport("KEY0")->read();
 
870
                case 0x08: return ioport("KEY1")->read();
 
871
                case 0x40: return ioport("KEY2")->read();
 
872
                case 0x80: return ioport("KEY3")->read();
868
873
        }
869
874
 
870
875
        /* mux disabled */
871
 
        return input_port_read(space->machine(), "P4");
 
876
        return ioport("P4")->read();
872
877
}
873
878
 
874
879
// Init and reset
889
894
        psx_sio_install_handler(machine, 0, sio_pad_handler);
890
895
        state->m_dip_timer = machine.scheduler().timer_alloc( FUNC(dip_timer_fired), NULL );
891
896
 
 
897
        UINT32 metalength;
892
898
        memset(state->m_cis, 0xff, 512);
893
 
        if (get_disk_handle(machine, ":card") != NULL)
894
 
                chd_get_metadata(get_disk_handle(machine, ":card"), PCMCIA_CIS_METADATA_TAG, 0, state->m_cis, 512, 0, 0, 0);
 
899
        if (get_disk_handle(machine, ":drive_0") != NULL)
 
900
                get_disk_handle(machine, ":drive_0")->read_metadata(PCMCIA_CIS_METADATA_TAG, 0, state->m_cis, 512, metalength);
895
901
}
896
902
 
897
903
static DRIVER_INIT( coh3002t_mp )
898
904
{
899
905
        DRIVER_INIT_CALL(coh3002t);
900
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1fa10100, 0x1fa10103, FUNC(gnet_mahjong_panel_r) );
 
906
        taitogn_state *state = machine.driver_data<taitogn_state>();
 
907
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x1fa10100, 0x1fa10103, read32_delegate(FUNC(taitogn_state::gnet_mahjong_panel_r),state));
901
908
}
902
909
 
903
910
static MACHINE_RESET( coh3002t )
915
922
        cputag_set_input_line(machine, "mn10200",INPUT_LINE_RESET,ASSERT_LINE); /* MCU */
916
923
}
917
924
 
918
 
static ADDRESS_MAP_START( taitogn_map, AS_PROGRAM, 32 )
 
925
static ADDRESS_MAP_START( taitogn_map, AS_PROGRAM, 32, taitogn_state )
919
926
        AM_RANGE(0x00000000, 0x003fffff) AM_RAM AM_SHARE("share1") /* ram */
920
927
        AM_RANGE(0x00400000, 0x007fffff) AM_RAM AM_SHARE("share1") /* ram mirror */
921
928
        AM_RANGE(0x1f000000, 0x1f1fffff) AM_READWRITE(flash_s1_r, flash_s1_w)
931
938
        AM_RANGE(0x1fa10300, 0x1fa10303) AM_READWRITE(znsecsel_r, znsecsel_w)
932
939
        AM_RANGE(0x1fa20000, 0x1fa20003) AM_READWRITE(coin_r, coin_w)
933
940
        AM_RANGE(0x1fa30000, 0x1fa30003) AM_READWRITE(control3_r, control3_w)
934
 
        AM_RANGE(0x1fa51c00, 0x1fa51dff) AM_READWRITE16(spu_r, spu_w, 0xffffffff) // systematic read at spu_address + 250000, result dropped, maybe other accesses
 
941
        AM_RANGE(0x1fa51c00, 0x1fa51dff) AM_READWRITE16_LEGACY(spu_r, spu_w, 0xffffffff) // systematic read at spu_address + 250000, result dropped, maybe other accesses
935
942
        AM_RANGE(0x1fa60000, 0x1fa60003) AM_READ(hack1_r)
936
 
        AM_RANGE(0x1faf0000, 0x1faf07ff) AM_DEVREADWRITE8("at28c16", at28c16_r, at28c16_w, 0xffffffff) /* eeprom */
 
943
        AM_RANGE(0x1faf0000, 0x1faf07ff) AM_DEVREADWRITE8_LEGACY("at28c16", at28c16_r, at28c16_w, 0xffffffff) /* eeprom */
937
944
        AM_RANGE(0x1fb00000, 0x1fb0ffff) AM_READWRITE(rf5c296_io_r, rf5c296_io_w)
938
945
        AM_RANGE(0x1fb40000, 0x1fb40003) AM_READWRITE(control_r, control_w)
939
946
        AM_RANGE(0x1fb60000, 0x1fb60003) AM_WRITE(control2_w)
975
982
        MCFG_MACHINE_RESET( coh3002t )
976
983
 
977
984
        MCFG_AT28C16_ADD( "at28c16", 0 )
978
 
        MCFG_IDE_CONTROLLER_ADD( "card", 0 )
 
985
        MCFG_IDE_CONTROLLER_ADD( "card", 0, ide_devices, "hdd", NULL)
979
986
 
980
987
        MCFG_MB3773_ADD("mb3773")
981
988
 
1127
1134
ROM_START(raycris)
1128
1135
        TAITOGNET_BIOS
1129
1136
 
1130
 
        DISK_REGION( "card" )
 
1137
        DISK_REGION( "drive_0" )
1131
1138
        DISK_IMAGE( "raycris", 0, SHA1(015cb0e6c4421cc38809de28c4793b4491386aee))
1132
1139
ROM_END
1133
1140
 
1135
1142
ROM_START(gobyrc)
1136
1143
        TAITOGNET_BIOS
1137
1144
 
1138
 
        DISK_REGION( "card" )
 
1145
        DISK_REGION( "drive_0" )
1139
1146
        DISK_IMAGE( "gobyrc", 0, SHA1(0bee1f495fc8b033fd56aad9260ae94abb35eb58))
1140
1147
ROM_END
1141
1148
 
1142
1149
ROM_START(rcdego)
1143
1150
        TAITOGNET_BIOS
1144
1151
 
1145
 
        DISK_REGION( "card" )
 
1152
        DISK_REGION( "drive_0" )
1146
1153
        DISK_IMAGE( "rcdego", 0, SHA1(9e177f2a3954cfea0c8c5a288e116324d10f5dd1))
1147
1154
ROM_END
1148
1155
 
1149
1156
ROM_START(chaoshea)
1150
1157
        TAITOGNET_BIOS
1151
1158
 
1152
 
        DISK_REGION( "card" )
 
1159
        DISK_REGION( "drive_0" )
1153
1160
        DISK_IMAGE( "chaosheat", 0, SHA1(c13b7d7025eee05f1f696d108801c7bafb3f1356))
1154
1161
ROM_END
1155
1162
 
1156
1163
ROM_START(chaosheaj)
1157
1164
        TAITOGNET_BIOS
1158
1165
 
1159
 
        DISK_REGION( "card" )
 
1166
        DISK_REGION( "drive_0" )
1160
1167
        DISK_IMAGE( "chaosheatj", 0, SHA1(2f211ac08675ea8ec33c7659a13951db94eaa627))
1161
1168
ROM_END
1162
1169
 
1164
1171
ROM_START(flipmaze)
1165
1172
        TAITOGNET_BIOS
1166
1173
 
1167
 
        DISK_REGION( "card" )
 
1174
        DISK_REGION( "drive_0" )
1168
1175
        DISK_IMAGE( "flipmaze", 0, SHA1(423b6c06f4f2d9a608ce20b61a3ac11687d22c40) )
1169
1176
ROM_END
1170
1177
 
1172
1179
ROM_START(spuzbobl)
1173
1180
        TAITOGNET_BIOS
1174
1181
 
1175
 
        DISK_REGION( "card" )
 
1182
        DISK_REGION( "drive_0" )
1176
1183
        DISK_IMAGE( "spuzbobl", 0, SHA1(1b1c72fb7e5656021485fefaef8f2ba48e2b4ea8))
1177
1184
ROM_END
1178
1185
 
1179
1186
ROM_START(spuzboblj)
1180
1187
        TAITOGNET_BIOS
1181
1188
 
1182
 
        DISK_REGION( "card" )
 
1189
        DISK_REGION( "drive_0" )
1183
1190
        DISK_IMAGE( "spuzbobj", 0, SHA1(dac433cf88543d2499bf797d7406b82ae4338726))
1184
1191
ROM_END
1185
1192
 
1186
1193
ROM_START(soutenry)
1187
1194
        TAITOGNET_BIOS
1188
1195
 
1189
 
        DISK_REGION( "card" )
 
1196
        DISK_REGION( "drive_0" )
1190
1197
        DISK_IMAGE( "soutenry", 0, SHA1(9204d0be833d29f37b8cd3fbdf09da69b622254b))
1191
1198
ROM_END
1192
1199
 
1193
1200
ROM_START(shanghss)
1194
1201
        TAITOGNET_BIOS
1195
1202
 
1196
 
        DISK_REGION( "card" )
 
1203
        DISK_REGION( "drive_0" )
1197
1204
        DISK_IMAGE( "shanghss", 0, SHA1(7964f71ec5c81d2120d83b63a82f97fbad5a8e6d))
1198
1205
ROM_END
1199
1206
 
1200
1207
ROM_START(sianniv)
1201
1208
        TAITOGNET_BIOS
1202
1209
 
1203
 
        DISK_REGION( "card" )
 
1210
        DISK_REGION( "drive_0" )
1204
1211
        DISK_IMAGE( "sianniv", 0, SHA1(1e08b813190a9e1baf29bc16884172d6c8da7ae3))
1205
1212
ROM_END
1206
1213
 
1207
1214
ROM_START(kollon)
1208
1215
        TAITOGNET_BIOS
1209
1216
 
1210
 
        DISK_REGION( "card" )
 
1217
        DISK_REGION( "drive_0" )
1211
1218
        DISK_IMAGE( "kollon", 0, SHA1(d8ea5b5b0ee99004b16ef89883e23de6c7ddd7ce))
1212
1219
ROM_END
1213
1220
 
1215
1222
        TAITOGNET_BIOS
1216
1223
        ROM_DEFAULT_BIOS( "v2" )
1217
1224
 
1218
 
        DISK_REGION( "card" )
 
1225
        DISK_REGION( "drive_0" )
1219
1226
        DISK_IMAGE( "kollonc", 0, SHA1(ce62181659701cfb8f7c564870ab902be4d8e060)) /* Original Taito Compact Flash version */
1220
1227
ROM_END
1221
1228
 
1222
1229
ROM_START(shikigam)
1223
1230
        TAITOGNET_BIOS
1224
1231
 
1225
 
        DISK_REGION( "card" )
 
1232
        DISK_REGION( "drive_0" )
1226
1233
        DISK_IMAGE( "shikigam", 0, SHA1(fa49a0bc47f5cb7c30d7e49e2c3696b21bafb840))
1227
1234
ROM_END
1228
1235
 
1232
1239
ROM_START(otenamih)
1233
1240
        TAITOGNET_BIOS
1234
1241
 
1235
 
        DISK_REGION( "card" )
 
1242
        DISK_REGION( "drive_0" )
1236
1243
        DISK_IMAGE( "otenamih", 0, SHA1(b3babe3a1876c43745616ee1e7d87276ce7dad0b) )
1237
1244
ROM_END
1238
1245
 
1240
1247
ROM_START(psyvaria)
1241
1248
        TAITOGNET_BIOS
1242
1249
 
1243
 
        DISK_REGION( "card" )
 
1250
        DISK_REGION( "drive_0" )
1244
1251
        DISK_IMAGE( "psyvaria", 0,  SHA1(b981a42a10069322b77f7a268beae1d409b4156d))
1245
1252
ROM_END
1246
1253
 
1247
1254
ROM_START(psyvarrv)
1248
1255
        TAITOGNET_BIOS
1249
1256
 
1250
 
        DISK_REGION( "card" )
 
1257
        DISK_REGION( "drive_0" )
1251
1258
        DISK_IMAGE( "psyvarrv", 0, SHA1(277c4f52502bcd7acc1889840962ec80d56465f3))
1252
1259
ROM_END
1253
1260
 
1254
1261
ROM_START(zooo)
1255
1262
        TAITOGNET_BIOS
1256
1263
 
1257
 
        DISK_REGION( "card" )
 
1264
        DISK_REGION( "drive_0" )
1258
1265
        DISK_IMAGE( "zooo", 0, SHA1(e275b3141b2bc49142990e6b497a5394a314a30b))
1259
1266
ROM_END
1260
1267
 
1261
1268
ROM_START(zokuoten)
1262
1269
        TAITOGNET_BIOS
1263
1270
 
1264
 
        DISK_REGION( "card" )
 
1271
        DISK_REGION( "drive_0" )
1265
1272
        DISK_IMAGE( "zokuoten", 0, SHA1(5ce13db00518f96af64935176c71ec68d2a51938))
1266
1273
ROM_END
1267
1274
 
1269
1276
        TAITOGNET_BIOS
1270
1277
        ROM_DEFAULT_BIOS( "v2" )
1271
1278
 
1272
 
        DISK_REGION( "card" )
 
1279
        DISK_REGION( "drive_0" )
1273
1280
        DISK_IMAGE( "otenamhf", 0, SHA1(5b15c33bf401e5546d78e905f538513d6ffcf562)) /* Original Taito Compact Flash version */
1274
1281
ROM_END
1275
1282
 
1281
1288
ROM_START(nightrai)
1282
1289
        TAITOGNET_BIOS
1283
1290
 
1284
 
        DISK_REGION( "card" )
 
1291
        DISK_REGION( "drive_0" )
1285
1292
        DISK_IMAGE( "nightrai", 0, SHA1(74d0458f851cbcf10453c5cc4c47bb4388244cdf))
1286
1293
ROM_END
1287
1294
 
1288
1295
ROM_START(otenki)
1289
1296
        TAITOGNET_BIOS
1290
1297
 
1291
 
        DISK_REGION( "card" )
 
1298
        DISK_REGION( "drive_0" )
1292
1299
        DISK_IMAGE( "otenki", 0, SHA1(7e745ca4c4570215f452fd09cdd56a42c39caeba))
1293
1300
ROM_END
1294
1301
 
1297
1304
ROM_START(usagi)
1298
1305
        TAITOGNET_BIOS
1299
1306
 
1300
 
        DISK_REGION( "card" )
 
1307
        DISK_REGION( "drive_0" )
1301
1308
        DISK_IMAGE( "usagi", 0, SHA1(edf9dd271957f6cb06feed238ae21100514bef8e))
1302
1309
ROM_END
1303
1310
 
1304
1311
ROM_START(mahjngoh)
1305
1312
        TAITOGNET_BIOS
1306
1313
 
1307
 
        DISK_REGION( "card" )
 
1314
        DISK_REGION( "drive_0" )
1308
1315
        DISK_IMAGE( "mahjngoh", 0, SHA1(3ef1110d15582d7c0187438d7ad61765dd121cff))
1309
1316
ROM_END
1310
1317
 
1311
1318
ROM_START(shangtou)
1312
1319
        TAITOGNET_BIOS
1313
1320
 
1314
 
        DISK_REGION( "card" )
 
1321
        DISK_REGION( "drive_0" )
1315
1322
        DISK_IMAGE( "shanghaito", 0, SHA1(9901db5a9aae77e3af4157aa2c601eaab5b7ca85) )
1316
1323
ROM_END
1317
1324
 
1321
1328
ROM_START(xiistag)
1322
1329
        TAITOGNET_BIOS
1323
1330
 
1324
 
        DISK_REGION( "card" )
 
1331
        DISK_REGION( "drive_0" )
1325
1332
        DISK_IMAGE( "xiistag", 0, SHA1(586e37c8d926293b2bd928e5f0d693910cfb05a2))
1326
1333
ROM_END
1327
1334