Previous 199869 Revisions Next

r21446 Tuesday 26th February, 2013 at 11:33:06 UTC by Fabio Priuli
(MESS) megadriv.c: added support for Legend of Wukong [Fabio Priuli]
[hash]megadriv.xml
[src/mess/drivers]megadriv.c
[src/mess/machine]md_rom.c md_rom.h md_slot.c md_slot.h

trunk/hash/megadriv.xml
r21445r21446
2574725747   </software>
2574825748
2574925749   <software name="wukong">
25750      <description>Legend of Wukong (Euro, USA)</description>
25751      <year>2008</year>
25752      <publisher>Super Fighter Team</publisher>
25753      <part name="cart" interface="megadriv_cart">
25754         <feature name="slot" value="rom_wukong" />
25755         <dataarea name="rom" size="2228224">
25756            <rom name="legend of wukong (unl).bin" size="2228224" crc="72f11771" sha1="4ef41e4caccab118014abb8e079c7e5668a4f468" offset="000000" loadflag="load16_word_swap" />
25757         </dataarea>
25758         <dataarea name="sram" size="16384">
25759         </dataarea>
25760      </part>
25761   </software>
25762
25763   <software name="wukongc" cloneof="wukong">
2575025764      <description>Wu Kong Wai Zhuan (Chi)</description>
2575125765      <year>1996</year>
2575225766      <publisher>Ming</publisher>
r21445r21446
2612026134   </software>
2612126135
2612226136   <software name="beggarp">
26123      <description>Beggar Prince (USA)</description>
26137      <description>Beggar Prince (Euro, USA)</description>
2612426138      <year>2005</year>
2612526139      <publisher>Super Fighter Team</publisher>
2612626140      <part name="cart" interface="megadriv_cart">
trunk/src/mess/drivers/megadriv.c
r21445r21446
305305   SLOT_INTERFACE_INTERNAL("rom_fram",  MD_ROM_FRAM)
306306   SLOT_INTERFACE_INTERNAL("rom_hardbl95", MD_ROM_SRAM)
307307   SLOT_INTERFACE_INTERNAL("rom_beggar",  MD_ROM_SRAM)
308   SLOT_INTERFACE_INTERNAL("rom_wukong",  MD_ROM_WUKONG)
308309// EEPROM handling (not supported fully yet)
309310   SLOT_INTERFACE_INTERNAL("rom_eeprom",  MD_STD_EEPROM)
310311   SLOT_INTERFACE_INTERNAL("rom_nbajam",  MD_EEPROM_NBAJAM)
trunk/src/mess/machine/md_slot.c
r21445r21446
241241   { SEGA_FRAM, "rom_fram" },
242242   { HARDBALL95, "rom_hardbl95" },
243243   { BEGGAR, "rom_beggar"},
244   { WUKONG, "rom_wukong"},
244245
245246   { SEGA_EEPROM, "rom_eeprom" },
246247   { NBA_JAM, "rom_nbajam" },
r21445r21446
639640         m_cart->m_nvram_active = 1;
640641         m_cart->m_nvram_handlers_installed = 1;
641642         break;
643      case WUKONG:
644         m_cart->m_nvram_start = 0x3c0000;
645         m_cart->m_nvram_end = m_cart->m_nvram_start + 0x3fff;
646         m_cart->nvram_alloc(machine(), m_cart->m_nvram_end - m_cart->m_nvram_start + 1);
647         m_cart->m_nvram_active = 1;
648         break;
642649   }
643650}
644651
trunk/src/mess/machine/md_slot.h
r21445r21446
2222   SEGA_SRAM, SEGA_FRAM,
2323   HARDBALL95,                  /* Hardball 95 uses different sram start address */
2424   BEGGAR,                      /* Beggar Prince / Xin Qigai Wangzi uses different sram start address and has no valid header */
25   WUKONG,                      /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */
2526
2627   // EEPROM
2728   SEGA_EEPROM,                 /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */
trunk/src/mess/machine/md_rom.c
r21445r21446
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_WUKONG = &device_creator<md_rom_wukong_device>;
5152
5253
5354md_std_rom_device::md_std_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
r21445r21446
192193{
193194}
194195
196md_rom_wukong_device::md_rom_wukong_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
197               : md_std_rom_device(mconfig, MD_ROM_WUKONG, "MD Legend of Wukong", tag, owner, clock)
198{
199}
200
195201//-------------------------------------------------
196202//  device_start - device-specific startup
197203//-------------------------------------------------
r21445r21446
286292   save_item(NAME(m_bank));
287293}
288294
295void md_rom_wukong_device::device_start()
296{
297   m_mode = 0;
298   save_item(NAME(m_mode));
299}
300
289301/*-------------------------------------------------
290302 mapper specific handlers
291303 -------------------------------------------------*/
r21445r21446
10421054      m_bank = offset & 0x3f;
10431055   return 0;
10441056}
1057
1058
1059/*-------------------------------------------------
1060 LEGEND OF WUKONG
1061 This game uses cart which is the same as SEGA_SRAM
1062 + bankswitch mechanism for last 128k of the image:
1063 first 2MB of ROM is loaded in 0-0x200000 and
1064 mirrored in 0x200000-0x400000, but depending on
1065 bit7 of the value written at 0xe00/2 accesses to
1066 0x200000-0x21ffff go either to the "physical" address
1067 (i.e. last 128K of ROM) or to the "memory" address
1068 (i.e. mirror of first 128K)
1069 -------------------------------------------------*/
1070
1071READ16_MEMBER(md_rom_wukong_device::read)
1072{
1073   if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active)
1074      return m_nvram[offset - m_nvram_start/2];
1075
1076   // here can access both last 128K of the ROM and the first 128K, depending of bit7 of m_mode
1077   if (offset >= 0x200000/2 && offset < 0x220000/2)   
1078      return !m_mode ? m_rom[offset] : m_rom[offset & 0xffff];
1079   else if (offset < 0x400000/2)
1080      return m_rom[offset & 0xfffff];
1081   else
1082      return 0xffff;
1083}
1084
1085WRITE16_MEMBER(md_rom_wukong_device::write)
1086{
1087   if (offset < 0x100000/2)   // it actually writes to 0xe00/2
1088      m_mode = BIT(data, 7);
1089
1090   if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && !m_nvram_readonly)
1091      m_nvram[offset - m_nvram_start/2] = data;
1092}
1093
1094WRITE16_MEMBER(md_rom_wukong_device::write_a13)
1095{
1096   if (offset == 0xf0/2)
1097   {
1098      /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */
1099      m_nvram_active = BIT(data, 0);
1100      m_nvram_readonly = BIT(data, 1);
1101     
1102      // since a lot of generic carts ends up here if loaded from fullpath
1103      // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here!
1104      if (m_nvram_active)
1105         m_nvram_handlers_installed = 1;
1106   }
1107}
1108
trunk/src/mess/machine/md_rom.h
r21445r21446
483483   UINT8 m_bank;
484484};
485485
486// ======================> md_rom_wukong_device
486487
488class md_rom_wukong_device : public md_std_rom_device
489{
490public:
491   // construction/destruction
492   md_rom_wukong_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_wukong"; }
497   
498   // reading and writing
499   virtual DECLARE_READ16_MEMBER(read);
500   virtual DECLARE_WRITE16_MEMBER(write);
501   virtual DECLARE_WRITE16_MEMBER(write_a13);
487502
503   UINT8 m_mode;
504};
505
506
507
488508// device type definition
489509extern const device_type MD_STD_ROM;
490510extern const device_type MD_ROM_SRAM;
r21445r21446
513533extern const device_type MD_ROM_SQUIR;
514534extern const device_type MD_ROM_TOPF;
515535extern const device_type MD_ROM_RADICA;
536extern const device_type MD_ROM_WUKONG;
516537
517538#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team