trunk/src/mess/machine/md_rom.c
| r21447 | r21448 | |
| 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_BEGGARP = &device_creator<md_rom_beggarp_device>; |
| 51 | 52 | const device_type MD_ROM_WUKONG = &device_creator<md_rom_wukong_device>; |
| 52 | 53 | |
| 53 | 54 | |
| r21447 | r21448 | |
| 193 | 194 | { |
| 194 | 195 | } |
| 195 | 196 | |
| 197 | md_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 | |
| 196 | 202 | md_rom_wukong_device::md_rom_wukong_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 197 | 203 | : md_std_rom_device(mconfig, MD_ROM_WUKONG, "MD Legend of Wukong", tag, owner, clock) |
| 198 | 204 | { |
| r21447 | r21448 | |
| 292 | 298 | save_item(NAME(m_bank)); |
| 293 | 299 | } |
| 294 | 300 | |
| 301 | void 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 | |
| 295 | 309 | void md_rom_wukong_device::device_start() |
| 296 | 310 | { |
| 297 | 311 | m_mode = 0; |
| r21447 | r21448 | |
| 1055 | 1069 | return 0; |
| 1056 | 1070 | } |
| 1057 | 1071 | |
| 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 | -------------------------------------------------*/ |
| 1058 | 1079 | |
| 1080 | READ16_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 | |
| 1107 | WRITE16_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 | |
| 1122 | WRITE16_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 | |
| 1059 | 1137 | /*------------------------------------------------- |
| 1060 | 1138 | LEGEND OF WUKONG |
| 1061 | 1139 | This game uses cart which is the same as SEGA_SRAM |
trunk/src/mess/machine/md_rom.h
| r21447 | r21448 | |
| 483 | 483 | UINT8 m_bank; |
| 484 | 484 | }; |
| 485 | 485 | |
| 486 | // ======================> md_rom_beggarp_device |
| 487 | |
| 488 | class md_rom_beggarp_device : public md_std_rom_device |
| 489 | { |
| 490 | public: |
| 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 | |
| 486 | 506 | // ======================> md_rom_wukong_device |
| 487 | 507 | |
| 488 | 508 | class md_rom_wukong_device : public md_std_rom_device |
| r21447 | r21448 | |
| 499 | 519 | virtual DECLARE_READ16_MEMBER(read); |
| 500 | 520 | virtual DECLARE_WRITE16_MEMBER(write); |
| 501 | 521 | virtual DECLARE_WRITE16_MEMBER(write_a13); |
| 502 | | |
| 522 | |
| 503 | 523 | UINT8 m_mode; |
| 504 | 524 | }; |
| 505 | 525 | |
| r21447 | r21448 | |
| 533 | 553 | extern const device_type MD_ROM_SQUIR; |
| 534 | 554 | extern const device_type MD_ROM_TOPF; |
| 535 | 555 | extern const device_type MD_ROM_RADICA; |
| 556 | extern const device_type MD_ROM_BEGGARP; |
| 536 | 557 | extern const device_type MD_ROM_WUKONG; |
| 537 | 558 | |
| 538 | 559 | #endif |
trunk/src/mess/machine/md_slot.c
| r21447 | r21448 | |
| 240 | 240 | { SEGA_SRAM, "rom_sram" }, |
| 241 | 241 | { SEGA_FRAM, "rom_fram" }, |
| 242 | 242 | { HARDBALL95, "rom_hardbl95" }, |
| 243 | | { BEGGAR, "rom_beggar"}, |
| 243 | { XINQIG, "rom_xinqig"}, |
| 244 | { BEGGARP, "rom_beggarp"}, |
| 244 | 245 | { WUKONG, "rom_wukong"}, |
| 245 | 246 | |
| 246 | 247 | { SEGA_EEPROM, "rom_eeprom" }, |
| r21447 | r21448 | |
| 633 | 634 | m_cart->m_nvram_active = 1; |
| 634 | 635 | m_cart->m_nvram_handlers_installed = 1; |
| 635 | 636 | break; |
| 636 | | case BEGGAR: |
| 637 | case XINQIG: |
| 637 | 638 | m_cart->m_nvram_start = 0x400000; |
| 638 | 639 | m_cart->m_nvram_end = m_cart->m_nvram_start + 0xffff; |
| 639 | 640 | m_cart->nvram_alloc(machine(), m_cart->m_nvram_end - m_cart->m_nvram_start + 1); |
| 640 | 641 | m_cart->m_nvram_active = 1; |
| 641 | 642 | m_cart->m_nvram_handlers_installed = 1; |
| 642 | 643 | 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; |
| 643 | 650 | case WUKONG: |
| 644 | 651 | m_cart->m_nvram_start = 0x3c0000; |
| 645 | 652 | m_cart->m_nvram_end = m_cart->m_nvram_start + 0x3fff; |
trunk/src/mess/drivers/megadriv.c
| r21447 | r21448 | |
| 304 | 304 | SLOT_INTERFACE_INTERNAL("rom_sramsafe", MD_ROM_SRAM) |
| 305 | 305 | SLOT_INTERFACE_INTERNAL("rom_fram", MD_ROM_FRAM) |
| 306 | 306 | 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) |
| 308 | 309 | SLOT_INTERFACE_INTERNAL("rom_wukong", MD_ROM_WUKONG) |
| 309 | 310 | // EEPROM handling (not supported fully yet) |
| 310 | 311 | SLOT_INTERFACE_INTERNAL("rom_eeprom", MD_STD_EEPROM) |
trunk/hash/megadriv.xml
| r21447 | r21448 | |
| 26138 | 26138 | <year>2005</year> |
| 26139 | 26139 | <publisher>Super Fighter Team</publisher> |
| 26140 | 26140 | <part name="cart" interface="megadriv_cart"> |
| 26141 | | <feature name="slot" value="rom_beggar" /> |
| 26141 | <feature name="slot" value="rom_beggarp" /> |
| 26142 | 26142 | <dataarea name="rom" size="4194304"> |
| 26143 | 26143 | <rom name="beggar prince (unl).bin" size="4194304" crc="f3af46cd" sha1="f481b970756c482d8f408c4bab8902172837e7d8" offset="000000" loadflag="load16_word_swap" /> |
| 26144 | 26144 | </dataarea> |
| r21447 | r21448 | |
| 26150 | 26150 | <year>1996</year> |
| 26151 | 26151 | <publisher>C&E</publisher> |
| 26152 | 26152 | <part name="cart" interface="megadriv_cart"> |
| 26153 | | <feature name="slot" value="rom_beggar" /> |
| 26153 | <feature name="slot" value="rom_xinqig" /> |
| 26154 | 26154 | <dataarea name="rom" size="4194304"> |
| 26155 | 26155 | <rom name="xin qi gai wang zi (chi) (alt) (unl).bin" size="4194304" crc="da5a4bfe" sha1="75f8003a6388814c1880347882b244549da62158" offset="000000" loadflag="load16_word_swap" /> |
| 26156 | 26156 | </dataarea> |
| r21447 | r21448 | |
| 26162 | 26162 | <year>1996</year> |
| 26163 | 26163 | <publisher>C&E</publisher> |
| 26164 | 26164 | <part name="cart" interface="megadriv_cart"> |
| 26165 | | <feature name="slot" value="rom_beggar" /> |
| 26165 | <feature name="slot" value="rom_xinqig" /> |
| 26166 | 26166 | <dataarea name="rom" size="4194304"> |
| 26167 | 26167 | <rom name="xin qi gai wang zi (chi) (unl).bin" size="4194304" crc="dd2f38b5" sha1="4a7494d8601149f43ba7e3595a0b2340cde2e9ba" offset="000000" loadflag="load16_word_swap" /> |
| 26168 | 26168 | </dataarea> |