Previous 15994 Revisions Next

r9265 Tuesday 28th September, 2010 at 16:02:27 UTC by Tafoid
Haze: More mame syncing (Cleaned up DMA function when SVP is used (Virtua Racing Genesis), avoiding duplicate code.)
[src/mame/drivers]megadriv.c

src/mame/drivers/megadriv.c
r9264r9265
622622{
623623   // should we limit the valid areas here?
624624   // how does this behave with the segacd etc?
625   // svp uses it's own function elsewhere...
626625   // note, the RV bit on 32x is important for this to work, because it causes a normal cart mapping - see tempo
627626   address_space *space68k = machine->device<legacy_cpu_device>("maincpu")->space();
628627
629628   if (( source >= 0x000000 ) && ( source <= 0x3fffff ))
630629   {
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   
631635      return space68k->read_word(source);
632636   }
633637   else if (( source >= 0xe00000 ) && ( source <= 0xffffff ))
r9264r9265
38933897ADDRESS_MAP_END
38943898
38953899
3896/* DMA read function for SVP */
3897static 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
39233900/* emulate testmode plug */
39243901static UINT8 megadrive_io_read_data_port_svp(running_machine *machine, int portnum)
39253902{
r9264r9265
39603937   ROM = memory_region(machine, "maincpu");
39613938   memory_set_bankptr(machine,  "bank4", ROM + 0x800 );
39623939
3963   vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_svp;
39643940   megadrive_io_read_data_port_ptr   = megadrive_io_read_data_port_svp;
39653941}
39663942

Previous 15994 Revisions Next


© 1998-2018 The MESS Team