removed snesbsx driver: it never worked, and satellaview support will be done through slot devices. nw.

This commit is contained in:
Fabio Priuli 2013-03-05 09:26:25 +00:00
parent 12ed314551
commit 7d59f1d7e9
10 changed files with 12 additions and 540 deletions

1
.gitattributes vendored
View File

@ -4994,7 +4994,6 @@ src/mame/machine/slapstic.c svneol=native#text/plain
src/mame/machine/slikshot.c svneol=native#text/plain src/mame/machine/slikshot.c svneol=native#text/plain
src/mame/machine/snes.c svneol=native#text/plain src/mame/machine/snes.c svneol=native#text/plain
src/mame/machine/snes7110.c svneol=native#text/plain src/mame/machine/snes7110.c svneol=native#text/plain
src/mame/machine/snesbsx.c svneol=native#text/plain
src/mame/machine/snescx4.c svneol=native#text/plain src/mame/machine/snescx4.c svneol=native#text/plain
src/mame/machine/snescx4.h svneol=native#text/plain src/mame/machine/snescx4.h svneol=native#text/plain
src/mame/machine/snesobc1.c svneol=native#text/plain src/mame/machine/snesobc1.c svneol=native#text/plain

View File

@ -694,8 +694,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(snes_extern_irq_w); DECLARE_WRITE_LINE_MEMBER(snes_extern_irq_w);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(snes_cart); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(snes_cart);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(sufami_cart); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(sufami_cart);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bsx_cart);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(bsx2slot_cart);
}; };
/* Special chips, checked at init and used in memory handlers */ /* Special chips, checked at init and used in memory handlers */

View File

@ -41,7 +41,6 @@ struct snes_cart_info snes_cart;
#include "machine/snesrtc.c" #include "machine/snesrtc.c"
#include "machine/snessdd1.c" #include "machine/snessdd1.c"
#include "machine/snes7110.c" #include "machine/snes7110.c"
#include "machine/snesbsx.c"
VIDEO_START( snes ) VIDEO_START( snes )
@ -694,19 +693,13 @@ address | | | | | | |
/* 0x000000 - 0x2fffff */ /* 0x000000 - 0x2fffff */
READ8_HANDLER( snes_r_bank1 ) READ8_HANDLER( snes_r_bank1 )
{ {
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0xff; UINT8 value = 0xff;
UINT16 address = offset & 0xffff; UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */ if (address < 0x2000) /* Mirror of Low RAM */
value = space.read_byte(0x7e0000 + address); value = space.read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */ else if (address < 0x6000) /* I/O */
{ value = snes_r_io(space, address);
if (state->m_cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
value = bsx_read(space, offset, mem_mask);
else
value = snes_r_io(space, address);
}
else if (address < 0x8000) else if (address < 0x8000)
{ {
logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space.device().safe_pc(),address); logerror("(PC=%06x) snes_r_bank1: Unmapped external chip read: %04x\n",space.device().safe_pc(),address);
@ -728,12 +721,7 @@ READ8_HANDLER( snes_r_bank2 )
if (address < 0x2000) /* Mirror of Low RAM */ if (address < 0x2000) /* Mirror of Low RAM */
value = space.read_byte(0x7e0000 + address); value = space.read_byte(0x7e0000 + address);
else if (address < 0x6000) /* I/O */ else if (address < 0x6000) /* I/O */
{ value = snes_r_io(space, address);
if (state->m_cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
value = bsx_read(space, 0x300000 + offset, mem_mask);
else
value = snes_r_io(space, address);
}
else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */ else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */
{ {
if (state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].sram > 0) if (state->m_cart[0].mode == SNES_MODE_21 && state->m_cart[0].sram > 0)
@ -834,30 +822,10 @@ READ8_HANDLER( snes_r_bank5 )
/* 0x800000 - 0xbfffff */ /* 0x800000 - 0xbfffff */
READ8_HANDLER( snes_r_bank6 ) READ8_HANDLER( snes_r_bank6 )
{ {
snes_state *state = space.machine().driver_data<snes_state>();
UINT8 value = 0; UINT8 value = 0;
UINT16 address = offset & 0xffff;
if (address < 0x8000) if ((offset & 0xffff) < 0x8000)
{ value = space.read_byte(offset);
if (state->m_cart[0].mode != SNES_MODE_25)
value = space.read_byte(offset);
else /* Mode 25 has SRAM not mirrored from lower banks */
{
if (address < 0x6000)
value = space.read_byte(offset);
else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0))
{
int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
value = snes_ram[0xb06000 + ((offset - 0x6000) & mask)];
}
else /* Area 0x6000-0x8000 with offset < 0x300000 is reserved */
{
logerror("(PC=%06x) snes_r_bank6: Unmapped external chip read: %04x\n",space.device().safe_pc(),address);
value = snes_open_bus_r(space, 0);
}
}
}
else else
value = snes_ram[0x800000 + offset]; value = snes_ram[0x800000 + offset];
@ -888,18 +856,12 @@ READ8_HANDLER( snes_r_bank7 )
/* 0x000000 - 0x2fffff */ /* 0x000000 - 0x2fffff */
WRITE8_HANDLER( snes_w_bank1 ) WRITE8_HANDLER( snes_w_bank1 )
{ {
snes_state *state = space.machine().driver_data<snes_state>();
UINT16 address = offset & 0xffff; UINT16 address = offset & 0xffff;
if (address < 0x2000) /* Mirror of Low RAM */ if (address < 0x2000) /* Mirror of Low RAM */
space.write_byte(0x7e0000 + address, data); space.write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */ else if (address < 0x6000) /* I/O */
{ snes_w_io(space, address, data);
if (state->m_cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
bsx_write(space, offset, data, mem_mask);
else
snes_w_io(space, address, data);
}
else if (address < 0x8000) else if (address < 0x8000)
logerror("snes_w_bank1: Attempt to write to reserved address: %x = %02x\n", offset, data); logerror("snes_w_bank1: Attempt to write to reserved address: %x = %02x\n", offset, data);
else else
@ -915,12 +877,7 @@ WRITE8_HANDLER( snes_w_bank2 )
if (address < 0x2000) /* Mirror of Low RAM */ if (address < 0x2000) /* Mirror of Low RAM */
space.write_byte(0x7e0000 + address, data); space.write_byte(0x7e0000 + address, data);
else if (address < 0x6000) /* I/O */ else if (address < 0x6000) /* I/O */
{ snes_w_io(space, address, data);
if (state->m_cart[0].mode == SNES_MODE_BSX && address >= 0x5000)
bsx_write(space, 0x300000 + offset, data, mem_mask);
else
snes_w_io(space, address, data);
}
else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */ else if (address < 0x8000) /* SRAM for mode_21, Reserved othewise */
{ {
if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0)) if ((state->m_cart[0].mode == SNES_MODE_21) && (state->m_cart[0].sram > 0))
@ -985,26 +942,8 @@ WRITE8_HANDLER( snes_w_bank5 )
/* 0x800000 - 0xbfffff */ /* 0x800000 - 0xbfffff */
WRITE8_HANDLER( snes_w_bank6 ) WRITE8_HANDLER( snes_w_bank6 )
{ {
snes_state *state = space.machine().driver_data<snes_state>(); if ((offset & 0xffff) < 0x8000)
UINT16 address = offset & 0xffff; space.write_byte(offset, data);
if (address < 0x8000)
{
if (state->m_cart[0].mode != SNES_MODE_25)
space.write_byte(offset, data);
else /* Mode 25 has SRAM not mirrored from lower banks */
{
if (address < 0x6000)
space.write_byte(offset, data);
else if ((offset >= 0x300000) && (state->m_cart[0].sram > 0))
{
int mask = (state->m_cart[0].sram - 1) & 0x7fff; /* Limit SRAM size to what's actually present */
snes_ram[0xb06000 + ((offset - 0x6000) & mask)] = data;
}
else /* Area in 0x6000-0x8000 && offset < 0x300000 is Reserved! */
logerror("snes_w_bank6: Attempt to write to reserved address: %X = %02x\n", offset + 0x800000, data);
}
}
else else
logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space.device().safe_pc(),offset + 0x800000); logerror("(PC=%06x) Attempt to write to ROM address: %X\n",space.device().safe_pc(),offset + 0x800000);
} }
@ -1215,9 +1154,6 @@ MACHINE_START( snes )
// SNES_CPU_REG_STATE(WRDIVL) = 0xff; // SNES_CPU_REG_STATE(WRDIVL) = 0xff;
// SNES_CPU_REG_STATE(WRDIVH) = 0xff; // SNES_CPU_REG_STATE(WRDIVH) = 0xff;
if (state->m_cart[0].mode == SNES_MODE_BSX)
bsx_init(machine);
snes_init_timers(machine); snes_init_timers(machine);
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)

View File

@ -1,250 +0,0 @@
/***************************************************************************
snesbsx.c
File to handle emulation of the SNES "BS-X Satellaview".
Based on byuu's research.
TODO: basically everything. The hardware can dynamically remap where
the memory handlers read/write (this will probably require some more
rethinking of the way we use snes_ram), see bsx_update_memory_map
***************************************************************************/
enum
{
SNES_BSX_CARTROM = 0,
SNES_BSX_PRAM,
SNES_BSX_FLASH
};
struct snes_bsx_state
{
// base regs
// we don't emulate the base unit yet
// cart regs
UINT8 cart_regs[16];
// flash regs
UINT32 command;
UINT8 write_old;
UINT8 write_new;
int flash_enable;
int read_enable;
int write_enable;
UINT8 *pram;
int ram_source;
};
static snes_bsx_state bsx_state;
static void bsx_update_memory_map(void)
{
bsx_state.ram_source = BIT(bsx_state.cart_regs[0x01], 7) ? SNES_BSX_PRAM : SNES_BSX_FLASH;
// UINT8 *RAM = (bsx_state.cart_regs[0x01] & 0x80) == 0x00 ? space.memregion("flash")->base() : bsx_state.pram;
logerror("BSX: updated memory map, current RAM: %d", bsx_state.ram_source);
if (!BIT(bsx_state.cart_regs[0x02], 7))
{
//LoROM mapping
// 0x00-0x7d:0x8000-0xfff -> RAM (either flash or pram)
// 0x80-0xff:0x8000-0xfff -> RAM
}
else
{
//HiROM mapping
// 0x00-0x3f:0x8000-0xfff -> RAM - 'shadowed'
// 0x40-0x7d:0x0000-0xfff -> RAM
// 0x80-0xbf:0x8000-0xfff -> RAM - 'shadowed'
// 0xc0-0xff:0x0000-0xfff -> RAM
}
if (BIT(bsx_state.cart_regs[0x03], 7))
{
// 0x60-0x6f:0x0000-0xffff -> PRAM
}
if (!BIT(bsx_state.cart_regs[0x05], 7))
{
// 0x40-0x4f:0x0000-0xffff -> PRAM
}
if (!BIT(bsx_state.cart_regs[0x06], 7))
{
// 0x50-0x5f:0x0000-0xffff -> PRAM
}
if (BIT(bsx_state.cart_regs[0x07], 7))
{
// 0x00-0x1f:0x8000-0xffff -> CART
}
if (BIT(bsx_state.cart_regs[0x08], 7))
{
// 0x80-0x9f:0x8000-0xffff -> CART
}
// 0x20-0x3f:0x6000-0x7fff -> PRAM
// 0x70-0x77:0x0000-0xffff -> PRAM
}
static READ8_HANDLER( bsx_read )
{
if ((offset & 0xf0ffff) == 0x005000)
{
//$[00-0f]:5000 MMIO
UINT8 n = (offset >> 16) & 0x0f;
return bsx_state.cart_regs[n];
}
if ((offset & 0xf8f000) == 0x105000)
{
//$[10-17]:[5000-5fff] SRAM
return bsx_state.pram[((offset >> 16) & 7) * 0x1000 + (offset & 0xfff)];
}
return 0x00;
}
static WRITE8_HANDLER( bsx_write )
{
if ((offset & 0xf0ffff) == 0x005000)
{
//$[00-0f]:5000 MMIO
UINT8 n = (offset >> 16) & 0x0f;
bsx_state.cart_regs[n] = data;
if ((n == 0x0e) && (data & 0x80))
bsx_update_memory_map();
}
if ((offset & 0xf8f000) == 0x105000)
{
//$[10-17]:[5000-5fff] SRAM
bsx_state.pram[((offset >> 16) & 7) * 0x1000 + (offset & 0xfff)] = data;
}
}
static void bsx_init( running_machine &machine )
{
memset(bsx_state.cart_regs, 0, ARRAY_LENGTH(bsx_state.cart_regs));
bsx_state.cart_regs[0x07] = 0x80;
bsx_state.cart_regs[0x08] = 0x80;
bsx_state.pram = auto_alloc_array(machine, UINT8, 0x80000);
bsx_update_memory_map();
// saves
}
#ifdef UNUSED_FUNCTION
static READ8_HANDLER( bsx_flash_read )
{
UINT8 *FLASH = space.memregion("flash")->base();
if (offset == 0x0002)
{
if (bsx_state.flash_enable)
return 0x80;
}
if (offset == 0x5555)
{
if (bsx_state.flash_enable)
return 0x80;
}
if (bsx_state.read_enable && offset >= 0xff00 && offset <= 0xff13)
{
//read flash cartridge vendor information
switch(offset - 0xff00)
{
case 0x00: return 0x4d;
case 0x01: return 0x00;
case 0x02: return 0x50;
case 0x03: return 0x00;
case 0x04: return 0x00;
case 0x05: return 0x00;
case 0x06: return 0x2a; //0x2a = 8mbit, 0x2b = 16mbit (not known to exist, though BIOS recognizes ID)
case 0x07: return 0x00;
default: return 0x00;
}
}
return FLASH[offset];
}
static WRITE8_HANDLER( bsx_flash_write )
{
if ((offset & 0xff0000) == 0)
{
bsx_state.write_old = bsx_state.write_new;
bsx_state.write_new = data;
if (bsx_state.write_enable && bsx_state.write_old == bsx_state.write_new)
{
// currently we have the flashcart loaded in a rom_region -> we cannot write yet
}
}
else
{
if (bsx_state.write_enable)
{
// currently we have the flashcart loaded in a rom_region -> we cannot write yet
}
}
if (offset == 0x0000)
{
bsx_state.command <<= 8;
bsx_state.command |= data;
if ((bsx_state.command & 0xffff) == 0x38d0)
{
bsx_state.flash_enable = 1;
bsx_state.read_enable = 1;
}
}
if (offset == 0x2aaa)
{
bsx_state.command <<= 8;
bsx_state.command |= data;
}
if (offset == 0x5555)
{
bsx_state.command <<= 8;
bsx_state.command |= data;
if ((bsx_state.command & 0xffffff) == 0xaa5570)
{
bsx_state.write_enable = 0;
}
if ((bsx_state.command & 0xffffff) == 0xaa55a0)
{
bsx_state.write_old = 0x00;
bsx_state.write_new = 0x00;
bsx_state.flash_enable = 1;
bsx_state.write_enable = 1;
}
if ((bsx_state.command & 0xffffff) == 0xaa55f0)
{
bsx_state.flash_enable = 0;
bsx_state.read_enable = 0;
bsx_state.write_enable = 0;
}
}
}
#endif

View File

@ -2388,8 +2388,7 @@ $(MACHINE)/snes.o: $(MAMESRC)/machine/snesobc1.c \
$(MAMESRC)/machine/cx4data.c \ $(MAMESRC)/machine/cx4data.c \
$(MAMESRC)/machine/snesrtc.c \ $(MAMESRC)/machine/snesrtc.c \
$(MAMESRC)/machine/snessdd1.c \ $(MAMESRC)/machine/snessdd1.c \
$(MAMESRC)/machine/snes7110.c \ $(MAMESRC)/machine/snes7110.c
$(MAMESRC)/machine/snesbsx.c
$(MACHINE)/nes_mmc.o: $(MAMESRC)/machine/nes_ines.c \ $(MACHINE)/nes_mmc.o: $(MAMESRC)/machine/nes_ines.c \
$(MAMESRC)/machine/nes_pcb.c \ $(MAMESRC)/machine/nes_pcb.c \
$(MAMESRC)/machine/nes_unif.c $(MAMESRC)/machine/nes_unif.c

View File

@ -1283,11 +1283,6 @@ static MACHINE_CONFIG_DERIVED( snesst, snes_base )
MCFG_FRAGMENT_ADD(sufami_cartslot) MCFG_FRAGMENT_ADD(sufami_cartslot)
MACHINE_CONFIG_END MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( snesbsx, snes_base )
MCFG_FRAGMENT_ADD(bsx_cartslot)
MACHINE_CONFIG_END
/************************************* /*************************************
* *
@ -1428,25 +1423,6 @@ ROM_START( snesst )
ROM_REGION( 0x800, "dspdata", ROMREGION_ERASEFF) ROM_REGION( 0x800, "dspdata", ROMREGION_ERASEFF)
ROM_END ROM_END
ROM_START( snesbsx )
ROM_REGION( 0x1000000, "maincpu", ROMREGION_ERASE00 )
ROM_REGION( 0x100, "sound_ipl", 0 ) /* IPL ROM */
ROM_LOAD( "spc700.rom", 0, 0x40, CRC(44bb3a40) SHA1(97e352553e94242ae823547cd853eecda55c20f0) ) /* boot rom */
ROM_REGION( 0x10000, "addons", 0 ) /* add-on chip ROMs (DSP, SFX, etc) */
ROM_LOAD( "dsp1b.bin", SNES_DSP1B_OFFSET, 0x002800, CRC(453557e0) SHA1(3a218b0e4572a8eba6d0121b17fdac9529609220) )
ROM_LOAD( "dsp1.bin", SNES_DSP1_OFFSET, 0x002800, CRC(2838f9f5) SHA1(0a03ccb1fd2bea91151c745a4d1f217ae784f889) )
ROM_LOAD( "dsp2.bin", SNES_DSP2_OFFSET, 0x002800, CRC(8e9fbd9b) SHA1(06dd9fcb118d18f6bbe234e013cb8780e06d6e63) )
ROM_LOAD( "dsp3.bin", SNES_DSP3_OFFSET, 0x002800, CRC(6b86728a) SHA1(1b133741fad810eb7320c21ecfdd427d25a46da1) )
ROM_LOAD( "dsp4.bin", SNES_DSP4_OFFSET, 0x002800, CRC(ce0c7783) SHA1(76fd25f7dc26c3b3f7868a3aa78c7684068713e5) )
ROM_REGION( MAX_SNES_CART_SIZE, "cart", ROMREGION_ERASE00 )
ROM_REGION( MAX_SNES_CART_SIZE, "flash", ROMREGION_ERASE00 )
ROM_REGION( 0x2000, "dspprg", ROMREGION_ERASEFF)
ROM_REGION( 0x800, "dspdata", ROMREGION_ERASEFF)
ROM_END
/************************************* /*************************************
@ -1473,7 +1449,6 @@ CONS( 1989, snesst11, snes, 0, snesst11, snes, snes_state, snes_mess,
// These would require cartslot to be added/removed depending on the cart which is loaded // These would require cartslot to be added/removed depending on the cart which is loaded
CONS( 1989, snesst, snes, 0, snesst, snes, snes_state, snesst, "Nintendo", "Super Nintendo Entertainment System / Super Famicom (NTSC, w/Sufami Turbo)", GAME_NOT_WORKING ) CONS( 1989, snesst, snes, 0, snesst, snes, snes_state, snesst, "Nintendo", "Super Nintendo Entertainment System / Super Famicom (NTSC, w/Sufami Turbo)", GAME_NOT_WORKING )
CONS( 1989, snesbsx, snes, 0, snesbsx, snes, snes_state, snes_mess, "Nintendo", "Super Nintendo Entertainment System / Super Famicom (NTSC, w/BS-X Satellaview slotted cart)", GAME_NOT_WORKING )

View File

@ -1017,16 +1017,9 @@ DEVICE_IMAGE_LOAD_MEMBER( snes_state,snes_cart )
case SNES_MODE_BSHI: case SNES_MODE_BSHI:
/* not handled yet */ /* not handled yet */
mame_printf_error("This is a BS-X Satellaview image: MESS does not support these yet, sorry.\n"); mame_printf_error("This is a BS-X Satellaview image: MESS does not support these yet, sorry.\n");
#if 0 /* so treat it like MODE_20 */
// shall we force incompatibility of flash carts without a base unit? state->m_cart[0].mode = SNES_MODE_20;
if (!has_bsx_slot) /* and load it as such... */
{
mame_printf_error("This is a BS-X flash cart and cannot be loaded in snes/snespal.\n");
// mame_printf_error("Please use snesbsx driver to load it, instead.\n");
return IMAGE_INIT_FAIL;
}
#endif
break;
default: default:
case SNES_MODE_20: case SNES_MODE_20:
@ -1237,162 +1230,6 @@ DEVICE_IMAGE_LOAD_MEMBER( snes_state,sufami_cart )
return IMAGE_INIT_PASS; return IMAGE_INIT_PASS;
} }
DEVICE_IMAGE_LOAD_MEMBER( snes_state,bsx_cart )
{
running_machine &machine = image.device().machine();
snes_state *state = machine.driver_data<snes_state>();
int total_blocks, read_blocks;
int has_bsx_slot = 0;
UINT32 offset, int_header_offs;
UINT8 *ROM = state->memregion("cart")->base();
if (image.software_entry() == NULL)
state->m_cart_size = image.length();
else
state->m_cart_size = image.get_software_region_length("rom");
/* Check for a header (512 bytes), and skip it if found */
offset = snes_skip_header(image, state->m_cart_size);
if (image.software_entry() == NULL)
{
image.fseek(offset, SEEK_SET);
image.fread( ROM, state->m_cart_size - offset);
}
else
memcpy(ROM, image.get_software_region("rom") + offset, state->m_cart_size - offset);
if (SNES_CART_DEBUG) mame_printf_error("size %08X\n", state->m_cart_size - offset);
/* First, look if the cart is HiROM or LoROM (and set snes_cart accordingly) */
int_header_offs = snes_find_hilo_mode(image, ROM, offset, 0);
// Detect presence of BS-X flash cartridge connector
if ((ROM[int_header_offs - 14] == 'Z') && (ROM[int_header_offs - 11] == 'J'))
{
UINT8 n13 = ROM[int_header_offs - 13];
if ((n13 >= 'A' && n13 <= 'Z') || (n13 >= '0' && n13 <= '9'))
{
if (ROM[int_header_offs + 0x1a] == 0x33 ||
(ROM[int_header_offs - 10] == 0x00 && ROM[int_header_offs - 4] == 0x00))
{
has_bsx_slot = 1;
}
}
}
// If there is a BS-X connector, detect if it is the Base Cart or a compatible slotted cart
if (has_bsx_slot)
{
if (!memcmp(ROM + int_header_offs, "Satellaview BS-X ", 21))
{
//BS-X Base Cart
state->m_cart[0].mode = SNES_MODE_BSX;
// handle RAM
}
else
{
state->m_cart[0].mode = (int_header_offs ==0x007fc0) ? SNES_MODE_BSLO : SNES_MODE_BSHI;
// handle RAM?
}
}
else
{
mame_printf_error("This is not a BS-X compatible cart.\n");
mame_printf_error("This image cannot be loaded in the first cartslot of snesbsx.\n");
return IMAGE_INIT_FAIL;
}
/* FIXME: Insert crc check here? */
/* How many blocks of data are available to be loaded? */
total_blocks = (state->m_cart_size - offset) / 0x8000;
read_blocks = 0;
if (SNES_CART_DEBUG) mame_printf_error("blocks %d\n", total_blocks);
// actually load the cart
while (read_blocks < 64 && read_blocks < total_blocks)
{
/* Loading data */
memcpy(&snes_ram[0x008000 + read_blocks * 0x10000], &ROM[0x000000 + read_blocks * 0x8000], 0x8000);
/* Mirroring */
memcpy(&snes_ram[0x808000 + read_blocks * 0x10000], &snes_ram[0x8000 + (read_blocks * 0x10000)], 0x8000);
read_blocks++;
}
/* Filling banks up to 0x3f and their mirrors */
while (read_blocks % 64)
{
int j = 0, repeat_blocks;
while ((read_blocks % (64 >> j)) && j < 6)
j++;
repeat_blocks = read_blocks % (64 >> (j - 1));
memcpy(&snes_ram[read_blocks * 0x10000], &snes_ram[(read_blocks - repeat_blocks) * 0x10000], repeat_blocks * 0x10000);
memcpy(&snes_ram[0x800000 + read_blocks * 0x10000], &snes_ram[(read_blocks - repeat_blocks) * 0x10000], repeat_blocks * 0x10000);
read_blocks += repeat_blocks;
}
return IMAGE_INIT_PASS;
}
DEVICE_IMAGE_LOAD_MEMBER( snes_state,bsx2slot_cart )
{
running_machine &machine = image.device().machine();
snes_state *state = machine.driver_data<snes_state>();
UINT32 offset, int_header_offs;
UINT8 *ROM = state->memregion("flash")->base();
if (image.software_entry() == NULL)
state->m_cart_size = image.length();
else
state->m_cart_size = image.get_software_region_length("rom");
/* Check for a header (512 bytes), and skip it if found */
offset = snes_skip_header(image, state->m_cart_size);
if (image.software_entry() == NULL)
{
image.fseek(offset, SEEK_SET);
image.fread( ROM, state->m_cart_size - offset);
}
else
memcpy(ROM, image.get_software_region("rom") + offset, state->m_cart_size - offset);
if (SNES_CART_DEBUG) mame_printf_error("size %08X\n", state->m_cart_size - offset);
/* First, look if the cart is HiROM or LoROM (and set snes_cart accordingly) */
int_header_offs = snes_find_hilo_mode(image, ROM, offset, 1);
// Detect presence of BS-X Flash Cart
if ((ROM[int_header_offs + 0x13] == 0x00 || ROM[int_header_offs + 0x13] == 0xff) &&
ROM[int_header_offs + 0x14] == 0x00)
{
UINT8 n15 = ROM[int_header_offs + 0x15];
if (n15 == 0x00 || n15 == 0x80 || n15 == 0x84 || n15 == 0x9c || n15 == 0xbc || n15 == 0xfc)
{
if (ROM[int_header_offs + 0x1a] == 0x33 || ROM[int_header_offs + 0x1a] == 0xff)
{
// BS-X Flash Cart
state->m_cart[1].mode = SNES_MODE_BSX;
}
}
}
if (state->m_cart[1].mode != SNES_MODE_BSX)
{
mame_printf_error("This is not a BS-X flash cart.\n");
mame_printf_error("This image cannot be loaded in the second cartslot of snesbsx.\n");
return IMAGE_INIT_FAIL;
}
// actually load the cart
return IMAGE_INIT_PASS;
}
MACHINE_CONFIG_FRAGMENT( snes_cartslot ) MACHINE_CONFIG_FRAGMENT( snes_cartslot )
MCFG_CARTSLOT_ADD("cart") MCFG_CARTSLOT_ADD("cart")
MCFG_CARTSLOT_EXTENSION_LIST("sfc,smc,fig,swc,bin") MCFG_CARTSLOT_EXTENSION_LIST("sfc,smc,fig,swc,bin")
@ -1433,25 +1270,6 @@ MACHINE_CONFIG_FRAGMENT( sufami_cartslot )
// MCFG_SOFTWARE_LIST_ADD("cart_list","snes") // MCFG_SOFTWARE_LIST_ADD("cart_list","snes")
MACHINE_CONFIG_END MACHINE_CONFIG_END
// This (hackily) emulates a SNES unit where you want to load a BS-X compatible cart:
// hence, the user can mount a SNES cart in the first slot (either a BS-X BIOS cart, or a
// BS-X compatible one, e.g. Same Game), and there is a second slot for the 8M data pack
// (in a real SNES this would have been inserted in the smaller slot on the cart itself)
MACHINE_CONFIG_FRAGMENT( bsx_cartslot )
MCFG_CARTSLOT_ADD("cart")
MCFG_CARTSLOT_EXTENSION_LIST("sfc,smc,fig,swc,bin")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_INTERFACE("snes_cart")
MCFG_CARTSLOT_LOAD(snes_state,bsx_cart)
MCFG_CARTSLOT_ADD("slot2")
MCFG_CARTSLOT_EXTENSION_LIST("bs,sfc")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_INTERFACE("bsx_cart")
MCFG_CARTSLOT_LOAD(snes_state,bsx2slot_cart)
// MCFG_SOFTWARE_LIST_ADD("cart_list","snes")
MACHINE_CONFIG_END
DRIVER_INIT_MEMBER(snes_state,snes_mess) DRIVER_INIT_MEMBER(snes_state,snes_mess)
{ {

View File

@ -14,6 +14,5 @@ void sufami_machine_stop(running_machine &machine);
MACHINE_CONFIG_EXTERN( snes_cartslot ); MACHINE_CONFIG_EXTERN( snes_cartslot );
MACHINE_CONFIG_EXTERN( snesp_cartslot ); MACHINE_CONFIG_EXTERN( snesp_cartslot );
MACHINE_CONFIG_EXTERN( sufami_cartslot ); MACHINE_CONFIG_EXTERN( sufami_cartslot );
MACHINE_CONFIG_EXTERN( bsx_cartslot );
#endif /* _SNESCART_H */ #endif /* _SNESCART_H */

View File

@ -79,7 +79,6 @@ snespdsp // Nintendo Super Nintendo PAL w/DSP-x CPU
snesst10 // Nintendo Super Nintendo NTSC w/ST-010 CPU snesst10 // Nintendo Super Nintendo NTSC w/ST-010 CPU
snesst11 // Nintendo Super Nintendo NTSC w/ST-011 CPU snesst11 // Nintendo Super Nintendo NTSC w/ST-011 CPU
snesst // Nintendo Super Nintendo NTSC w/Sufami Turbo base cart snesst // Nintendo Super Nintendo NTSC w/Sufami Turbo base cart
snesbsx // Nintendo Super Nintendo NTSC w/BS-X compatible cart
n64 // Nintendo N64 n64 // Nintendo N64
n64dd // Nintendo N64 (64DD Attachment) n64dd // Nintendo N64 (64DD Attachment)
pokemini // Nintendo Pokemon Mini pokemini // Nintendo Pokemon Mini

View File

@ -2146,7 +2146,6 @@ $(MAME_MACHINE)/snes.o: $(MAMESRC)/machine/snesobc1.c \
$(MAMESRC)/machine/snesrtc.c \ $(MAMESRC)/machine/snesrtc.c \
$(MAMESRC)/machine/snessdd1.c \ $(MAMESRC)/machine/snessdd1.c \
$(MAMESRC)/machine/snes7110.c \ $(MAMESRC)/machine/snes7110.c \
$(MAMESRC)/machine/snesbsx.c
$(MESS_VIDEO)/gba.o: $(MESSSRC)/video/gbamode0.c \ $(MESS_VIDEO)/gba.o: $(MESSSRC)/video/gbamode0.c \
$(MESSSRC)/video/gbamode1.c \ $(MESSSRC)/video/gbamode1.c \