trunk/src/mame/drivers/konamigx.c
| r241523 | r241524 | |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | | |
| 110 | | static int konamigx_cfgport; |
| 111 | | |
| 112 | | static int gx_rdport1_3, gx_syncen; |
| 113 | | |
| 114 | | static emu_timer *dmadelay_timer; |
| 115 | | static emu_timer *boothack_timer; |
| 116 | | |
| 117 | 109 | /**********************************************************************************/ |
| 118 | 110 | /* |
| 119 | 111 | Konami ESC (E Security Chip) protection chip found on: |
| r241523 | r241524 | |
| 179 | 171 | |
| 180 | 172 | static void generate_sprites(address_space &space, UINT32 src, UINT32 spr, int count) |
| 181 | 173 | { |
| 182 | | int i; |
| 183 | | int scount; |
| 184 | | int ecount; |
| 185 | | scount = 0; |
| 186 | | ecount = 0; |
| 174 | int scount = 0; |
| 175 | int ecount = 0; |
| 187 | 176 | |
| 188 | | for(i=0; i<count; i++) { |
| 177 | for(int i=0; i<count; i++) { |
| 189 | 178 | UINT32 adr = src + 0x100*i; |
| 190 | 179 | int pri; |
| 191 | 180 | if(!space.read_word(adr+2)) |
| r241523 | r241524 | |
| 200 | 189 | } |
| 201 | 190 | //qsort(sprites, ecount, sizeof(struct sprite_entry), pri_comp); |
| 202 | 191 | |
| 203 | | for(i=0; i<ecount; i++) { |
| 192 | for(int i=0; i<ecount; i++) { |
| 204 | 193 | UINT32 adr = sprites[i].adr; |
| 205 | 194 | if(adr) { |
| 206 | 195 | UINT32 set =(space.read_word(adr) << 16)|space.read_word(adr+2); |
| r241523 | r241524 | |
| 315 | 304 | } |
| 316 | 305 | } |
| 317 | 306 | |
| 318 | | static void tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 307 | void konamigx_state::tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 319 | 308 | { |
| 320 | | konamigx_state* state = space.machine().driver_data<konamigx_state>(); |
| 321 | | state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x0142, 0x100, 0); |
| 309 | konamigx_esc_alert(m_workram, 0x0142, 0x100, 0); |
| 322 | 310 | } |
| 323 | 311 | |
| 324 | | static void dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 312 | void konamigx_state::dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 325 | 313 | { |
| 326 | | konamigx_state* state = space.machine().driver_data<konamigx_state>(); |
| 327 | | state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x5c00, 0x100, 0); |
| 314 | konamigx_esc_alert(m_workram, 0x5c00, 0x100, 0); |
| 328 | 315 | } |
| 329 | 316 | |
| 330 | | static void sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 317 | void konamigx_state::sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 331 | 318 | { |
| 332 | | konamigx_state* state = space.machine().driver_data<konamigx_state>(); |
| 333 | | state->konamigx_esc_alert(space.machine().driver_data<konamigx_state>()->m_workram, 0x1c8c, 0x172, 1); |
| 319 | konamigx_esc_alert(m_workram, 0x1c8c, 0x172, 1); |
| 334 | 320 | } |
| 335 | 321 | |
| 336 | | static void sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 322 | void konamigx_state::sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 337 | 323 | { |
| 338 | 324 | // The d20000 should probably be p3 |
| 339 | 325 | generate_sprites(space, 0xc00604, 0xd20000, 0xfc); |
| 340 | 326 | } |
| 341 | 327 | |
| 342 | | static void tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 328 | void konamigx_state::tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 343 | 329 | { |
| 344 | 330 | generate_sprites(space, 0xc00000, 0xd20000, 0x100); |
| 345 | 331 | } |
| 346 | 332 | |
| 347 | | static void daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 333 | void konamigx_state::daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4) |
| 348 | 334 | { |
| 349 | 335 | generate_sprites(space, 0xc00000, 0xd20000, 0x100); |
| 350 | 336 | } |
| 351 | 337 | |
| 352 | | static UINT8 esc_program[4096]; |
| 353 | | static void (*esc_cb)(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 354 | | |
| 355 | 338 | WRITE32_MEMBER(konamigx_state::esc_w) |
| 356 | 339 | { |
| 357 | 340 | UINT32 opcode; |
| r241523 | r241524 | |
| 386 | 369 | break; |
| 387 | 370 | case 2: // Load program |
| 388 | 371 | for(i=0; i<4096; i++) |
| 389 | | esc_program[i] = space.read_byte(params+i); |
| 372 | m_esc_program[i] = space.read_byte(params+i); |
| 390 | 373 | /* |
| 391 | 374 | { |
| 392 | 375 | FILE *f; |
| r241523 | r241524 | |
| 400 | 383 | */ |
| 401 | 384 | break; |
| 402 | 385 | case 1: // Run program |
| 403 | | if(esc_cb) { |
| 386 | if(m_esc_cb) { |
| 404 | 387 | UINT32 p1 = (space.read_word(params+0)<<16) | space.read_word(params+2); |
| 405 | 388 | UINT32 p2 = (space.read_word(params+4)<<16) | space.read_word(params+6); |
| 406 | 389 | UINT32 p3 = (space.read_word(params+8)<<16) | space.read_word(params+10); |
| 407 | 390 | UINT32 p4 = (space.read_word(params+12)<<16) | space.read_word(params+14); |
| 408 | | esc_cb(space, p1, p2, p3, p4); |
| 391 | (this->*m_esc_cb)(space, p1, p2, p3, p4); |
| 409 | 392 | } |
| 410 | 393 | break; |
| 411 | 394 | default: |
| r241523 | r241524 | |
| 414 | 397 | } |
| 415 | 398 | space.write_byte(data+9, ESTATE_END); |
| 416 | 399 | |
| 417 | | if (konamigx_wrport1_1 & 0x10) |
| 400 | if (m_gx_wrport1_1 & 0x10) |
| 418 | 401 | { |
| 419 | | gx_rdport1_3 &= ~8; |
| 402 | m_gx_rdport1_3 &= ~8; |
| 420 | 403 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 421 | 404 | } |
| 422 | 405 | } |
| r241523 | r241524 | |
| 439 | 422 | |
| 440 | 423 | CUSTOM_INPUT_MEMBER(konamigx_state::gx_rdport1_3_r) |
| 441 | 424 | { |
| 442 | | return (gx_rdport1_3 >> 1); |
| 425 | return (m_gx_rdport1_3 >> 1); |
| 443 | 426 | } |
| 444 | 427 | |
| 445 | 428 | WRITE32_MEMBER(konamigx_state::eeprom_w) |
| r241523 | r241524 | |
| 462 | 445 | |
| 463 | 446 | m_eepromout->write(odata, 0xff); |
| 464 | 447 | |
| 465 | | konamigx_wrport1_0 = odata; |
| 448 | m_gx_wrport1_0 = odata; |
| 466 | 449 | } |
| 467 | 450 | |
| 468 | 451 | if (ACCESSING_BITS_16_23) |
| r241523 | r241524 | |
| 478 | 461 | bit 0 = CCU1-INT1 enable |
| 479 | 462 | */ |
| 480 | 463 | |
| 481 | | konamigx_wrport1_1 = (data>>16)&0xff; |
| 482 | | // logerror("write %x to IRQ register (PC=%x)\n", konamigx_wrport1_1, space.device().safe_pc()); |
| 464 | m_gx_wrport1_1 = (data>>16)&0xff; |
| 465 | // logerror("write %x to IRQ register (PC=%x)\n", m_gx_wrport1_1, space.device().safe_pc()); |
| 483 | 466 | |
| 484 | | // gx_syncen is to ensure each IRQ is trigger at least once after being enabled |
| 485 | | if (konamigx_wrport1_1 & 0x80) |
| 486 | | gx_syncen |= konamigx_wrport1_1 & 0x1f; |
| 467 | // m_gx_syncen is to ensure each IRQ is triggered at least once after being enabled |
| 468 | if (m_gx_wrport1_1 & 0x80) |
| 469 | m_gx_syncen |= m_gx_wrport1_1 & 0x1f; |
| 487 | 470 | } |
| 488 | 471 | } |
| 489 | 472 | |
| r241523 | r241524 | |
| 526 | 509 | |
| 527 | 510 | m_k055673->k053246_set_objcha_line((data&0x100000) ? ASSERT_LINE : CLEAR_LINE); |
| 528 | 511 | |
| 529 | | konamigx_wrport2 = (data>>16)&0xff; |
| 512 | m_gx_wrport2 = (data>>16)&0xff; |
| 530 | 513 | } |
| 531 | 514 | } |
| 532 | 515 | |
| r241523 | r241524 | |
| 534 | 517 | /**********************************************************************************/ |
| 535 | 518 | /* IRQ controllers */ |
| 536 | 519 | |
| 537 | | static int suspension_active, resume_trigger; |
| 538 | | |
| 539 | 520 | READ32_MEMBER(konamigx_state::ccu_r) |
| 540 | 521 | { |
| 541 | 522 | // the routine at 204abe in opengolf polls to see if we're in vblank (it wants values between 0x111 and 0x1df) |
| r241523 | r241524 | |
| 559 | 540 | if (ACCESSING_BITS_24_31) |
| 560 | 541 | { |
| 561 | 542 | m_maincpu->set_input_line(1, CLEAR_LINE); |
| 562 | | gx_syncen |= 0x20; |
| 543 | m_gx_syncen |= 0x20; |
| 563 | 544 | } |
| 564 | 545 | |
| 565 | 546 | // hblank interrupt ACK |
| 566 | 547 | if (ACCESSING_BITS_8_15) |
| 567 | 548 | { |
| 568 | 549 | m_maincpu->set_input_line(2, CLEAR_LINE); |
| 569 | | gx_syncen |= 0x40; |
| 550 | m_gx_syncen |= 0x40; |
| 570 | 551 | } |
| 571 | 552 | } |
| 572 | 553 | } |
| r241523 | r241524 | |
| 588 | 569 | TIMER_CALLBACK_MEMBER(konamigx_state::dmaend_callback) |
| 589 | 570 | { |
| 590 | 571 | // foul-proof (CPU0 could be deactivated while we wait) |
| 591 | | if (resume_trigger && suspension_active) |
| 572 | if (m_resume_trigger && m_suspension_active) |
| 592 | 573 | { |
| 593 | | suspension_active = 0; |
| 594 | | machine().scheduler().trigger(resume_trigger); |
| 574 | m_suspension_active = 0; |
| 575 | machine().scheduler().trigger(m_resume_trigger); |
| 595 | 576 | } |
| 596 | 577 | |
| 597 | 578 | // DMA busy flag must be cleared before triggering IRQ 3 |
| 598 | | gx_rdport1_3 &= ~2; |
| 579 | m_gx_rdport1_3 &= ~2; |
| 599 | 580 | |
| 600 | 581 | // IRQ 3 is the "object DMA end" IRQ also happens during vblank |
| 601 | | if ((konamigx_wrport1_1 & 0x84) == 0x84 || (gx_syncen & 4)) |
| 582 | if ((m_gx_wrport1_1 & 0x84) == 0x84 || (m_gx_syncen & 4)) |
| 602 | 583 | { |
| 603 | | gx_syncen &= ~4; |
| 584 | m_gx_syncen &= ~4; |
| 604 | 585 | |
| 605 | 586 | // lower OBJINT-REQ flag and trigger interrupt |
| 606 | | gx_rdport1_3 &= ~0x80; |
| 587 | m_gx_rdport1_3 &= ~0x80; |
| 607 | 588 | m_maincpu->set_input_line(3, HOLD_LINE); |
| 608 | 589 | } |
| 609 | 590 | } |
| r241523 | r241524 | |
| 611 | 592 | void konamigx_state::dmastart_callback(int data) |
| 612 | 593 | { |
| 613 | 594 | // raise the DMA busy flag |
| 614 | | gx_rdport1_3 |= 2; |
| 595 | m_gx_rdport1_3 |= 2; |
| 615 | 596 | |
| 616 | 597 | // begin transfer if DMAEN(bit4 of OBJSET1) is set (see p.48) |
| 617 | 598 | if (m_k055673->k053246_read_register(5) & 0x10) |
| r241523 | r241524 | |
| 621 | 602 | } |
| 622 | 603 | |
| 623 | 604 | // simulate DMA delay |
| 624 | | dmadelay_timer->adjust(attotime::from_usec(120)); |
| 605 | m_dmadelay_timer->adjust(attotime::from_usec(120)); |
| 625 | 606 | } |
| 626 | 607 | |
| 627 | 608 | |
| 628 | 609 | INTERRUPT_GEN_MEMBER(konamigx_state::konamigx_vbinterrupt) |
| 629 | 610 | { |
| 630 | 611 | // lift idle suspension |
| 631 | | if (resume_trigger && suspension_active) |
| 612 | if (m_resume_trigger && m_suspension_active) |
| 632 | 613 | { |
| 633 | | suspension_active = 0; |
| 634 | | machine().scheduler().trigger(resume_trigger); |
| 614 | m_suspension_active = 0; |
| 615 | machine().scheduler().trigger(m_resume_trigger); |
| 635 | 616 | } |
| 636 | 617 | |
| 637 | 618 | // IRQ 1 is the main 60hz vblank interrupt |
| 638 | | if (gx_syncen & 0x20) |
| 619 | if (m_gx_syncen & 0x20) |
| 639 | 620 | { |
| 640 | | gx_syncen &= ~0x20; |
| 621 | m_gx_syncen &= ~0x20; |
| 641 | 622 | |
| 642 | | if ((konamigx_wrport1_1 & 0x81) == 0x81 || (gx_syncen & 1)) |
| 623 | if ((m_gx_wrport1_1 & 0x81) == 0x81 || (m_gx_syncen & 1)) |
| 643 | 624 | { |
| 644 | | gx_syncen &= ~1; |
| 625 | m_gx_syncen &= ~1; |
| 645 | 626 | device.execute().set_input_line(1, HOLD_LINE); |
| 646 | 627 | } |
| 647 | 628 | } |
| r241523 | r241524 | |
| 656 | 637 | if (scanline == 240) |
| 657 | 638 | { |
| 658 | 639 | // lift idle suspension |
| 659 | | if (resume_trigger && suspension_active) |
| 640 | if (m_resume_trigger && m_suspension_active) |
| 660 | 641 | { |
| 661 | | suspension_active = 0; |
| 662 | | machine().scheduler().trigger(resume_trigger); |
| 642 | m_suspension_active = 0; |
| 643 | machine().scheduler().trigger(m_resume_trigger); |
| 663 | 644 | } |
| 664 | 645 | |
| 665 | 646 | // IRQ 1 is the main 60hz vblank interrupt |
| 666 | | // the gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board |
| 647 | // the m_gx_syncen & 0x20 test doesn't work on type 3 or 4 ROM boards, likely because the ROM board |
| 667 | 648 | // generates the timing in those cases. With this change, rushing heroes and rng2 boot :) |
| 668 | 649 | |
| 669 | 650 | // maybe this interrupt should only be every 30fps, or maybe there are flags to prevent the game running too fast |
| 670 | 651 | // the real hardware should output the display for each screen on alternate frames |
| 671 | 652 | // if(device->m_screen->frame_number() & 1) |
| 672 | | if (1) // gx_syncen & 0x20) |
| 653 | if (1) // m_gx_syncen & 0x20) |
| 673 | 654 | { |
| 674 | | gx_syncen &= ~0x20; |
| 655 | m_gx_syncen &= ~0x20; |
| 675 | 656 | |
| 676 | | if ((konamigx_wrport1_1 & 0x81) == 0x81 || (gx_syncen & 1)) |
| 657 | if ((m_gx_wrport1_1 & 0x81) == 0x81 || (m_gx_syncen & 1)) |
| 677 | 658 | { |
| 678 | | gx_syncen &= ~1; |
| 659 | m_gx_syncen &= ~1; |
| 679 | 660 | m_maincpu->set_input_line(1, HOLD_LINE); |
| 680 | 661 | |
| 681 | 662 | } |
| r241523 | r241524 | |
| 686 | 667 | else if(scanline < 240) // hblank |
| 687 | 668 | { |
| 688 | 669 | // IRQ 2 is a programmable interrupt with scanline resolution |
| 689 | | if (gx_syncen & 0x40) |
| 670 | if (m_gx_syncen & 0x40) |
| 690 | 671 | { |
| 691 | | gx_syncen &= ~0x40; |
| 672 | m_gx_syncen &= ~0x40; |
| 692 | 673 | |
| 693 | | if ((konamigx_wrport1_1 & 0x82) == 0x82 || (gx_syncen & 2)) |
| 674 | if ((m_gx_wrport1_1 & 0x82) == 0x82 || (m_gx_syncen & 2)) |
| 694 | 675 | { |
| 695 | | gx_syncen &= ~2; |
| 676 | m_gx_syncen &= ~2; |
| 696 | 677 | m_maincpu->set_input_line(2, HOLD_LINE); |
| 697 | 678 | } |
| 698 | 679 | } |
| r241523 | r241524 | |
| 759 | 740 | return ROM[offset]; |
| 760 | 741 | } |
| 761 | 742 | |
| 762 | | //static int sync_frame = 0; |
| 763 | | |
| 764 | 743 | READ32_MEMBER(konamigx_state::type3_sync_r) |
| 765 | 744 | { |
| 766 | 745 | if(m_konamigx_current_frame==0) |
| r241523 | r241524 | |
| 768 | 747 | else |
| 769 | 748 | return 0;// return 0xfffffffe | 0; |
| 770 | 749 | } |
| 771 | | static int last_prot_op, last_prot_clk; |
| 772 | 750 | |
| 751 | |
| 773 | 752 | /* |
| 774 | 753 | Run and Gun 2, Rushing Heroes, Winning Spike, and Vs. Net Soccer contain a XILINX FPGA that serves as security. |
| 775 | 754 | |
| r241523 | r241524 | |
| 844 | 823 | move.l #$C10400,($C102EC).l move.l #$C10400,($C102EC).l |
| 845 | 824 | */ |
| 846 | 825 | |
| 847 | | //static int cc=0; |
| 848 | | |
| 849 | 826 | WRITE32_MEMBER(konamigx_state::type4_prot_w) |
| 850 | 827 | { |
| 851 | 828 | int clk; |
| r241523 | r241524 | |
| 853 | 830 | |
| 854 | 831 | if (offset == 1) |
| 855 | 832 | { |
| 856 | | last_prot_op = data>>16; |
| 833 | m_last_prot_op = data>>16; |
| 857 | 834 | } |
| 858 | 835 | else |
| 859 | 836 | { |
| 860 | 837 | data >>= 16; |
| 861 | 838 | |
| 862 | 839 | clk = data & 0x200; |
| 863 | | if ((clk == 0) && (last_prot_clk != 0)) |
| 840 | if ((clk == 0) && (m_last_prot_clk != 0)) |
| 864 | 841 | { |
| 865 | | if (last_prot_op != -1) |
| 842 | if (m_last_prot_op != -1) |
| 866 | 843 | { |
| 867 | | // osd_printf_debug("type 4 prot command: %x\n", last_prot_op); |
| 844 | // osd_printf_debug("type 4 prot command: %x\n", m_last_prot_op); |
| 868 | 845 | /* |
| 869 | 846 | known commands: |
| 870 | 847 | rng2 rushhero vsnet winspike what |
| r241523 | r241524 | |
| 874 | 851 | 0d97 0515 parse big DMA list at c10200 |
| 875 | 852 | 57a copy 4 bytes from c00f10 to c10f00 and 4 bytes from c00f30 to c0fe00 |
| 876 | 853 | */ |
| 877 | | if ((last_prot_op == 0xa56) || (last_prot_op == 0xd96) || (last_prot_op == 0xd14) || (last_prot_op == 0xd1c)) |
| 854 | if ((m_last_prot_op == 0xa56) || (m_last_prot_op == 0xd96) || (m_last_prot_op == 0xd14) || (m_last_prot_op == 0xd1c)) |
| 878 | 855 | { |
| 879 | 856 | // memcpy from c01000 to c01400 for 0x400 bytes (startup check for type 4 games) |
| 880 | 857 | for (i = 0; i < 0x400; i += 2) |
| r241523 | r241524 | |
| 882 | 859 | space.write_word(0xc01400+i, space.read_word(0xc01000+i)); |
| 883 | 860 | } |
| 884 | 861 | } |
| 885 | | else if(last_prot_op == 0x57a) // winspike |
| 862 | else if(m_last_prot_op == 0x57a) // winspike |
| 886 | 863 | { |
| 887 | 864 | /* player 1 input buffer protection */ |
| 888 | 865 | space.write_dword(0xc10f00, space.read_dword(0xc00f10)); |
| r241523 | r241524 | |
| 894 | 871 | space.write_dword(0xc0fe00, space.read_dword(0xc00f30)); |
| 895 | 872 | space.write_dword(0xc0fe04, space.read_dword(0xc00f34)); |
| 896 | 873 | } |
| 897 | | else if(last_prot_op == 0xd97) // rushhero |
| 874 | else if(m_last_prot_op == 0xd97) // rushhero |
| 898 | 875 | { |
| 899 | 876 | int src = 0xc09ff0; |
| 900 | 877 | int dst = 0xd20000; |
| r241523 | r241524 | |
| 917 | 894 | space.write_byte(0xc01cc4, ~space.read_byte(0xc00547)); |
| 918 | 895 | space.write_byte(0xc01cc5, ~space.read_byte(0xc00567)); |
| 919 | 896 | } |
| 920 | | else if(last_prot_op == 0xb16) // slamdnk2 |
| 897 | else if(m_last_prot_op == 0xb16) // slamdnk2 |
| 921 | 898 | { |
| 922 | 899 | int src = 0xc01000; |
| 923 | 900 | int dst = 0xd20000; |
| r241523 | r241524 | |
| 932 | 909 | |
| 933 | 910 | //maybe here there's a [$d8001f] <- 0x31 write too? |
| 934 | 911 | } |
| 935 | | else if(last_prot_op == 0x515) // vsnetscr screen 1 |
| 912 | else if(m_last_prot_op == 0x515) // vsnetscr screen 1 |
| 936 | 913 | { |
| 937 | 914 | int adr; |
| 938 | | //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc()); |
| 915 | //printf("GXT4: command %x %d (PC=%x)\n", m_last_prot_op, cc++, space.device().safe_pc()); |
| 939 | 916 | for (adr = 0; adr < 0x400; adr += 2) |
| 940 | 917 | space.write_word(0xc01c00+adr, space.read_word(0xc01800+adr)); |
| 941 | 918 | } |
| 942 | | else if(last_prot_op == 0x115d) // vsnetscr screen 2 |
| 919 | else if(m_last_prot_op == 0x115d) // vsnetscr screen 2 |
| 943 | 920 | { |
| 944 | 921 | int adr; |
| 945 | | //printf("GXT4: command %x %d (PC=%x)\n", last_prot_op, cc++, space.device().safe_pc()); |
| 922 | //printf("GXT4: command %x %d (PC=%x)\n", m_last_prot_op, cc++, space.device().safe_pc()); |
| 946 | 923 | for (adr = 0; adr < 0x400; adr += 2) |
| 947 | 924 | space.write_word(0xc18c00+adr, space.read_word(0xc18800+adr)); |
| 948 | 925 | } |
| 949 | 926 | else |
| 950 | 927 | { |
| 951 | | printf("GXT4: unknown protection command %x (PC=%x)\n", last_prot_op, space.device().safe_pc()); |
| 928 | printf("GXT4: unknown protection command %x (PC=%x)\n", m_last_prot_op, space.device().safe_pc()); |
| 952 | 929 | } |
| 953 | 930 | |
| 954 | | if (konamigx_wrport1_1 & 0x10) |
| 931 | if (m_gx_wrport1_1 & 0x10) |
| 955 | 932 | { |
| 956 | | gx_rdport1_3 &= ~8; |
| 933 | m_gx_rdport1_3 &= ~8; |
| 957 | 934 | m_maincpu->set_input_line(4, HOLD_LINE); |
| 958 | 935 | } |
| 959 | 936 | |
| 960 | 937 | // don't accidentally do a phony command |
| 961 | | last_prot_op = -1; |
| 938 | m_last_prot_op = -1; |
| 962 | 939 | } |
| 963 | 940 | } |
| 964 | | last_prot_clk = clk; |
| 941 | m_last_prot_clk = clk; |
| 965 | 942 | } |
| 966 | 943 | } |
| 967 | 944 | |
| r241523 | r241524 | |
| 1180 | 1157 | |
| 1181 | 1158 | // note: racin' force expects bit 1 of the eeprom port to toggle |
| 1182 | 1159 | PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) |
| 1183 | | PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, konamigx_state,gx_rdport1_3_r, NULL) |
| 1160 | PORT_BIT( 0x000000fe, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, konamigx_state, gx_rdport1_3_r, NULL) |
| 1184 | 1161 | PORT_BIT( 0x00000100, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 1185 | 1162 | PORT_BIT( 0x00000200, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 1186 | 1163 | PORT_BIT( 0x00000400, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| r241523 | r241524 | |
| 3578 | 3555 | |
| 3579 | 3556 | MACHINE_START_MEMBER(konamigx_state,konamigx) |
| 3580 | 3557 | { |
| 3581 | | save_item(NAME(konamigx_wrport1_1)); |
| 3558 | save_item(NAME(m_gx_wrport1_1)); |
| 3582 | 3559 | } |
| 3583 | 3560 | |
| 3584 | 3561 | MACHINE_RESET_MEMBER(konamigx_state,konamigx) |
| 3585 | 3562 | { |
| 3586 | | konamigx_wrport1_0 = konamigx_wrport1_1 = 0; |
| 3587 | | konamigx_wrport2 = 0; |
| 3563 | m_gx_wrport1_0 = m_gx_wrport1_1 = 0; |
| 3564 | m_gx_wrport2 = 0; |
| 3588 | 3565 | |
| 3589 | 3566 | /* |
| 3590 | 3567 | bit0 : EEPROM data(don't care) |
| 3591 | 3568 | bit1 : DMA busy (cleared) |
| 3592 | 3569 | bit2-7: IRQ ready (all set) |
| 3593 | 3570 | */ |
| 3594 | | gx_rdport1_3 = 0xfc; |
| 3595 | | gx_syncen = 0; |
| 3596 | | suspension_active = 0; |
| 3571 | m_gx_rdport1_3 = 0xfc; |
| 3572 | m_gx_syncen = 0; |
| 3573 | m_suspension_active = 0; |
| 3597 | 3574 | |
| 3598 | 3575 | // Hold sound CPUs in reset |
| 3599 | 3576 | m_soundcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| r241523 | r241524 | |
| 3633 | 3610 | |
| 3634 | 3611 | // To hack around this, we underclock the 68020 for 10 seconds during POST |
| 3635 | 3612 | m_maincpu->set_clock_scale(0.66f); |
| 3636 | | boothack_timer->adjust(attotime::from_seconds(10)); |
| 3613 | m_boothack_timer->adjust(attotime::from_seconds(10)); |
| 3637 | 3614 | } |
| 3638 | 3615 | |
| 3639 | 3616 | if (!strcmp(setname, "le2") || |
| r241523 | r241524 | |
| 3708 | 3685 | int i, match; |
| 3709 | 3686 | int readback = 0; |
| 3710 | 3687 | |
| 3711 | | konamigx_cfgport = -1; |
| 3712 | | last_prot_op = -1; |
| 3713 | | last_prot_clk = 0; |
| 3688 | m_gx_cfgport = -1; |
| 3689 | m_last_prot_op = -1; |
| 3690 | m_last_prot_clk = 0; |
| 3714 | 3691 | |
| 3715 | | esc_cb = 0; |
| 3716 | | resume_trigger = 0; |
| 3692 | m_esc_cb = NULL; |
| 3693 | m_resume_trigger = 0; |
| 3717 | 3694 | |
| 3718 | | dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this)); |
| 3719 | | boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this)); |
| 3695 | m_dmadelay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::dmaend_callback),this)); |
| 3696 | m_boothack_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(konamigx_state::boothack_callback),this)); |
| 3720 | 3697 | |
| 3721 | 3698 | i = match = 0; |
| 3722 | 3699 | while ((gameDefs[i].cfgport != -1) && (!match)) |
| r241523 | r241524 | |
| 3724 | 3701 | if (!strcmp(machine().system().name, gameDefs[i].romname)) |
| 3725 | 3702 | { |
| 3726 | 3703 | match = 1; |
| 3727 | | konamigx_cfgport = gameDefs[i].cfgport; |
| 3704 | m_gx_cfgport = gameDefs[i].cfgport; |
| 3728 | 3705 | readback = gameDefs[i].readback; |
| 3729 | 3706 | |
| 3730 | 3707 | switch (gameDefs[i].special) |
| r241523 | r241524 | |
| 3745 | 3722 | rom[0x810f1] &= ~1; // fix checksum |
| 3746 | 3723 | rom[0x872ea] |= 0xe0000; // enable plane B,C,D |
| 3747 | 3724 | |
| 3748 | | esc_cb = tkmmpzdm_esc; |
| 3725 | m_esc_cb = &konamigx_state::tkmmpzdm_esc; |
| 3749 | 3726 | break; |
| 3750 | 3727 | } |
| 3751 | 3728 | |
| 3752 | 3729 | case 3: // dragoon might |
| 3753 | | esc_cb = dragoonj_esc; |
| 3730 | m_esc_cb = &konamigx_state::dragoonj_esc; |
| 3754 | 3731 | break; |
| 3755 | 3732 | |
| 3756 | 3733 | case 4: // sexyparo |
| 3757 | | esc_cb = sexyparo_esc; |
| 3734 | m_esc_cb = &konamigx_state::sexyparo_esc; |
| 3758 | 3735 | break; |
| 3759 | 3736 | |
| 3760 | 3737 | case 5: // daiskiss |
| 3761 | | esc_cb = daiskiss_esc; |
| 3738 | m_esc_cb = &konamigx_state::daiskiss_esc; |
| 3762 | 3739 | break; |
| 3763 | 3740 | |
| 3764 | 3741 | case 6: // salamander 2 |
| 3765 | | esc_cb = sal2_esc; |
| 3742 | m_esc_cb = &konamigx_state::sal2_esc; |
| 3766 | 3743 | break; |
| 3767 | 3744 | |
| 3768 | 3745 | case 7: // install type 4 Xilinx protection for non-type 3/4 games |
| r241523 | r241524 | |
| 3770 | 3747 | break; |
| 3771 | 3748 | |
| 3772 | 3749 | case 8: // tbyahhoo |
| 3773 | | esc_cb = tbyahhoo_esc; |
| 3750 | m_esc_cb = &konamigx_state::tbyahhoo_esc; |
| 3774 | 3751 | break; |
| 3775 | 3752 | |
| 3776 | 3753 | case 9: // fantjour |
trunk/src/mame/includes/konamigx.h
| r241523 | r241524 | |
| 16 | 16 | m_maincpu(*this,"maincpu"), |
| 17 | 17 | m_soundcpu(*this, "soundcpu"), |
| 18 | 18 | m_dasp(*this, "dasp"), |
| 19 | | m_workram(*this,"workram"), |
| 20 | | m_psacram(*this,"psacram"), |
| 21 | | m_subpaletteram32(*this,"subpaletteram"), |
| 22 | 19 | m_k055673(*this, "k055673"), |
| 23 | 20 | m_k055555(*this, "k055555"), |
| 24 | 21 | m_k056832(*this, "k056832"), |
| 25 | 22 | m_k054338(*this, "k054338"), |
| 23 | m_k056800(*this, "k056800"), |
| 24 | m_k054539_1(*this,"k054539_1"), |
| 25 | m_k054539_2(*this,"k054539_2"), |
| 26 | m_gfxdecode(*this, "gfxdecode"), |
| 27 | m_screen(*this, "screen"), |
| 28 | m_palette(*this, "palette"), |
| 29 | m_workram(*this,"workram"), |
| 30 | m_psacram(*this,"psacram"), |
| 31 | m_subpaletteram32(*this,"subpaletteram"), |
| 26 | 32 | m_k053936_0_ctrl(*this,"k053936_0_ctrl",32), |
| 27 | 33 | m_k053936_0_linectrl(*this,"k053936_0_line",32), |
| 28 | 34 | m_k053936_0_ctrl_16(*this,"k053936_0_ct16",16), |
| 29 | 35 | m_k053936_0_linectrl_16(*this,"k053936_0_li16",16), |
| 30 | 36 | m_konamigx_type3_psac2_bank(*this,"psac2_bank"), |
| 31 | | m_k056800(*this, "k056800"), |
| 32 | | m_k054539_1(*this,"k054539_1"), |
| 33 | | m_k054539_2(*this,"k054539_2"), |
| 37 | m_generic_paletteram_32(*this, "paletteram"), |
| 34 | 38 | m_an0(*this, "AN0"), |
| 35 | 39 | m_an1(*this, "AN1"), |
| 36 | 40 | m_light0_x(*this, "LIGHT0_X"), |
| 37 | 41 | m_light0_y(*this, "LIGHT0_Y"), |
| 38 | 42 | m_light1_x(*this, "LIGHT1_X"), |
| 39 | 43 | m_light1_y(*this, "LIGHT1_Y"), |
| 40 | | m_eepromout(*this, "EEPROMOUT"), |
| 41 | | m_gfxdecode(*this, "gfxdecode"), |
| 42 | | m_screen(*this, "screen"), |
| 43 | | m_palette(*this, "palette"), |
| 44 | | m_generic_paletteram_32(*this, "paletteram") |
| 44 | m_eepromout(*this, "EEPROMOUT") |
| 45 | 45 | { } |
| 46 | 46 | |
| 47 | 47 | required_device<cpu_device> m_maincpu; |
| 48 | 48 | optional_device<cpu_device> m_soundcpu; |
| 49 | 49 | optional_device<tms57002_device> m_dasp; |
| 50 | | |
| 51 | | optional_shared_ptr<UINT32> m_workram; |
| 52 | | optional_shared_ptr<UINT32> m_psacram; |
| 53 | | optional_shared_ptr<UINT32> m_subpaletteram32; |
| 54 | 50 | required_device<k055673_device> m_k055673; |
| 55 | 51 | required_device<k055555_device> m_k055555; |
| 56 | 52 | required_device<k056832_device> m_k056832; |
| 57 | 53 | optional_device<k054338_device> m_k054338; |
| 58 | | optional_shared_ptr<UINT16> m_k053936_0_ctrl; |
| 59 | | optional_shared_ptr<UINT16> m_k053936_0_linectrl; |
| 60 | | optional_shared_ptr<UINT16> m_k053936_0_ctrl_16; |
| 61 | | optional_shared_ptr<UINT16> m_k053936_0_linectrl_16; |
| 62 | | optional_shared_ptr<UINT32> m_konamigx_type3_psac2_bank; |
| 63 | 54 | optional_device<k056800_device> m_k056800; |
| 64 | 55 | optional_device<k054539_device> m_k054539_1; |
| 65 | 56 | optional_device<k054539_device> m_k054539_2; |
| 66 | | optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout; |
| 67 | 57 | required_device<gfxdecode_device> m_gfxdecode; |
| 68 | 58 | required_device<screen_device> m_screen; |
| 69 | 59 | required_device<palette_device> m_palette; |
| 60 | |
| 61 | optional_shared_ptr<UINT32> m_workram; |
| 62 | optional_shared_ptr<UINT32> m_psacram; |
| 63 | optional_shared_ptr<UINT32> m_subpaletteram32; |
| 64 | optional_shared_ptr<UINT16> m_k053936_0_ctrl; |
| 65 | optional_shared_ptr<UINT16> m_k053936_0_linectrl; |
| 66 | optional_shared_ptr<UINT16> m_k053936_0_ctrl_16; |
| 67 | optional_shared_ptr<UINT16> m_k053936_0_linectrl_16; |
| 68 | optional_shared_ptr<UINT32> m_konamigx_type3_psac2_bank; |
| 70 | 69 | optional_shared_ptr<UINT32> m_generic_paletteram_32; |
| 70 | |
| 71 | optional_ioport m_an0, m_an1, m_light0_x, m_light0_y, m_light1_x, m_light1_y, m_eepromout; |
| 71 | 72 | |
| 72 | 73 | DECLARE_WRITE32_MEMBER(esc_w); |
| 73 | 74 | DECLARE_WRITE32_MEMBER(eeprom_w); |
| r241523 | r241524 | |
| 166 | 167 | void fantjour_dma_install(); |
| 167 | 168 | |
| 168 | 169 | void konamigx_mixer_primode(int mode); |
| 170 | |
| 171 | typedef void (konamigx_state::*esc_cb)(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 172 | |
| 173 | void tkmmpzdm_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 174 | void dragoonj_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 175 | void sal2_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 176 | void sexyparo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 177 | void tbyahhoo_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 178 | void daiskiss_esc(address_space &space, UINT32 p1, UINT32 p2, UINT32 p3, UINT32 p4); |
| 179 | |
| 180 | inline int K053247GX_combine_c18(int attrib); |
| 181 | inline int K055555GX_decode_objcolor(int c18); |
| 182 | inline int K055555GX_decode_inpri(int c18); |
| 183 | int K055555GX_decode_vmixcolor(int layer, int *color); |
| 169 | 184 | |
| 170 | 185 | UINT8 m_sound_ctrl; |
| 171 | 186 | UINT8 m_sound_intck; |
| 172 | 187 | UINT32 m_fantjour_dma[8]; |
| 173 | 188 | int m_konamigx_current_frame; |
| 174 | 189 | int m_gx_objdma, m_gx_primode; |
| 175 | | }; |
| 190 | emu_timer *m_dmadelay_timer; |
| 191 | emu_timer *m_boothack_timer; |
| 192 | int m_gx_rdport1_3, m_gx_syncen; |
| 193 | int m_gx_cfgport; |
| 194 | int m_suspension_active, m_resume_trigger; |
| 195 | int m_last_prot_op, m_last_prot_clk; |
| 196 | |
| 197 | UINT8 m_esc_program[4096]; |
| 198 | esc_cb m_esc_cb; |
| 199 | |
| 200 | UINT16 m_prot_data[0x20]; |
| 201 | |
| 202 | // 1st-Tier GX/MW Variables |
| 203 | // frequently used registers |
| 204 | int m_k053247_vrcbk[4]; |
| 205 | int m_k053247_coreg, m_k053247_coregshift, m_k053247_opset; |
| 206 | int m_opri, m_oinprion; |
| 207 | int m_vcblk[6], m_ocblk; |
| 208 | int m_vinmix, m_vmixon, m_osinmix, m_osmixon; |
| 209 | UINT8 m_gx_wrport1_0, m_gx_wrport1_1; |
| 210 | UINT16 m_gx_wrport2; |
| 211 | |
| 212 | // 2nd-Tier GX/MW Graphics Variables |
| 213 | UINT8 *m_gx_objzbuf, *m_gx_shdzbuf; |
| 214 | int m_layer_colorbase[4]; |
| 215 | INT32 m_gx_tilebanks[8], m_gx_oldbanks[8]; |
| 216 | int m_gx_tilemode, m_gx_rozenable, m_psac_colorbase, m_last_psac_colorbase; |
| 217 | int m_gx_specialrozenable; // type 1 roz, with voxel height-map, rendered from 2 source tilemaps (which include height data) to temp bitmap for further processing |
| 218 | int m_gx_rushingheroes_hack; |
| 219 | int m_gx_le2_textcolour_hack; |
| 220 | tilemap_t *m_gx_psac_tilemap, *m_gx_psac_tilemap2; |
| 221 | bitmap_ind16 *m_type3_roz_temp_bitmap; |
| 222 | tilemap_t *m_gx_psac_tilemap_alt; |
| 223 | int m_konamigx_has_dual_screen; |
| 224 | int m_konamigx_palformat; |
| 225 | bitmap_rgb32 *m_dualscreen_left_tempbitmap; |
| 226 | bitmap_rgb32 *m_dualscreen_right_tempbitmap; |
| 227 | |
| 228 | /* On Type-1 the K053936 output is rendered to these temporary bitmaps as raw data |
| 229 | the 'voxel' effect to give the pixels height is a post-process operation on the |
| 230 | output of the K053936 (this can clearly be seen in videos as large chunks of |
| 231 | scenary flicker when in the distance due to single pixels in the K053936 output |
| 232 | becoming visible / invisible due to drawing precision. |
| 176 | 233 | |
| 234 | -- however, progress on this has stalled as our K053936 doesn't seem to give |
| 235 | the right output for post processing, I suspect the game is using some |
| 236 | unsupported flipping modes (probably due to the way it's hooked up to the |
| 237 | rest of the chips) which is causing entirely the wrong output. |
| 177 | 238 | |
| 178 | | /*----------- defined in video/konamigx.c -----------*/ |
| 239 | -- furthermore video/konamigx.c contains it's own implementation of |
| 240 | the K053936_zoom_draw named K053936GP_zoom_draw ... |
| 179 | 241 | |
| 180 | 242 | |
| 181 | | // 1st-Tier GX/MW Variables and Functions |
| 182 | | extern UINT8 konamigx_wrport1_0, konamigx_wrport1_1; |
| 183 | | extern UINT16 konamigx_wrport2; |
| 243 | */ |
| 244 | bitmap_ind16 *m_gxtype1_roz_dstbitmap; |
| 245 | bitmap_ind16 *m_gxtype1_roz_dstbitmap2; |
| 246 | rectangle m_gxtype1_roz_dstbitmapclip; |
| 247 | }; |
| 184 | 248 | |
| 185 | | |
| 186 | | |
| 187 | 249 | // Sprite Callbacks |
| 188 | 250 | |
| 189 | 251 | /* callbacks should return color codes in this format: |
trunk/src/mame/video/konamigx.c
| r241523 | r241524 | |
| 11 | 11 | //#define GX_DEBUG |
| 12 | 12 | #define VERBOSE 0 |
| 13 | 13 | |
| 14 | | /***************************************************************************/ |
| 15 | | /* */ |
| 16 | | /* 2nd-Tier GX/MW Graphics Functions */ |
| 17 | | /* */ |
| 18 | | /***************************************************************************/ |
| 19 | 14 | |
| 20 | | |
| 21 | | |
| 22 | | static UINT8 *gx_objzbuf, *gx_shdzbuf; |
| 23 | | |
| 24 | | |
| 25 | | |
| 26 | | static int layer_colorbase[4]; |
| 27 | | static INT32 gx_tilebanks[8], gx_oldbanks[8]; |
| 28 | | static int gx_tilemode, gx_rozenable, psac_colorbase, last_psac_colorbase; |
| 29 | | static int gx_specialrozenable; // type 1 roz, with voxel height-map, rendered from 2 source tilemaps (which include height data) to temp bitmap for further processing |
| 30 | | static int gx_rushingheroes_hack; |
| 31 | | static int gx_le2_textcolour_hack; |
| 32 | | static tilemap_t *gx_psac_tilemap, *gx_psac_tilemap2; |
| 33 | | static bitmap_ind16* type3_roz_temp_bitmap; |
| 34 | | static tilemap_t* gx_psac_tilemap_alt; |
| 35 | | |
| 36 | | static int konamigx_has_dual_screen; |
| 37 | 15 | INLINE void set_color_555(palette_device &palette, pen_t color, int rshift, int gshift, int bshift, UINT16 data); |
| 38 | | static int konamigx_palformat; |
| 39 | | static bitmap_rgb32* dualscreen_left_tempbitmap; |
| 40 | | static bitmap_rgb32* dualscreen_right_tempbitmap; |
| 41 | 16 | |
| 42 | | /* On Type-1 the K053936 output is rendered to these temporary bitmaps as raw data |
| 43 | | the 'voxel' effect to give the pixels height is a post-process operation on the |
| 44 | | output of the K053936 (this can clearly be seen in videos as large chunks of |
| 45 | | scenary flicker when in the distance due to single pixels in the K053936 output |
| 46 | | becoming visible / invisible due to drawing precision. |
| 47 | 17 | |
| 48 | | -- however, progress on this has stalled as our K053936 doesn't seem to give |
| 49 | | the right output for post processing, I suspect the game is using some |
| 50 | | unsupported flipping modes (probably due to the way it's hooked up to the |
| 51 | | rest of the chips) which is causing entirely the wrong output. |
| 52 | | |
| 53 | | -- furthermore machine/konamigx.c (!) contains it's own implementation of |
| 54 | | the K053936_zoom_draw named K053936GP_zoom_draw ... It really shouldn't do, |
| 55 | | epsecially not in 'machine', which isn't meant to be video related. |
| 56 | | |
| 57 | | |
| 58 | | */ |
| 59 | | static bitmap_ind16 *gxtype1_roz_dstbitmap; |
| 60 | | static bitmap_ind16 *gxtype1_roz_dstbitmap2; |
| 61 | | static rectangle gxtype1_roz_dstbitmapclip; |
| 62 | | |
| 63 | | /***************************************************************************/ |
| 64 | | /* */ |
| 65 | | /* 1st-Tier GX/MW Variables and Functions */ |
| 66 | | /* */ |
| 67 | | /***************************************************************************/ |
| 68 | | |
| 69 | | // global system ports access |
| 70 | | UINT8 konamigx_wrport1_0, konamigx_wrport1_1; |
| 71 | | UINT16 konamigx_wrport2; |
| 72 | | |
| 73 | | // frequently used registers |
| 74 | | static int k053247_vrcbk[4]; |
| 75 | | static int k053247_coreg, k053247_coregshift, k053247_opset; |
| 76 | | static int opri, oinprion; |
| 77 | | static int vcblk[6], ocblk; |
| 78 | | static int vinmix, vmixon, osinmix, osmixon; |
| 79 | | |
| 80 | | |
| 81 | 18 | void konamigx_state::konamigx_precache_registers(void) |
| 82 | 19 | { |
| 83 | 20 | // (see sprite color coding scheme on p.46 & 47) |
| r241523 | r241524 | |
| 86 | 23 | int i; |
| 87 | 24 | |
| 88 | 25 | i = m_k055673->k053247_read_register(0x8/2); |
| 89 | | k053247_vrcbk[0] = (i & 0x000f) << 14; |
| 90 | | k053247_vrcbk[1] = (i & 0x0f00) << 6; |
| 26 | m_k053247_vrcbk[0] = (i & 0x000f) << 14; |
| 27 | m_k053247_vrcbk[1] = (i & 0x0f00) << 6; |
| 91 | 28 | i = m_k055673->k053247_read_register(0xa/2); |
| 92 | | k053247_vrcbk[2] = (i & 0x000f) << 14; |
| 93 | | k053247_vrcbk[3] = (i & 0x0f00) << 6; |
| 29 | m_k053247_vrcbk[2] = (i & 0x000f) << 14; |
| 30 | m_k053247_vrcbk[3] = (i & 0x0f00) << 6; |
| 94 | 31 | |
| 95 | 32 | // COREG == OBJSET2+1C == bit8-11 of OPSET ??? (see p.50 last table, needs p.49 to confirm) |
| 96 | | k053247_opset = m_k055673->k053247_read_register(0xc/2); |
| 33 | m_k053247_opset = m_k055673->k053247_read_register(0xc/2); |
| 97 | 34 | |
| 98 | | i = k053247_opset & 7; if (i > 4) i = 4; |
| 35 | i = m_k053247_opset & 7; if (i > 4) i = 4; |
| 99 | 36 | |
| 100 | | k053247_coreg = m_k055673->k053247_read_register(0xc/2)>>8 & 0xf; |
| 101 | | k053247_coreg =(k053247_coreg & coregmasks[i]) << 12; |
| 37 | m_k053247_coreg = m_k055673->k053247_read_register(0xc/2)>>8 & 0xf; |
| 38 | m_k053247_coreg =(m_k053247_coreg & coregmasks[i]) << 12; |
| 102 | 39 | |
| 103 | | k053247_coregshift = coregshifts[i]; |
| 40 | m_k053247_coregshift = coregshifts[i]; |
| 104 | 41 | |
| 105 | | opri = m_k055555->K055555_read_register(K55_PRIINP_8); |
| 106 | | oinprion = m_k055555->K055555_read_register(K55_OINPRI_ON); |
| 107 | | vcblk[0] = m_k055555->K055555_read_register(K55_PALBASE_A); |
| 108 | | vcblk[1] = m_k055555->K055555_read_register(K55_PALBASE_B); |
| 109 | | vcblk[2] = m_k055555->K055555_read_register(K55_PALBASE_C); |
| 110 | | vcblk[3] = m_k055555->K055555_read_register(K55_PALBASE_D); |
| 111 | | vcblk[4] = m_k055555->K055555_read_register(K55_PALBASE_SUB1); |
| 112 | | vcblk[5] = m_k055555->K055555_read_register(K55_PALBASE_SUB2); |
| 113 | | ocblk = m_k055555->K055555_read_register(K55_PALBASE_OBJ); |
| 114 | | vinmix = m_k055555->K055555_read_register(K55_BLEND_ENABLES); |
| 115 | | vmixon = m_k055555->K055555_read_register(K55_VINMIX_ON); |
| 116 | | osinmix = m_k055555->K055555_read_register(K55_OSBLEND_ENABLES); |
| 117 | | osmixon = m_k055555->K055555_read_register(K55_OSBLEND_ON); |
| 42 | m_opri = m_k055555->K055555_read_register(K55_PRIINP_8); |
| 43 | m_oinprion = m_k055555->K055555_read_register(K55_OINPRI_ON); |
| 44 | m_vcblk[0] = m_k055555->K055555_read_register(K55_PALBASE_A); |
| 45 | m_vcblk[1] = m_k055555->K055555_read_register(K55_PALBASE_B); |
| 46 | m_vcblk[2] = m_k055555->K055555_read_register(K55_PALBASE_C); |
| 47 | m_vcblk[3] = m_k055555->K055555_read_register(K55_PALBASE_D); |
| 48 | m_vcblk[4] = m_k055555->K055555_read_register(K55_PALBASE_SUB1); |
| 49 | m_vcblk[5] = m_k055555->K055555_read_register(K55_PALBASE_SUB2); |
| 50 | m_ocblk = m_k055555->K055555_read_register(K55_PALBASE_OBJ); |
| 51 | m_vinmix = m_k055555->K055555_read_register(K55_BLEND_ENABLES); |
| 52 | m_vmixon = m_k055555->K055555_read_register(K55_VINMIX_ON); |
| 53 | m_osinmix = m_k055555->K055555_read_register(K55_OSBLEND_ENABLES); |
| 54 | m_osmixon = m_k055555->K055555_read_register(K55_OSBLEND_ON); |
| 118 | 55 | } |
| 119 | 56 | |
| 120 | | INLINE int K053247GX_combine_c18(int attrib) // (see p.46) |
| 57 | inline int konamigx_state::K053247GX_combine_c18(int attrib) // (see p.46) |
| 121 | 58 | { |
| 122 | 59 | int c18; |
| 123 | 60 | |
| 124 | | c18 = (attrib & 0xff)<<k053247_coregshift | k053247_coreg; |
| 61 | c18 = (attrib & 0xff)<<m_k053247_coregshift | m_k053247_coreg; |
| 125 | 62 | |
| 126 | | if (konamigx_wrport2 & 4) c18 &= 0x3fff; else |
| 127 | | if (!(konamigx_wrport2 & 8)) c18 = (c18 & 0x3fff) | (attrib<<6 & 0xc000); |
| 63 | if (m_gx_wrport2 & 4) c18 &= 0x3fff; else |
| 64 | if (!(m_gx_wrport2 & 8)) c18 = (c18 & 0x3fff) | (attrib<<6 & 0xc000); |
| 128 | 65 | |
| 129 | 66 | return(c18); |
| 130 | 67 | } |
| 131 | 68 | |
| 132 | | INLINE int K055555GX_decode_objcolor(int c18) // (see p.59 7.2.2) |
| 69 | inline int konamigx_state::K055555GX_decode_objcolor(int c18) // (see p.59 7.2.2) |
| 133 | 70 | { |
| 134 | 71 | int ocb, opon; |
| 135 | 72 | |
| 136 | | opon = oinprion<<8 | 0xff; |
| 137 | | ocb = (ocblk & 7) << 10; |
| 73 | opon = m_oinprion<<8 | 0xff; |
| 74 | ocb = (m_ocblk & 7) << 10; |
| 138 | 75 | c18 &= opon; |
| 139 | 76 | ocb &=~opon; |
| 140 | 77 | |
| 141 | | return((ocb | c18) >> k053247_coregshift); |
| 78 | return((ocb | c18) >> m_k053247_coregshift); |
| 142 | 79 | } |
| 143 | 80 | |
| 144 | | INLINE int K055555GX_decode_inpri(int c18) // (see p.59 7.2.2) |
| 81 | inline int konamigx_state::K055555GX_decode_inpri(int c18) // (see p.59 7.2.2) |
| 145 | 82 | { |
| 146 | | int op = opri; |
| 83 | int op = m_opri; |
| 147 | 84 | |
| 148 | 85 | c18 >>= 8; |
| 149 | | op &= oinprion; |
| 150 | | c18 &=~oinprion; |
| 86 | op &= m_oinprion; |
| 87 | c18 &=~m_oinprion; |
| 151 | 88 | |
| 152 | 89 | return(c18 | op); |
| 153 | 90 | } |
| r241523 | r241524 | |
| 157 | 94 | int num = *code; |
| 158 | 95 | int c18 = *color; |
| 159 | 96 | |
| 160 | | *code = k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 97 | *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 161 | 98 | c18 = K053247GX_combine_c18(c18); |
| 162 | 99 | *color = K055555GX_decode_objcolor(c18); |
| 163 | 100 | *priority_mask = K055555GX_decode_inpri(c18); |
| r241523 | r241524 | |
| 168 | 105 | int num, op, pri, c18; |
| 169 | 106 | |
| 170 | 107 | num = *code; |
| 171 | | *code = k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 108 | *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 172 | 109 | |
| 173 | 110 | c18 = pri = *color; |
| 174 | | op = opri; |
| 111 | op = m_opri; |
| 175 | 112 | pri = (pri & 0x200) ? 4 : pri>>4 & 0xf; |
| 176 | | op &= oinprion; |
| 177 | | pri &=~oinprion; |
| 113 | op &= m_oinprion; |
| 114 | pri &=~m_oinprion; |
| 178 | 115 | *priority_mask = pri | op; |
| 179 | 116 | |
| 180 | 117 | c18 = K053247GX_combine_c18(c18); |
| r241523 | r241524 | |
| 186 | 123 | int num, op, pri, c18; |
| 187 | 124 | |
| 188 | 125 | num = *code; |
| 189 | | *code = k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 126 | *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 190 | 127 | |
| 191 | 128 | c18 = pri = *color; |
| 192 | | op = opri; |
| 129 | op = m_opri; |
| 193 | 130 | pri = pri>>4 & 0x3f; |
| 194 | | op &= oinprion; |
| 195 | | pri &=~oinprion; |
| 131 | op &= m_oinprion; |
| 132 | pri &=~m_oinprion; |
| 196 | 133 | *priority_mask = pri | op; |
| 197 | 134 | |
| 198 | 135 | c18 = K053247GX_combine_c18(c18); |
| r241523 | r241524 | |
| 204 | 141 | int num, op, pri; |
| 205 | 142 | |
| 206 | 143 | num = *code; |
| 207 | | *code = k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 144 | *code = m_k053247_vrcbk[num>>14] | (num & 0x3fff); |
| 208 | 145 | |
| 209 | 146 | pri = *color; |
| 210 | 147 | *color &= 0x1f; |
| 211 | 148 | |
| 212 | | op = opri; |
| 149 | op = m_opri; |
| 213 | 150 | pri &= 0xf0; |
| 214 | | op &= oinprion; |
| 215 | | pri &=~oinprion; |
| 151 | op &= m_oinprion; |
| 152 | pri &=~m_oinprion; |
| 216 | 153 | *priority_mask = pri | op; |
| 217 | 154 | } |
| 218 | 155 | |
| 219 | | static int K055555GX_decode_vmixcolor(int layer, int *color) // (see p.62 7.2.6 and p.27 3.3) |
| 156 | int konamigx_state::K055555GX_decode_vmixcolor(int layer, int *color) // (see p.62 7.2.6 and p.27 3.3) |
| 220 | 157 | { |
| 221 | 158 | int vcb, shift, pal, vmx, von, pl45, emx; |
| 222 | 159 | |
| 223 | | vcb = vcblk[layer]<<6; |
| 160 | vcb = m_vcblk[layer]<<6; |
| 224 | 161 | shift = layer<<1; |
| 225 | 162 | pal = *color; |
| 226 | | vmx = vinmix>>shift & 3; |
| 227 | | von = vmixon>>shift & 3; |
| 163 | vmx = m_vinmix>>shift & 3; |
| 164 | von = m_vmixon>>shift & 3; |
| 228 | 165 | emx = pl45 = pal>>4 & 3; |
| 229 | 166 | pal &= 0xf; |
| 230 | 167 | pl45 &= von; |
| r241523 | r241524 | |
| 235 | 172 | emx |= vmx; |
| 236 | 173 | pal |= vcb; |
| 237 | 174 | |
| 238 | | if (gx_le2_textcolour_hack) |
| 175 | if (m_gx_le2_textcolour_hack) |
| 239 | 176 | if (layer==0) |
| 240 | 177 | pal |= 0x1c0; |
| 241 | 178 | |
| r241523 | r241524 | |
| 252 | 189 | |
| 253 | 190 | shift = layer<<1; |
| 254 | 191 | pal = *color; |
| 255 | | osmx = osinmix>>shift & 3; |
| 256 | | oson = osmixon>>shift & 3; |
| 192 | osmx = m_osinmix>>shift & 3; |
| 193 | oson = m_osmixon>>shift & 3; |
| 257 | 194 | |
| 258 | 195 | if (layer) |
| 259 | 196 | { |
| 260 | 197 | // layer 1-3 are external tile layers |
| 261 | | scb = vcblk[layer+3]<<6; |
| 198 | scb = m_vcblk[layer+3]<<6; |
| 262 | 199 | emx = pl45 = pal>>4 & 3; |
| 263 | 200 | pal &= 0xf; |
| 264 | 201 | pl45 &= oson; |
| r241523 | r241524 | |
| 292 | 229 | int w = visarea.width(); |
| 293 | 230 | int h = visarea.height(); |
| 294 | 231 | |
| 295 | | UINT8 *zptr = gx_objzbuf; |
| 232 | UINT8 *zptr = m_gx_objzbuf; |
| 296 | 233 | int ecx = h; |
| 297 | 234 | |
| 298 | 235 | do { memset(zptr, -1, w); zptr += GX_ZBUFW; } while (--ecx); |
| 299 | 236 | |
| 300 | 237 | if (!noshadow) |
| 301 | 238 | { |
| 302 | | zptr = gx_shdzbuf; |
| 239 | zptr = m_gx_shdzbuf; |
| 303 | 240 | w <<= 1; |
| 304 | 241 | ecx = h; |
| 305 | 242 | do { memset(zptr, -1, w); zptr += (GX_ZBUFW<<1); } while (--ecx); |
| r241523 | r241524 | |
| 350 | 287 | m_gx_objdma = 0; |
| 351 | 288 | m_gx_primode = 0; |
| 352 | 289 | |
| 353 | | gx_objzbuf = &screen.priority().pix8(0); |
| 354 | | gx_shdzbuf = auto_alloc_array(machine(), UINT8, GX_ZBUFSIZE); |
| 290 | m_gx_objzbuf = &screen.priority().pix8(0); |
| 291 | m_gx_shdzbuf = auto_alloc_array(machine(), UINT8, GX_ZBUFSIZE); |
| 355 | 292 | gx_objpool = auto_alloc_array(machine(), struct GX_OBJ, GX_MAX_OBJECTS); |
| 356 | 293 | |
| 357 | 294 | m_k054338->export_config(&K054338_shdRGB); |
| r241523 | r241524 | |
| 393 | 330 | int cltc_shdpri, /*prflp,*/ disp; |
| 394 | 331 | |
| 395 | 332 | // buffer can move when it's resized, so refresh the pointer |
| 396 | | gx_objzbuf = &screen.priority().pix8(0); |
| 333 | m_gx_objzbuf = &screen.priority().pix8(0); |
| 397 | 334 | |
| 398 | 335 | // abort if object database failed to initialize |
| 399 | 336 | objpool = gx_objpool; |
| 400 | 337 | if (!objpool) return; |
| 401 | 338 | |
| 402 | 339 | // clear screen with backcolor and update flicker pulse |
| 403 | | if (konamigx_wrport1_0 & 0x20) |
| 340 | if (m_gx_wrport1_0 & 0x20) |
| 404 | 341 | m_k054338->fill_backcolor(bitmap, |
| 405 | 342 | cliprect, |
| 406 | 343 | m_palette->pens() + (m_k055555->K055555_read_register(0) << 9), |
| r241523 | r241524 | |
| 564 | 501 | int zcode = gx_spriteram[offs] & 0xff; |
| 565 | 502 | |
| 566 | 503 | // invert z-order when opset_pri is set (see p.51 OPSET PRI) |
| 567 | | if (k053247_opset & 0x10) zcode = 0xff - zcode; |
| 504 | if (m_k053247_opset & 0x10) zcode = 0xff - zcode; |
| 568 | 505 | |
| 569 | 506 | int code = gx_spriteram[offs+1]; |
| 570 | 507 | int color = k = gx_spriteram[offs+6]; |
| r241523 | r241524 | |
| 635 | 572 | if (temp3) |
| 636 | 573 | { |
| 637 | 574 | // determine shadow priority |
| 638 | | spri = (k053247_opset & 0x20) ? pri : shdpri[shadow]; // (see p.51 OPSET SDSEL) |
| 575 | spri = (m_k053247_opset & 0x20) ? pri : shdpri[shadow]; // (see p.51 OPSET SDSEL) |
| 639 | 576 | } |
| 640 | 577 | } |
| 641 | 578 | |
| r241523 | r241524 | |
| 732 | 669 | if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>(i+16); temp3 = 3; } |
| 733 | 670 | else |
| 734 | 671 | { |
| 735 | | temp1 = vinmix; |
| 736 | | temp2 = vinmix>>i & 3; |
| 737 | | temp3 = vmixon>>i & 3; |
| 672 | temp1 = m_vinmix; |
| 673 | temp2 = m_vinmix>>i & 3; |
| 674 | temp3 = m_vmixon>>i & 3; |
| 738 | 675 | } |
| 739 | 676 | |
| 740 | 677 | /* blend layer only when: |
| 741 | | 1) vinmix != 0xff |
| 678 | 1) m_vinmix != 0xff |
| 742 | 679 | 2) its internal mix code is set |
| 743 | 680 | 3) all mix code bits are internal(overriden until tile blending has been implemented) |
| 744 | 681 | 4) 0 > alpha < 255; |
| r241523 | r241524 | |
| 775 | 712 | if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>24; temp3 = 3; } |
| 776 | 713 | else |
| 777 | 714 | { |
| 778 | | temp1 = osinmix; |
| 779 | | temp2 = osinmix>>2 & 3; |
| 780 | | temp3 = osmixon>>2 & 3; |
| 715 | temp1 = m_osinmix; |
| 716 | temp2 = m_osinmix>>2 & 3; |
| 717 | temp3 = m_osmixon>>2 & 3; |
| 781 | 718 | } |
| 782 | 719 | |
| 783 | 720 | if (temp1!=0xff && temp2 /*&& temp3==3*/) |
| r241523 | r241524 | |
| 803 | 740 | } |
| 804 | 741 | else |
| 805 | 742 | { |
| 806 | | machine().device<k053250_device>("k053250_1")->draw(bitmap, cliprect, vcblk[4]<<l, 0, screen.priority(), 0); |
| 743 | machine().device<k053250_device>("k053250_1")->draw(bitmap, cliprect, m_vcblk[4]<<l, 0, screen.priority(), 0); |
| 807 | 744 | } |
| 808 | 745 | } |
| 809 | 746 | } |
| r241523 | r241524 | |
| 825 | 762 | if (j == GXMIX_BLEND_FORCE) { temp1 = 0x00; temp2 = mixerflags>>26; temp3 = 3; } |
| 826 | 763 | else |
| 827 | 764 | { |
| 828 | | temp1 = osinmix; |
| 829 | | temp2 = osinmix>>4 & 3; |
| 830 | | temp3 = osmixon>>4 & 3; |
| 765 | temp1 = m_osinmix; |
| 766 | temp2 = m_osinmix>>4 & 3; |
| 767 | temp3 = m_osmixon>>4 & 3; |
| 831 | 768 | } |
| 832 | 769 | |
| 833 | 770 | if (temp1!=0xff && temp2 /*&& temp3==3*/) |
| r241523 | r241524 | |
| 875 | 812 | } |
| 876 | 813 | } |
| 877 | 814 | else |
| 878 | | machine().device<k053250_device>("k053250_2")->draw(bitmap, cliprect, vcblk[5]<<l, 0, screen.priority(), 0); |
| 815 | machine().device<k053250_device>("k053250_2")->draw(bitmap, cliprect, m_vcblk[5]<<l, 0, screen.priority(), 0); |
| 879 | 816 | } |
| 880 | 817 | } |
| 881 | 818 | |
| r241523 | r241524 | |
| 932 | 869 | |
| 933 | 870 | |
| 934 | 871 | m_k055673->k053247_draw_single_sprite_gxcore(bitmap, cliprect, |
| 935 | | gx_objzbuf, gx_shdzbuf, code, gx_spriteram, offs, |
| 872 | m_gx_objzbuf, m_gx_shdzbuf, code, gx_spriteram, offs, |
| 936 | 873 | color, alpha, drawmode, zcode, pri, |
| 937 | 874 | /* non-gx only */ |
| 938 | 875 | 0,0,NULL,NULL,0 |
| r241523 | r241524 | |
| 985 | 922 | |
| 986 | 923 | } |
| 987 | 924 | |
| 988 | | colour = (psac_colorbase << 4) + col; |
| 925 | colour = (m_psac_colorbase << 4) + col; |
| 989 | 926 | |
| 990 | 927 | SET_TILE_INFO_MEMBER(0, tileno, colour, TILE_FLIPYX(flip)); |
| 991 | 928 | } |
| r241523 | r241524 | |
| 1003 | 940 | /* handle this by creating 2 roz tilemaps instead, otherwise performance dies completely on dual screen mode |
| 1004 | 941 | if (konamigx_type3_psac2_actual_bank!=konamigx_type3_psac2_actual_last_bank) |
| 1005 | 942 | { |
| 1006 | | gx_psac_tilemap->mark_all_dirty(); |
| 943 | m_gx_psac_tilemap->mark_all_dirty(); |
| 1007 | 944 | konamigx_type3_psac2_actual_last_bank = konamigx_type3_psac2_actual_bank; |
| 1008 | 945 | } |
| 1009 | 946 | */ |
| r241523 | r241524 | |
| 1106 | 1043 | { |
| 1107 | 1044 | int d = *code; |
| 1108 | 1045 | |
| 1109 | | *code = (gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff); |
| 1046 | *code = (m_gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff); |
| 1110 | 1047 | K055555GX_decode_vmixcolor(layer, color); |
| 1111 | 1048 | } |
| 1112 | 1049 | |
| r241523 | r241524 | |
| 1118 | 1055 | mixcode = K055555GX_decode_vmixcolor(layer, color); |
| 1119 | 1056 | |
| 1120 | 1057 | if (mixcode < 0) |
| 1121 | | *code = (gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff); |
| 1058 | *code = (m_gx_tilebanks[(d & 0xe000)>>13]<<13) + (d & 0x1fff); |
| 1122 | 1059 | else |
| 1123 | 1060 | { |
| 1124 | 1061 | /* save mixcode and mark tile alpha (unimplemented) */ |
| r241523 | r241524 | |
| 1165 | 1102 | |
| 1166 | 1103 | for (int i = 0; i < 8; i++) |
| 1167 | 1104 | { |
| 1168 | | gx_tilebanks[i] = gx_oldbanks[i] = 0; |
| 1105 | m_gx_tilebanks[i] = m_gx_oldbanks[i] = 0; |
| 1169 | 1106 | } |
| 1170 | 1107 | |
| 1171 | | machine().save().save_item(NAME(gx_tilebanks)); |
| 1108 | machine().save().save_item(NAME(m_gx_tilebanks)); |
| 1172 | 1109 | |
| 1173 | | gx_tilemode = 0; |
| 1110 | m_gx_tilemode = 0; |
| 1174 | 1111 | |
| 1175 | | gx_rozenable = 0; |
| 1176 | | gx_specialrozenable = 0; |
| 1177 | | gx_rushingheroes_hack = 0; |
| 1178 | | gx_le2_textcolour_hack = 0; |
| 1112 | m_gx_rozenable = 0; |
| 1113 | m_gx_specialrozenable = 0; |
| 1114 | m_gx_rushingheroes_hack = 0; |
| 1115 | m_gx_le2_textcolour_hack = 0; |
| 1179 | 1116 | |
| 1180 | 1117 | // Documented relative offsets of non-flipped games are (-2, 0, 2, 3),(0, 0, 0, 0). |
| 1181 | 1118 | // (+ve values move layers to the right and -ve values move layers to the left) |
| r241523 | r241524 | |
| 1187 | 1124 | m_k056832->set_layer_offs(2, 2, 0); |
| 1188 | 1125 | m_k056832->set_layer_offs(3, 3, 0); |
| 1189 | 1126 | |
| 1190 | | konamigx_has_dual_screen = 0; |
| 1127 | m_konamigx_has_dual_screen = 0; |
| 1191 | 1128 | m_konamigx_current_frame = 0; |
| 1192 | 1129 | } |
| 1193 | 1130 | |
| r241523 | r241524 | |
| 1197 | 1134 | common_init(); |
| 1198 | 1135 | |
| 1199 | 1136 | if (!strcmp(machine().system().name,"tbyahhoo")) |
| 1200 | | gx_tilemode = 1; |
| 1137 | m_gx_tilemode = 1; |
| 1201 | 1138 | else if (!strcmp(machine().system().name,"crzcross") || !strcmp(machine().system().name,"puzldama")) |
| 1202 | 1139 | konamigx_mixer_primode(5); |
| 1203 | 1140 | else if (!strcmp(machine().system().name,"daiskiss")) |
| r241523 | r241524 | |
| 1220 | 1157 | |
| 1221 | 1158 | konamigx_mixer_primode(-1); // swapped layer B and C priorities? |
| 1222 | 1159 | |
| 1223 | | gx_le2_textcolour_hack = 1; // force text layer to use the right palette |
| 1160 | m_gx_le2_textcolour_hack = 1; // force text layer to use the right palette |
| 1224 | 1161 | } |
| 1225 | 1162 | |
| 1226 | 1163 | VIDEO_START_MEMBER(konamigx_state, konamigx_6bpp) |
| r241523 | r241524 | |
| 1234 | 1171 | int width = m_screen->width(); |
| 1235 | 1172 | int height = m_screen->height(); |
| 1236 | 1173 | |
| 1237 | | dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1238 | | dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1174 | m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1175 | m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1239 | 1176 | |
| 1240 | 1177 | common_init(); |
| 1241 | 1178 | |
| 1242 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256); |
| 1243 | | gx_psac_tilemap_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_alt_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256); |
| 1179 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256); |
| 1180 | m_gx_psac_tilemap_alt = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac3_alt_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 256, 256); |
| 1244 | 1181 | |
| 1245 | | gx_rozenable = 0; |
| 1246 | | gx_specialrozenable = 2; |
| 1182 | m_gx_rozenable = 0; |
| 1183 | m_gx_specialrozenable = 2; |
| 1247 | 1184 | |
| 1248 | 1185 | |
| 1249 | 1186 | /* set up tile layers */ |
| 1250 | | type3_roz_temp_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); |
| 1187 | m_type3_roz_temp_bitmap = auto_bitmap_ind16_alloc(machine(), width, height); |
| 1251 | 1188 | |
| 1252 | 1189 | |
| 1253 | | //gx_psac_tilemap->set_flip(TILEMAP_FLIPX| TILEMAP_FLIPY); |
| 1190 | //m_gx_psac_tilemap->set_flip(TILEMAP_FLIPX| TILEMAP_FLIPY); |
| 1254 | 1191 | |
| 1255 | 1192 | K053936_wraparound_enable(0, 1); |
| 1256 | 1193 | // K053936GP_set_offset(0, -30, -1); |
| r241523 | r241524 | |
| 1261 | 1198 | m_k056832->set_layer_offs(2, -48, 0); |
| 1262 | 1199 | m_k056832->set_layer_offs(3, -48, 0); |
| 1263 | 1200 | |
| 1264 | | konamigx_has_dual_screen = 1; |
| 1265 | | konamigx_palformat = 1; |
| 1201 | m_konamigx_has_dual_screen = 1; |
| 1202 | m_konamigx_palformat = 1; |
| 1266 | 1203 | } |
| 1267 | 1204 | |
| 1268 | 1205 | VIDEO_START_MEMBER(konamigx_state, konamigx_type4) |
| r241523 | r241524 | |
| 1270 | 1207 | int width = m_screen->width(); |
| 1271 | 1208 | int height = m_screen->height(); |
| 1272 | 1209 | |
| 1273 | | dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1274 | | dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1210 | m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1211 | m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1275 | 1212 | |
| 1276 | 1213 | common_init(); |
| 1277 | 1214 | |
| 1278 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1279 | | gx_rozenable = 0; |
| 1280 | | gx_specialrozenable = 3; |
| 1215 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1216 | m_gx_rozenable = 0; |
| 1217 | m_gx_specialrozenable = 3; |
| 1281 | 1218 | |
| 1282 | 1219 | m_k056832->set_layer_offs(0, -27, 0); |
| 1283 | 1220 | m_k056832->set_layer_offs(1, -25, 0); |
| r241523 | r241524 | |
| 1287 | 1224 | K053936_wraparound_enable(0, 0); |
| 1288 | 1225 | K053936GP_set_offset(0, -36, 1); |
| 1289 | 1226 | |
| 1290 | | gx_rushingheroes_hack = 1; |
| 1291 | | konamigx_has_dual_screen = 1; |
| 1292 | | konamigx_palformat = 0; |
| 1227 | m_gx_rushingheroes_hack = 1; |
| 1228 | m_konamigx_has_dual_screen = 1; |
| 1229 | m_konamigx_palformat = 0; |
| 1293 | 1230 | |
| 1294 | 1231 | } |
| 1295 | 1232 | |
| r241523 | r241524 | |
| 1298 | 1235 | int width = m_screen->width(); |
| 1299 | 1236 | int height = m_screen->height(); |
| 1300 | 1237 | |
| 1301 | | dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1302 | | dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1238 | m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1239 | m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1303 | 1240 | |
| 1304 | 1241 | common_init(); |
| 1305 | 1242 | |
| 1306 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1307 | | gx_rozenable = 0; |
| 1308 | | gx_specialrozenable = 3; |
| 1243 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1244 | m_gx_rozenable = 0; |
| 1245 | m_gx_specialrozenable = 3; |
| 1309 | 1246 | |
| 1310 | 1247 | m_k056832->set_layer_offs(0, -52, 0); |
| 1311 | 1248 | m_k056832->set_layer_offs(1, -48, 0); |
| r241523 | r241524 | |
| 1315 | 1252 | K053936_wraparound_enable(0, 1); // wraparound doesn't work properly with the custom drawing function anyway, see the crowd in vsnet and rushhero |
| 1316 | 1253 | K053936GP_set_offset(0, -30, 0); |
| 1317 | 1254 | |
| 1318 | | gx_rushingheroes_hack = 1; |
| 1319 | | konamigx_has_dual_screen = 1; |
| 1320 | | konamigx_palformat = 0; |
| 1255 | m_gx_rushingheroes_hack = 1; |
| 1256 | m_konamigx_has_dual_screen = 1; |
| 1257 | m_konamigx_palformat = 0; |
| 1321 | 1258 | } |
| 1322 | 1259 | |
| 1323 | 1260 | VIDEO_START_MEMBER(konamigx_state, konamigx_type4_sd2) |
| r241523 | r241524 | |
| 1325 | 1262 | int width = m_screen->width(); |
| 1326 | 1263 | int height = m_screen->height(); |
| 1327 | 1264 | |
| 1328 | | dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1329 | | dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1265 | m_dualscreen_left_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1266 | m_dualscreen_right_tempbitmap = auto_bitmap_rgb32_alloc(machine(), width, height); |
| 1330 | 1267 | |
| 1331 | 1268 | common_init(); |
| 1332 | 1269 | |
| 1333 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1334 | | gx_rozenable = 0; |
| 1335 | | gx_specialrozenable = 3; |
| 1270 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1271 | m_gx_rozenable = 0; |
| 1272 | m_gx_specialrozenable = 3; |
| 1336 | 1273 | |
| 1337 | 1274 | |
| 1338 | 1275 | m_k056832->set_layer_offs(0, -29, -1); |
| r241523 | r241524 | |
| 1344 | 1281 | K053936_wraparound_enable(0, 0); |
| 1345 | 1282 | K053936GP_set_offset(0, -36, -1); |
| 1346 | 1283 | |
| 1347 | | gx_rushingheroes_hack = 1; |
| 1348 | | konamigx_has_dual_screen = 1; |
| 1349 | | konamigx_palformat = 0; |
| 1284 | m_gx_rushingheroes_hack = 1; |
| 1285 | m_konamigx_has_dual_screen = 1; |
| 1286 | m_konamigx_palformat = 0; |
| 1350 | 1287 | |
| 1351 | 1288 | } |
| 1352 | 1289 | |
| r241523 | r241524 | |
| 1359 | 1296 | m_k056832->set_layer_offs(2, 2+1, 0); |
| 1360 | 1297 | m_k056832->set_layer_offs(3, 3+1, 0); |
| 1361 | 1298 | |
| 1362 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1363 | | gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1299 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1300 | m_gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1364 | 1301 | |
| 1365 | 1302 | // transparency will be handled manually in post-processing |
| 1366 | | //gx_psac_tilemap->set_transparent_pen(0); |
| 1367 | | //gx_psac_tilemap2->set_transparent_pen(0); |
| 1303 | //m_gx_psac_tilemap->set_transparent_pen(0); |
| 1304 | //m_gx_psac_tilemap2->set_transparent_pen(0); |
| 1368 | 1305 | |
| 1369 | | gx_rozenable = 0; |
| 1370 | | gx_specialrozenable = 1; |
| 1306 | m_gx_rozenable = 0; |
| 1307 | m_gx_specialrozenable = 1; |
| 1371 | 1308 | |
| 1372 | | gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1373 | | gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1309 | m_gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1310 | m_gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1374 | 1311 | |
| 1375 | 1312 | |
| 1376 | | gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); |
| 1313 | m_gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); |
| 1377 | 1314 | |
| 1378 | 1315 | |
| 1379 | 1316 | K053936_wraparound_enable(0, 1); |
| r241523 | r241524 | |
| 1394 | 1331 | m_k056832->set_layer_offs(2, 2+1, 0); |
| 1395 | 1332 | m_k056832->set_layer_offs(3, 3+1, 0); |
| 1396 | 1333 | |
| 1397 | | gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1398 | | gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1334 | m_gx_psac_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1a_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1335 | m_gx_psac_tilemap2 = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(konamigx_state::get_gx_psac1b_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 128); |
| 1399 | 1336 | |
| 1400 | 1337 | // transparency will be handled manually in post-processing |
| 1401 | | //gx_psac_tilemap->set_transparent_pen(0); |
| 1402 | | //gx_psac_tilemap2->set_transparent_pen(0); |
| 1338 | //m_gx_psac_tilemap->set_transparent_pen(0); |
| 1339 | //m_gx_psac_tilemap2->set_transparent_pen(0); |
| 1403 | 1340 | |
| 1404 | | gx_rozenable = 0; |
| 1405 | | gx_specialrozenable = 1; |
| 1341 | m_gx_rozenable = 0; |
| 1342 | m_gx_specialrozenable = 1; |
| 1406 | 1343 | |
| 1407 | | gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1408 | | gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1344 | m_gxtype1_roz_dstbitmap = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1345 | m_gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine(),512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing |
| 1409 | 1346 | |
| 1410 | 1347 | |
| 1411 | | gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); |
| 1348 | m_gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); |
| 1412 | 1349 | |
| 1413 | 1350 | |
| 1414 | 1351 | K053936_wraparound_enable(0, 1); |
| r241523 | r241524 | |
| 1428 | 1365 | /* if any banks are different from last render, we need to flush the planes */ |
| 1429 | 1366 | for (dirty = 0, i = 0; i < 8; i++) |
| 1430 | 1367 | { |
| 1431 | | newbank = gx_tilebanks[i]; |
| 1432 | | if (gx_oldbanks[i] != newbank) { gx_oldbanks[i] = newbank; dirty = 1; } |
| 1368 | newbank = m_gx_tilebanks[i]; |
| 1369 | if (m_gx_oldbanks[i] != newbank) { m_gx_oldbanks[i] = newbank; dirty = 1; } |
| 1433 | 1370 | } |
| 1434 | 1371 | |
| 1435 | | if (gx_tilemode == 0) |
| 1372 | if (m_gx_tilemode == 0) |
| 1436 | 1373 | { |
| 1437 | 1374 | // driver approximates tile update in mode 0 for speed |
| 1438 | 1375 | unchained = m_k056832->get_layer_association(); |
| 1439 | 1376 | for (i=0; i<4; i++) |
| 1440 | 1377 | { |
| 1441 | 1378 | newbase = m_k055555->K055555_get_palette_index(i)<<6; |
| 1442 | | if (layer_colorbase[i] != newbase) |
| 1379 | if (m_layer_colorbase[i] != newbase) |
| 1443 | 1380 | { |
| 1444 | | layer_colorbase[i] = newbase; |
| 1381 | m_layer_colorbase[i] = newbase; |
| 1445 | 1382 | |
| 1446 | 1383 | if (unchained) |
| 1447 | 1384 | m_k056832->mark_plane_dirty(i); |
| r241523 | r241524 | |
| 1456 | 1393 | } |
| 1457 | 1394 | |
| 1458 | 1395 | // sub2 is PSAC colorbase on GX |
| 1459 | | if (gx_rozenable) |
| 1396 | if (m_gx_rozenable) |
| 1460 | 1397 | { |
| 1461 | | last_psac_colorbase = psac_colorbase; |
| 1462 | | psac_colorbase = m_k055555->K055555_get_palette_index(6); |
| 1398 | m_last_psac_colorbase = m_psac_colorbase; |
| 1399 | m_psac_colorbase = m_k055555->K055555_get_palette_index(6); |
| 1463 | 1400 | |
| 1464 | | if (psac_colorbase != last_psac_colorbase) |
| 1401 | if (m_psac_colorbase != m_last_psac_colorbase) |
| 1465 | 1402 | { |
| 1466 | | gx_psac_tilemap->mark_all_dirty(); |
| 1467 | | if (gx_rozenable == 3) |
| 1403 | m_gx_psac_tilemap->mark_all_dirty(); |
| 1404 | if (m_gx_rozenable == 3) |
| 1468 | 1405 | { |
| 1469 | | gx_psac_tilemap2->mark_all_dirty(); |
| 1406 | m_gx_psac_tilemap2->mark_all_dirty(); |
| 1470 | 1407 | } |
| 1471 | 1408 | } |
| 1472 | 1409 | } |
| r241523 | r241524 | |
| 1474 | 1411 | if (dirty) m_k056832->mark_all_tilemaps_dirty(); |
| 1475 | 1412 | |
| 1476 | 1413 | // Type-1 |
| 1477 | | if (gx_specialrozenable == 1) |
| 1414 | if (m_gx_specialrozenable == 1) |
| 1478 | 1415 | { |
| 1479 | | K053936_0_zoom_draw(screen, *gxtype1_roz_dstbitmap, gxtype1_roz_dstbitmapclip,gx_psac_tilemap, 0,0,0); // height data |
| 1480 | | K053936_0_zoom_draw(screen, *gxtype1_roz_dstbitmap2,gxtype1_roz_dstbitmapclip,gx_psac_tilemap2,0,0,0); // colour data (+ some voxel height data?) |
| 1416 | K053936_0_zoom_draw(screen, *m_gxtype1_roz_dstbitmap, m_gxtype1_roz_dstbitmapclip,m_gx_psac_tilemap, 0,0,0); // height data |
| 1417 | K053936_0_zoom_draw(screen, *m_gxtype1_roz_dstbitmap2,m_gxtype1_roz_dstbitmapclip,m_gx_psac_tilemap2,0,0,0); // colour data (+ some voxel height data?) |
| 1481 | 1418 | } |
| 1482 | 1419 | |
| 1483 | 1420 | |
| 1484 | 1421 | |
| 1485 | | if (gx_specialrozenable==3) |
| 1422 | if (m_gx_specialrozenable==3) |
| 1486 | 1423 | { |
| 1487 | | konamigx_mixer(screen, bitmap, cliprect, gx_psac_tilemap, GXSUB_8BPP,0,0, 0, 0, gx_rushingheroes_hack); |
| 1424 | konamigx_mixer(screen, bitmap, cliprect, m_gx_psac_tilemap, GXSUB_8BPP,0,0, 0, 0, m_gx_rushingheroes_hack); |
| 1488 | 1425 | } |
| 1489 | 1426 | // hack, draw the roz tilemap if W is held |
| 1490 | 1427 | // todo: fix so that it works with the mixer without crashing(!) |
| 1491 | | else if (gx_specialrozenable == 2) |
| 1428 | else if (m_gx_specialrozenable == 2) |
| 1492 | 1429 | { |
| 1493 | 1430 | // we're going to throw half of this away anyway in post-process, so only render what's needed |
| 1494 | 1431 | rectangle temprect; |
| 1495 | 1432 | temprect = cliprect; |
| 1496 | 1433 | temprect.max_x = cliprect.min_x+320; |
| 1497 | 1434 | |
| 1498 | | if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(screen, *type3_roz_temp_bitmap, temprect,gx_psac_tilemap_alt, 0,0,0); // soccerss playfield |
| 1499 | | else K053936_0_zoom_draw(screen, *type3_roz_temp_bitmap, temprect,gx_psac_tilemap, 0,0,0); // soccerss playfield |
| 1435 | if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap_alt, 0,0,0); // soccerss playfield |
| 1436 | else K053936_0_zoom_draw(screen, *m_type3_roz_temp_bitmap, temprect,m_gx_psac_tilemap, 0,0,0); // soccerss playfield |
| 1500 | 1437 | |
| 1501 | 1438 | |
| 1502 | | konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, type3_roz_temp_bitmap, gx_rushingheroes_hack); |
| 1439 | konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, m_type3_roz_temp_bitmap, m_gx_rushingheroes_hack); |
| 1503 | 1440 | } |
| 1504 | 1441 | else |
| 1505 | 1442 | { |
| 1506 | | konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, 0, gx_rushingheroes_hack); |
| 1443 | konamigx_mixer(screen, bitmap, cliprect, 0, 0, 0, 0, 0, 0, m_gx_rushingheroes_hack); |
| 1507 | 1444 | } |
| 1508 | 1445 | |
| 1509 | 1446 | |
| 1510 | 1447 | |
| 1511 | 1448 | /* Hack! draw type-1 roz layer here for testing purposes only */ |
| 1512 | | if (gx_specialrozenable == 1) |
| 1449 | if (m_gx_specialrozenable == 1) |
| 1513 | 1450 | { |
| 1514 | 1451 | const pen_t *paldata = m_palette->pens(); |
| 1515 | 1452 | |
| r241523 | r241524 | |
| 1522 | 1459 | { |
| 1523 | 1460 | for (y=0;y<256;y++) |
| 1524 | 1461 | { |
| 1525 | | //UINT16* src = &gxtype1_roz_dstbitmap->pix16(y); |
| 1462 | //UINT16* src = &m_gxtype1_roz_dstbitmap->pix16(y); |
| 1526 | 1463 | |
| 1527 | 1464 | //UINT32* dst = &bitmap.pix32(y); |
| 1528 | 1465 | // ths K053936 rendering should probably just be flipped |
| 1529 | 1466 | // this is just kludged to align the racing force 2d logo |
| 1530 | | UINT16* src = &gxtype1_roz_dstbitmap2->pix16(y+30); |
| 1467 | UINT16* src = &m_gxtype1_roz_dstbitmap2->pix16(y+30); |
| 1531 | 1468 | UINT32* dst = &bitmap.pix32(256-y); |
| 1532 | 1469 | |
| 1533 | 1470 | for (x=0;x<512;x++) |
| r241523 | r241524 | |
| 1554 | 1491 | { |
| 1555 | 1492 | int offset=0; |
| 1556 | 1493 | |
| 1557 | | if (konamigx_palformat==1) |
| 1494 | if (m_konamigx_palformat==1) |
| 1558 | 1495 | { |
| 1559 | 1496 | for (offset=0;offset<0x4000/4;offset++) |
| 1560 | 1497 | { |
| r241523 | r241524 | |
| 1578 | 1515 | } |
| 1579 | 1516 | } |
| 1580 | 1517 | |
| 1581 | | screen_update_konamigx( screen, downcast<bitmap_rgb32 &>(*dualscreen_left_tempbitmap), cliprect); |
| 1582 | | copybitmap(bitmap, *dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1518 | screen_update_konamigx( screen, downcast<bitmap_rgb32 &>(*m_dualscreen_left_tempbitmap), cliprect); |
| 1519 | copybitmap(bitmap, *m_dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1583 | 1520 | } |
| 1584 | 1521 | else |
| 1585 | 1522 | { |
| 1586 | | copybitmap(bitmap, *dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1523 | copybitmap(bitmap, *m_dualscreen_left_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1587 | 1524 | } |
| 1588 | 1525 | |
| 1589 | 1526 | return 0; |
| r241523 | r241524 | |
| 1593 | 1530 | { |
| 1594 | 1531 | if (m_konamigx_current_frame==1) |
| 1595 | 1532 | { |
| 1596 | | copybitmap(bitmap, *dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1533 | copybitmap(bitmap, *m_dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1597 | 1534 | } |
| 1598 | 1535 | else |
| 1599 | 1536 | { |
| 1600 | 1537 | int offset=0; |
| 1601 | 1538 | |
| 1602 | | if (konamigx_palformat==1) |
| 1539 | if (m_konamigx_palformat==1) |
| 1603 | 1540 | { |
| 1604 | 1541 | for (offset=0;offset<0x4000/4;offset++) |
| 1605 | 1542 | { |
| r241523 | r241524 | |
| 1623 | 1560 | } |
| 1624 | 1561 | } |
| 1625 | 1562 | |
| 1626 | | screen_update_konamigx(screen, downcast<bitmap_rgb32 &>(*dualscreen_right_tempbitmap), cliprect); |
| 1627 | | copybitmap(bitmap, *dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1563 | screen_update_konamigx(screen, downcast<bitmap_rgb32 &>(*m_dualscreen_right_tempbitmap), cliprect); |
| 1564 | copybitmap(bitmap, *m_dualscreen_right_tempbitmap, 0, 0, 0, 0, cliprect); |
| 1628 | 1565 | } |
| 1629 | 1566 | |
| 1630 | 1567 | return 0; |
| r241523 | r241524 | |
| 1697 | 1634 | WRITE32_MEMBER(konamigx_state::konamigx_tilebank_w) |
| 1698 | 1635 | { |
| 1699 | 1636 | if (ACCESSING_BITS_24_31) |
| 1700 | | gx_tilebanks[offset*4] = (data>>24)&0xff; |
| 1637 | m_gx_tilebanks[offset*4] = (data>>24)&0xff; |
| 1701 | 1638 | if (ACCESSING_BITS_16_23) |
| 1702 | | gx_tilebanks[offset*4+1] = (data>>16)&0xff; |
| 1639 | m_gx_tilebanks[offset*4+1] = (data>>16)&0xff; |
| 1703 | 1640 | if (ACCESSING_BITS_8_15) |
| 1704 | | gx_tilebanks[offset*4+2] = (data>>8)&0xff; |
| 1641 | m_gx_tilebanks[offset*4+2] = (data>>8)&0xff; |
| 1705 | 1642 | if (ACCESSING_BITS_0_7) |
| 1706 | | gx_tilebanks[offset*4+3] = data&0xff; |
| 1643 | m_gx_tilebanks[offset*4+3] = data&0xff; |
| 1707 | 1644 | } |
| 1708 | 1645 | |
| 1709 | 1646 | // type 1 RAM-based PSAC tilemap |
| 1710 | 1647 | WRITE32_MEMBER(konamigx_state::konamigx_t1_psacmap_w) |
| 1711 | 1648 | { |
| 1712 | 1649 | COMBINE_DATA(&m_psacram[offset]); |
| 1713 | | gx_psac_tilemap->mark_tile_dirty(offset/2); |
| 1714 | | gx_psac_tilemap2->mark_tile_dirty(offset/2); |
| 1650 | m_gx_psac_tilemap->mark_tile_dirty(offset/2); |
| 1651 | m_gx_psac_tilemap2->mark_tile_dirty(offset/2); |
| 1715 | 1652 | } |
| 1716 | 1653 | |
| 1717 | 1654 | // type 4 RAM-based PSAC tilemap |
| r241523 | r241524 | |
| 1719 | 1656 | { |
| 1720 | 1657 | COMBINE_DATA(&m_psacram[offset]); |
| 1721 | 1658 | |
| 1722 | | gx_psac_tilemap->mark_tile_dirty(offset*2); |
| 1723 | | gx_psac_tilemap->mark_tile_dirty((offset*2)+1); |
| 1659 | m_gx_psac_tilemap->mark_tile_dirty(offset*2); |
| 1660 | m_gx_psac_tilemap->mark_tile_dirty((offset*2)+1); |
| 1724 | 1661 | } |