(MESS) bbc.c: fixed external cart slot -cart1 for the BBC Master (demo cart

runs properly now), added second external slot -cart2 (same functionality
as -cart1). Expansion ROM slots, which are handled as internal cart slot, 
are now accessible via -cart3/-cart6 media switch, until they are converted 
to proper slot devices. [Fabio Priuli]
This commit is contained in:
Fabio Priuli 2014-04-04 17:23:15 +00:00
parent 16b55173a6
commit ced9717453
4 changed files with 87 additions and 97 deletions

View file

@ -15,11 +15,9 @@
<year>198?</year>
<publisher>Acorn</publisher>
<part name="cart" interface="bbcm_cart">
<dataarea name="uprom" size="16384">
<dataarea name="rom" size="32768">
<rom name="bbcmasterdemonstrationcartridge_1.rom" size="16384" crc="fc40c0e8" sha1="970ff4721e707f3c843f4fb09ce7f03e7ab265ae" offset="0" />
</dataarea>
<dataarea name="lorom" size="16384">
<rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0" />
<rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0x4000" />
</dataarea>
</part>
</software>

View file

@ -639,25 +639,29 @@ WRITE_LINE_MEMBER(bbc_state::econet_clk_w)
}
static MACHINE_CONFIG_FRAGMENT( bbc_cartslot )
MCFG_CARTSLOT_ADD("cart1")
MCFG_CARTSLOT_ADD("exp_rom1")
MCFG_CARTSLOT_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
MCFG_CARTSLOT_INTERFACE("bbc_cart")
MCFG_CARTSLOT_ADD("cart2")
MCFG_CARTSLOT_ADD("exp_rom2")
MCFG_CARTSLOT_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
MCFG_CARTSLOT_INTERFACE("bbc_cart")
MCFG_CARTSLOT_ADD("cart3")
MCFG_CARTSLOT_ADD("exp_rom3")
MCFG_CARTSLOT_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
MCFG_CARTSLOT_INTERFACE("bbc_cart")
MCFG_CARTSLOT_ADD("cart4")
MCFG_CARTSLOT_ADD("exp_rom4")
MCFG_CARTSLOT_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
MCFG_CARTSLOT_INTERFACE("bbc_cart")
MACHINE_CONFIG_END
@ -929,7 +933,12 @@ static MACHINE_CONFIG_START( bbcm, bbc_state )
MCFG_CASSETTE_ADD( "cassette", bbc_cassette_interface )
/* cartridges */
MCFG_CARTSLOT_ADD("cart")
MCFG_CARTSLOT_ADD("cart1")
MCFG_CARTSLOT_EXTENSION_LIST("bin")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart)
MCFG_CARTSLOT_INTERFACE("bbcm_cart")
MCFG_CARTSLOT_ADD("cart2")
MCFG_CARTSLOT_EXTENSION_LIST("bin")
MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart)

View file

@ -155,7 +155,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcb_cart );
int exp_rom_load(device_image_interface &image, int index);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbc_exp_rom );
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcm_cart );
private:

View file

@ -1959,116 +1959,98 @@ WRITE8_MEMBER(bbc_state::bbc_disc_w)
/**************************************
BBC B Rom loading functions
***************************************/
DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcb_cart )
int bbc_state::exp_rom_load(device_image_interface &image, int index)
{
UINT8 *RAM = m_region_user1->base();
int size, read_;
int addr = 0;
int index = 0;
size = image.length();
if (strcmp(image.device().tag(),":cart1") == 0)
int addr = 0x8000 + (0x4000 * index);
if (image.software_entry() == NULL)
{
index = 0;
}
if (strcmp(image.device().tag(),":cart2") == 0)
{
index = 1;
}
if (strcmp(image.device().tag(),":cart3") == 0)
{
index = 2;
}
if (strcmp(image.device().tag(),":cart4") == 0)
{
index = 3;
}
addr = 0x8000 + (0x4000 * index);
logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size);
switch (size)
{
case 0x2000:
read_ = image.fread(RAM + addr, size);
size = image.length();
logerror("loading rom %s, at %.4x size:%.4x\n", image.filename(), addr, size);
switch (size)
{
case 0x2000:
read_ = image.fread(RAM + addr, size);
if (read_ != size)
return 1;
image.fseek(0, SEEK_SET);
read_ = image.fread(RAM + addr + 0x2000, size);
break;
case 0x4000:
read_ = image.fread(RAM + addr, size);
break;
default:
read_ = 0;
logerror("bad rom file size of %.4x\n", size);
break;
}
if (read_ != size)
return 1;
image.fseek(0, SEEK_SET);
read_ = image.fread(RAM + addr + 0x2000, size);
break;
case 0x4000:
read_ = image.fread(RAM + addr, size);
break;
default:
read_ = 0;
logerror("bad rom file size of %.4x\n", size);
break;
return IMAGE_INIT_FAIL;
}
return IMAGE_INIT_PASS;
}
if (read_ != size)
return 1;
return 0;
DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbc_exp_rom )
{
if (strcmp(image.device().tag(),":exp_rom1") == 0)
return exp_rom_load(image, 0);
if (strcmp(image.device().tag(),":exp_rom2") == 0)
return exp_rom_load(image, 1);
if (strcmp(image.device().tag(),":exp_rom3") == 0)
return exp_rom_load(image, 2);
if (strcmp(image.device().tag(),":exp_rom4") == 0)
return exp_rom_load(image, 3);
return IMAGE_INIT_FAIL;
}
/**************************************
BBC Master Rom loading functions
***************************************/
DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcm_cart )
{
UINT8 *RAM = m_region_user1->base();
int size, read_;
int addr = 0;
int index = 0;
size = image.length();
UINT32 size;
int addr = 0, index = 0;
if (strcmp(image.device().tag(),":cart1") == 0)
{
index = 0;
}
if (strcmp(image.device().tag(),":cart2") == 0)
{
index = 1;
}
if (strcmp(image.device().tag(),":cart3") == 0)
addr += index * 0x8000;
if (image.software_entry() == NULL)
{
index = 2;
size = image.length();
logerror("loading rom %s, size:%.4x\n", image.filename(), size);
if (size != 0x8000)
{
image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid rom file size");
return IMAGE_INIT_FAIL;
}
image.fread(RAM + addr, size);
}
if (strcmp(image.device().tag(),":cart4") == 0)
else
{
index = 3;
}
addr = 0x8000 + (0x4000 * index);
size = image.get_software_region_length("rom");
logerror("loading rom %s, size:%.4x\n", image.filename(), size);
logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size);
switch (size)
{
case 0x2000:
read_ = image.fread(RAM + addr, size);
if (read_ != size)
return 1;
image.fseek(0, SEEK_SET);
read_ = image.fread(RAM + addr + 0x2000, size);
break;
case 0x4000:
read_ = image.fread(RAM + addr, size);
break;
default:
read_ = 0;
logerror("bad rom file size of %.4x\n", size);
break;
memcpy(RAM + addr, image.get_software_region("rom"), size);
}
if (read_ != size)
return 1;
return 0;
return IMAGE_INIT_PASS;
}