(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> <year>198?</year>
<publisher>Acorn</publisher> <publisher>Acorn</publisher>
<part name="cart" interface="bbcm_cart"> <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" /> <rom name="bbcmasterdemonstrationcartridge_1.rom" size="16384" crc="fc40c0e8" sha1="970ff4721e707f3c843f4fb09ce7f03e7ab265ae" offset="0" />
</dataarea> <rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0x4000" />
<dataarea name="lorom" size="16384">
<rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0" />
</dataarea> </dataarea>
</part> </part>
</software> </software>

View File

@ -639,25 +639,29 @@ WRITE_LINE_MEMBER(bbc_state::econet_clk_w)
} }
static MACHINE_CONFIG_FRAGMENT( bbc_cartslot ) static MACHINE_CONFIG_FRAGMENT( bbc_cartslot )
MCFG_CARTSLOT_ADD("cart1") MCFG_CARTSLOT_ADD("exp_rom1")
MCFG_CARTSLOT_EXTENSION_LIST("rom") MCFG_CARTSLOT_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY 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_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY 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_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY 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_EXTENSION_LIST("rom")
MCFG_CARTSLOT_NOT_MANDATORY 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 MACHINE_CONFIG_END
@ -929,7 +933,12 @@ static MACHINE_CONFIG_START( bbcm, bbc_state )
MCFG_CASSETTE_ADD( "cassette", bbc_cassette_interface ) MCFG_CASSETTE_ADD( "cassette", bbc_cassette_interface )
/* cartridges */ /* 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_EXTENSION_LIST("bin")
MCFG_CARTSLOT_NOT_MANDATORY MCFG_CARTSLOT_NOT_MANDATORY
MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart) MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart)

View File

@ -155,7 +155,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt); 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 ); DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcm_cart );
private: private:

View File

@ -1959,36 +1959,17 @@ WRITE8_MEMBER(bbc_state::bbc_disc_w)
/************************************** /**************************************
BBC B Rom loading functions 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(); UINT8 *RAM = m_region_user1->base();
int size, read_; int size, read_;
int addr = 0; int addr = 0x8000 + (0x4000 * index);
int index = 0;
if (image.software_entry() == NULL)
{
size = image.length(); size = image.length();
logerror("loading rom %s, at %.4x size:%.4x\n", image.filename(), addr, size);
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)
{
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) switch (size)
{ {
@ -2009,66 +1990,67 @@ DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcb_cart )
} }
if (read_ != size) if (read_ != size)
return 1; return IMAGE_INIT_FAIL;
return 0; }
return IMAGE_INIT_PASS;
}
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 BBC Master Rom loading functions
***************************************/ ***************************************/
DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcm_cart ) DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcm_cart )
{ {
UINT8 *RAM = m_region_user1->base(); UINT8 *RAM = m_region_user1->base();
int size, read_; UINT32 size;
int addr = 0; int addr = 0, index = 0;
int index = 0;
size = image.length();
if (strcmp(image.device().tag(),":cart1") == 0) if (strcmp(image.device().tag(),":cart1") == 0)
{
index = 0; index = 0;
}
if (strcmp(image.device().tag(),":cart2") == 0) if (strcmp(image.device().tag(),":cart2") == 0)
{
index = 1; index = 1;
} addr += index * 0x8000;
if (strcmp(image.device().tag(),":cart3") == 0)
if (image.software_entry() == NULL)
{ {
index = 2; size = image.length();
} logerror("loading rom %s, size:%.4x\n", image.filename(), size);
if (strcmp(image.device().tag(),":cart4") == 0)
if (size != 0x8000)
{ {
index = 3; image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid rom file size");
return IMAGE_INIT_FAIL;
} }
addr = 0x8000 + (0x4000 * index);
image.fread(RAM + addr, size);
logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size); }
else
switch (size)
{ {
case 0x2000: size = image.get_software_region_length("rom");
read_ = image.fread(RAM + addr, size); logerror("loading rom %s, size:%.4x\n", image.filename(), size);
if (read_ != size)
return 1; memcpy(RAM + addr, image.get_software_region("rom"), size);
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 IMAGE_INIT_PASS;
return 1;
return 0;
} }