src/mess/drivers/genesis.c
| r2227 | r2228 | |
| 60 | 60 | static int is_kof99 = 0; |
| 61 | 61 | static int is_soulb = 0; |
| 62 | 62 | static int is_mjlovr = 0; |
| 63 | static int is_squir = 0; |
| 64 | static int squirrel_king_extra = 0; |
| 63 | 65 | |
| 64 | 66 | static UINT8 *genesis_sram; |
| 65 | 67 | static int genesis_sram_start; |
| r2227 | r2228 | |
| 185 | 187 | int ptr, x; |
| 186 | 188 | unsigned char *ROM; |
| 187 | 189 | |
| 190 | printf("Entering DEVICE_IMAGE_LOAD()\n"); |
| 188 | 191 | genesis_sram = NULL; |
| 189 | 192 | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = 0; |
| 190 | | is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = 0; |
| 193 | is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = is_squir = 0; |
| 191 | 194 | |
| 192 | 195 | rawROM = memory_region(REGION_CPU1); |
| 193 | 196 | ROM = rawROM /*+ 512 */; |
| r2227 | r2228 | |
| 244 | 247 | { |
| 245 | 248 | relocate = 0x2000; |
| 246 | 249 | |
| 247 | | if (!strncmp((char *)&ROM[0x0120+relocate], "SUPER STREET FIGHTER2", 20)) |
| 250 | if (!strncmp((char *)&ROM[0x0120+relocate], "SUPER STREET FIGHTER2", 21)) |
| 248 | 251 | { |
| 249 | 252 | is_ssf2 = 1; |
| 250 | 253 | } |
| r2227 | r2228 | |
| 305 | 308 | is_mjlovr = 1; |
| 306 | 309 | } |
| 307 | 310 | } |
| 311 | // detect Squirrel King unlicensed game |
| 312 | if (length == 0x100000) |
| 313 | { |
| 314 | static unsigned char squirsig[] = { 0x26, 0x79, 0x00, 0xff, 0x00, 0xfa}; |
| 308 | 315 | |
| 316 | if (!memcmp(&ROM[0x03b4+relocate],&squirsig[0],sizeof(squirsig))) |
| 317 | { |
| 318 | is_squir = 1; |
| 319 | } |
| 320 | } |
| 321 | |
| 309 | 322 | } |
| 310 | 323 | |
| 311 | 324 | ROM = memory_region(REGION_CPU1); /* 68000 ROM region */ |
| r2227 | r2228 | |
| 522 | 535 | return 0; |
| 523 | 536 | } |
| 524 | 537 | |
| 525 | | // Red Cliff handler borrowed from HazeMD |
| 538 | // Red Cliff handler from HazeMD |
| 526 | 539 | |
| 527 | 540 | READ16_HANDLER( redclif_prot_r ) |
| 528 | 541 | { |
| r2227 | r2228 | |
| 534 | 547 | return 0x55 << 8; |
| 535 | 548 | } |
| 536 | 549 | |
| 550 | // Squirrel King handler from HazeMD, this does not give screen garbage like HazeMD compile If you reset it twice |
| 551 | READ16_HANDLER( squirrel_king_extra_r ) |
| 552 | { |
| 553 | return squirrel_king_extra; |
| 554 | |
| 555 | } |
| 556 | WRITE16_HANDLER( squirrel_king_extra_w ) |
| 557 | { |
| 558 | squirrel_king_extra = data; |
| 559 | } |
| 560 | |
| 561 | |
| 537 | 562 | static WRITE16_HANDLER( genesis_TMSS_bank_w ) |
| 538 | 563 | { |
| 539 | 564 | /* this probably should do more, like make Genesis V2 'die' if the SEGA string is not written promptly */ |
| r2227 | r2228 | |
| 545 | 570 | |
| 546 | 571 | static DRIVER_INIT( gencommon ) |
| 547 | 572 | { |
| 548 | | if (genesis_sram) |
| 573 | printf("Entering DRIVER_INIT()\n"); |
| 574 | if (genesis_sram) |
| 549 | 575 | { |
| 550 | 576 | add_exit_callback(machine, genesis_machine_stop); |
| 551 | 577 | } |
| r2227 | r2228 | |
| 584 | 610 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x401000, 0x401001, 0, 0, mjlovr_prot_2_r ); |
| 585 | 611 | } |
| 586 | 612 | |
| 613 | if (is_squir) |
| 614 | { |
| 615 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, 0, squirrel_king_extra_r); |
| 616 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x400000, 0x400007, 0, 0, squirrel_king_extra_w); |
| 617 | } |
| 618 | |
| 587 | 619 | /* install NOP handler for TMSS */ |
| 588 | 620 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA14000, 0xA14003, 0, 0, genesis_TMSS_bank_w); |
| 589 | 621 | |