src/mess/drivers/genesis.c
| r2163 | r2164 | |
| 55 | 55 | #include "../../mame/drivers/megadriv.h" |
| 56 | 56 | |
| 57 | 57 | static int is_ssf2 = 0; |
| 58 | static int is_redcliff = 0; |
| 58 | 59 | |
| 59 | 60 | static UINT8 *genesis_sram; |
| 60 | 61 | static int genesis_sram_start; |
| r2163 | r2164 | |
| 181 | 182 | unsigned char *ROM; |
| 182 | 183 | |
| 183 | 184 | genesis_sram = NULL; |
| 184 | | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = is_ssf2 = 0; |
| 185 | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = is_ssf2 = is_redcliff = 0; |
| 185 | 186 | |
| 186 | 187 | rawROM = memory_region(REGION_CPU1); |
| 187 | 188 | ROM = rawROM /*+ 512 */; |
| r2163 | r2164 | |
| 242 | 243 | { |
| 243 | 244 | is_ssf2 = 1; |
| 244 | 245 | } |
| 246 | // detect the 'Romance of the Three Kingdoms - Red Cliff' rom, already decoded from useless .mdx format |
| 247 | if (length == 0x200000) { |
| 248 | static unsigned char redcliffsig[] = { 0x10, 0x39, 0x00, 0x40, 0x00, 0x04}; // move.b ($400004).l,d0 |
| 249 | if (!memcmp(&ROM[0xce560+relocate],&redcliffsig[0],sizeof(redcliffsig))) { |
| 250 | is_redcliff = 1; |
| 251 | } |
| 252 | } |
| 245 | 253 | } |
| 246 | 254 | |
| 247 | 255 | ROM = memory_region(REGION_CPU1); /* 68000 ROM region */ |
| r2163 | r2164 | |
| 380 | 388 | } |
| 381 | 389 | } |
| 382 | 390 | |
| 391 | // Red Cliff handler borrowed from HazeMD |
| 392 | |
| 393 | READ16_HANDLER( redclif_prot_r ) |
| 394 | { |
| 395 | return -0x56 << 8; |
| 396 | } |
| 397 | |
| 398 | READ16_HANDLER( redclif_prot2_r ) |
| 399 | { |
| 400 | return 0x55 << 8; |
| 401 | } |
| 402 | |
| 383 | 403 | static WRITE16_HANDLER( genesis_TMSS_bank_w ) |
| 384 | 404 | { |
| 385 | 405 | /* this probably should do more, like make Genesis V2 'die' if the SEGA string is not written promptly */ |
| r2163 | r2164 | |
| 406 | 426 | { |
| 407 | 427 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, genesis_ssf2_bank_w); |
| 408 | 428 | } |
| 429 | if (is_redcliff) { |
| 430 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400001, 0, 0, redclif_prot2_r ); |
| 431 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400004, 0x400005, 0, 0, redclif_prot_r ); |
| 432 | } |
| 433 | |
| 409 | 434 | /* install NOP handler for TMSS */ |
| 410 | 435 | |
| 411 | 436 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA14000, 0xA14003, 0, 0, genesis_TMSS_bank_w); |