trunk/hash/megadriv.xml
| r21445 | r21446 | |
| 25747 | 25747 | </software> |
| 25748 | 25748 | |
| 25749 | 25749 | <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"> |
| 25750 | 25764 | <description>Wu Kong Wai Zhuan (Chi)</description> |
| 25751 | 25765 | <year>1996</year> |
| 25752 | 25766 | <publisher>Ming</publisher> |
| r21445 | r21446 | |
| 26120 | 26134 | </software> |
| 26121 | 26135 | |
| 26122 | 26136 | <software name="beggarp"> |
| 26123 | | <description>Beggar Prince (USA)</description> |
| 26137 | <description>Beggar Prince (Euro, USA)</description> |
| 26124 | 26138 | <year>2005</year> |
| 26125 | 26139 | <publisher>Super Fighter Team</publisher> |
| 26126 | 26140 | <part name="cart" interface="megadriv_cart"> |
trunk/src/mess/machine/md_slot.c
| r21445 | r21446 | |
| 241 | 241 | { SEGA_FRAM, "rom_fram" }, |
| 242 | 242 | { HARDBALL95, "rom_hardbl95" }, |
| 243 | 243 | { BEGGAR, "rom_beggar"}, |
| 244 | { WUKONG, "rom_wukong"}, |
| 244 | 245 | |
| 245 | 246 | { SEGA_EEPROM, "rom_eeprom" }, |
| 246 | 247 | { NBA_JAM, "rom_nbajam" }, |
| r21445 | r21446 | |
| 639 | 640 | m_cart->m_nvram_active = 1; |
| 640 | 641 | m_cart->m_nvram_handlers_installed = 1; |
| 641 | 642 | 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; |
| 642 | 649 | } |
| 643 | 650 | } |
| 644 | 651 | |
trunk/src/mess/machine/md_rom.c
| r21445 | r21446 | |
| 48 | 48 | const device_type MD_ROM_SQUIR = &device_creator<md_rom_squir_device>; |
| 49 | 49 | const device_type MD_ROM_TOPF = &device_creator<md_rom_topf_device>; |
| 50 | 50 | const device_type MD_ROM_RADICA = &device_creator<md_rom_radica_device>; |
| 51 | const device_type MD_ROM_WUKONG = &device_creator<md_rom_wukong_device>; |
| 51 | 52 | |
| 52 | 53 | |
| 53 | 54 | md_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) |
| r21445 | r21446 | |
| 192 | 193 | { |
| 193 | 194 | } |
| 194 | 195 | |
| 196 | md_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 | |
| 195 | 201 | //------------------------------------------------- |
| 196 | 202 | // device_start - device-specific startup |
| 197 | 203 | //------------------------------------------------- |
| r21445 | r21446 | |
| 286 | 292 | save_item(NAME(m_bank)); |
| 287 | 293 | } |
| 288 | 294 | |
| 295 | void md_rom_wukong_device::device_start() |
| 296 | { |
| 297 | m_mode = 0; |
| 298 | save_item(NAME(m_mode)); |
| 299 | } |
| 300 | |
| 289 | 301 | /*------------------------------------------------- |
| 290 | 302 | mapper specific handlers |
| 291 | 303 | -------------------------------------------------*/ |
| r21445 | r21446 | |
| 1042 | 1054 | m_bank = offset & 0x3f; |
| 1043 | 1055 | return 0; |
| 1044 | 1056 | } |
| 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 | |
| 1071 | READ16_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 | |
| 1085 | WRITE16_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 | |
| 1094 | WRITE16_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
| r21445 | r21446 | |
| 483 | 483 | UINT8 m_bank; |
| 484 | 484 | }; |
| 485 | 485 | |
| 486 | // ======================> md_rom_wukong_device |
| 486 | 487 | |
| 488 | class md_rom_wukong_device : public md_std_rom_device |
| 489 | { |
| 490 | public: |
| 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); |
| 487 | 502 | |
| 503 | UINT8 m_mode; |
| 504 | }; |
| 505 | |
| 506 | |
| 507 | |
| 488 | 508 | // device type definition |
| 489 | 509 | extern const device_type MD_STD_ROM; |
| 490 | 510 | extern const device_type MD_ROM_SRAM; |
| r21445 | r21446 | |
| 513 | 533 | extern const device_type MD_ROM_SQUIR; |
| 514 | 534 | extern const device_type MD_ROM_TOPF; |
| 515 | 535 | extern const device_type MD_ROM_RADICA; |
| 536 | extern const device_type MD_ROM_WUKONG; |
| 516 | 537 | |
| 517 | 538 | #endif |