Previous 199869 Revisions Next

r21582 Tuesday 5th March, 2013 at 06:07:05 UTC by Fabio Priuli
snes: shuffling some code around (part 3). nw.
[src/mame/includes]snes.h
[src/mame/machine]snes.c snessdd1.c
[src/mess/drivers]snes.c

trunk/src/mame/machine/snes.c
r21581r21582
410410         return superfx_mmio_read(state->m_superfx, offset);
411411      }
412412   }
413   else if (state->m_has_addon_chip == HAS_SDD1)
414   {
415      if (offset >= 0x4800 && offset < 0x4808)
416      {
417         return sdd1_mmio_read(space, (UINT32)offset);
418      }
419      if (offset < 0x80)
420      {
421         offset += 0x4300;
422      }
423   }
424413   else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
425414   {
426415      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
r21581r21582
540529         return;
541530      }
542531   }
543   else if (state->m_has_addon_chip == HAS_SDD1)
544   {
545      if ((offset >= 0x4300 && offset < 0x4380) ||
546         (offset >= 0x4800 && offset < 0x4808))
547      {
548         sdd1_mmio_write(space, (UINT32)offset, data);
549         return;
550      }
551      if (offset < 0x80)
552      {
553         offset += 0x4300;
554      }
555   }
556532   else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC)
557533   {
558534      UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f;
r21581r21582
1021997   }
1022998   else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset >= 0x100000)
1023999      value = spc7110_bank7_read(space, offset);
1024   else if (state->m_has_addon_chip == HAS_SDD1)
1025      value = sdd1_read(space.machine(), offset);
10261000   else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX))      /* Mode 20 & 22 */
10271001   {
10281002      if (address < 0x8000)
trunk/src/mame/machine/snessdd1.c
r21581r21582
554554   snes_sdd1.buffer.ready = 0;
555555}
556556
557static UINT8 sdd1_mmio_read(address_space &space, UINT32 addr)
557UINT8 sdd1_mmio_read(address_space &space, UINT32 addr)
558558{
559559   addr &= 0xffff;
560560
561   if ((addr & 0x4380) == 0x4300)
562   {
563      return snes_r_io(space, addr & 0x7f);
564   }
565
566561   switch(addr)
567562   {
568563      case 0x4804:
r21581r21582
578573   return snes_open_bus_r(space, 0);
579574}
580575
581static void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data)
576void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data)
582577{
583578   addr &= 0xffff;
584579
r21581r21582
604599            snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size &   0x00ff) + (data <<  8);
605600            break;
606601      }
607      snes_ram[addr] = data;
608      snes_io_dma_w(space, addr, data);
609602      return;
610603   }
611604
r21581r21582
633626   }
634627}
635628
636static UINT8 sdd1_read(running_machine& machine, UINT32 addr)
629UINT8 sdd1_read(running_machine& machine, UINT32 addr)
637630{
638631   unsigned char *ROM = machine.root_device().memregion("cart")->base();
639632
trunk/src/mame/includes/snes.h
r21581r21582
773773extern DECLARE_WRITE8_HANDLER(obc1_write);
774774UINT8 CX4_read(UINT32 addr);
775775void CX4_write(running_machine &machine, UINT32 addr, UINT8 data);
776UINT8 sdd1_mmio_read(address_space &space, UINT32 addr);
777void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data);
778UINT8 sdd1_read(running_machine& machine, UINT32 addr);
776779
777780
778781extern struct snes_cart_info snes_cart;
trunk/src/mess/drivers/snes.c
r21581r21582
141141   if (state->m_has_addon_chip == HAS_DSP4
142142      && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
143143      return ((offset & 0xffff) < 0xc000) ? dsp_get_dr() : dsp_get_sr();
144   if (state->m_has_addon_chip == HAS_SDD1
145      && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
146      return sdd1_mmio_read(space, (UINT32)(offset & 0xffff));
144147   
145148   // base cart access
146149   if (offset < 0x300000)
r21581r21582
191194   if (state->m_has_addon_chip == HAS_DSP4
192195      && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000))
193196      return ((offset & 0xffff) < 0xc000) ? dsp_get_dr() : dsp_get_sr();
197   if (state->m_has_addon_chip == HAS_SDD1
198      && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
199      return sdd1_mmio_read(space, (UINT32)(offset & 0xffff));
200   if (state->m_has_addon_chip == HAS_SDD1 && offset >= 0x400000)
201      return sdd1_read(space.machine(), offset - 0x400000);;
194202   
195203   // base cart access
196204   if (offset < 0x400000)
r21581r21582
259267      else
260268      {   dsp_set_sr(data);   return;   }
261269   }
270   if (state->m_has_addon_chip == HAS_SDD1 && offset < 0x400000)
271   {
272      if (((offset & 0xffff) >= 0x4300 && (offset & 0xffff) < 0x4380) ||
273         ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
274      {
275            sdd1_mmio_write(space, (UINT32)(offset & 0xffff), data);
276            // here we don't return, but we let the w_io happen...
277      }
278   }
262279   
263280   // base cart access
264281   if (offset < 0x300000)
r21581r21582
333350      else
334351      {   dsp_set_sr(data);   return;   }
335352   }
353   if (state->m_has_addon_chip == HAS_SDD1 && offset < 0x400000)
354   {
355      if (((offset & 0xffff) >= 0x4300 && (offset & 0xffff) < 0x4380) ||
356         ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808))
357      {
358         sdd1_mmio_write(space, (UINT32)(offset & 0xffff), data);
359         // here we don't return, but we let the w_io happen...
360      }
361   }
336362   
337363   // base cart access
338364   if (offset < 0x400000)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team