Previous 199869 Revisions Next

r29275 Friday 4th April, 2014 at 17:23:15 UTC by Fabio Priuli
(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]
[hash]bbcm_cart.xml
[src/mess/drivers]bbc.c
[src/mess/includes]bbc.h
[src/mess/machine]bbc.c

trunk/src/mess/machine/bbc.c
r29274r29275
19591959/**************************************
19601960   BBC B Rom loading functions
19611961***************************************/
1962DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcb_cart )
1962
1963int bbc_state::exp_rom_load(device_image_interface &image, int index)
19631964{
19641965   UINT8 *RAM = m_region_user1->base();
19651966   int size, read_;
1966   int addr = 0;
1967   int index = 0;
1968
1969   size = image.length();
1970
1971   if (strcmp(image.device().tag(),":cart1") == 0)
1967   int addr = 0x8000 + (0x4000 * index);
1968   
1969   if (image.software_entry() == NULL)
19721970   {
1973      index = 0;
1971      size = image.length();
1972      logerror("loading rom %s, at %.4x size:%.4x\n", image.filename(), addr, size);
1973     
1974      switch (size)
1975      {
1976         case 0x2000:
1977            read_ = image.fread(RAM + addr, size);
1978            if (read_ != size)
1979               return 1;
1980            image.fseek(0, SEEK_SET);
1981            read_ = image.fread(RAM + addr + 0x2000, size);
1982            break;
1983         case 0x4000:
1984            read_ = image.fread(RAM + addr, size);
1985            break;
1986         default:
1987            read_ = 0;
1988            logerror("bad rom file size of %.4x\n", size);
1989            break;
1990      }
1991     
1992      if (read_ != size)
1993         return IMAGE_INIT_FAIL;
19741994   }
1975   if (strcmp(image.device().tag(),":cart2") == 0)
1976   {
1977      index = 1;
1978   }
1979   if (strcmp(image.device().tag(),":cart3") == 0)
1980   {
1981      index = 2;
1982   }
1983   if (strcmp(image.device().tag(),":cart4") == 0)
1984   {
1985      index = 3;
1986   }
1987   addr = 0x8000 + (0x4000 * index);
1995   return IMAGE_INIT_PASS;
1996}
19881997
1998DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbc_exp_rom )
1999{
2000   if (strcmp(image.device().tag(),":exp_rom1") == 0)
2001      return exp_rom_load(image, 0);
19892002
1990   logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size);
2003   if (strcmp(image.device().tag(),":exp_rom2") == 0)
2004      return exp_rom_load(image, 1);
19912005
2006   if (strcmp(image.device().tag(),":exp_rom3") == 0)
2007      return exp_rom_load(image, 2);
2008   
2009   if (strcmp(image.device().tag(),":exp_rom4") == 0)
2010      return exp_rom_load(image, 3);
19922011
1993   switch (size)
1994   {
1995   case 0x2000:
1996      read_ = image.fread(RAM + addr, size);
1997      if (read_ != size)
1998         return 1;
1999      image.fseek(0, SEEK_SET);
2000      read_ = image.fread(RAM + addr + 0x2000, size);
2001      break;
2002   case 0x4000:
2003      read_ = image.fread(RAM + addr, size);
2004      break;
2005   default:
2006      read_ = 0;
2007      logerror("bad rom file size of %.4x\n", size);
2008      break;
2009   }
2010
2011   if (read_ != size)
2012      return 1;
2013   return 0;
2012   return IMAGE_INIT_FAIL;
20142013}
20152014
20162015
20172016/**************************************
20182017   BBC Master Rom loading functions
20192018***************************************/
2019
20202020DEVICE_IMAGE_LOAD_MEMBER( bbc_state, bbcm_cart )
20212021{
20222022   UINT8 *RAM = m_region_user1->base();
2023   int size, read_;
2024   int addr = 0;
2025   int index = 0;
2023   UINT32 size;
2024   int addr = 0, index = 0;
20262025
2027   size = image.length();
2028
20292026   if (strcmp(image.device().tag(),":cart1") == 0)
2030   {
20312027      index = 0;
2032   }
20332028   if (strcmp(image.device().tag(),":cart2") == 0)
2034   {
20352029      index = 1;
2036   }
2037   if (strcmp(image.device().tag(),":cart3") == 0)
2030   addr += index * 0x8000;
2031
2032   if (image.software_entry() == NULL)
20382033   {
2039      index = 2;
2034      size = image.length();
2035      logerror("loading rom %s, size:%.4x\n", image.filename(), size);
2036
2037      if (size != 0x8000)
2038      {
2039         image.seterror(IMAGE_ERROR_UNSUPPORTED, "Invalid rom file size");
2040         return IMAGE_INIT_FAIL;
2041      }
2042     
2043      image.fread(RAM + addr, size);
20402044   }
2041   if (strcmp(image.device().tag(),":cart4") == 0)
2045   else
20422046   {
2043      index = 3;
2044   }
2045   addr = 0x8000 + (0x4000 * index);
2047      size = image.get_software_region_length("rom");
2048      logerror("loading rom %s, size:%.4x\n", image.filename(), size);
20462049
2047
2048   logerror("loading rom %s at %.4x size:%.4x\n", image.filename(), addr, size);
2049
2050
2051   switch (size)
2052   {
2053   case 0x2000:
2054      read_ = image.fread(RAM + addr, size);
2055      if (read_ != size)
2056         return 1;
2057      image.fseek(0, SEEK_SET);
2058      read_ = image.fread(RAM + addr + 0x2000, size);
2059      break;
2060   case 0x4000:
2061      read_ = image.fread(RAM + addr, size);
2062      break;
2063   default:
2064      read_ = 0;
2065      logerror("bad rom file size of %.4x\n", size);
2066      break;
2050      memcpy(RAM + addr, image.get_software_region("rom"), size);
20672051   }
20682052
2069   if (read_ != size)
2070      return 1;
2071   return 0;
2053   return IMAGE_INIT_PASS;
20722054}
20732055
20742056
trunk/src/mess/includes/bbc.h
r29274r29275
155155   
156156   DECLARE_WRITE_LINE_MEMBER(bbc_i8271_interrupt);
157157
158   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcb_cart );
158   int exp_rom_load(device_image_interface &image, int index);
159   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbc_exp_rom );
159160   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( bbcm_cart );
160161
161162private:
trunk/src/mess/drivers/bbc.c
r29274r29275
639639}
640640
641641static MACHINE_CONFIG_FRAGMENT( bbc_cartslot )
642   MCFG_CARTSLOT_ADD("cart1")
642   MCFG_CARTSLOT_ADD("exp_rom1")
643643   MCFG_CARTSLOT_EXTENSION_LIST("rom")
644644   MCFG_CARTSLOT_NOT_MANDATORY
645   MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
645   MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
646   MCFG_CARTSLOT_INTERFACE("bbc_cart")
646647
647   MCFG_CARTSLOT_ADD("cart2")
648   MCFG_CARTSLOT_ADD("exp_rom2")
648649   MCFG_CARTSLOT_EXTENSION_LIST("rom")
649650   MCFG_CARTSLOT_NOT_MANDATORY
650   MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
651   MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
652   MCFG_CARTSLOT_INTERFACE("bbc_cart")
651653
652   MCFG_CARTSLOT_ADD("cart3")
654   MCFG_CARTSLOT_ADD("exp_rom3")
653655   MCFG_CARTSLOT_EXTENSION_LIST("rom")
654656   MCFG_CARTSLOT_NOT_MANDATORY
655   MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
657   MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
658   MCFG_CARTSLOT_INTERFACE("bbc_cart")
656659
657   MCFG_CARTSLOT_ADD("cart4")
660   MCFG_CARTSLOT_ADD("exp_rom4")
658661   MCFG_CARTSLOT_EXTENSION_LIST("rom")
659662   MCFG_CARTSLOT_NOT_MANDATORY
660   MCFG_CARTSLOT_LOAD(bbc_state, bbcb_cart)
663   MCFG_CARTSLOT_LOAD(bbc_state, bbc_exp_rom)
664   MCFG_CARTSLOT_INTERFACE("bbc_cart")
661665MACHINE_CONFIG_END
662666
663667
r29274r29275
929933   MCFG_CASSETTE_ADD( "cassette", bbc_cassette_interface )
930934
931935   /* cartridges */
932   MCFG_CARTSLOT_ADD("cart")
936   MCFG_CARTSLOT_ADD("cart1")
933937   MCFG_CARTSLOT_EXTENSION_LIST("bin")
934938   MCFG_CARTSLOT_NOT_MANDATORY
935939   MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart)
936940   MCFG_CARTSLOT_INTERFACE("bbcm_cart")
941   MCFG_CARTSLOT_ADD("cart2")
942   MCFG_CARTSLOT_EXTENSION_LIST("bin")
943   MCFG_CARTSLOT_NOT_MANDATORY
944   MCFG_CARTSLOT_LOAD(bbc_state, bbcm_cart)
945   MCFG_CARTSLOT_INTERFACE("bbcm_cart")
937946
938947   /* software lists */
939948   MCFG_SOFTWARE_LIST_ADD("cass_ls_m", "bbcm_cass")
trunk/hash/bbcm_cart.xml
r29274r29275
1515      <year>198?</year>
1616      <publisher>Acorn</publisher>
1717      <part name="cart" interface="bbcm_cart">
18         <dataarea name="uprom" size="16384">
18         <dataarea name="rom" size="32768">
1919            <rom name="bbcmasterdemonstrationcartridge_1.rom" size="16384" crc="fc40c0e8" sha1="970ff4721e707f3c843f4fb09ce7f03e7ab265ae" offset="0" />
20            <rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0x4000" />
2021         </dataarea>
21         <dataarea name="lorom" size="16384">
22            <rom name="bbcmasterdemonstrationcartridge_2.rom" size="16384" crc="2e73522d" sha1="ff39620d93b18fd36a4718474495211a46ef8184" offset="0" />
23         </dataarea>
2422      </part>
2523   </software>
2624

Previous 199869 Revisions Next


© 1997-2024 The MAME Team