Previous 199869 Revisions Next

r21448 Tuesday 26th February, 2013 at 14:44:43 UTC by Fabio Priuli
this should fix the resets and lockups (at least most of them). sram is still not saved, though... nw.
[hash]megadriv.xml
[src/mess/drivers]megadriv.c
[src/mess/machine]md_rom.c md_rom.h md_slot.c md_slot.h

trunk/src/mess/machine/md_rom.c
r21447r21448
4848const device_type MD_ROM_SQUIR = &device_creator<md_rom_squir_device>;
4949const device_type MD_ROM_TOPF = &device_creator<md_rom_topf_device>;
5050const device_type MD_ROM_RADICA = &device_creator<md_rom_radica_device>;
51const device_type MD_ROM_BEGGARP = &device_creator<md_rom_beggarp_device>;
5152const device_type MD_ROM_WUKONG = &device_creator<md_rom_wukong_device>;
5253
5354
r21447r21448
193194{
194195}
195196
197md_rom_beggarp_device::md_rom_beggarp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
198               : md_std_rom_device(mconfig, MD_ROM_BEGGARP, "MD Beggar Prince", tag, owner, clock)
199{
200}
201
196202md_rom_wukong_device::md_rom_wukong_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
197203               : md_std_rom_device(mconfig, MD_ROM_WUKONG, "MD Legend of Wukong", tag, owner, clock)
198204{
r21447r21448
292298   save_item(NAME(m_bank));
293299}
294300
301void md_rom_beggarp_device::device_start()
302{
303   m_mode = 0;
304   m_lock = 0;
305   save_item(NAME(m_mode));
306   save_item(NAME(m_lock));
307}
308
295309void md_rom_wukong_device::device_start()
296310{
297311   m_mode = 0;
r21447r21448
10551069   return 0;
10561070}
10571071
1072/*-------------------------------------------------
1073 BEGGAR PRINCE
1074 This game uses cart which is the same as SEGA_SRAM
1075 + bankswitch mechanism to remap some 256K chunk of
1076 ROM and to enable/disable SRAM (not yet fully
1077 emulated)
1078 -------------------------------------------------*/
10581079
1080READ16_MEMBER(md_rom_beggarp_device::read)
1081{
1082   if (m_mode & 2)
1083   {
1084      //000000-03ffff = ROM bank 15 x 256k
1085      //040000-3bffff = ROM banks 2 to 15 x256k
1086      //3c0000-3fffff = ?? SRAM ?? (32k?)
1087      if (offset < 0x040000/2)
1088         return m_rom[offset + 0x380000/2];
1089      else if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active)
1090         return m_nvram[offset & 0x3fff];
1091      else if (offset < 0x400000/2)
1092         return m_rom[offset & 0x1fffff];
1093   }
1094   else
1095   {
1096      // currently not supported
1097      //      if (m_mode & 1)   //00-40 = unmapped (open bus?)
1098     
1099       //00-40 = ROM banks 1 to 16 x256k
1100      if (offset < 0x400000/2)
1101         return m_rom[offset & 0x1fffff];
1102   }
1103   
1104   return 0xffff;
1105}
1106
1107WRITE16_MEMBER(md_rom_beggarp_device::write)
1108{
1109   if (offset >= 0x0e00/2 && offset < 0x0f00/2)   // it actually writes to 0xe00/2
1110   {
1111      if (!m_lock)
1112         m_mode = (data & 0xc0) >> 6;
1113     
1114      m_lock = BIT(data, 5); // lock bankswitch hardware when set, until hard reset
1115   }
1116   
1117   // SRAM is only accessible in mode 2
1118   if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && !m_nvram_readonly && m_mode == 2)
1119      m_nvram[offset & 0x3fff] = data;
1120}
1121
1122WRITE16_MEMBER(md_rom_beggarp_device::write_a13)
1123{
1124   if (offset == 0xf0/2)
1125   {
1126      /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */
1127      m_nvram_active = BIT(data, 0);
1128      m_nvram_readonly = BIT(data, 1);
1129     
1130      // since a lot of generic carts ends up here if loaded from fullpath
1131      // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here!
1132      if (m_nvram_active)
1133         m_nvram_handlers_installed = 1;
1134   }
1135}
1136
10591137/*-------------------------------------------------
10601138 LEGEND OF WUKONG
10611139 This game uses cart which is the same as SEGA_SRAM
trunk/src/mess/machine/md_rom.h
r21447r21448
483483   UINT8 m_bank;
484484};
485485
486// ======================> md_rom_beggarp_device
487
488class md_rom_beggarp_device : public md_std_rom_device
489{
490public:
491   // construction/destruction
492   md_rom_beggarp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
493   
494   // device-level overrides
495   virtual void device_start();
496   virtual void device_config_complete() { m_shortname = "md_rom_beggarp"; }
497   
498   // reading and writing
499   virtual DECLARE_READ16_MEMBER(read);
500   virtual DECLARE_WRITE16_MEMBER(write);
501   virtual DECLARE_WRITE16_MEMBER(write_a13);
502
503   UINT8 m_mode, m_lock;
504};
505
486506// ======================> md_rom_wukong_device
487507
488508class md_rom_wukong_device : public md_std_rom_device
r21447r21448
499519   virtual DECLARE_READ16_MEMBER(read);
500520   virtual DECLARE_WRITE16_MEMBER(write);
501521   virtual DECLARE_WRITE16_MEMBER(write_a13);
502
522   
503523   UINT8 m_mode;
504524};
505525
r21447r21448
533553extern const device_type MD_ROM_SQUIR;
534554extern const device_type MD_ROM_TOPF;
535555extern const device_type MD_ROM_RADICA;
556extern const device_type MD_ROM_BEGGARP;
536557extern const device_type MD_ROM_WUKONG;
537558
538559#endif
trunk/src/mess/machine/md_slot.c
r21447r21448
240240   { SEGA_SRAM, "rom_sram" },
241241   { SEGA_FRAM, "rom_fram" },
242242   { HARDBALL95, "rom_hardbl95" },
243   { BEGGAR, "rom_beggar"},
243   { XINQIG, "rom_xinqig"},
244   { BEGGARP, "rom_beggarp"},
244245   { WUKONG, "rom_wukong"},
245246
246247   { SEGA_EEPROM, "rom_eeprom" },
r21447r21448
633634         m_cart->m_nvram_active = 1;
634635         m_cart->m_nvram_handlers_installed = 1;
635636         break;
636      case BEGGAR:
637      case XINQIG:
637638         m_cart->m_nvram_start = 0x400000;
638639         m_cart->m_nvram_end = m_cart->m_nvram_start + 0xffff;
639640         m_cart->nvram_alloc(machine(), m_cart->m_nvram_end - m_cart->m_nvram_start + 1);
640641         m_cart->m_nvram_active = 1;
641642         m_cart->m_nvram_handlers_installed = 1;
642643         break;
644      case BEGGARP:
645         m_cart->m_nvram_start = 0x3c0000;
646         m_cart->m_nvram_end = m_cart->m_nvram_start + 0xffff;
647         m_cart->nvram_alloc(machine(), 0x8000);   // 32K mirrored
648         m_cart->m_nvram_active = 1;
649         break;
643650      case WUKONG:
644651         m_cart->m_nvram_start = 0x3c0000;
645652         m_cart->m_nvram_end = m_cart->m_nvram_start + 0x3fff;
trunk/src/mess/machine/md_slot.h
r21447r21448
2121   // Cart + NVRAM
2222   SEGA_SRAM, SEGA_FRAM,
2323   HARDBALL95,                  /* Hardball 95 uses different sram start address */
24   BEGGAR,                      /* Beggar Prince / Xin Qigai Wangzi uses different sram start address and has no valid header */
24   XINQIG,                   /* Xin Qigai Wangzi uses different sram start address and has no valid header */
25   BEGGARP,                     /* Beggar Prince uses different sram start address + bankswitch tricks */
2526   WUKONG,                      /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */
2627
2728   // EEPROM
trunk/src/mess/drivers/megadriv.c
r21447r21448
304304   SLOT_INTERFACE_INTERNAL("rom_sramsafe",  MD_ROM_SRAM)
305305   SLOT_INTERFACE_INTERNAL("rom_fram",  MD_ROM_FRAM)
306306   SLOT_INTERFACE_INTERNAL("rom_hardbl95", MD_ROM_SRAM)
307   SLOT_INTERFACE_INTERNAL("rom_beggar",  MD_ROM_SRAM)
307   SLOT_INTERFACE_INTERNAL("rom_xinqig",  MD_ROM_SRAM)
308   SLOT_INTERFACE_INTERNAL("rom_beggarp",  MD_ROM_BEGGARP)
308309   SLOT_INTERFACE_INTERNAL("rom_wukong",  MD_ROM_WUKONG)
309310// EEPROM handling (not supported fully yet)
310311   SLOT_INTERFACE_INTERNAL("rom_eeprom",  MD_STD_EEPROM)
trunk/hash/megadriv.xml
r21447r21448
2613826138      <year>2005</year>
2613926139      <publisher>Super Fighter Team</publisher>
2614026140      <part name="cart" interface="megadriv_cart">
26141         <feature name="slot" value="rom_beggar" />
26141         <feature name="slot" value="rom_beggarp" />
2614226142         <dataarea name="rom" size="4194304">
2614326143            <rom name="beggar prince (unl).bin" size="4194304" crc="f3af46cd" sha1="f481b970756c482d8f408c4bab8902172837e7d8" offset="000000" loadflag="load16_word_swap" />
2614426144         </dataarea>
r21447r21448
2615026150      <year>1996</year>
2615126151      <publisher>C&amp;E</publisher>
2615226152      <part name="cart" interface="megadriv_cart">
26153         <feature name="slot" value="rom_beggar" />
26153         <feature name="slot" value="rom_xinqig" />
2615426154         <dataarea name="rom" size="4194304">
2615526155            <rom name="xin qi gai wang zi (chi) (alt) (unl).bin" size="4194304" crc="da5a4bfe" sha1="75f8003a6388814c1880347882b244549da62158" offset="000000" loadflag="load16_word_swap" />
2615626156         </dataarea>
r21447r21448
2616226162      <year>1996</year>
2616326163      <publisher>C&amp;E</publisher>
2616426164      <part name="cart" interface="megadriv_cart">
26165         <feature name="slot" value="rom_beggar" />
26165         <feature name="slot" value="rom_xinqig" />
2616626166         <dataarea name="rom" size="4194304">
2616726167            <rom name="xin qi gai wang zi (chi) (unl).bin" size="4194304" crc="dd2f38b5" sha1="4a7494d8601149f43ba7e3595a0b2340cde2e9ba" offset="000000" loadflag="load16_word_swap" />
2616826168         </dataarea>

Previous 199869 Revisions Next


© 1997-2024 The MAME Team