src/mess/drivers/genesis.c
| r2292 | r2293 | |
| 70 | 70 | static int is_rx3 = 0; |
| 71 | 71 | static int is_bugsl = 0; |
| 72 | 72 | static int is_sbub = 0; |
| 73 | static int is_smb2 = 0; |
| 74 | static int is_kof98 = 0; |
| 75 | static int is_kaiju = 0; |
| 73 | 76 | |
| 74 | 77 | static UINT8 *genesis_sram; |
| 75 | 78 | static int genesis_sram_start; |
| r2292 | r2293 | |
| 197 | 200 | |
| 198 | 201 | genesis_sram = NULL; |
| 199 | 202 | genesis_sram_start = genesis_sram_len = genesis_sram_active = genesis_sram_readonly = 0; |
| 200 | | is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = is_squir = is_smous = is_elfwor = is_lionk2 = is_rx3 = is_bugsl = is_sbub = 0; |
| 203 | is_ssf2 = is_redcliff = is_radica = is_kof99 = is_soulb = is_mjlovr = is_squir = is_smous = is_elfwor = is_lionk2 = is_rx3 = is_bugsl = is_sbub = is_smb2 = is_kof98 = is_kaiju = 0; |
| 201 | 204 | |
| 202 | 205 | rawROM = memory_region(REGION_CPU1); |
| 203 | 206 | ROM = rawROM /*+ 512 */; |
| r2292 | r2293 | |
| 258 | 261 | { |
| 259 | 262 | is_ssf2 = 1; |
| 260 | 263 | } |
| 264 | is_kaiju = 1; |
| 261 | 265 | // detect the 'Romance of the Three Kingdoms - Battle of Red Cliffs' rom, already decoded from .mdx format |
| 262 | 266 | if (length == 0x200000) |
| 263 | 267 | { |
| r2292 | r2293 | |
| 334 | 338 | is_smous = 1; |
| 335 | 339 | } |
| 336 | 340 | } |
| 341 | if (length >= 0x200000) |
| 342 | { |
| 343 | static unsigned char smb2sig[] = { 0x4e, 0xb9, 0x00, 0x0f, 0x25, 0x84}; |
| 344 | |
| 345 | if (!memcmp(&ROM[0xf24d6+relocate],&smb2sig[0],sizeof(smb2sig))) |
| 346 | { |
| 347 | is_smb2 = 1; |
| 348 | } |
| 349 | } |
| 350 | |
| 337 | 351 | if (length == 0x200000) |
| 338 | 352 | { |
| 339 | 353 | static unsigned char smbsig[] = { 0x0c, 0x39, 0x00, 0x0c, 0x00, 0xff}; // cmpi.b #$C,($FF1130).l |
| r2292 | r2293 | |
| 343 | 357 | is_smb = 1; |
| 344 | 358 | } |
| 345 | 359 | } |
| 360 | |
| 346 | 361 | if (length == 0x200000) |
| 347 | 362 | { |
| 348 | 363 | static unsigned char lionk2sig[] = { 0x26, 0x79, 0x00, 0xff, 0x00, 0xf4}; |
| r2292 | r2293 | |
| 383 | 398 | is_sbub = 1; |
| 384 | 399 | } |
| 385 | 400 | } |
| 386 | | |
| 401 | if (length == 0x200000) |
| 402 | { |
| 403 | static unsigned char kof98sig[] = { 0x9b, 0xfc, 0x00, 0x00, 0x4a, 0x00}; |
| 404 | if (!memcmp(&ROM[0x56ae2+relocate],&kof98sig[0],sizeof(kof98sig))) |
| 405 | { |
| 406 | is_kof98 = 1; |
| 407 | } |
| 408 | } |
| 387 | 409 | } |
| 388 | 410 | |
| 389 | 411 | ROM = memory_region(REGION_CPU1); /* 68000 ROM region */ |
| r2292 | r2293 | |
| 407 | 429 | memcpy(&ROM[0x400000],&ROM[0x000000],0x400000); |
| 408 | 430 | } |
| 409 | 431 | |
| 432 | if (is_kaiju) |
| 433 | { |
| 434 | memcpy(&ROM[0x400000],&ROM[0x000000],0x200000); |
| 435 | memcpy(&ROM[0x600000],&ROM[0x000000],0x200000); |
| 436 | } |
| 410 | 437 | if (is_radica) |
| 411 | 438 | { |
| 412 | 439 | memcpy(&ROM[0x400000], &ROM[0], 0x400000); // keep a copy for later banking.. making use of huge ROM_REGION allocated to genesis driver |
| r2292 | r2293 | |
| 550 | 577 | } |
| 551 | 578 | } |
| 552 | 579 | |
| 580 | static WRITE16_HANDLER( g_kaiju_bank_w ) |
| 581 | { |
| 582 | UINT8 *ROM = memory_region(REGION_CPU1); |
| 583 | printf("%06x data %04x\n",activecpu_get_pc(), data); |
| 584 | memcpy(ROM + 0x000000, ROM + 0x400000+(data&0x7f)*0x8000, 0x8000); |
| 585 | } |
| 586 | |
| 553 | 587 | // Soulblade handler from HazeMD |
| 554 | 588 | READ16_HANDLER( soulb_0x400006_r ) |
| 555 | 589 | { |
| r2292 | r2293 | |
| 688 | 722 | return 0xc; |
| 689 | 723 | } |
| 690 | 724 | |
| 725 | // King of Fighters 98 handler from HazeMD |
| 726 | READ16_HANDLER( g_kof98_aa_r ) |
| 727 | { |
| 728 | return 0xaa00; |
| 729 | } |
| 691 | 730 | |
| 731 | READ16_HANDLER( g_kof98_0a_r ) |
| 732 | { |
| 733 | return 0x0a00; |
| 734 | } |
| 735 | |
| 736 | READ16_HANDLER( g_kof98_00_r ) |
| 737 | { |
| 738 | return 0x0000; |
| 739 | } |
| 740 | |
| 741 | // Super Mario Bros 2 handler from HazeMD |
| 742 | READ16_HANDLER( smb2_extra_r ) |
| 743 | { |
| 744 | return 0xa; |
| 745 | } |
| 746 | |
| 692 | 747 | // Bug's Life handler from HazeMD |
| 693 | 748 | READ16_HANDLER( bugl_extra_r ) |
| 694 | 749 | { |
| r2292 | r2293 | |
| 736 | 791 | { |
| 737 | 792 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA130F0, 0xA130FF, 0, 0, genesis_ssf2_bank_w); |
| 738 | 793 | } |
| 794 | if (is_kaiju) |
| 795 | { |
| 796 | memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x700000, 0x7fffff, 0, 0, g_kaiju_bank_w ); |
| 797 | } |
| 739 | 798 | |
| 740 | 799 | if (is_radica) |
| 741 | 800 | { |
| r2292 | r2293 | |
| 779 | 838 | { |
| 780 | 839 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa13000, 0xa13001, 0, 0, smbro_prot_r ); |
| 781 | 840 | } |
| 841 | if (is_smb2) |
| 842 | { |
| 843 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xA13000, 0xA13001, 0, 0, smb2_extra_r); |
| 844 | } |
| 845 | if (is_kof98) |
| 846 | { |
| 847 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x480000, 0x480001, 0, 0, g_kof98_aa_r ); |
| 848 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x4800e0, 0x4800e1, 0, 0, g_kof98_aa_r ); |
| 849 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x4824a0, 0x4824a1, 0, 0, g_kof98_aa_r ); |
| 850 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x488880, 0x488881, 0, 0, g_kof98_aa_r ); |
| 782 | 851 | |
| 852 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x4a8820, 0x4a8821, 0, 0, g_kof98_0a_r ); |
| 853 | memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x4f8820, 0x4f8821, 0, 0, g_kof98_00_r ); |
| 854 | } |
| 783 | 855 | |
| 784 | 856 | if (is_elfwor) |
| 785 | 857 | { |