trunk/src/mame/machine/stvprot.c
| r21047 | r21048 | |
| 120 | 120 | { |
| 121 | 121 | if(offset == 3) |
| 122 | 122 | { |
| 123 | UINT32 res; |
| 123 | 124 | logerror("A-Bus control protection read at %06x with data = %08x\n",space.device().safe_pc(),a_bus[3]); |
| 124 | 125 | #ifdef MAME_DEBUG |
| 125 | 126 | popmessage("Prot read at %06x with data = %08x",space.device().safe_pc(),a_bus[3]); |
| 126 | 127 | #endif |
| 127 | | switch(a_bus[3]) |
| 128 | switch(a_bus[3] >> 16) |
| 128 | 129 | { |
| 130 | case 0x1212: |
| 131 | if(ctrl_index & 2) |
| 132 | { |
| 133 | res = (ROM[ctrl_index / 4] & 0xffff) << 16; |
| 134 | res |= (ROM[(ctrl_index+4) / 4] & 0xffff0000) >> 16; |
| 135 | } |
| 136 | else |
| 137 | { |
| 138 | res = ROM[ctrl_index / 4] & 0xffff0000; |
| 139 | res |= ROM[ctrl_index / 4] & 0xffff; |
| 140 | } |
| 141 | ctrl_index+=4; |
| 142 | return res; |
| 129 | 143 | } |
| 130 | 144 | } |
| 131 | 145 | return a_bus[offset]; |
| r21047 | r21048 | |
| 143 | 157 | logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data); |
| 144 | 158 | if(offset == 3) |
| 145 | 159 | { |
| 146 | | logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); |
| 160 | int a_bus_vector; |
| 147 | 161 | |
| 162 | a_bus_vector = a_bus[2] >> 16; |
| 163 | a_bus_vector|= (a_bus[2] & 0xffff) << 16; |
| 164 | a_bus_vector<<= 1; |
| 165 | |
| 148 | 166 | //MAIN : 12120000 DATA : 0ad20069 Tecmo logo |
| 149 | | if(a_bus[3] == 0x12120000 && a_bus[2] == 0x0ad20069) |
| 150 | | { |
| 151 | | // ... |
| 152 | | } |
| 153 | 167 | //MAIN : 12120000 DATA : e332006b title screen |
| 154 | | if(a_bus[3] == 0x12120000 && a_bus[2] == 0xe332006b) |
| 168 | |
| 169 | /* TODO: encrypted / compressed data. |
| 170 | Both points to a section that has a string ("TECMO" / "TITLE") */ |
| 171 | |
| 172 | //printf("MAIN : %08x DATA : %08x %08x\n",a_bus[3],a_bus[2],a_bus_vector); |
| 173 | |
| 174 | switch(a_bus[3] >> 16) |
| 155 | 175 | { |
| 156 | | // ... |
| 176 | case 0x1212: |
| 177 | ctrl_index = a_bus_vector; |
| 178 | break; |
| 157 | 179 | } |
| 158 | 180 | } |
| 159 | 181 | //popmessage("%04x %04x",data,offset/4); |
| r21047 | r21048 | |
| 316 | 338 | logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data); |
| 317 | 339 | if(offset == 3) |
| 318 | 340 | { |
| 319 | | //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); |
| 341 | // int a_bus_vector; |
| 342 | |
| 343 | // a_bus_vector = a_bus[2] >> 16; |
| 344 | // a_bus_vector|= (a_bus[2] & 0xffff) << 16; |
| 345 | // a_bus_vector<<= 1; |
| 346 | // printf("MAIN : %08x DATA : %08x %08x\n",a_bus[3],a_bus[2],a_bus_vector); |
| 320 | 347 | switch(a_bus[3]) |
| 321 | 348 | { |
| 322 | 349 | case 0x77770000: ctrl_index = 0; break; |
| r21047 | r21048 | |
| 336 | 363 | * |
| 337 | 364 | *************************/ |
| 338 | 365 | |
| 339 | | #define ELANDORE_CTRL_1_HUMAN 0xff7f0000 |
| 340 | | #define ELANDORE_CTRL_2_HUMAN 0xffbf0000 |
| 341 | | |
| 342 | | #define ELANDORE_CTRL_1_DRAGON 0xf9ff0000 |
| 343 | | #define ELANDORE_CTRL_2_DRAGON 0xfbff0000 |
| 344 | | #define ELANDORE_CTRL_3_DRAGON 0xfe7f0000 |
| 345 | | #define ELANDORE_CTRL_4_DRAGON 0xfd7f0000 |
| 346 | | #define ELANDORE_CTRL_5_DRAGON 0xfeff0000 |
| 347 | | #define ELANDORE_CTRL_6_DRAGON 0xf9bf0000 |
| 348 | | |
| 349 | 366 | static READ32_HANDLER( elandore_prot_r ) |
| 350 | 367 | { |
| 351 | 368 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| r21047 | r21048 | |
| 354 | 371 | { |
| 355 | 372 | if(offset == 3) |
| 356 | 373 | { |
| 374 | UINT32 res; |
| 357 | 375 | logerror("A-Bus control protection read at %06x with data = %08x\n",space.device().safe_pc(),a_bus[3]); |
| 358 | 376 | #ifdef MAME_DEBUG |
| 359 | 377 | popmessage("Prot read at %06x with data = %08x",space.device().safe_pc(),a_bus[3]); |
| 360 | 378 | #endif |
| 361 | | switch(a_bus[3]) |
| 379 | switch(a_bus[3] >> 16) |
| 362 | 380 | { |
| 363 | | case ELANDORE_CTRL_1_HUMAN: |
| 364 | | case ELANDORE_CTRL_2_HUMAN: |
| 365 | | case ELANDORE_CTRL_1_DRAGON: |
| 366 | | case ELANDORE_CTRL_2_DRAGON: |
| 367 | | case ELANDORE_CTRL_3_DRAGON: |
| 368 | | case ELANDORE_CTRL_4_DRAGON: |
| 369 | | case ELANDORE_CTRL_5_DRAGON: |
| 370 | | case ELANDORE_CTRL_6_DRAGON: |
| 371 | | //ctrl_index++; |
| 372 | | return ROM[ctrl_index]; |
| 381 | default: |
| 382 | if(ctrl_index & 2) |
| 383 | { |
| 384 | res = (ROM[ctrl_index / 4] & 0xffff) << 16; |
| 385 | res |= (ROM[(ctrl_index+4) / 4] & 0xffff0000) >> 16; |
| 386 | } |
| 387 | else |
| 388 | { |
| 389 | res = ROM[ctrl_index / 4] & 0xffff0000; |
| 390 | res |= ROM[ctrl_index / 4] & 0xffff; |
| 391 | } |
| 392 | ctrl_index+=4; |
| 393 | return res; |
| 373 | 394 | } |
| 374 | 395 | } |
| 375 | 396 | return a_bus[offset]; |
| r21047 | r21048 | |
| 387 | 408 | logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data); |
| 388 | 409 | if(offset == 3) |
| 389 | 410 | { |
| 390 | | /* a bus value 2 seed is used too here. */ |
| 391 | | //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); |
| 392 | | switch(a_bus[3]) |
| 411 | int a_bus_vector; |
| 412 | |
| 413 | a_bus_vector = a_bus[2] >> 16; |
| 414 | a_bus_vector|= (a_bus[2] & 0xffff) << 16; |
| 415 | a_bus_vector<<= 1; |
| 416 | |
| 417 | //printf("MAIN : %08x DATA : %08x %08x\n",a_bus[3],a_bus[2],a_bus_vector); |
| 418 | switch(a_bus[3] >> 16) |
| 393 | 419 | { |
| 394 | | case ELANDORE_CTRL_1_HUMAN: // (human polygons) |
| 395 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 420 | default: |
| 421 | ctrl_index = a_bus_vector; |
| 396 | 422 | break; |
| 397 | | case ELANDORE_CTRL_2_HUMAN: // (human polygons) |
| 398 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 399 | | break; |
| 400 | | case ELANDORE_CTRL_1_DRAGON://KAIN / THUNDER (dragon polygons) |
| 401 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 402 | | break; |
| 403 | | case ELANDORE_CTRL_2_DRAGON://REVI CURIO / DARK (dragon polygons) |
| 404 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 405 | | break; |
| 406 | | case ELANDORE_CTRL_3_DRAGON://RUBONE / POISON (dragon polygons) |
| 407 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 408 | | break; |
| 409 | | case ELANDORE_CTRL_4_DRAGON://TINA / MAGICAL GIRL (dragon polygons) |
| 410 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 411 | | break; |
| 412 | | case ELANDORE_CTRL_5_DRAGON://KEYAKI / FIRE (dragon polygons) |
| 413 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 414 | | break; |
| 415 | | case ELANDORE_CTRL_6_DRAGON://SION / WIND (dragon polygons) |
| 416 | | ctrl_index = ((0x0000000/4) + ((a_bus[2] & 0xff)<<12) + ((a_bus[2] & 0x0fff0000)>>16)/4); |
| 417 | | break; |
| 418 | 423 | } |
| 419 | 424 | } |
| 420 | 425 | //popmessage("%04x %04x",data,offset/4); |
| r21047 | r21048 | |
| 439 | 444 | |
| 440 | 445 | Directory listing for Final Fight Revenge (Saturn Version): |
| 441 | 446 | |
| 442 | | Most of these file names could be found at relative address 0x346a0 (0x22346a0) |
| 447 | In the ST-V version, most of these file names could be found at relative address 0x346a0 (0x22346a0) |
| 448 | Also, there's a table at 0x260000 (0x2260000), this points to offsets to the ROM (and are sent to the protection device), |
| 449 | and the size of it |
| 443 | 450 | |
| 444 | 451 | fad size file name date |
| 445 | 452 | 000000aa 00003000 2000/2/8 |
| r21047 | r21048 | |
| 689 | 696 | 00002207 0001efc0 _WHSRCHR.BIN;1 1999/11/9 |
| 690 | 697 | 00002203 00001cf4 _WHSRMAP.BIN;1 1999/11/9 |
| 691 | 698 | */ |
| 692 | | static const UINT32 vector_prot[] = { 0x0603B1B2,0x234 }; |
| 693 | 699 | |
| 694 | | |
| 695 | 700 | static READ32_HANDLER( ffreveng_prot_r ) |
| 696 | 701 | { |
| 697 | 702 | UINT32 *ROM = (UINT32 *)space.machine().root_device().memregion("abus")->base(); |
| r21047 | r21048 | |
| 700 | 705 | { |
| 701 | 706 | if(offset == 3) |
| 702 | 707 | { |
| 708 | #if 0 |
| 709 | UINT32 res; |
| 710 | #endif |
| 703 | 711 | logerror("A-Bus control protection read at %06x with data = %08x\n",space.device().safe_pc(),a_bus[3]); |
| 704 | | #ifdef MAME_DEBUG |
| 705 | | popmessage("Prot read at %06x with data = %08x",space.device().safe_pc(),a_bus[3]); |
| 706 | | #endif |
| 707 | | switch(a_bus[3]) |
| 712 | switch(a_bus[3] >> 16) |
| 708 | 713 | { |
| 709 | | case 0x10da0000://ffreveng, boot vectors at $6080000,test mode |
| 710 | | ctrl_index++; |
| 711 | | if(ctrl_index > 2) |
| 712 | | return 0x234; |
| 714 | case 0x10da://ffreveng, boot vectors at $6080000,test mode |
| 715 | case 0x10d7://ffreveng, boot vectors at $6080000,attract mode |
| 716 | #if 0 |
| 717 | if(ctrl_index & 2) |
| 718 | { |
| 719 | res = (ROM[ctrl_index / 4] & 0xffff) << 16; |
| 720 | res |= (ROM[(ctrl_index+4) / 4] & 0xffff0000) >> 16; |
| 721 | } |
| 713 | 722 | else |
| 714 | | return vector_prot[ctrl_index-1]; |
| 715 | | case 0x10d70000://ffreveng, boot vectors at $6080000,attract mode |
| 716 | | ctrl_index++; |
| 717 | | return ROM[ctrl_index]; |
| 723 | { |
| 724 | res = ROM[ctrl_index / 4] & 0xffff0000; |
| 725 | res |= ROM[ctrl_index / 4] & 0xffff; |
| 726 | } |
| 727 | #endif |
| 728 | ctrl_index+=4; |
| 729 | return 0; |
| 718 | 730 | } |
| 719 | 731 | } |
| 720 | 732 | return a_bus[offset]; |
| r21047 | r21048 | |
| 732 | 744 | logerror("A-Bus control protection write at %06x: [%02x] <- %08x\n",space.device().safe_pc(),offset,data); |
| 733 | 745 | if(offset == 3) |
| 734 | 746 | { |
| 735 | | //logerror("MAIN : %08x DATA : %08x\n",a_bus[3],a_bus[2]); |
| 736 | | switch(a_bus[3]) |
| 747 | int a_bus_vector; |
| 748 | |
| 749 | a_bus_vector = a_bus[2] >> 16; |
| 750 | a_bus_vector|= (a_bus[2] & 0xffff) << 16; |
| 751 | a_bus_vector<<= 1; |
| 752 | |
| 753 | printf("MAIN : %08x DATA : %08x %08x\n",a_bus[3],a_bus[2],a_bus_vector); |
| 754 | switch(a_bus[3] >> 16) |
| 737 | 755 | { |
| 738 | | /*ffreveng*/ |
| 739 | | case 0x10d70000: ctrl_index = 0; break; |
| 740 | | case 0x10da0000: ctrl_index = 0; break; |
| 756 | case 0x10d7: ctrl_index = a_bus_vector; break; |
| 757 | case 0x10da: ctrl_index = a_bus_vector; break; |
| 758 | default: |
| 759 | ctrl_index = 0; |
| 741 | 760 | } |
| 742 | 761 | } |
| 743 | 762 | //popmessage("%04x %04x",data,offset/4); |