diff --git a/src/mame/includes/snes.h b/src/mame/includes/snes.h index c886f4f130b..e52d2cff994 100644 --- a/src/mame/includes/snes.h +++ b/src/mame/includes/snes.h @@ -773,6 +773,9 @@ extern DECLARE_READ8_HANDLER(obc1_read); extern DECLARE_WRITE8_HANDLER(obc1_write); UINT8 CX4_read(UINT32 addr); void CX4_write(running_machine &machine, UINT32 addr, UINT8 data); +UINT8 sdd1_mmio_read(address_space &space, UINT32 addr); +void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data); +UINT8 sdd1_read(running_machine& machine, UINT32 addr); extern struct snes_cart_info snes_cart; diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c index 79dfebdd3a8..a0c5e40c4b9 100644 --- a/src/mame/machine/snes.c +++ b/src/mame/machine/snes.c @@ -410,17 +410,6 @@ READ8_HANDLER( snes_r_io ) return superfx_mmio_read(state->m_superfx, offset); } } - else if (state->m_has_addon_chip == HAS_SDD1) - { - if (offset >= 0x4800 && offset < 0x4808) - { - return sdd1_mmio_read(space, (UINT32)offset); - } - if (offset < 0x80) - { - offset += 0x4300; - } - } else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) { UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; @@ -540,19 +529,6 @@ WRITE8_HANDLER( snes_w_io ) return; } } - else if (state->m_has_addon_chip == HAS_SDD1) - { - if ((offset >= 0x4300 && offset < 0x4380) || - (offset >= 0x4800 && offset < 0x4808)) - { - sdd1_mmio_write(space, (UINT32)offset, data); - return; - } - if (offset < 0x80) - { - offset += 0x4300; - } - } else if (state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) { UINT16 limit = (state->m_has_addon_chip == HAS_SPC7110_RTC) ? 0x4842 : 0x483f; @@ -1021,8 +997,6 @@ READ8_HANDLER( snes_r_bank7 ) } else if ((state->m_has_addon_chip == HAS_SPC7110 || state->m_has_addon_chip == HAS_SPC7110_RTC) && offset >= 0x100000) value = spc7110_bank7_read(space, offset); - else if (state->m_has_addon_chip == HAS_SDD1) - value = sdd1_read(space.machine(), offset); else if ((state->m_cart[0].mode & 5) && !(state->m_has_addon_chip == HAS_SUPERFX)) /* Mode 20 & 22 */ { if (address < 0x8000) diff --git a/src/mame/machine/snessdd1.c b/src/mame/machine/snessdd1.c index 91608a857b8..c326dd296b4 100644 --- a/src/mame/machine/snessdd1.c +++ b/src/mame/machine/snessdd1.c @@ -554,15 +554,10 @@ static void sdd1_init(running_machine& machine) snes_sdd1.buffer.ready = 0; } -static UINT8 sdd1_mmio_read(address_space &space, UINT32 addr) +UINT8 sdd1_mmio_read(address_space &space, UINT32 addr) { addr &= 0xffff; - if ((addr & 0x4380) == 0x4300) - { - return snes_r_io(space, addr & 0x7f); - } - switch(addr) { case 0x4804: @@ -578,7 +573,7 @@ static UINT8 sdd1_mmio_read(address_space &space, UINT32 addr) return snes_open_bus_r(space, 0); } -static void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data) +void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data) { addr &= 0xffff; @@ -604,8 +599,6 @@ static void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data) snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size & 0x00ff) + (data << 8); break; } - snes_ram[addr] = data; - snes_io_dma_w(space, addr, data); return; } @@ -633,7 +626,7 @@ static void sdd1_mmio_write(address_space &space, UINT32 addr, UINT8 data) } } -static UINT8 sdd1_read(running_machine& machine, UINT32 addr) +UINT8 sdd1_read(running_machine& machine, UINT32 addr) { unsigned char *ROM = machine.root_device().memregion("cart")->base(); diff --git a/src/mess/drivers/snes.c b/src/mess/drivers/snes.c index f4462be32f6..33bdbb68426 100644 --- a/src/mess/drivers/snes.c +++ b/src/mess/drivers/snes.c @@ -141,6 +141,9 @@ static READ8_HANDLER( snes_lo_r ) if (state->m_has_addon_chip == HAS_DSP4 && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) return ((offset & 0xffff) < 0xc000) ? dsp_get_dr() : dsp_get_sr(); + if (state->m_has_addon_chip == HAS_SDD1 + && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) + return sdd1_mmio_read(space, (UINT32)(offset & 0xffff)); // base cart access if (offset < 0x300000) @@ -191,6 +194,11 @@ static READ8_HANDLER( snes_hi_r ) if (state->m_has_addon_chip == HAS_DSP4 && (offset >= 0x300000 && offset < 0x400000 && (offset & 0x8000) == 0x8000)) return ((offset & 0xffff) < 0xc000) ? dsp_get_dr() : dsp_get_sr(); + if (state->m_has_addon_chip == HAS_SDD1 + && (offset < 0x400000 && (offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) + return sdd1_mmio_read(space, (UINT32)(offset & 0xffff)); + if (state->m_has_addon_chip == HAS_SDD1 && offset >= 0x400000) + return sdd1_read(space.machine(), offset - 0x400000);; // base cart access if (offset < 0x400000) @@ -259,6 +267,15 @@ static WRITE8_HANDLER( snes_lo_w ) else { dsp_set_sr(data); return; } } + if (state->m_has_addon_chip == HAS_SDD1 && offset < 0x400000) + { + if (((offset & 0xffff) >= 0x4300 && (offset & 0xffff) < 0x4380) || + ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) + { + sdd1_mmio_write(space, (UINT32)(offset & 0xffff), data); + // here we don't return, but we let the w_io happen... + } + } // base cart access if (offset < 0x300000) @@ -333,6 +350,15 @@ static WRITE8_HANDLER( snes_hi_w ) else { dsp_set_sr(data); return; } } + if (state->m_has_addon_chip == HAS_SDD1 && offset < 0x400000) + { + if (((offset & 0xffff) >= 0x4300 && (offset & 0xffff) < 0x4380) || + ((offset & 0xffff) >= 0x4800 && (offset & 0xffff) < 0x4808)) + { + sdd1_mmio_write(space, (UINT32)(offset & 0xffff), data); + // here we don't return, but we let the w_io happen... + } + } // base cart access if (offset < 0x400000)