src/mame/drivers/megadriv.c
| r9264 | r9265 | |
| 622 | 622 | { |
| 623 | 623 | // should we limit the valid areas here? |
| 624 | 624 | // how does this behave with the segacd etc? |
| 625 | | // svp uses it's own function elsewhere... |
| 626 | 625 | // note, the RV bit on 32x is important for this to work, because it causes a normal cart mapping - see tempo |
| 627 | 626 | address_space *space68k = machine->device<legacy_cpu_device>("maincpu")->space(); |
| 628 | 627 | |
| 629 | 628 | if (( source >= 0x000000 ) && ( source <= 0x3fffff )) |
| 630 | 629 | { |
| 630 | if (_svp_cpu != NULL) |
| 631 | { |
| 632 | source -= 2; // the SVP introduces some kind of DMA 'lag', which we have to compensate for, this is obvious even on gfx DMAd from ROM (the Speedometer) |
| 633 | } |
| 634 | |
| 631 | 635 | return space68k->read_word(source); |
| 632 | 636 | } |
| 633 | 637 | else if (( source >= 0xe00000 ) && ( source <= 0xffffff )) |
| r9264 | r9265 | |
| 3893 | 3897 | ADDRESS_MAP_END |
| 3894 | 3898 | |
| 3895 | 3899 | |
| 3896 | | /* DMA read function for SVP */ |
| 3897 | | static UINT16 vdp_get_word_from_68k_mem_svp(running_machine *machine, UINT32 source) |
| 3898 | | { |
| 3899 | | if ((source & 0xe00000) == 0x000000) |
| 3900 | | { |
| 3901 | | UINT16 *rom = (UINT16*)memory_region(machine, "maincpu"); |
| 3902 | | source -= 2; // DMA latency |
| 3903 | | return rom[source >> 1]; |
| 3904 | | } |
| 3905 | | else if ((source & 0xfe0000) == 0x300000) |
| 3906 | | { |
| 3907 | | UINT16 *dram = (UINT16*)svp.dram; |
| 3908 | | source &= 0x1fffe; |
| 3909 | | source -= 2; |
| 3910 | | return dram[source >> 1]; |
| 3911 | | } |
| 3912 | | else if ((source & 0xe00000) == 0xe00000) |
| 3913 | | { |
| 3914 | | return megadrive_ram[(source&0xffff)>>1]; |
| 3915 | | } |
| 3916 | | else |
| 3917 | | { |
| 3918 | | mame_printf_debug("DMA Read unmapped %06x\n",source); |
| 3919 | | return mame_rand(machine); |
| 3920 | | } |
| 3921 | | } |
| 3922 | | |
| 3923 | 3900 | /* emulate testmode plug */ |
| 3924 | 3901 | static UINT8 megadrive_io_read_data_port_svp(running_machine *machine, int portnum) |
| 3925 | 3902 | { |
| r9264 | r9265 | |
| 3960 | 3937 | ROM = memory_region(machine, "maincpu"); |
| 3961 | 3938 | memory_set_bankptr(machine, "bank4", ROM + 0x800 ); |
| 3962 | 3939 | |
| 3963 | | vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_svp; |
| 3964 | 3940 | megadrive_io_read_data_port_ptr = megadrive_io_read_data_port_svp; |
| 3965 | 3941 | } |
| 3966 | 3942 | |