Previous 199869 Revisions Next

r21583 Tuesday 5th March, 2013 at 06:34:52 UTC by Fabio Priuli
snes: shuffling some code around (part 4). nw.
[src/mame/includes]snes.h
[src/mame/machine]snes.c snes7110.c
[src/mess/drivers]snes.c

trunk/src/mame/machine/snes.c
r21582r21583
410410         return superfx_mmio_read(state->m_superfx, offset);
411411      }
412412   }
413   else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
414   {
415      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
416      if (offset >= 0x4800 && offset <= limit)
417      {
418         return spc7110_mmio_read(space, offset);
419      }
420   }
421413
422414   if (offset >= DMAP0 && offset < 0x4380)
423415   {
r21582r21583
529521         return;
530522      }
531523   }
532   else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
533   {
534      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
535      if (offset >= 0x4800 && offset <= limit)
536      {
537         spc7110_mmio_write(space.machine(), (UINT32)offset, data);
538         return;
539      }
540   }
541524
542525   if (offset >= DMAP0 && offset < 0x4380)
543526   {
r21582r21583
755738         else
756739            value = snes_open_bus_r(space, 0);
757740      }
758      else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
759      {
760         if (offset < 0x10000)
761            value = snes_ram[0x306000 + (offset & 0x1fff)];
762      }
763741      else
764742      {
765743         logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space.device().safe_pc(),address);
r21582r21583
797775         else
798776            value = snes_open_bus_r(space, 0);
799777      }
800      else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
801      {
802         if (offset < 0x10000)
803            value = snes_ram[0x306000 + (offset & 0x1fff)];
804      }
805778      else if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0))
806779      {
807780         /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
r21582r21583
841814         return sfx_data[offset & 0x0f];
842815      }
843816   }
844   else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC))
845   {
846      if (offset >= 0x100000 && offset < 0x110000)
847         value = spc7110_mmio_read(space, 0x4800);
848   }
849817   else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX))  /* Mode 20 & 22 */
850818   {
851819      if ((address < 0x8000) && (state->m_cart[0].mode == SNES_MODE_20))
r21582r21583
995963            value = snes_open_bus_r(space, 0);
996964      }
997965   }
998   else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset >= 0x100000)
999      value = spc7110_bank7_read(space, offset);
1000966   else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX))      /* Mode 20 & 22 */
1001967   {
1002968      if (address < 0x8000)
r21582r21583
1030996   {
1031997      if (state->m_has_addon_chip == HAS_SUPERFX)
1032998         snes_ram[0xf00000 + (offset & 0x1fff)] = data;  // here it should be 0xe00000 but there are mirroring issues
1033      else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
1034      {
1035         if (offset < 0x10000)
1036            snes_ram[0x306000 + (offset & 0x1fff)] = data;
1037      }
1038999      else
10391000         logerror("snes_w_bank1: Attempt to write to reserved address: %x = %02x\n", offset, data);
10401001   }
r21582r21583
10611022   {
10621023      if (state->m_has_addon_chip == HAS_SUPERFX)
10631024         snes_ram[0xf00000 + (offset & 0x1fff)] = data;  // here it should be 0xe00000 but there are mirroring issues
1064      else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
1065      {
1066         if (offset < 0x10000)
1067            snes_ram[0x306000 + (offset & 0x1fff)] = data;
1068      }
10691025      else if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0))
10701026      {
10711027         /* Donkey Kong Country checks this and detects a copier if 0x800 is not masked out due to sram size */
trunk/src/mame/machine/snes7110.c
r21582r21583
758758      + m_morton32[2][(data >> 16) & 255] + m_morton32[3][(data >> 24) & 255];
759759}
760760
761static void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data);
762static UINT8 spc7110_mmio_read(address_space &space, UINT32 addr);
763761static void spc7110_update_time(running_machine &machine, UINT8 offset);
764762
765763enum RTC_State
r21582r21583
10581056   }
10591057}
10601058
1061static UINT8 spc7110_mmio_read(address_space &space, UINT32 addr)
1059UINT8 spc7110_mmio_read(address_space &space, UINT32 addr)
10621060{
10631061   running_machine &machine = space.machine();
10641062   UINT8 *ROM = machine.root_device().memregion("cart")->base();
r21582r21583
12451243   return snes_open_bus_r(space, 0);
12461244}
12471245
1248static void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data)
1246void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data)
12491247{
12501248   UINT8 *ROM = machine.root_device().memregion("cart")->base();
12511249
r21582r21583
16311629   }
16321630}
16331631
1634static UINT8 spc7110_bank7_read(address_space &space, UINT32 offset)
1632UINT8 spc7110_bank7_read(address_space &space, UINT32 offset)
16351633{
16361634   UINT8 *ROM = space.machine().root_device().memregion("cart")->base();
16371635   UINT32 addr = offset & 0x0fffff;
trunk/src/mame/includes/snes.h
r21582r21583
776776UINT8 sdd1_mmio_read(address_space &space, UINT32 addr);
777777void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data);
778778UINT8 sdd1_read(running_machine& machine, UINT32 addr);
779UINT8 spc7110_mmio_read(address_space &space, UINT32 addr);
780void spc7110_mmio_write(running_machine &machine, UINT32 addr, UINT8 data);
781UINT8 spc7110_bank7_read(address_space &space, UINT32 offset);
779782
780783
781784extern struct snes_cart_info snes_cart;
trunk/src/mess/drivers/snes.c
r21582r21583
144144   if (state->m_has_addon_chip == HAS_SDD1
145145      && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
146146      return sdd1_mmio_read(space, (UINT32)(offset & 0xffff));
147   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
148      && offset < 0x400000)
149   {   
150      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
151      if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit)
152         return spc7110_mmio_read(space, (UINT32)(offset & 0xffff));
153      if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
154         return snes_ram[0x306000 + (offset & 0x1fff)];
155      if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
156         return snes_ram[0x306000 + (offset & 0x1fff)];
157   }
158   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
159      && offset >= 0x500000 && offset < 0x510000)
160      return spc7110_mmio_read(space, 0x4800);
147161   
148162   // base cart access
149163   if (offset < 0x300000)
r21582r21583
198212      && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
199213      return sdd1_mmio_read(space, (UINT32)(offset & 0xffff));
200214   if (state->m_has_addon_chip == HAS_SDD1 && offset >= 0x400000)
201      return sdd1_read(space.machine(), offset - 0x400000);;
215      return sdd1_read(space.machine(), offset - 0x400000);
216   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
217      && offset < 0x400000)
218   {   
219      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
220      if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit)
221         return spc7110_mmio_read(space, (UINT32)(offset & 0xffff));
222      if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
223         return snes_ram[0x306000 + (offset & 0x1fff)];
224      if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
225         return snes_ram[0x306000 + (offset & 0x1fff)];
226   }
227   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
228      && offset >= 0x500000)
229      return spc7110_bank7_read(space, offset - 0x400000);
202230   
203231   // base cart access
204232   if (offset < 0x400000)
r21582r21583
276304            // here we don't return, but we let the w_io happen...
277305      }
278306   }
307   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset < 0x400000)
308   {   
309      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
310      if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit)
311      {   spc7110_mmio_write(space.machine(), (UINT32)(offset & 0xffff), data);   return;   }
312      if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
313      {   snes_ram[0x306000 + (offset & 0x1fff)] = data;   return;   }
314      if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
315      {   snes_ram[0x306000 + (offset & 0x1fff)] = data;   return;   }
316   }
279317   
280318   // base cart access
281319   if (offset < 0x300000)
r21582r21583
359397         // here we don't return, but we let the w_io happen...
360398      }
361399   }
400   if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset < 0x400000)
401   {   
402      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
403      if ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) <= limit)
404      {   spc7110_mmio_write(space.machine(), (UINT32)(offset & 0xffff), data);   return;   }
405      if (offset < 0x10000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
406      {   snes_ram[0x306000 + (offset & 0x1fff)] = data;   return;   }
407      if (offset >= 0x300000 && offset < 0x310000 && (offset & 0xffff) >= 0x6000 && (offset & 0xffff) < 0x8000)
408      {   snes_ram[0x306000 + (offset & 0x1fff)] = data;   return;   }
409   }
362410   
363411   // base cart access
364412   if (offset < 0x400000)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team