src/mess/drivers/genesis.c
| r2192 | r2193 | |
| 56 | 56 | |
| 57 | 57 | static int is_ssf2 = 0; |
| 58 | 58 | static int is_redcliff = 0; |
| 59 | static int is_radica = 0; |
| 59 | 60 | |
| 60 | 61 | static UINT8 *genesis_sram; |
| 61 | 62 | static int genesis_sram_start; |
| r2192 | r2193 | |
| 182 | 183 | unsigned char *ROM; |
| 183 | 184 | |
| 184 | 185 | genesis_sram = NULL; |
| 185 | | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = is_ssf2 = is_redcliff = 0; |
| 186 | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = is_ssf2 = is_redcliff = is_radica = 0; |
| 186 | 187 | |
| 187 | 188 | rawROM = memory_region(REGION_CPU1); |
| 188 | 189 | ROM = rawROM /*+ 512 */; |
| r2192 | r2193 | |
| 239 | 240 | { |
| 240 | 241 | relocate = 0x2000; |
| 241 | 242 | |
| 242 | | if (!strncmp((char *)&ROM[0x2120], "SUPER STREET FIGHTER2", 20)) |
| 243 | if (!strncmp((char *)&ROM[0x0120+relocate], "SUPER STREET FIGHTER2", 20)) |
| 243 | 244 | { |
| 244 | 245 | is_ssf2 = 1; |
| 245 | 246 | } |
| 246 | 247 | // detect the 'Romance of the Three Kingdoms - Red Cliff' rom, already decoded from useless .mdx format |
| 247 | | if (length == 0x200000) |
| 248 | if (length == 0x200000) |
| 248 | 249 | { |
| 249 | 250 | static unsigned char redcliffsig[] = { 0x10, 0x39, 0x00, 0x40, 0x00, 0x04}; // move.b ($400004).l,d0 |
| 250 | | if (!memcmp(&ROM[0xce560+relocate],&redcliffsig[0],sizeof(redcliffsig))) |
| 251 | if (!memcmp(&ROM[0xce560+relocate],&redcliffsig[0],sizeof(redcliffsig))) |
| 251 | 252 | { |
| 252 | 253 | is_redcliff = 1; |
| 253 | 254 | } |
| 254 | 255 | } |
| 256 | // detect the Radica TV games.. these probably should be a seperate driver since they are a seperate 'console' |
| 257 | if (length == 0x400000) |
| 258 | { |
| 259 | static unsigned char radicasig[] = { 0xd0, 0x30, 0x39, 0x00, 0xa1, 0x30}; // jmp (a0) move.w ($a130xx),d0 |
| 260 | |
| 261 | if (!memcmp(&ROM[0x3c031d+relocate],&radicasig[0],sizeof(radicasig))) // ssf+gng |
| 262 | { |
| 263 | is_radica = 1; |
| 264 | } |
| 265 | if (!memcmp(&ROM[0x3f031d+relocate],&radicasig[0],sizeof(radicasig))) // 6in1 vol 1 |
| 266 | { |
| 267 | is_radica = 1; |
| 268 | } |
| 269 | |
| 270 | } |
| 271 | |
| 255 | 272 | } |
| 256 | 273 | |
| 257 | 274 | ROM = memory_region(REGION_CPU1); /* 68000 ROM region */ |
| r2192 | r2193 | |
| 277 | 294 | free(tmpROM); |
| 278 | 295 | } |
| 279 | 296 | |
| 297 | if (is_radica) |
| 298 | { |
| 299 | memcpy(&ROM[0x400000], &ROM[0], 0x400000); // keep a copy for later banking.. making use of huge ROM_REGION allocated to genesis driver |
| 300 | memcpy(&ROM[0x800000], &ROM[0], 0x400000); // wraparound banking (from hazemd code) |
| 301 | } |
| 302 | |
| 303 | |
| 280 | 304 | /* check if cart has battery save */ |
| 281 | 305 | genesis_sram_len = 0; |
| 282 | 306 | genesis_sram = NULL; |
| r2192 | r2193 | |
| 403 | 427 | } |
| 404 | 428 | } |
| 405 | 429 | |
| 430 | // Radica handler borrowed from HazeMD |
| 431 | |
| 432 | READ16_HANDLER( radica_bank_select ) |
| 433 | { |
| 434 | int bank = offset&0x3f; |
| 435 | UINT8 *ROM = memory_region(REGION_CPU1); |
| 436 | memcpy(ROM, ROM + (bank*0x10000)+0x400000, 0x400000); |
| 437 | |
| 438 | // printf("bank %02x\n",offset); |
| 439 | return 0; |
| 440 | } |
| 441 | |
| 406 | 442 | // Red Cliff handler borrowed from HazeMD |
| 407 | 443 | |
| 408 | 444 | READ16_HANDLER( redclif_prot_r ) |
| r2192 | r2193 | |
| 424 | 460 | { |
| 425 | 461 | } |
| 426 | 462 | |
| 427 | | |
| 428 | 463 | static DRIVER_INIT( gencommon ) |
| 429 | 464 | { |
| 430 | 465 | if (genesis_sram) |
| r2192 | r2193 | |
| 437 | 472 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, genesis_ssf2_bank_w); |
| 438 | 473 | } |
| 439 | 474 | |
| 440 | | if (is_redcliff) |
| 475 | if (is_radica) |
| 441 | 476 | { |
| 477 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa13000, 0xa1307f, 0, 0, radica_bank_select ); |
| 478 | } |
| 479 | |
| 480 | |
| 481 | if (is_redcliff) |
| 482 | { |
| 442 | 483 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400001, 0, 0, redclif_prot2_r ); |
| 443 | 484 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400004, 0x400005, 0, 0, redclif_prot_r ); |
| 444 | 485 | } |
| 445 | 486 | |
| 487 | |
| 446 | 488 | /* install NOP handler for TMSS */ |
| 447 | 489 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA14000, 0xA14003, 0, 0, genesis_TMSS_bank_w); |
| 448 | 490 | |