trunk/src/mame/machine/mega32x.c
| r17434 | r17435 | |
| 284 | 284 | /**********************************************************************************************/ |
| 285 | 285 | |
| 286 | 286 | |
| 287 | | static READ16_HANDLER( _32x_common_vdp_regs_r ); |
| 288 | | static WRITE16_HANDLER( _32x_common_vdp_regs_w ); |
| 289 | 287 | |
| 290 | 288 | static UINT16 _32x_autofill_length; |
| 291 | 289 | static UINT16 _32x_autofill_address; |
| r17434 | r17435 | |
| 296 | 294 | |
| 297 | 295 | |
| 298 | 296 | |
| 299 | | static READ16_HANDLER( _32x_68k_palette_r ) |
| 297 | READ16_MEMBER( sega_32x_device::_32x_68k_palette_r ) |
| 300 | 298 | { |
| 301 | 299 | return _32x_palette[offset]; |
| 302 | 300 | } |
| 303 | 301 | |
| 304 | | static WRITE16_HANDLER( _32x_68k_palette_w ) |
| 302 | WRITE16_MEMBER( sega_32x_device::_32x_68k_palette_w ) |
| 305 | 303 | { |
| 306 | 304 | int r,g,b, p; |
| 307 | 305 | |
| r17434 | r17435 | |
| 315 | 313 | |
| 316 | 314 | _32x_palette_lookup[offset] = (r << 10) | (g << 5) | (b << 0) | (p << 15); |
| 317 | 315 | |
| 318 | | palette_set_color_rgb(space->machine(),offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 316 | palette_set_color_rgb(space.machine(),offset+0x40,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 319 | 317 | |
| 320 | 318 | } |
| 321 | 319 | |
| 322 | | static READ16_HANDLER( _32x_68k_dram_r ) |
| 320 | READ16_MEMBER( sega_32x_device::_32x_68k_dram_r ) |
| 323 | 321 | { |
| 324 | 322 | return _32x_access_dram[offset]; |
| 325 | 323 | } |
| 326 | 324 | |
| 327 | | static WRITE16_HANDLER( _32x_68k_dram_w ) |
| 325 | WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_w ) |
| 328 | 326 | { |
| 329 | 327 | if ((mem_mask&0xffff) == 0xffff) |
| 330 | 328 | { |
| r17434 | r17435 | |
| 354 | 352 | } |
| 355 | 353 | } |
| 356 | 354 | |
| 357 | | static READ16_HANDLER( _32x_68k_dram_overwrite_r ) |
| 355 | READ16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_r ) |
| 358 | 356 | { |
| 359 | 357 | return _32x_access_dram[offset]; |
| 360 | 358 | } |
| 361 | 359 | |
| 362 | | static WRITE16_HANDLER( _32x_68k_dram_overwrite_w ) |
| 360 | WRITE16_MEMBER( sega_32x_device::_32x_68k_dram_overwrite_w ) |
| 363 | 361 | { |
| 364 | 362 | //COMBINE_DATA(&_32x_access_dram[offset+0x10000]); |
| 365 | 363 | |
| r17434 | r17435 | |
| 413 | 411 | static UINT16 a15106_reg; |
| 414 | 412 | |
| 415 | 413 | |
| 416 | | static READ16_HANDLER( _32x_68k_a15106_r ) |
| 414 | READ16_MEMBER( sega_32x_device::_32x_68k_a15106_r ) |
| 417 | 415 | { |
| 418 | 416 | UINT16 retval; |
| 419 | 417 | |
| r17434 | r17435 | |
| 424 | 422 | return retval; |
| 425 | 423 | } |
| 426 | 424 | |
| 427 | | static WRITE16_HANDLER( _32x_68k_a15106_w ) |
| 425 | WRITE16_MEMBER( sega_32x_device::_32x_68k_a15106_w ) |
| 428 | 426 | { |
| 429 | 427 | if (ACCESSING_BITS_0_7) |
| 430 | 428 | { |
| r17434 | r17435 | |
| 435 | 433 | |
| 436 | 434 | // install the game rom in the normal 0x000000-0x03fffff space used by the genesis - this allows VDP DMA operations to work as they have to be from this area or RAM |
| 437 | 435 | // it should also UNMAP the banked rom area... |
| 438 | | space->install_rom(0x0000100, 0x03fffff, space->machine().root_device().memregion("gamecart")->base() + 0x100); |
| 436 | space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("gamecart")->base() + 0x100); |
| 439 | 437 | } |
| 440 | 438 | else |
| 441 | 439 | { |
| r17434 | r17435 | |
| 443 | 441 | |
| 444 | 442 | // this is actually blank / nop area |
| 445 | 443 | // we should also map the banked area back (we don't currently unmap it tho) |
| 446 | | space->install_rom(0x0000100, 0x03fffff, space->machine().root_device().memregion("maincpu")->base()+0x100); |
| 444 | space.install_rom(0x0000100, 0x03fffff, space.machine().root_device().memregion("maincpu")->base()+0x100); |
| 447 | 445 | } |
| 448 | 446 | |
| 449 | 447 | if((a15106_reg & 4) == 0) // clears the FIFO state |
| r17434 | r17435 | |
| 474 | 472 | |
| 475 | 473 | static UINT16 dreq_src_addr[2],dreq_dst_addr[2],dreq_size; |
| 476 | 474 | |
| 477 | | static READ16_HANDLER( _32x_dreq_common_r ) |
| 475 | READ16_MEMBER( sega_32x_device::_32x_dreq_common_r ) |
| 478 | 476 | { |
| 479 | | address_space* _68kspace = space->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 477 | address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 480 | 478 | |
| 481 | 479 | switch (offset) |
| 482 | 480 | { |
| r17434 | r17435 | |
| 492 | 490 | return dreq_size; |
| 493 | 491 | |
| 494 | 492 | case 0x0a/2: // a15112 / 4012 |
| 495 | | if (space == _68kspace) |
| 493 | if (&space == _68kspace) |
| 496 | 494 | { |
| 497 | 495 | printf("attempting to READ FIFO with 68k!\n"); |
| 498 | 496 | return 0xffff; |
| r17434 | r17435 | |
| 508 | 506 | printf("Fifo block a isn't filled!\n"); |
| 509 | 507 | |
| 510 | 508 | if (current_fifo_readblock == fifo_block_b && !fifo_block_b_full) |
| 511 | | printf("%08x Fifo block b isn't filled!\n",cpu_get_pc(&space->device())); |
| 509 | printf("%08x Fifo block b isn't filled!\n",cpu_get_pc(&space.device())); |
| 512 | 510 | |
| 513 | 511 | |
| 514 | 512 | if (current_fifo_read_pos==4) |
| r17434 | r17435 | |
| 545 | 543 | return 0x0000; |
| 546 | 544 | } |
| 547 | 545 | |
| 548 | | static WRITE16_HANDLER( _32x_dreq_common_w ) |
| 546 | WRITE16_MEMBER( sega_32x_device::_32x_dreq_common_w ) |
| 549 | 547 | { |
| 550 | | address_space* _68kspace = space->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 548 | address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 551 | 549 | |
| 552 | 550 | switch (offset) |
| 553 | 551 | { |
| 554 | 552 | case 0x00/2: // a15108 / 4008 |
| 555 | 553 | case 0x02/2: // a1510a / 400a |
| 556 | | if (space != _68kspace) |
| 554 | if (&space != _68kspace) |
| 557 | 555 | { |
| 558 | 556 | printf("attempting to WRITE DREQ SRC with SH2!\n"); |
| 559 | 557 | return; |
| r17434 | r17435 | |
| 568 | 566 | |
| 569 | 567 | case 0x04/2: // a1510c / 400c |
| 570 | 568 | case 0x06/2: // a1510e / 400e |
| 571 | | if (space != _68kspace) |
| 569 | if (&space != _68kspace) |
| 572 | 570 | { |
| 573 | 571 | printf("attempting to WRITE DREQ DST with SH2!\n"); |
| 574 | 572 | return; |
| r17434 | r17435 | |
| 582 | 580 | break; |
| 583 | 581 | |
| 584 | 582 | case 0x08/2: // a15110 / 4010 |
| 585 | | if (space != _68kspace) |
| 583 | if (&space != _68kspace) |
| 586 | 584 | { |
| 587 | 585 | printf("attempting to WRITE DREQ SIZE with SH2!\n"); |
| 588 | 586 | return; |
| r17434 | r17435 | |
| 596 | 594 | break; |
| 597 | 595 | |
| 598 | 596 | case 0x0a/2: // a15112 / 4012 - FIFO Write (68k only!) |
| 599 | | if (space != _68kspace) |
| 597 | if (&space != _68kspace) |
| 600 | 598 | { |
| 601 | 599 | printf("attempting to WRITE FIFO with SH2!\n"); |
| 602 | 600 | return; |
| r17434 | r17435 | |
| 633 | 631 | current_fifo_block = fifo_block_b; |
| 634 | 632 | current_fifo_readblock = fifo_block_a; |
| 635 | 633 | // incase we have a stalled DMA in progress, let the SH2 know there is data available |
| 636 | | sh2_notify_dma_data_available(space->machine().device(_32X_MASTER_TAG)); |
| 637 | | sh2_notify_dma_data_available(space->machine().device(_32X_SLAVE_TAG)); |
| 634 | sh2_notify_dma_data_available(space.machine().device(_32X_MASTER_TAG)); |
| 635 | sh2_notify_dma_data_available(space.machine().device(_32X_SLAVE_TAG)); |
| 638 | 636 | |
| 639 | 637 | } |
| 640 | 638 | current_fifo_write_pos = 0; |
| r17434 | r17435 | |
| 648 | 646 | current_fifo_block = fifo_block_a; |
| 649 | 647 | current_fifo_readblock = fifo_block_b; |
| 650 | 648 | // incase we have a stalled DMA in progress, let the SH2 know there is data available |
| 651 | | sh2_notify_dma_data_available(space->machine().device(_32X_MASTER_TAG)); |
| 652 | | sh2_notify_dma_data_available(space->machine().device(_32X_SLAVE_TAG)); |
| 649 | sh2_notify_dma_data_available(space.machine().device(_32X_MASTER_TAG)); |
| 650 | sh2_notify_dma_data_available(space.machine().device(_32X_SLAVE_TAG)); |
| 653 | 651 | |
| 654 | 652 | } |
| 655 | 653 | |
| r17434 | r17435 | |
| 664 | 662 | |
| 665 | 663 | static UINT8 sega_tv; |
| 666 | 664 | |
| 667 | | static READ16_HANDLER( _32x_68k_a1511a_r ) |
| 665 | READ16_MEMBER( sega_32x_device::_32x_68k_a1511a_r ) |
| 668 | 666 | { |
| 669 | 667 | return sega_tv; |
| 670 | 668 | } |
| 671 | 669 | |
| 672 | | static WRITE16_HANDLER( _32x_68k_a1511a_w ) |
| 670 | WRITE16_MEMBER( sega_32x_device::_32x_68k_a1511a_w ) |
| 673 | 671 | { |
| 674 | 672 | sega_tv = data & 1; |
| 675 | 673 | |
| r17434 | r17435 | |
| 682 | 680 | |
| 683 | 681 | static UINT16 hint_vector[2]; |
| 684 | 682 | |
| 685 | | static READ16_HANDLER( _32x_68k_hint_vector_r ) |
| 683 | READ16_MEMBER( sega_32x_device::_32x_68k_hint_vector_r ) |
| 686 | 684 | { |
| 687 | 685 | return hint_vector[offset]; |
| 688 | 686 | } |
| 689 | 687 | |
| 690 | | static WRITE16_HANDLER( _32x_68k_hint_vector_w ) |
| 688 | WRITE16_MEMBER( sega_32x_device::_32x_68k_hint_vector_w ) |
| 691 | 689 | { |
| 692 | 690 | hint_vector[offset] = data; |
| 693 | 691 | } |
| 694 | 692 | |
| 695 | 693 | // returns MARS, the system ID of the 32x |
| 696 | | static READ16_HANDLER( _32x_68k_MARS_r ) |
| 694 | READ16_MEMBER( sega_32x_device::_32x_68k_MARS_r ) |
| 697 | 695 | { |
| 698 | 696 | switch (offset) |
| 699 | 697 | { |
| r17434 | r17435 | |
| 715 | 713 | |
| 716 | 714 | static UINT16 a15100_reg; |
| 717 | 715 | |
| 718 | | static READ16_HANDLER( _32x_68k_a15100_r ) |
| 716 | READ16_MEMBER( sega_32x_device::_32x_68k_a15100_r ) |
| 719 | 717 | { |
| 720 | 718 | return (_32x_access_auth<<15) | 0x0080; |
| 721 | 719 | } |
| 722 | 720 | |
| 723 | | static WRITE16_HANDLER( _32x_68k_a15100_w ) |
| 721 | WRITE16_MEMBER( sega_32x_device::_32x_68k_a15100_w ) |
| 724 | 722 | { |
| 725 | 723 | if (ACCESSING_BITS_0_7) |
| 726 | 724 | { |
| r17434 | r17435 | |
| 735 | 733 | if (data & 0x01) |
| 736 | 734 | { |
| 737 | 735 | _32x_adapter_enabled = 1; |
| 738 | | space->install_rom(0x0880000, 0x08fffff, space->machine().root_device().memregion("gamecart")->base()); // 'fixed' 512kb rom bank |
| 736 | space.install_rom(0x0880000, 0x08fffff, space.machine().root_device().memregion("gamecart")->base()); // 'fixed' 512kb rom bank |
| 739 | 737 | |
| 740 | | space->install_read_bank(0x0900000, 0x09fffff, "bank12"); // 'bankable' 1024kb rom bank |
| 741 | | space->machine().root_device().membank("bank12")->set_base(space->machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) ); |
| 738 | space.install_read_bank(0x0900000, 0x09fffff, "bank12"); // 'bankable' 1024kb rom bank |
| 739 | space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) ); |
| 742 | 740 | |
| 743 | | space->install_rom(0x0000000, 0x03fffff, space->machine().root_device().memregion("32x_68k_bios")->base()); |
| 741 | space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("32x_68k_bios")->base()); |
| 744 | 742 | |
| 745 | 743 | /* VDP area */ |
| 746 | | space->install_legacy_readwrite_handler(0x0a15180, 0x0a1518b, FUNC(_32x_common_vdp_regs_r), FUNC(_32x_common_vdp_regs_w)); // common / shared VDP regs |
| 747 | | space->install_legacy_readwrite_handler(0x0a15200, 0x0a153ff, FUNC(_32x_68k_palette_r), FUNC(_32x_68k_palette_w)); // access to 'palette' xRRRRRGGGGGBBBBB |
| 748 | | space->install_legacy_readwrite_handler(0x0840000, 0x085ffff, FUNC(_32x_68k_dram_r), FUNC(_32x_68k_dram_w)); // access to 'display ram' (framebuffer) |
| 749 | | space->install_legacy_readwrite_handler(0x0860000, 0x087ffff, FUNC(_32x_68k_dram_overwrite_r), FUNC(_32x_68k_dram_overwrite_w)); // access to 'display ram' (framebuffer) |
| 744 | space.install_readwrite_handler(0x0a15180, 0x0a1518b, read16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_r), this), write16_delegate(FUNC(sega_32x_device::_32x_common_vdp_regs_w),this)); // common / shared VDP regs |
| 745 | space.install_readwrite_handler(0x0a15200, 0x0a153ff, read16_delegate(FUNC(sega_32x_device::_32x_68k_palette_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_palette_w),this)); // access to 'palette' xRRRRRGGGGGBBBBB |
| 746 | space.install_readwrite_handler(0x0840000, 0x085ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_r), this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_w),this)); // access to 'display ram' (framebuffer) |
| 747 | space.install_readwrite_handler(0x0860000, 0x087ffff, read16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_dram_overwrite_w),this)); // access to 'display ram' (framebuffer) |
| 750 | 748 | |
| 751 | 749 | |
| 752 | 750 | |
| 753 | | space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x000070, 0x000073, FUNC(_32x_68k_hint_vector_r), FUNC(_32x_68k_hint_vector_w)); // h interrupt vector |
| 751 | space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_w),this)); // h interrupt vector |
| 754 | 752 | } |
| 755 | 753 | else |
| 756 | 754 | { |
| 757 | 755 | _32x_adapter_enabled = 0; |
| 758 | 756 | |
| 759 | | space->install_rom(0x0000000, 0x03fffff, space->machine().root_device().memregion("gamecart")->base()); |
| 760 | | space->machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x000070, 0x000073, FUNC(_32x_68k_hint_vector_r), FUNC(_32x_68k_hint_vector_w)); // h interrupt vector |
| 757 | space.install_rom(0x0000000, 0x03fffff, space.machine().root_device().memregion("gamecart")->base()); |
| 758 | space.machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_w),this)); // h interrupt vector |
| 761 | 759 | } |
| 762 | 760 | } |
| 763 | 761 | |
| r17434 | r17435 | |
| 775 | 773 | |
| 776 | 774 | static int _32x_68k_a15102_reg; |
| 777 | 775 | |
| 778 | | static READ16_HANDLER( _32x_68k_a15102_r ) |
| 776 | READ16_MEMBER( sega_32x_device::_32x_68k_a15102_r ) |
| 779 | 777 | { |
| 780 | 778 | //printf("_32x_68k_a15102_r\n"); |
| 781 | 779 | return _32x_68k_a15102_reg; |
| 782 | 780 | } |
| 783 | 781 | |
| 784 | | static WRITE16_HANDLER( _32x_68k_a15102_w ) |
| 782 | WRITE16_MEMBER( sega_32x_device::_32x_68k_a15102_w ) |
| 785 | 783 | { |
| 786 | 784 | if (ACCESSING_BITS_0_7) |
| 787 | 785 | { |
| r17434 | r17435 | |
| 807 | 805 | /**********************************************************************************************/ |
| 808 | 806 | |
| 809 | 807 | |
| 810 | | static READ16_HANDLER( _32x_68k_a15104_r ) |
| 808 | READ16_MEMBER( sega_32x_device::_32x_68k_a15104_r ) |
| 811 | 809 | { |
| 812 | 810 | return _32x_68k_a15104_reg; |
| 813 | 811 | } |
| 814 | 812 | |
| 815 | | static WRITE16_HANDLER( _32x_68k_a15104_w ) |
| 813 | WRITE16_MEMBER( sega_32x_device::_32x_68k_a15104_w ) |
| 816 | 814 | { |
| 817 | 815 | if (ACCESSING_BITS_0_7) |
| 818 | 816 | { |
| r17434 | r17435 | |
| 824 | 822 | _32x_68k_a15104_reg = (_32x_68k_a15104_reg & 0x00ff) | (data & 0xff00); |
| 825 | 823 | } |
| 826 | 824 | |
| 827 | | space->machine().root_device().membank("bank12")->set_base(space->machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) ); |
| 825 | space.machine().root_device().membank("bank12")->set_base(space.machine().root_device().memregion("gamecart")->base()+((_32x_68k_a15104_reg&0x3)*0x100000) ); |
| 828 | 826 | } |
| 829 | 827 | |
| 830 | 828 | /**********************************************************************************************/ |
| r17434 | r17435 | |
| 838 | 836 | /**********************************************************************************************/ |
| 839 | 837 | |
| 840 | 838 | // reads |
| 841 | | static READ16_HANDLER( _32x_68k_commsram_r ) |
| 839 | READ16_MEMBER( sega_32x_device::_32x_68k_commsram_r ) |
| 842 | 840 | { |
| 843 | | if (_32X_COMMS_PORT_SYNC) space->machine().scheduler().synchronize(); |
| 841 | if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); |
| 844 | 842 | return commsram[offset]; |
| 845 | 843 | } |
| 846 | 844 | |
| 847 | 845 | // writes |
| 848 | | static WRITE16_HANDLER( _32x_68k_commsram_w ) |
| 846 | WRITE16_MEMBER( sega_32x_device::_32x_68k_commsram_w ) |
| 849 | 847 | { |
| 850 | 848 | COMBINE_DATA(&commsram[offset]); |
| 851 | | if (_32X_COMMS_PORT_SYNC) space->machine().scheduler().synchronize(); |
| 849 | if (_32X_COMMS_PORT_SYNC) space.machine().scheduler().synchronize(); |
| 852 | 850 | } |
| 853 | 851 | |
| 854 | 852 | /**********************************************************************************************/ |
| r17434 | r17435 | |
| 943 | 941 | _32xdev->m_32x_pwm_timer->adjust(attotime::from_hz((PWM_CLOCK) / (pwm_cycle - 1))); |
| 944 | 942 | } |
| 945 | 943 | |
| 946 | | static READ16_HANDLER( _32x_pwm_r ) |
| 944 | READ16_MEMBER( sega_32x_device::_32x_pwm_r ) |
| 947 | 945 | { |
| 948 | 946 | switch(offset) |
| 949 | 947 | { |
| r17434 | r17435 | |
| 958 | 956 | return 0xffff; |
| 959 | 957 | } |
| 960 | 958 | |
| 961 | | static WRITE16_HANDLER( _32x_pwm_w ) |
| 959 | WRITE16_MEMBER( sega_32x_device::_32x_pwm_w ) |
| 962 | 960 | { |
| 963 | 961 | |
| 964 | 962 | switch(offset) |
| r17434 | r17435 | |
| 966 | 964 | case 0x00/2: |
| 967 | 965 | pwm_ctrl = data & 0xffff; |
| 968 | 966 | pwm_tm_reg = (pwm_ctrl & 0xf00) >> 8; |
| 969 | | calculate_pwm_timer(space->machine()); |
| 967 | calculate_pwm_timer(space.machine()); |
| 970 | 968 | break; |
| 971 | 969 | case 0x02/2: |
| 972 | 970 | pwm_cycle = pwm_cycle_reg = data & 0xfff; |
| 973 | | calculate_pwm_timer(space->machine()); |
| 971 | calculate_pwm_timer(space.machine()); |
| 974 | 972 | break; |
| 975 | 973 | case 0x04/2: |
| 976 | 974 | if(lch_index_w < PWM_FIFO_SIZE) |
| r17434 | r17435 | |
| 1014 | 1012 | } |
| 1015 | 1013 | } |
| 1016 | 1014 | |
| 1017 | | static WRITE16_HANDLER( _32x_68k_pwm_w ) |
| 1015 | WRITE16_MEMBER( sega_32x_device::_32x_68k_pwm_w ) |
| 1018 | 1016 | { |
| 1019 | 1017 | if(offset == 0/2) |
| 1020 | 1018 | _32x_pwm_w(space,offset,(data & 0x7f) | (pwm_ctrl & 0xff80),mem_mask); |
| r17434 | r17435 | |
| 1050 | 1048 | return value4; |
| 1051 | 1049 | } |
| 1052 | 1050 | |
| 1053 | | static READ16_HANDLER( _32x_common_vdp_regs_r ) |
| 1051 | READ16_MEMBER( sega_32x_device::_32x_common_vdp_regs_r ) |
| 1054 | 1052 | { |
| 1055 | 1053 | // what happens if the z80 accesses it, what authorization do we use? |
| 1056 | 1054 | |
| r17434 | r17435 | |
| 1138 | 1136 | } |
| 1139 | 1137 | |
| 1140 | 1138 | |
| 1141 | | static WRITE16_HANDLER( _32x_common_vdp_regs_w ) |
| 1139 | WRITE16_MEMBER( sega_32x_device::_32x_common_vdp_regs_w ) |
| 1142 | 1140 | { |
| 1143 | 1141 | // what happens if the z80 accesses it, what authorization do we use? which address space do we get?? the z80 *can* write here and to the framebuffer via the window |
| 1144 | 1142 | |
| 1145 | | address_space* _68kspace = space->machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 1143 | address_space* _68kspace = space.machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 1146 | 1144 | |
| 1147 | | if (space!= _68kspace) |
| 1145 | if (&space!= _68kspace) |
| 1148 | 1146 | { |
| 1149 | 1147 | if (_32x_access_auth!=1) |
| 1150 | 1148 | return; |
| 1151 | 1149 | } |
| 1152 | 1150 | |
| 1153 | | if (space== _68kspace) |
| 1151 | if (&space== _68kspace) |
| 1154 | 1152 | { |
| 1155 | 1153 | if (_32x_access_auth!=0) |
| 1156 | 1154 | return; |
| r17434 | r17435 | |
| 1270 | 1268 | /**********************************************************************************************/ |
| 1271 | 1269 | |
| 1272 | 1270 | /* MASTER */ |
| 1273 | | static READ16_HANDLER( _32x_sh2_master_4000_r ) |
| 1271 | READ16_MEMBER( sega_32x_device::_32x_sh2_master_4000_r ) |
| 1274 | 1272 | { |
| 1275 | 1273 | UINT16 retvalue = 0x0200; |
| 1276 | 1274 | retvalue |= _32x_access_auth << 15; |
| r17434 | r17435 | |
| 1284 | 1282 | return retvalue; |
| 1285 | 1283 | } |
| 1286 | 1284 | |
| 1287 | | static WRITE16_HANDLER( _32x_sh2_master_4000_w ) |
| 1285 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4000_w ) |
| 1288 | 1286 | { |
| 1289 | 1287 | if (ACCESSING_BITS_8_15) |
| 1290 | 1288 | { |
| r17434 | r17435 | |
| 1302 | 1300 | //if (sh2_master_hint_enable) printf("sh2_master_hint_enable enable!\n"); |
| 1303 | 1301 | //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n"); |
| 1304 | 1302 | |
| 1305 | | _32x_check_irqs(space->machine()); |
| 1303 | _32x_check_irqs(space.machine()); |
| 1306 | 1304 | } |
| 1307 | 1305 | } |
| 1308 | 1306 | |
| 1309 | 1307 | /* SLAVE */ |
| 1310 | 1308 | |
| 1311 | | static READ16_HANDLER( _32x_sh2_slave_4000_r ) |
| 1309 | READ16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_r ) |
| 1312 | 1310 | { |
| 1313 | 1311 | UINT16 retvalue = 0x0200; |
| 1314 | 1312 | retvalue |= _32x_access_auth << 15; |
| r17434 | r17435 | |
| 1322 | 1320 | } |
| 1323 | 1321 | |
| 1324 | 1322 | |
| 1325 | | static WRITE16_HANDLER( _32x_sh2_slave_4000_w ) |
| 1323 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4000_w ) |
| 1326 | 1324 | { |
| 1327 | 1325 | if (ACCESSING_BITS_8_15) |
| 1328 | 1326 | { |
| r17434 | r17435 | |
| 1340 | 1338 | //if (sh2_slave_hint_enable) printf("sh2_slave_hint_enable enable!\n"); |
| 1341 | 1339 | //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n"); |
| 1342 | 1340 | |
| 1343 | | _32x_check_irqs(space->machine()); |
| 1341 | _32x_check_irqs(space.machine()); |
| 1344 | 1342 | |
| 1345 | 1343 | } |
| 1346 | 1344 | } |
| r17434 | r17435 | |
| 1351 | 1349 | // Shouldn't be used |
| 1352 | 1350 | /**********************************************************************************************/ |
| 1353 | 1351 | |
| 1354 | | static READ16_HANDLER( _32x_sh2_common_4002_r ) |
| 1352 | READ16_MEMBER( sega_32x_device::_32x_sh2_common_4002_r ) |
| 1355 | 1353 | { |
| 1356 | 1354 | printf("reading 4002!\n"); |
| 1357 | 1355 | return 0x0000; |
| 1358 | 1356 | } |
| 1359 | 1357 | |
| 1360 | | static WRITE16_HANDLER( _32x_sh2_common_4002_w ) |
| 1358 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4002_w ) |
| 1361 | 1359 | { |
| 1362 | 1360 | printf("write 4002!\n"); |
| 1363 | 1361 | } |
| r17434 | r17435 | |
| 1368 | 1366 | // H Count Register (H Interrupt) |
| 1369 | 1367 | // 0 = every line |
| 1370 | 1368 | /**********************************************************************************************/ |
| 1371 | | static READ16_HANDLER( _32x_sh2_common_4004_r ) |
| 1369 | READ16_MEMBER( sega_32x_device::_32x_sh2_common_4004_r ) |
| 1372 | 1370 | { |
| 1373 | 1371 | return _32x_hcount_reg; |
| 1374 | 1372 | } |
| 1375 | 1373 | |
| 1376 | | static WRITE16_HANDLER( _32x_sh2_common_4004_w ) |
| 1374 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4004_w ) |
| 1377 | 1375 | { |
| 1378 | 1376 | _32x_hcount_reg = data & 0xff; |
| 1379 | 1377 | } |
| r17434 | r17435 | |
| 1384 | 1382 | // DReq Control Register |
| 1385 | 1383 | /**********************************************************************************************/ |
| 1386 | 1384 | |
| 1387 | | static READ16_HANDLER( _32x_sh2_common_4006_r ) |
| 1385 | READ16_MEMBER( sega_32x_device::_32x_sh2_common_4006_r ) |
| 1388 | 1386 | { |
| 1389 | 1387 | //printf("DREQ read!\n"); // tempo reads it, shut up for now |
| 1390 | 1388 | return _32x_68k_a15106_r(space,offset,mem_mask); |
| 1391 | 1389 | } |
| 1392 | 1390 | |
| 1393 | | static WRITE16_HANDLER( _32x_sh2_common_4006_w ) |
| 1391 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_common_4006_w ) |
| 1394 | 1392 | { |
| 1395 | 1393 | printf("DREQ write!\n"); //register is read only on SH-2 side |
| 1396 | 1394 | } |
| r17434 | r17435 | |
| 1401 | 1399 | // VRES (md reset button interrupt) clear |
| 1402 | 1400 | /**********************************************************************************************/ |
| 1403 | 1401 | |
| 1404 | | static WRITE16_HANDLER( _32x_sh2_master_4014_w ){ device_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 1405 | | static WRITE16_HANDLER( _32x_sh2_slave_4014_w ) { device_set_input_line(_32x_slave_cpu, SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 1402 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4014_w ){ device_set_input_line(_32x_master_cpu,SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 1403 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4014_w ) { device_set_input_line(_32x_slave_cpu, SH2_VRES_IRQ_LEVEL,CLEAR_LINE);} |
| 1406 | 1404 | |
| 1407 | 1405 | /**********************************************************************************************/ |
| 1408 | 1406 | // SH2 side 4016 |
| 1409 | 1407 | // VINT (vertical interrupt) clear |
| 1410 | 1408 | /**********************************************************************************************/ |
| 1411 | 1409 | |
| 1412 | | static WRITE16_HANDLER( _32x_sh2_master_4016_w ){ sh2_master_vint_pending = 0; _32x_check_irqs(space->machine()); } |
| 1413 | | static WRITE16_HANDLER( _32x_sh2_slave_4016_w ) { sh2_slave_vint_pending = 0; _32x_check_irqs(space->machine()); } |
| 1410 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4016_w ){ sh2_master_vint_pending = 0; _32x_check_irqs(space.machine()); } |
| 1411 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4016_w ) { sh2_slave_vint_pending = 0; _32x_check_irqs(space.machine()); } |
| 1414 | 1412 | |
| 1415 | 1413 | /**********************************************************************************************/ |
| 1416 | 1414 | // SH2 side 4018 |
| 1417 | 1415 | // HINT (horizontal interrupt) clear |
| 1418 | 1416 | /**********************************************************************************************/ |
| 1419 | 1417 | |
| 1420 | | static WRITE16_HANDLER( _32x_sh2_master_4018_w ){ device_set_input_line(_32x_master_cpu,SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1421 | | static WRITE16_HANDLER( _32x_sh2_slave_4018_w ) { device_set_input_line(_32x_slave_cpu, SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1418 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_4018_w ){ device_set_input_line(_32x_master_cpu,SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1419 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_4018_w ) { device_set_input_line(_32x_slave_cpu, SH2_HINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1422 | 1420 | |
| 1423 | 1421 | /**********************************************************************************************/ |
| 1424 | 1422 | // SH2 side 401A |
| r17434 | r17435 | |
| 1426 | 1424 | // Note: flag cleared here is a guess, according to After Burner behaviour |
| 1427 | 1425 | /**********************************************************************************************/ |
| 1428 | 1426 | |
| 1429 | | static WRITE16_HANDLER( _32x_sh2_master_401a_w ){ _32x_68k_a15102_reg &= ~1; device_set_input_line(_32x_master_cpu,SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1430 | | static WRITE16_HANDLER( _32x_sh2_slave_401a_w ) { _32x_68k_a15102_reg &= ~2; device_set_input_line(_32x_slave_cpu, SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1427 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401a_w ){ _32x_68k_a15102_reg &= ~1; device_set_input_line(_32x_master_cpu,SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1428 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401a_w ) { _32x_68k_a15102_reg &= ~2; device_set_input_line(_32x_slave_cpu, SH2_CINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1431 | 1429 | |
| 1432 | 1430 | /**********************************************************************************************/ |
| 1433 | 1431 | // SH2 side 401C |
| 1434 | 1432 | // PINT (PWM timer interrupt) clear |
| 1435 | 1433 | /**********************************************************************************************/ |
| 1436 | 1434 | |
| 1437 | | static WRITE16_HANDLER( _32x_sh2_master_401c_w ){ device_set_input_line(_32x_master_cpu,SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1438 | | static WRITE16_HANDLER( _32x_sh2_slave_401c_w ) { device_set_input_line(_32x_slave_cpu, SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1435 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401c_w ){ device_set_input_line(_32x_master_cpu,SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1436 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401c_w ) { device_set_input_line(_32x_slave_cpu, SH2_PINT_IRQ_LEVEL,CLEAR_LINE);} |
| 1439 | 1437 | |
| 1440 | 1438 | /**********************************************************************************************/ |
| 1441 | 1439 | // SH2 side 401E |
| 1442 | 1440 | // ?? unknown / unused |
| 1443 | 1441 | /**********************************************************************************************/ |
| 1444 | 1442 | |
| 1445 | | static WRITE16_HANDLER( _32x_sh2_master_401e_w ) |
| 1443 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_master_401e_w ) |
| 1446 | 1444 | { |
| 1447 | 1445 | printf("_32x_sh2_master_401e_w\n"); |
| 1448 | 1446 | } |
| 1449 | 1447 | |
| 1450 | | static WRITE16_HANDLER( _32x_sh2_slave_401e_w ) |
| 1448 | WRITE16_MEMBER( sega_32x_device::_32x_sh2_slave_401e_w ) |
| 1451 | 1449 | { |
| 1452 | 1450 | printf("_32x_sh2_slave_401e_w\n"); |
| 1453 | 1451 | } |
| r17434 | r17435 | |
| 1527 | 1525 | UINT32 retvalue = 0x00000000; \ |
| 1528 | 1526 | if (ACCESSING_BITS_16_31) \ |
| 1529 | 1527 | { \ |
| 1530 | | UINT16 ret = _32x_sh2_##NAMEA##_r(&space,0,(mem_mask>>16)&0xffff); \ |
| 1528 | UINT16 ret = _32x_sh2_##NAMEA##_r(space,0,(mem_mask>>16)&0xffff); \ |
| 1531 | 1529 | retvalue |= ret << 16; \ |
| 1532 | 1530 | } \ |
| 1533 | 1531 | if (ACCESSING_BITS_0_15) \ |
| 1534 | 1532 | { \ |
| 1535 | | UINT16 ret = _32x_sh2_##NAMEB##_r(&space,0,(mem_mask>>0)&0xffff); \ |
| 1533 | UINT16 ret = _32x_sh2_##NAMEB##_r(space,0,(mem_mask>>0)&0xffff); \ |
| 1536 | 1534 | retvalue |= ret << 0; \ |
| 1537 | 1535 | } \ |
| 1538 | 1536 | \ |
| r17434 | r17435 | |
| 1544 | 1542 | { \ |
| 1545 | 1543 | if (ACCESSING_BITS_16_31) \ |
| 1546 | 1544 | { \ |
| 1547 | | _32x_sh2_##NAMEA##_w(&space,0,(data>>16)&0xffff,(mem_mask>>16)&0xffff); \ |
| 1545 | _32x_sh2_##NAMEA##_w(space,0,(data>>16)&0xffff,(mem_mask>>16)&0xffff); \ |
| 1548 | 1546 | } \ |
| 1549 | 1547 | if (ACCESSING_BITS_0_15) \ |
| 1550 | 1548 | { \ |
| 1551 | | _32x_sh2_##NAMEB##_w(&space,0,(data>>0)&0xffff,(mem_mask>>0)&0xffff); \ |
| 1549 | _32x_sh2_##NAMEB##_w(space,0,(data>>0)&0xffff,(mem_mask>>0)&0xffff); \ |
| 1552 | 1550 | } \ |
| 1553 | 1551 | } \ |
| 1554 | 1552 | |
| r17434 | r17435 | |
| 1588 | 1586 | AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_master_4000_common_4002_r, _32x_sh2_master_4000_common_4002_w ) |
| 1589 | 1587 | AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) |
| 1590 | 1588 | |
| 1591 | | AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16_LEGACY(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) |
| 1589 | AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) |
| 1592 | 1590 | |
| 1593 | 1591 | AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_master_4014_master_4016_w ) // IRQ clear |
| 1594 | 1592 | AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_master_4018_master_401a_w ) // IRQ clear |
| 1595 | 1593 | AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_master_401c_master_401e_w ) // IRQ clear |
| 1596 | 1594 | |
| 1597 | | AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16_LEGACY(_32x_68k_commsram_r, _32x_68k_commsram_w, 0xffffffff ) |
| 1598 | | AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16_LEGACY(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) |
| 1595 | AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_commsram_r, _32x_68k_commsram_w, 0xffffffff ) |
| 1596 | AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) |
| 1599 | 1597 | |
| 1600 | | AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16_LEGACY(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) |
| 1601 | | AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16_LEGACY(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) |
| 1598 | AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) |
| 1599 | AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) |
| 1600 | |
| 1601 | AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) |
| 1602 | AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) |
| 1602 | 1603 | |
| 1603 | | AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16_LEGACY(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) |
| 1604 | | AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16_LEGACY(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) |
| 1605 | | |
| 1606 | 1604 | AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") |
| 1607 | 1605 | AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) |
| 1608 | 1606 | |
| r17434 | r17435 | |
| 1617 | 1615 | AM_RANGE(0x00004000, 0x00004003) AM_READWRITE(_32x_sh2_slave_4000_common_4002_r, _32x_sh2_slave_4000_common_4002_w ) |
| 1618 | 1616 | AM_RANGE(0x00004004, 0x00004007) AM_READWRITE(_32x_sh2_common_4004_common_4006_r, _32x_sh2_common_4004_common_4006_w) |
| 1619 | 1617 | |
| 1620 | | AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16_LEGACY(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) |
| 1618 | AM_RANGE(0x00004008, 0x00004013) AM_READWRITE16(_32x_dreq_common_r, _32x_dreq_common_w, 0xffffffff ) |
| 1621 | 1619 | |
| 1622 | 1620 | AM_RANGE(0x00004014, 0x00004017) AM_READNOP AM_WRITE(_32x_sh2_slave_4014_slave_4016_w ) // IRQ clear |
| 1623 | 1621 | AM_RANGE(0x00004018, 0x0000401b) AM_READNOP AM_WRITE(_32x_sh2_slave_4018_slave_401a_w ) // IRQ clear |
| 1624 | 1622 | AM_RANGE(0x0000401c, 0x0000401f) AM_READNOP AM_WRITE(_32x_sh2_slave_401c_slave_401e_w ) // IRQ clear |
| 1625 | 1623 | |
| 1626 | | AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16_LEGACY(_32x_68k_commsram_r, _32x_68k_commsram_w, 0xffffffff ) |
| 1627 | | AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16_LEGACY(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) |
| 1624 | AM_RANGE(0x00004020, 0x0000402f) AM_READWRITE16(_32x_68k_commsram_r, _32x_68k_commsram_w, 0xffffffff ) |
| 1625 | AM_RANGE(0x00004030, 0x0000403f) AM_READWRITE16(_32x_pwm_r, _32x_pwm_w, 0xffffffff ) |
| 1628 | 1626 | |
| 1629 | | AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16_LEGACY(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) |
| 1630 | | AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16_LEGACY(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) |
| 1627 | AM_RANGE(0x00004100, 0x0000410b) AM_READWRITE16(_32x_common_vdp_regs_r, _32x_common_vdp_regs_w , 0xffffffff) |
| 1628 | AM_RANGE(0x00004200, 0x000043ff) AM_READWRITE16(_32x_68k_palette_r, _32x_68k_palette_w, 0xffffffff) |
| 1631 | 1629 | |
| 1632 | | AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16_LEGACY(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) |
| 1633 | | AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16_LEGACY(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) |
| 1630 | AM_RANGE(0x04000000, 0x0401ffff) AM_READWRITE16(_32x_68k_dram_r, _32x_68k_dram_w, 0xffffffff) |
| 1631 | AM_RANGE(0x04020000, 0x0403ffff) AM_READWRITE16(_32x_68k_dram_overwrite_r, _32x_68k_dram_overwrite_w, 0xffffffff) |
| 1634 | 1632 | |
| 1635 | 1633 | AM_RANGE(0x06000000, 0x0603ffff) AM_RAM AM_SHARE("sh2_shared") |
| 1636 | 1634 | AM_RANGE(0x02000000, 0x023fffff) AM_ROM AM_REGION(":gamecart_sh2", 0) // program is writeable (wwfraw) |
| r17434 | r17435 | |
| 1644 | 1642 | |
| 1645 | 1643 | |
| 1646 | 1644 | |
| 1647 | | DRIVER_INIT_MEMBER(md_cons_state,_32x) |
| 1648 | | { |
| 1649 | 1645 | |
| 1650 | | |
| 1651 | | |
| 1652 | | _32x_adapter_enabled = 0; |
| 1653 | | |
| 1654 | | if (_32x_adapter_enabled == 0) |
| 1655 | | { |
| 1656 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base()); |
| 1657 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x000070, 0x000073, FUNC(_32x_68k_hint_vector_r), FUNC(_32x_68k_hint_vector_w)); // h interrupt vector |
| 1658 | | }; |
| 1659 | | |
| 1660 | | |
| 1661 | | a15100_reg = 0x0000; |
| 1662 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15100, 0xa15101, FUNC(_32x_68k_a15100_r), FUNC(_32x_68k_a15100_w)); // framebuffer control regs |
| 1663 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15102, 0xa15103, FUNC(_32x_68k_a15102_r), FUNC(_32x_68k_a15102_w)); // send irq to sh2 |
| 1664 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15104, 0xa15105, FUNC(_32x_68k_a15104_r), FUNC(_32x_68k_a15104_w)); // 68k BANK rom set |
| 1665 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15106, 0xa15107, FUNC(_32x_68k_a15106_r), FUNC(_32x_68k_a15106_w)); // dreq stuff |
| 1666 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15108, 0xa15113, FUNC(_32x_dreq_common_r), FUNC(_32x_dreq_common_w)); // dreq src / dst / length /fifo |
| 1667 | | |
| 1668 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa1511a, 0xa1511b, FUNC(_32x_68k_a1511a_r), FUNC(_32x_68k_a1511a_w)); // SEGA TV |
| 1669 | | |
| 1670 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15120, 0xa1512f, FUNC(_32x_68k_commsram_r), FUNC(_32x_68k_commsram_w)); // comms reg 0-7 |
| 1671 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0xa15130, 0xa1513f, FUNC(_32x_pwm_r), FUNC(_32x_68k_pwm_w)); |
| 1672 | | |
| 1673 | | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0a130ec, 0x0a130ef, FUNC(_32x_68k_MARS_r)); // system ID |
| 1674 | | |
| 1675 | | |
| 1676 | | |
| 1677 | | // checking if these help brutal, they don't. |
| 1678 | | sh2drc_set_options(machine().device(_32X_MASTER_TAG), SH2DRC_COMPATIBLE_OPTIONS); |
| 1679 | | sh2drc_set_options(machine().device(_32X_SLAVE_TAG), SH2DRC_COMPATIBLE_OPTIONS); |
| 1680 | | |
| 1681 | | DRIVER_INIT_CALL(megadriv); |
| 1682 | | } |
| 1683 | | |
| 1684 | 1646 | void _32x_check_irqs(running_machine& machine) |
| 1685 | 1647 | { |
| 1686 | 1648 | |
| r17434 | r17435 | |
| 1998 | 1960 | |
| 1999 | 1961 | _32x_hcount_compare_val = -1; |
| 2000 | 1962 | |
| 1963 | |
| 1964 | // moved from init |
| 1965 | |
| 1966 | _32x_adapter_enabled = 0; |
| 1967 | |
| 1968 | if (_32x_adapter_enabled == 0) |
| 1969 | { |
| 1970 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_rom(0x0000000, 0x03fffff, machine().root_device().memregion(":gamecart")->base()); |
| 1971 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x000070, 0x000073, read16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_hint_vector_w),this)); // h interrupt vector |
| 1972 | }; |
| 1973 | |
| 1974 | |
| 1975 | a15100_reg = 0x0000; |
| 1976 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15100, 0xa15101, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15100_w),this)); // framebuffer control regs |
| 1977 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15102, 0xa15103, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15102_w),this)); // send irq to sh2 |
| 1978 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15104, 0xa15105, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15104_w),this)); // 68k BANK rom set |
| 1979 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15106, 0xa15107, read16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a15106_w),this)); // dreq stuff |
| 1980 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15108, 0xa15113, read16_delegate(FUNC(sega_32x_device::_32x_dreq_common_r),this), write16_delegate(FUNC(sega_32x_device::_32x_dreq_common_w),this)); // dreq src / dst / length /fifo |
| 1981 | |
| 1982 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa1511a, 0xa1511b, read16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_a1511a_w),this)); // SEGA TV |
| 1983 | |
| 1984 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15120, 0xa1512f, read16_delegate(FUNC(sega_32x_device::_32x_68k_commsram_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_commsram_w),this)); // comms reg 0-7 |
| 1985 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xa15130, 0xa1513f, read16_delegate(FUNC(sega_32x_device::_32x_pwm_r),this), write16_delegate(FUNC(sega_32x_device::_32x_68k_pwm_w),this)); |
| 1986 | |
| 1987 | machine().device(":maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0a130ec, 0x0a130ef, read16_delegate(FUNC(sega_32x_device::_32x_68k_MARS_r),this)); // system ID |
| 1988 | |
| 1989 | |
| 1990 | |
| 1991 | // checking if these help brutal, they don't. |
| 1992 | sh2drc_set_options(machine().device(_32X_MASTER_TAG), SH2DRC_COMPATIBLE_OPTIONS); |
| 1993 | sh2drc_set_options(machine().device(_32X_SLAVE_TAG), SH2DRC_COMPATIBLE_OPTIONS); |
| 1994 | |
| 1995 | |
| 2001 | 1996 | // install these now, otherwise we'll get the following (incorrect) warnings on startup.. |
| 2002 | 1997 | // SH-2 device ':sega32x:32x_slave_sh2': program space memory map entry 0-3FFF references non-existant region ':slave' |
| 2003 | 1998 | // SH-2 device ':sega32x:32x_master_sh2': program space memory map entry 0-3FFF references non-existant region ':master' |