summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2009-09-05 00:46:41 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2009-09-05 00:46:41 +0000
commit652a7ca44151b4290cb8316fa725893ca6a80dfa (patch)
tree97a4c5f6f84d9f3da2582cc64230fd89e2336bce /src
parent698949fe6aae8aa81ffaba1292d7a0ae367b81f0 (diff)
Made numerous corrections to SNES S-DD1 chip emulation, SFA2 and Star Ocean still do not boot [Harmony]
Diffstat (limited to 'src')
-rw-r--r--src/mame/machine/snes.c41
-rw-r--r--src/mame/machine/snessdd1.c34
2 files changed, 58 insertions, 17 deletions
diff --git a/src/mame/machine/snes.c b/src/mame/machine/snes.c
index 76a3603ac9a..647ae6542fe 100644
--- a/src/mame/machine/snes.c
+++ b/src/mame/machine/snes.c
@@ -369,7 +369,11 @@ READ8_HANDLER( snes_r_io )
{
if(offset >= 0x4800 && offset < 0x4808)
{
- return sdd1_mmio_read(space->machine, offset);
+ return sdd1_mmio_read(space, (UINT32)offset);
+ }
+ if(offset < 0x80)
+ {
+ offset += 0x4300;
}
}
@@ -735,9 +739,13 @@ WRITE8_HANDLER( snes_w_io )
if((offset >= 0x4300 && offset < 0x4380) ||
(offset >= 0x4800 && offset < 0x4808))
{
- sdd1_mmio_write(space->machine, offset, data);
+ sdd1_mmio_write(space, (UINT32)offset, data);
return;
}
+ if(offset < 0x80)
+ {
+ offset += 0x4300;
+ }
}
/* offset is from 0x000000 */
@@ -1638,14 +1646,18 @@ READ8_HANDLER( snes_r_bank6 )
/* 0xc00000 - 0xffffff */
READ8_HANDLER( snes_r_bank7 )
{
- UINT8 value;
+ UINT8 value = 0;
UINT16 address = offset & 0xffff;
- if(snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
+ if(snes_has_addon_chip == HAS_SDD1)
+ {
+ return sdd1_read(space->machine, offset);
+ }
+ else if(snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
{
logerror( "snes_r_bank7 hit in Super FX mode, please fix me\n" );
}
- if (snes_cart.mode & 5) /* Mode 20 & 22 */
+ else if (snes_cart.mode & 5) /* Mode 20 & 22 */
{
if (address < 0x8000)
{
@@ -1732,6 +1744,7 @@ WRITE8_HANDLER( snes_w_bank4 )
if (snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
{
+ //printf( "Writing %02x to %08x\n", data, 0x600000 + offset );
snes_ram[0x600000 + offset] = data;
}
else if (snes_cart.mode & 5) /* Mode 20 & 22 */
@@ -2311,11 +2324,13 @@ void snes_gdma( const address_space *space, UINT8 channels )
{
if( channels & mask )
{
+ //printf( "Making a transfer on channel %d\n", i );
/* Find transfer addresses */
abus = (snes_ram[SNES_DMA_BASE + dma + 3] << 8) + snes_ram[SNES_DMA_BASE + dma + 2];
abus_bank = (snes_ram[SNES_DMA_BASE + dma + 4] << 16);
bbus = 0x2100 + snes_ram[SNES_DMA_BASE + dma + 1];
+ //printf( "Address: %06x\n", abus | abus_bank );
/* Auto increment */
if( snes_ram[SNES_DMA_BASE + dma] & 0x8 )
{
@@ -2445,11 +2460,16 @@ void snes_gdma( const address_space *space, UINT8 channels )
#endif
break;
}
+
/* We're done so write the new abus back to the registers */
- snes_ram[SNES_DMA_BASE + dma + 2] = abus & 0xff;
- snes_ram[SNES_DMA_BASE + dma + 3] = (abus >> 8) & 0xff;
- snes_ram[SNES_DMA_BASE + dma + 5] = 0;
- snes_ram[SNES_DMA_BASE + dma + 6] = 0;
+ snes_w_io(space, SNES_DMA_BASE + dma + 2, abus & 0xff);
+ snes_w_io(space, SNES_DMA_BASE + dma + 3, (abus >> 8) & 0xff);
+ snes_w_io(space, SNES_DMA_BASE + dma + 5, 0);
+ snes_w_io(space, SNES_DMA_BASE + dma + 6, 0);
+ //snes_ram[SNES_DMA_BASE + dma + 2] = abus & 0xff;
+ //snes_ram[SNES_DMA_BASE + dma + 3] = (abus >> 8) & 0xff;
+ //snes_ram[SNES_DMA_BASE + dma + 5] = 0;
+ //snes_ram[SNES_DMA_BASE + dma + 6] = 0;
}
dma += 0x10;
mask <<= 1;
@@ -2468,16 +2488,19 @@ READ8_HANDLER( superfx_r_bank2 )
READ8_HANDLER( superfx_r_bank3 )
{
+ //printf( "superfx_r_bank3: %08x = %02x\n", 0x600000 + offset, snes_ram[0x600000 + offset] );
return snes_ram[0x600000 + offset];
}
WRITE8_HANDLER( superfx_w_bank1 )
{
+ printf( "Attempting to write to cart ROM: %08x = %02x\n", offset, data );
// Do nothing; can't write to cart ROM.
}
WRITE8_HANDLER( superfx_w_bank2 )
{
+ printf( "Attempting to write to cart ROM: %08x = %02x\n", 0x400000 + offset, data );
// Do nothing; can't write to cart ROM.
}
diff --git a/src/mame/machine/snessdd1.c b/src/mame/machine/snessdd1.c
index 8e468a1518a..db873d47a76 100644
--- a/src/mame/machine/snessdd1.c
+++ b/src/mame/machine/snessdd1.c
@@ -1,4 +1,4 @@
-static UINT8 sdd1_read(running_machine* machine, UINT32 addr);
+static UINT8 sdd1_read(running_machine* machine, UINT16 addr);
typedef struct //Input Manager
{
@@ -411,7 +411,7 @@ static void SDD1_OL_prepareDecomp(SDD1_OL* this, UINT32 first_byte, UINT16 out_l
static void SDD1_OL_launch(SDD1_OL* this)
{
UINT8 i;
- UINT8 register1, register2;
+ UINT8 register1 = 0, register2 = 0;
switch(this->bitplanesInfo)
{
@@ -540,26 +540,37 @@ static void sdd1_init(running_machine* machine)
snes_sdd1.sdd1emu = SDD1emu_ctor(machine);
}
-static UINT8 sdd1_mmio_read(running_machine* machine, UINT16 addr)
+static UINT8 sdd1_mmio_read(const address_space *space, UINT32 addr)
{
addr &= 0xffff;
+ //printf("SDD1::mmio_read(%04x)\n", addr);
+
+ if((addr & 0x4380) == 0x4300)
+ {
+ return snes_r_io(space, addr & 0x7f);
+ }
+
switch(addr)
{
case 0x4804:
return (snes_sdd1.mmc[0] >> 20) & 7;
+ break;
case 0x4805:
return (snes_sdd1.mmc[1] >> 20) & 7;
+ break;
case 0x4806:
return (snes_sdd1.mmc[2] >> 20) & 7;
+ break;
case 0x4807:
return (snes_sdd1.mmc[3] >> 20) & 7;
+ break;
}
return 0xff;
}
-static void sdd1_mmio_write(running_machine* machine, UINT16 addr, UINT8 data)
+static void sdd1_mmio_write(const address_space *space, UINT32 addr, UINT8 data)
{
addr &= 0xffff;
@@ -570,19 +581,24 @@ static void sdd1_mmio_write(running_machine* machine, UINT16 addr, UINT8 data)
{
case 2:
snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0xffff00) + (data << 0);
+ //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
break;
case 3:
snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0xff00ff) + (data << 8);
+ //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
break;
case 4:
snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0x00ffff) + (data << 16);
+ //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
break;
case 5:
- snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0xff00) + (data << 0);
+ snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size & 0xff00) + (data << 0);
+ //printf( "dma[%d].size = %04x\n", channel, snes_sdd1.dma[channel].size );
break;
case 6:
- snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0x00ff) + (data << 8);
+ snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size & 0x00ff) + (data << 8);
+ //printf( "dma[%d].size = %04x\n", channel, snes_sdd1.dma[channel].size );
break;
}
snes_ram[addr] = data;
@@ -613,8 +629,9 @@ static void sdd1_mmio_write(running_machine* machine, UINT16 addr, UINT8 data)
}
}
-static UINT8 sdd1_read(running_machine* machine, UINT32 addr)
+static UINT8 sdd1_read(running_machine* machine, UINT16 addr)
{
+ //printf( "sdd1.read(%06x)\n", addr );
if(snes_sdd1.sdd1_enable & snes_sdd1.xfer_enable)
{
// at least one channel has S-DD1 decompression enabled...
@@ -659,7 +676,8 @@ static UINT8 sdd1_read(running_machine* machine, UINT32 addr)
} // channel loop
} // S-DD1 decompressor enabled
- return memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff));
+ //printf( "returning a generic memory read from %06x\n", 0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff) );
+ return snes_ram[0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff)];
}
static void sdd1_reset(running_machine *machine)