diff options
-rw-r--r-- | hash/bbcm_cart.xml | 6 | ||||
-rw-r--r-- | src/mess/drivers/bbc.c | 27 | ||||
-rw-r--r-- | src/mess/includes/bbc.h | 3 | ||||
-rw-r--r-- | src/mess/machine/bbc.c | 144 |
4 files changed, 85 insertions, 95 deletions
diff --git a/hash/bbcm_cart.xml b/hash/bbcm_cart.xml index c9a48d80930..7c42ea04a3a 100644 --- a/hash/bbcm_cart.xml +++ b/hash/bbcm_cart.xml @@ -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> diff --git a/src/mess/drivers/bbc.c b/src/mess/drivers/bbc.c index 169080b1517..54c6f6362bb 100644 --- a/src/mess/drivers/bbc.c +++ b/src/mess/drivers/bbc.c @@ -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) diff --git a/src/mess/includes/bbc.h b/src/mess/includes/bbc.h index b08b1792895..0a2de809fb9 100644 --- a/src/mess/includes/bbc.h +++ b/src/mess/includes/bbc.h @@ -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: diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c index b657e6d24b7..fc47168e996 100644 --- a/src/mess/machine/bbc.c +++ b/src/mess/machine/bbc.c @@ -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) - { - 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) + int addr = 0x8000 + (0x4000 * index); + + if (image.software_entry() == NULL) { - index = 3; + 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 IMAGE_INIT_FAIL; } - addr = 0x8000 + (0x4000 * index); - + return IMAGE_INIT_PASS; +} - logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size); +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); - 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 (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); - if (read_ != size) - return 1; - return 0; + 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; } |