src/mess/includes/x68k.h
| r15028 | r15029 | |
| 38 | 38 | MFP_IRQ_GPIP7 |
| 39 | 39 | }; // MC68901 IRQ priority levels |
| 40 | 40 | |
| 41 | | class x68k_base_state : public driver_device |
| 41 | class x68k_state : public driver_device |
| 42 | 42 | { |
| 43 | 43 | public: |
| 44 | | x68k_base_state(const machine_config &mconfig, device_type type, const char *tag) |
| 44 | x68k_state(const machine_config &mconfig, device_type type, const char *tag) |
| 45 | 45 | : driver_device(mconfig, type, tag), |
| 46 | 46 | m_mfpdev(*this, MC68901_TAG), |
| 47 | | m_rtc(*this, RP5C15_TAG) |
| 47 | m_rtc(*this, RP5C15_TAG), |
| 48 | m_nvram16(*this, "nvram16"), |
| 49 | m_nvram32(*this, "nvram32"), |
| 50 | m_gvram16(*this, "gvram16"), |
| 51 | m_tvram16(*this, "tvram16"), |
| 52 | m_gvram32(*this, "gvram32"), |
| 53 | m_tvram32(*this, "tvram32") |
| 48 | 54 | { } |
| 49 | 55 | |
| 50 | 56 | required_device<mc68901_device> m_mfpdev; |
| 51 | 57 | required_device<rp5c15_device> m_rtc; |
| 52 | 58 | |
| 59 | optional_shared_ptr<UINT16> m_nvram16; |
| 60 | optional_shared_ptr<UINT32> m_nvram32; |
| 61 | |
| 62 | optional_shared_ptr<UINT16> m_gvram16; |
| 63 | optional_shared_ptr<UINT16> m_tvram16; |
| 64 | optional_shared_ptr<UINT32> m_gvram32; |
| 65 | optional_shared_ptr<UINT32> m_tvram32; |
| 66 | |
| 67 | DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w ); |
| 68 | DECLARE_READ8_MEMBER( mfp_gpio_r ); |
| 69 | |
| 53 | 70 | struct |
| 54 | 71 | { |
| 55 | 72 | int sram_writeprotect; |
| r15028 | r15029 | |
| 234 | 251 | tilemap_t* m_bg1_16; |
| 235 | 252 | int m_sprite_shift; |
| 236 | 253 | int m_oddscanline; |
| 254 | bool m_is_32bit; |
| 237 | 255 | }; |
| 238 | 256 | |
| 239 | | class x68k_state : public x68k_base_state |
| 240 | | { |
| 241 | | public: |
| 242 | | x68k_state(const machine_config &mconfig, device_type type, const char *tag) |
| 243 | | : x68k_base_state(mconfig,type,tag), |
| 244 | | m_nvram(*this, "nvram"), |
| 245 | | m_gvram(*this, "gvram"), |
| 246 | | m_tvram(*this, "tvram") |
| 247 | | { } |
| 248 | 257 | |
| 249 | | required_shared_ptr<UINT16> m_nvram; |
| 250 | | required_shared_ptr<UINT16> m_gvram; |
| 251 | | required_shared_ptr<UINT16> m_tvram; |
| 252 | | |
| 253 | | DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w ); |
| 254 | | DECLARE_READ8_MEMBER( mfp_gpio_r ); |
| 255 | | }; |
| 256 | | |
| 257 | | class x68030_state : public x68k_base_state |
| 258 | | { |
| 259 | | public: |
| 260 | | x68030_state(const machine_config &mconfig, device_type type, const char *tag) |
| 261 | | : x68k_base_state(mconfig,type,tag), |
| 262 | | m_nvram(*this, "nvram"), |
| 263 | | m_gvram(*this, "gvram"), |
| 264 | | m_tvram(*this, "tvram") |
| 265 | | { } |
| 266 | | |
| 267 | | required_shared_ptr<UINT32> m_nvram; |
| 268 | | required_shared_ptr<UINT32> m_gvram; |
| 269 | | required_shared_ptr<UINT32> m_tvram; |
| 270 | | |
| 271 | | DECLARE_WRITE_LINE_MEMBER( mfp_tdo_w ); |
| 272 | | DECLARE_READ8_MEMBER( mfp_gpio_r ); |
| 273 | | }; |
| 274 | | |
| 275 | 258 | /*----------- defined in drivers/x68k.c -----------*/ |
| 276 | 259 | |
| 277 | 260 | #ifdef UNUSED_FUNCTION |
src/mess/video/x68k.c
| r15028 | r15029 | |
| 81 | 81 | static void x68k_crtc_text_copy(x68k_state *state, int src, int dest) |
| 82 | 82 | { |
| 83 | 83 | // copys one raster in T-VRAM to another raster |
| 84 | UINT16* tvram; |
| 84 | 85 | int src_ram = src * 256; // 128 bytes per scanline |
| 85 | 86 | int dest_ram = dest * 256; |
| 86 | 87 | int line; |
| 87 | 88 | |
| 89 | if(state->m_is_32bit) |
| 90 | tvram = (UINT16*)state->m_tvram32.target(); |
| 91 | else |
| 92 | tvram = (UINT16*)state->m_tvram16.target(); |
| 93 | |
| 88 | 94 | if(dest > 250) |
| 89 | 95 | return; // for some reason, Salamander causes a SIGSEGV in a debug build in this function. |
| 90 | 96 | |
| 91 | 97 | for(line=0;line<8;line++) |
| 92 | 98 | { |
| 93 | 99 | // update RAM in each plane |
| 94 | | memcpy(state->m_tvram+dest_ram,state->m_tvram+src_ram,128); |
| 95 | | memcpy(state->m_tvram+dest_ram+0x10000,state->m_tvram+src_ram+0x10000,128); |
| 96 | | memcpy(state->m_tvram+dest_ram+0x20000,state->m_tvram+src_ram+0x20000,128); |
| 97 | | memcpy(state->m_tvram+dest_ram+0x30000,state->m_tvram+src_ram+0x30000,128); |
| 100 | memcpy(tvram+dest_ram,tvram+src_ram,128); |
| 101 | memcpy(tvram+dest_ram+0x10000,tvram+src_ram+0x10000,128); |
| 102 | memcpy(tvram+dest_ram+0x20000,tvram+src_ram+0x20000,128); |
| 103 | memcpy(tvram+dest_ram+0x30000,tvram+src_ram+0x30000,128); |
| 98 | 104 | |
| 99 | 105 | src_ram+=64; |
| 100 | 106 | dest_ram+=64; |
| r15028 | r15029 | |
| 447 | 453 | } |
| 448 | 454 | if(data & 0x02) // high-speed graphic screen clear |
| 449 | 455 | { |
| 450 | | memset(state->m_gvram,0,0x40000); |
| 456 | if(state->m_is_32bit) |
| 457 | memset(state->m_gvram32,0,0x40000); |
| 458 | else |
| 459 | memset(state->m_gvram16,0,0x40000); |
| 451 | 460 | space->machine().scheduler().timer_set(attotime::from_msec(10), FUNC(x68k_crtc_operation_end), 0x02); // time taken to do operation is a complete guess. |
| 452 | 461 | } |
| 453 | 462 | break; |
| r15028 | r15029 | |
| 499 | 508 | WRITE16_HANDLER( x68k_gvram_w ) |
| 500 | 509 | { |
| 501 | 510 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 511 | UINT16* gvram; |
| 502 | 512 | // int xloc,yloc,pageoffset; |
| 503 | 513 | /* |
| 504 | 514 | G-VRAM usage is determined by colour depth and "real" screen size. |
| r15028 | r15029 | |
| 515 | 525 | Page 3 - 0xd00000-0xd7ffff Page 4 - 0xd80000-0xdfffff |
| 516 | 526 | */ |
| 517 | 527 | |
| 528 | if(state->m_is_32bit) |
| 529 | gvram = (UINT16*)state->m_gvram32.target(); |
| 530 | else |
| 531 | gvram = (UINT16*)state->m_gvram16.target(); |
| 532 | |
| 518 | 533 | // handle different G-VRAM page setups |
| 519 | 534 | if(state->m_crtc.reg[20] & 0x08) // G-VRAM set to buffer |
| 520 | 535 | { |
| 521 | 536 | if(offset < 0x40000) |
| 522 | | COMBINE_DATA(state->m_gvram+offset); |
| 537 | COMBINE_DATA(gvram+offset); |
| 523 | 538 | } |
| 524 | 539 | else |
| 525 | 540 | { |
| r15028 | r15029 | |
| 527 | 542 | { |
| 528 | 543 | case 0x0300: |
| 529 | 544 | if(offset < 0x40000) |
| 530 | | COMBINE_DATA(state->m_gvram+offset); |
| 545 | COMBINE_DATA(gvram+offset); |
| 531 | 546 | break; |
| 532 | 547 | case 0x0100: |
| 533 | 548 | if(offset < 0x40000) |
| 534 | 549 | { |
| 535 | | state->m_gvram[offset] = (state->m_gvram[offset] & 0xff00) | (data & 0x00ff); |
| 550 | gvram[offset] = (gvram[offset] & 0xff00) | (data & 0x00ff); |
| 536 | 551 | } |
| 537 | 552 | if(offset >= 0x40000 && offset < 0x80000) |
| 538 | 553 | { |
| 539 | | state->m_gvram[offset-0x40000] = (state->m_gvram[offset-0x40000] & 0x00ff) | ((data & 0x00ff) << 8); |
| 554 | gvram[offset-0x40000] = (gvram[offset-0x40000] & 0x00ff) | ((data & 0x00ff) << 8); |
| 540 | 555 | } |
| 541 | 556 | break; |
| 542 | 557 | case 0x0000: |
| 543 | 558 | if(offset < 0x40000) |
| 544 | 559 | { |
| 545 | | state->m_gvram[offset] = (state->m_gvram[offset] & 0xfff0) | (data & 0x000f); |
| 560 | gvram[offset] = (gvram[offset] & 0xfff0) | (data & 0x000f); |
| 546 | 561 | } |
| 547 | 562 | if(offset >= 0x40000 && offset < 0x80000) |
| 548 | 563 | { |
| 549 | | state->m_gvram[offset-0x40000] = (state->m_gvram[offset-0x40000] & 0xff0f) | ((data & 0x000f) << 4); |
| 564 | gvram[offset-0x40000] = (gvram[offset-0x40000] & 0xff0f) | ((data & 0x000f) << 4); |
| 550 | 565 | } |
| 551 | 566 | if(offset >= 0x80000 && offset < 0xc0000) |
| 552 | 567 | { |
| 553 | | state->m_gvram[offset-0x80000] = (state->m_gvram[offset-0x80000] & 0xf0ff) | ((data & 0x000f) << 8); |
| 568 | gvram[offset-0x80000] = (gvram[offset-0x80000] & 0xf0ff) | ((data & 0x000f) << 8); |
| 554 | 569 | } |
| 555 | 570 | if(offset >= 0xc0000 && offset < 0x100000) |
| 556 | 571 | { |
| 557 | | state->m_gvram[offset-0xc0000] = (state->m_gvram[offset-0xc0000] & 0x0fff) | ((data & 0x000f) << 12); |
| 572 | gvram[offset-0xc0000] = (gvram[offset-0xc0000] & 0x0fff) | ((data & 0x000f) << 12); |
| 558 | 573 | } |
| 559 | 574 | break; |
| 560 | 575 | default: |
| r15028 | r15029 | |
| 566 | 581 | WRITE16_HANDLER( x68k_tvram_w ) |
| 567 | 582 | { |
| 568 | 583 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 584 | UINT16* tvram; |
| 569 | 585 | UINT16 text_mask; |
| 570 | 586 | |
| 587 | if(state->m_is_32bit) |
| 588 | tvram = (UINT16*)state->m_tvram32.target(); |
| 589 | else |
| 590 | tvram = (UINT16*)state->m_tvram16.target(); |
| 591 | |
| 571 | 592 | text_mask = ~(state->m_crtc.reg[23]) & mem_mask; |
| 572 | 593 | |
| 573 | 594 | if(!(state->m_crtc.reg[21] & 0x0200)) // text access mask enable |
| r15028 | r15029 | |
| 584 | 605 | { |
| 585 | 606 | if(wr & (1 << plane)) |
| 586 | 607 | { |
| 587 | | COMBINE_DATA(state->m_tvram+offset+(0x10000*plane)); |
| 608 | COMBINE_DATA(tvram+offset+(0x10000*plane)); |
| 588 | 609 | } |
| 589 | 610 | } |
| 590 | 611 | } |
| 591 | 612 | else |
| 592 | 613 | { |
| 593 | | COMBINE_DATA(state->m_tvram+offset); |
| 614 | COMBINE_DATA(tvram+offset); |
| 594 | 615 | } |
| 595 | 616 | } |
| 596 | 617 | |
| 597 | 618 | READ16_HANDLER( x68k_gvram_r ) |
| 598 | 619 | { |
| 599 | 620 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 621 | const UINT16* gvram; |
| 600 | 622 | UINT16 ret = 0; |
| 601 | 623 | |
| 624 | if(state->m_is_32bit) |
| 625 | gvram = (const UINT16*)state->m_gvram32.target(); |
| 626 | else |
| 627 | gvram = (const UINT16*)state->m_gvram16.target(); |
| 628 | |
| 602 | 629 | if(state->m_crtc.reg[20] & 0x08) // G-VRAM set to buffer |
| 603 | | return state->m_gvram[offset]; |
| 630 | return gvram[offset]; |
| 604 | 631 | |
| 605 | 632 | switch(state->m_crtc.reg[20] & 0x0300) // colour setup determines G-VRAM use |
| 606 | 633 | { |
| 607 | 634 | case 0x0300: // 65,536 colour (RGB) - 16-bits per word |
| 608 | 635 | if(offset < 0x40000) |
| 609 | | ret = state->m_gvram[offset]; |
| 636 | ret = gvram[offset]; |
| 610 | 637 | else |
| 611 | 638 | ret = 0xffff; |
| 612 | 639 | break; |
| 613 | 640 | case 0x0100: // 256 colour (paletted) - 8 bits per word |
| 614 | 641 | if(offset < 0x40000) |
| 615 | | ret = state->m_gvram[offset] & 0x00ff; |
| 642 | ret = gvram[offset] & 0x00ff; |
| 616 | 643 | if(offset >= 0x40000 && offset < 0x80000) |
| 617 | | ret = (state->m_gvram[offset-0x40000] & 0xff00) >> 8; |
| 644 | ret = (gvram[offset-0x40000] & 0xff00) >> 8; |
| 618 | 645 | if(offset >= 0x80000) |
| 619 | 646 | ret = 0xffff; |
| 620 | 647 | break; |
| 621 | 648 | case 0x0000: // 16 colour (paletted) - 4 bits per word |
| 622 | 649 | if(offset < 0x40000) |
| 623 | | ret = state->m_gvram[offset] & 0x000f; |
| 650 | ret = gvram[offset] & 0x000f; |
| 624 | 651 | if(offset >= 0x40000 && offset < 0x80000) |
| 625 | | ret = (state->m_gvram[offset-0x40000] & 0x00f0) >> 4; |
| 652 | ret = (gvram[offset-0x40000] & 0x00f0) >> 4; |
| 626 | 653 | if(offset >= 0x80000 && offset < 0xc0000) |
| 627 | | ret = (state->m_gvram[offset-0x80000] & 0x0f00) >> 8; |
| 654 | ret = (gvram[offset-0x80000] & 0x0f00) >> 8; |
| 628 | 655 | if(offset >= 0xc0000 && offset < 0x100000) |
| 629 | | ret = (state->m_gvram[offset-0xc0000] & 0xf000) >> 12; |
| 656 | ret = (gvram[offset-0xc0000] & 0xf000) >> 12; |
| 630 | 657 | break; |
| 631 | 658 | default: |
| 632 | 659 | logerror("G-VRAM read while layer setup is undefined.\n"); |
| r15028 | r15029 | |
| 639 | 666 | READ16_HANDLER( x68k_tvram_r ) |
| 640 | 667 | { |
| 641 | 668 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 642 | | return state->m_tvram[offset]; |
| 669 | const UINT16* tvram; |
| 670 | |
| 671 | if(state->m_is_32bit) |
| 672 | tvram = (const UINT16*)state->m_tvram32.target(); |
| 673 | else |
| 674 | tvram = (const UINT16*)state->m_tvram16.target(); |
| 675 | |
| 676 | return tvram[offset]; |
| 643 | 677 | } |
| 644 | 678 | |
| 645 | 679 | READ32_HANDLER( x68k_tvram32_r ) |
| r15028 | r15029 | |
| 769 | 803 | static void x68k_draw_text(running_machine &machine,bitmap_ind16 &bitmap, int xscr, int yscr, rectangle rect) |
| 770 | 804 | { |
| 771 | 805 | x68k_state *state = machine.driver_data<x68k_state>(); |
| 806 | const UINT16* tvram; |
| 772 | 807 | unsigned int line,pixel; // location on screen |
| 773 | 808 | UINT32 loc; // location in TVRAM |
| 774 | 809 | UINT32 colour; |
| 775 | 810 | int bit; |
| 776 | 811 | |
| 812 | if(state->m_is_32bit) |
| 813 | tvram = (const UINT16*)state->m_tvram32.target(); |
| 814 | else |
| 815 | tvram = (const UINT16*)state->m_tvram16.target(); |
| 816 | |
| 777 | 817 | for(line=rect.min_y;line<=rect.max_y;line++) // per scanline |
| 778 | 818 | { |
| 779 | 819 | // adjust for scroll registers |
| r15028 | r15029 | |
| 783 | 823 | bit = 15 - (xscr & 0x0f); |
| 784 | 824 | for(pixel=rect.min_x;pixel<=rect.max_x;pixel++) // per pixel |
| 785 | 825 | { |
| 786 | | colour = (((state->m_tvram[loc] >> bit) & 0x01) ? 1 : 0) |
| 787 | | + (((state->m_tvram[loc+0x10000] >> bit) & 0x01) ? 2 : 0) |
| 788 | | + (((state->m_tvram[loc+0x20000] >> bit) & 0x01) ? 4 : 0) |
| 789 | | + (((state->m_tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); |
| 826 | colour = (((tvram[loc] >> bit) & 0x01) ? 1 : 0) |
| 827 | + (((tvram[loc+0x10000] >> bit) & 0x01) ? 2 : 0) |
| 828 | + (((tvram[loc+0x20000] >> bit) & 0x01) ? 4 : 0) |
| 829 | + (((tvram[loc+0x30000] >> bit) & 0x01) ? 8 : 0); |
| 790 | 830 | if(state->m_video.text_pal[colour] != 0x0000) // any colour but black |
| 791 | 831 | { |
| 792 | 832 | // Colour 0 is displayable if the text layer is at the priority level 2 |
| r15028 | r15029 | |
| 810 | 850 | static void x68k_draw_gfx_scanline(running_machine &machine, bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority) |
| 811 | 851 | { |
| 812 | 852 | x68k_state *state = machine.driver_data<x68k_state>(); |
| 853 | const UINT16* gvram; |
| 813 | 854 | int pixel; |
| 814 | 855 | int page; |
| 815 | 856 | UINT32 loc; // location in GVRAM |
| r15028 | r15029 | |
| 819 | 860 | int shift; |
| 820 | 861 | int scanline; |
| 821 | 862 | |
| 863 | if(state->m_is_32bit) |
| 864 | gvram = (const UINT16*)state->m_gvram32.target(); |
| 865 | else |
| 866 | gvram = (const UINT16*)state->m_gvram16.target(); |
| 867 | |
| 822 | 868 | for(scanline=cliprect.min_y;scanline<=cliprect.max_y;scanline++) // per scanline |
| 823 | 869 | { |
| 824 | 870 | if(state->m_crtc.reg[20] & 0x0400) // 1024x1024 "real" screen size - use 1024x1024 16-colour gfx layer |
| r15028 | r15029 | |
| 835 | 881 | switch(lineoffset & 0xc0000) |
| 836 | 882 | { |
| 837 | 883 | case 0x00000: |
| 838 | | colour = state->m_gvram[lineoffset + (loc & 0x3ff)] & 0x000f; |
| 884 | colour = gvram[lineoffset + (loc & 0x3ff)] & 0x000f; |
| 839 | 885 | break; |
| 840 | 886 | case 0x40000: |
| 841 | | colour = (state->m_gvram[(lineoffset - 0x40000) + (loc & 0x3ff)] & 0x00f0) >> 4; |
| 887 | colour = (gvram[(lineoffset - 0x40000) + (loc & 0x3ff)] & 0x00f0) >> 4; |
| 842 | 888 | break; |
| 843 | 889 | case 0x80000: |
| 844 | | colour = (state->m_gvram[(lineoffset - 0x80000) + (loc & 0x3ff)] & 0x0f00) >> 8; |
| 890 | colour = (gvram[(lineoffset - 0x80000) + (loc & 0x3ff)] & 0x0f00) >> 8; |
| 845 | 891 | break; |
| 846 | 892 | case 0xc0000: |
| 847 | | colour = (state->m_gvram[(lineoffset - 0xc0000) + (loc & 0x3ff)] & 0xf000) >> 12; |
| 893 | colour = (gvram[(lineoffset - 0xc0000) + (loc & 0x3ff)] & 0xf000) >> 12; |
| 848 | 894 | break; |
| 849 | 895 | } |
| 850 | 896 | if(colour != 0) |
| r15028 | r15029 | |
| 870 | 916 | shift = 4; |
| 871 | 917 | for(pixel=state->m_crtc.hbegin;pixel<=state->m_crtc.hend;pixel++) |
| 872 | 918 | { |
| 873 | | colour = ((state->m_gvram[lineoffset + loc] >> page*shift) & 0x000f); |
| 919 | colour = ((gvram[lineoffset + loc] >> page*shift) & 0x000f); |
| 874 | 920 | if(colour != 0) |
| 875 | 921 | bitmap.pix16(scanline, pixel) = 512 + (state->m_video.gfx_pal[colour & 0x0f] >> 1); |
| 876 | 922 | loc++; |
| r15028 | r15029 | |
| 887 | 933 | shift = 4; |
| 888 | 934 | for(pixel=state->m_crtc.hbegin;pixel<=state->m_crtc.hend;pixel++) |
| 889 | 935 | { |
| 890 | | colour = ((state->m_gvram[lineoffset + loc] >> page*shift) & 0x00ff); |
| 936 | colour = ((gvram[lineoffset + loc] >> page*shift) & 0x00ff); |
| 891 | 937 | if(colour != 0) |
| 892 | 938 | bitmap.pix16(scanline, pixel) = 512 + (state->m_video.gfx_pal[colour & 0xff] >> 1); |
| 893 | 939 | loc++; |
| r15028 | r15029 | |
| 902 | 948 | loc = xscr & 0x1ff; |
| 903 | 949 | for(pixel=state->m_crtc.hbegin;pixel<=state->m_crtc.hend;pixel++) |
| 904 | 950 | { |
| 905 | | colour = state->m_gvram[lineoffset + loc]; |
| 951 | colour = gvram[lineoffset + loc]; |
| 906 | 952 | if(colour != 0) |
| 907 | 953 | bitmap.pix16(scanline, pixel) = 512 + (colour >> 1); |
| 908 | 954 | loc++; |
src/mess/drivers/x68k.c
| r15028 | r15029 | |
| 1544 | 1544 | |
| 1545 | 1545 | if(state->m_sysport.sram_writeprotect == 0x31) |
| 1546 | 1546 | { |
| 1547 | | state->m_nvram[offset] = data; |
| 1547 | COMBINE_DATA(state->m_nvram16 + offset); |
| 1548 | 1548 | } |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| r15028 | r15029 | |
| 1564 | 1564 | if(offset == 0x70/2) |
| 1565 | 1565 | return 0x0700; |
| 1566 | 1566 | #endif |
| 1567 | | return state->m_nvram[offset]; |
| 1567 | return state->m_nvram16[offset]; |
| 1568 | 1568 | } |
| 1569 | 1569 | |
| 1570 | 1570 | static READ32_HANDLER( x68k_sram32_r ) |
| 1571 | 1571 | { |
| 1572 | | x68030_state *state = space->machine().driver_data<x68030_state>(); |
| 1572 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 1573 | 1573 | if(offset == 0x08/4) |
| 1574 | 1574 | return (space->machine().device<ram_device>(RAM_TAG)->size() & 0xffff0000); // RAM size |
| 1575 | 1575 | #if 0 |
| r15028 | r15029 | |
| 1580 | 1580 | if(offset == 0x70/2) |
| 1581 | 1581 | return 0x0700; |
| 1582 | 1582 | #endif |
| 1583 | | return state->m_nvram[offset]; |
| 1583 | return state->m_nvram32[offset]; |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | 1586 | static WRITE32_HANDLER( x68k_sram32_w ) |
| 1587 | 1587 | { |
| 1588 | | x68030_state *state = space->machine().driver_data<x68030_state>(); |
| 1588 | x68k_state *state = space->machine().driver_data<x68k_state>(); |
| 1589 | 1589 | if(state->m_sysport.sram_writeprotect == 0x31) |
| 1590 | 1590 | { |
| 1591 | | COMBINE_DATA(state->m_nvram + offset); |
| 1591 | COMBINE_DATA(state->m_nvram32 + offset); |
| 1592 | 1592 | } |
| 1593 | 1593 | } |
| 1594 | 1594 | |
| r15028 | r15029 | |
| 1965 | 1965 | AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE_LEGACY(x68k_rom0_r, x68k_rom0_w) |
| 1966 | 1966 | // AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE_LEGACY(x68k_gvram_r, x68k_gvram_w) AM_SHARE("gvram") |
| 1967 | 1967 | // AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE_LEGACY(x68k_tvram_r, x68k_tvram_w) AM_SHARE("tvram") |
| 1968 | | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram") |
| 1969 | | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram") |
| 1968 | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram16") |
| 1969 | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram16") |
| 1970 | 1970 | AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE_LEGACY(x68k_crtc_r, x68k_crtc_w) |
| 1971 | 1971 | AM_RANGE(0xe82000, 0xe83fff) AM_READWRITE_LEGACY(x68k_vid_r, x68k_vid_w) |
| 1972 | 1972 | AM_RANGE(0xe84000, 0xe85fff) AM_READWRITE_LEGACY(x68k_dmac_r, x68k_dmac_w) |
| r15028 | r15029 | |
| 1990 | 1990 | AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE_LEGACY(x68k_spriteram_r, x68k_spriteram_w) |
| 1991 | 1991 | AM_RANGE(0xece000, 0xece3ff) AM_READWRITE_LEGACY(x68k_exp_r, x68k_exp_w) // User I/O |
| 1992 | 1992 | // AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE_LEGACY(sram_r, sram_w) AM_BASE_LEGACY(&generic_nvram16) AM_SIZE_LEGACY(&generic_nvram_size) |
| 1993 | | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram") |
| 1993 | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram16") |
| 1994 | 1994 | AM_RANGE(0xed4000, 0xefffff) AM_NOP |
| 1995 | 1995 | AM_RANGE(0xf00000, 0xfbffff) AM_ROM |
| 1996 | 1996 | AM_RANGE(0xfc0000, 0xfdffff) AM_READWRITE_LEGACY(x68k_exp_r, x68k_exp_w) // internal SCSI ROM |
| r15028 | r15029 | |
| 2002 | 2002 | AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE_LEGACY(x68k_rom0_r, x68k_rom0_w) |
| 2003 | 2003 | // AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE_LEGACY(x68k_gvram_r, x68k_gvram_w) AM_SHARE("gvram") |
| 2004 | 2004 | // AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE_LEGACY(x68k_tvram_r, x68k_tvram_w) AM_SHARE("tvram") |
| 2005 | | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram") |
| 2006 | | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram") |
| 2005 | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram16") |
| 2006 | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram16") |
| 2007 | 2007 | AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE_LEGACY(x68k_crtc_r, x68k_crtc_w) |
| 2008 | 2008 | AM_RANGE(0xe82000, 0xe83fff) AM_READWRITE_LEGACY(x68k_vid_r, x68k_vid_w) |
| 2009 | 2009 | AM_RANGE(0xe84000, 0xe85fff) AM_READWRITE_LEGACY(x68k_dmac_r, x68k_dmac_w) |
| r15028 | r15029 | |
| 2028 | 2028 | AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE_LEGACY(x68k_spriteram_r, x68k_spriteram_w) |
| 2029 | 2029 | AM_RANGE(0xece000, 0xece3ff) AM_READWRITE_LEGACY(x68k_exp_r, x68k_exp_w) // User I/O |
| 2030 | 2030 | // AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE_LEGACY(sram_r, sram_w) AM_BASE_LEGACY(&generic_nvram16) AM_SIZE_LEGACY(&generic_nvram_size) |
| 2031 | | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram") |
| 2031 | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram16") |
| 2032 | 2032 | AM_RANGE(0xed4000, 0xefffff) AM_NOP |
| 2033 | 2033 | AM_RANGE(0xf00000, 0xfbffff) AM_ROM |
| 2034 | 2034 | AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM |
| r15028 | r15029 | |
| 2041 | 2041 | AM_RANGE(0xbffffc, 0xbfffff) AM_READWRITE16_LEGACY(x68k_rom0_r, x68k_rom0_w,0xffffffff) |
| 2042 | 2042 | // AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE_LEGACY(x68k_gvram_r, x68k_gvram_w) AM_SHARE("gvram") |
| 2043 | 2043 | // AM_RANGE(0xe00000, 0xe7ffff) AM_READWRITE_LEGACY(x68k_tvram_r, x68k_tvram_w) AM_SHARE("tvram") |
| 2044 | | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram") |
| 2045 | | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram") |
| 2044 | AM_RANGE(0xc00000, 0xdfffff) AM_RAMBANK("bank2") AM_SHARE("gvram32") |
| 2045 | AM_RANGE(0xe00000, 0xe7ffff) AM_RAMBANK("bank3") AM_SHARE("tvram32") |
| 2046 | 2046 | AM_RANGE(0xe80000, 0xe81fff) AM_READWRITE16_LEGACY(x68k_crtc_r, x68k_crtc_w,0xffffffff) |
| 2047 | 2047 | AM_RANGE(0xe82000, 0xe83fff) AM_READWRITE16_LEGACY(x68k_vid_r, x68k_vid_w,0xffffffff) |
| 2048 | 2048 | AM_RANGE(0xe84000, 0xe85fff) AM_READWRITE16_LEGACY(x68k_dmac_r, x68k_dmac_w,0xffffffff) |
| r15028 | r15029 | |
| 2066 | 2066 | AM_RANGE(0xeb8000, 0xebffff) AM_READWRITE16_LEGACY(x68k_spriteram_r, x68k_spriteram_w,0xffffffff) |
| 2067 | 2067 | AM_RANGE(0xece000, 0xece3ff) AM_READWRITE16_LEGACY(x68k_exp_r, x68k_exp_w,0xffffffff) // User I/O |
| 2068 | 2068 | // AM_RANGE(0xed0000, 0xed3fff) AM_READWRITE_LEGACY(sram_r, sram_w) AM_BASE_LEGACY(&generic_nvram16) AM_SIZE_LEGACY(&generic_nvram_size) |
| 2069 | | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram") |
| 2069 | AM_RANGE(0xed0000, 0xed3fff) AM_RAMBANK("bank4") AM_SHARE("nvram32") |
| 2070 | 2070 | AM_RANGE(0xed4000, 0xefffff) AM_NOP |
| 2071 | 2071 | AM_RANGE(0xf00000, 0xfbffff) AM_ROM |
| 2072 | 2072 | AM_RANGE(0xfc0000, 0xfdffff) AM_ROM // internal SCSI ROM |
| r15028 | r15029 | |
| 2647 | 2647 | state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer()); |
| 2648 | 2648 | space->install_legacy_read_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram_r)); |
| 2649 | 2649 | space->install_legacy_write_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram_w)); |
| 2650 | | state->membank("bank2")->set_base(state->m_gvram); // so that code in VRAM is executable - needed for Terra Cresta |
| 2650 | state->membank("bank2")->set_base(state->m_gvram16); // so that code in VRAM is executable - needed for Terra Cresta |
| 2651 | 2651 | space->install_legacy_read_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram_r)); |
| 2652 | 2652 | space->install_legacy_write_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram_w)); |
| 2653 | | state->membank("bank3")->set_base(state->m_tvram); // so that code in VRAM is executable - needed for Terra Cresta |
| 2653 | state->membank("bank3")->set_base(state->m_tvram16); // so that code in VRAM is executable - needed for Terra Cresta |
| 2654 | 2654 | space->install_legacy_read_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram_r)); |
| 2655 | 2655 | space->install_legacy_write_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram_w)); |
| 2656 | | state->membank("bank4")->set_base(state->m_nvram); // so that code in SRAM is executable, there is an option for booting from SRAM |
| 2656 | state->membank("bank4")->set_base(state->m_nvram16); // so that code in SRAM is executable, there is an option for booting from SRAM |
| 2657 | 2657 | |
| 2658 | 2658 | // start keyboard timer |
| 2659 | 2659 | state->m_kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5)); // every 5ms |
| r15028 | r15029 | |
| 2669 | 2669 | static MACHINE_START( x68030 ) |
| 2670 | 2670 | { |
| 2671 | 2671 | address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM); |
| 2672 | | x68030_state *state = machine.driver_data<x68030_state>(); |
| 2672 | x68k_state *state = machine.driver_data<x68k_state>(); |
| 2673 | 2673 | /* Install RAM handlers */ |
| 2674 | 2674 | state->m_spriteram = (UINT16*)(*state->memregion("user1")); |
| 2675 | 2675 | space->install_legacy_read_handler(0x000000,0xbffffb,0xffffffff,0,FUNC(x68k_rom0_r),0xffffffff); |
| r15028 | r15029 | |
| 2678 | 2678 | state->membank("bank1")->set_base(machine.device<ram_device>(RAM_TAG)->pointer()); |
| 2679 | 2679 | space->install_legacy_read_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram32_r)); |
| 2680 | 2680 | space->install_legacy_write_handler(0xc00000,0xdfffff,0xffffffff,0,FUNC(x68k_gvram32_w)); |
| 2681 | | state->membank("bank2")->set_base(state->m_gvram); // so that code in VRAM is executable - needed for Terra Cresta |
| 2681 | state->membank("bank2")->set_base(state->m_gvram32); // so that code in VRAM is executable - needed for Terra Cresta |
| 2682 | 2682 | space->install_legacy_read_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram32_r)); |
| 2683 | 2683 | space->install_legacy_write_handler(0xe00000,0xe7ffff,0xffffffff,0,FUNC(x68k_tvram32_w)); |
| 2684 | | state->membank("bank3")->set_base(state->m_tvram); // so that code in VRAM is executable - needed for Terra Cresta |
| 2684 | state->membank("bank3")->set_base(state->m_tvram32); // so that code in VRAM is executable - needed for Terra Cresta |
| 2685 | 2685 | space->install_legacy_read_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram32_r)); |
| 2686 | 2686 | space->install_legacy_write_handler(0xed0000,0xed3fff,0xffffffff,0,FUNC(x68k_sram32_w)); |
| 2687 | | state->membank("bank4")->set_base(state->m_nvram); // so that code in SRAM is executable, there is an option for booting from SRAM |
| 2687 | state->membank("bank4")->set_base(state->m_nvram32); // so that code in SRAM is executable, there is an option for booting from SRAM |
| 2688 | 2688 | |
| 2689 | 2689 | // start keyboard timer |
| 2690 | 2690 | state->m_kb_timer->adjust(attotime::zero, 0, attotime::from_msec(5)); // every 5ms |
| r15028 | r15029 | |
| 2738 | 2738 | md_6button_init(machine); |
| 2739 | 2739 | |
| 2740 | 2740 | state->m_sysport.cputype = 0xff; // 68000, 10MHz |
| 2741 | state->m_is_32bit = false; |
| 2741 | 2742 | } |
| 2742 | 2743 | |
| 2743 | 2744 | static DRIVER_INIT( x68kxvi ) |
| r15028 | r15029 | |
| 2745 | 2746 | x68k_state *state = machine.driver_data<x68k_state>(); |
| 2746 | 2747 | DRIVER_INIT_CALL( x68000 ); |
| 2747 | 2748 | state->m_sysport.cputype = 0xfe; // 68000, 16MHz |
| 2749 | state->m_is_32bit = false; |
| 2748 | 2750 | } |
| 2749 | 2751 | |
| 2750 | 2752 | static DRIVER_INIT( x68030 ) |
| r15028 | r15029 | |
| 2752 | 2754 | x68k_state *state = machine.driver_data<x68k_state>(); |
| 2753 | 2755 | DRIVER_INIT_CALL( x68000 ); |
| 2754 | 2756 | state->m_sysport.cputype = 0xdc; // 68030, 25MHz |
| 2757 | state->m_is_32bit = true; |
| 2755 | 2758 | } |
| 2756 | 2759 | |
| 2757 | 2760 | static MACHINE_CONFIG_FRAGMENT( x68000_base ) |
| r15028 | r15029 | |
| 2817 | 2820 | static MACHINE_CONFIG_START( x68000, x68k_state ) |
| 2818 | 2821 | MCFG_FRAGMENT_ADD(x68000_base) |
| 2819 | 2822 | |
| 2820 | | MCFG_NVRAM_ADD_0FILL("nvram") |
| 2823 | MCFG_NVRAM_ADD_0FILL("nvram16") |
| 2821 | 2824 | |
| 2822 | 2825 | MCFG_X68KHDC_ADD( "x68k_hdc" ) |
| 2823 | 2826 | |
| r15028 | r15029 | |
| 2839 | 2842 | MCFG_HARDDISK_ADD("harddisk6") |
| 2840 | 2843 | MACHINE_CONFIG_END |
| 2841 | 2844 | |
| 2842 | | static MACHINE_CONFIG_START( x68030, x68030_state ) |
| 2845 | static MACHINE_CONFIG_START( x68030, x68k_state ) |
| 2843 | 2846 | MCFG_FRAGMENT_ADD(x68000_base) |
| 2844 | 2847 | |
| 2845 | 2848 | MCFG_CPU_REPLACE("maincpu", M68030, 25000000) /* 25 MHz 68EC030 */ |
| r15028 | r15029 | |
| 2848 | 2851 | MCFG_MACHINE_START( x68030 ) |
| 2849 | 2852 | MCFG_MACHINE_RESET( x68000 ) |
| 2850 | 2853 | |
| 2851 | | MCFG_NVRAM_ADD_0FILL("nvram") |
| 2854 | MCFG_NVRAM_ADD_0FILL("nvram32") |
| 2852 | 2855 | |
| 2853 | 2856 | MCFG_MB89352A_ADD("mb89352_int",x68k_scsi_intf) |
| 2854 | 2857 | MCFG_HARDDISK_ADD("harddisk0") |