trunk/src/mame/drivers/cobra.c
r17401 | r17402 | |
280 | 280 | #include "machine/timekpr.h" |
281 | 281 | #include "machine/jvshost.h" |
282 | 282 | #include "machine/jvsdev.h" |
| 283 | #include "video/konicdev.h" |
283 | 284 | #include "video/polynew.h" |
284 | 285 | #include "sound/rf5c400.h" |
285 | 286 | |
286 | 287 | #define GFXFIFO_IN_VERBOSE 0 |
287 | 288 | #define GFXFIFO_OUT_VERBOSE 0 |
288 | | #define M2SFIFO_VERBOSE 0 |
289 | | #define S2MFIFO_VERBOSE 0 |
| 289 | #define M2SFIFO_VERBOSE 1 |
| 290 | #define S2MFIFO_VERBOSE 1 |
290 | 291 | |
291 | 292 | |
292 | 293 | /* Cobra Renderer class */ |
r17401 | r17402 | |
564 | 565 | DECLARE_WRITE32_MEMBER(sub_ata1_w); |
565 | 566 | DECLARE_READ32_MEMBER(sub_psac2_r); |
566 | 567 | DECLARE_WRITE32_MEMBER(sub_psac2_w); |
| 568 | DECLARE_WRITE32_MEMBER(sub_psac_palette_w); |
567 | 569 | |
568 | 570 | DECLARE_WRITE64_MEMBER(gfx_fifo0_w); |
569 | 571 | DECLARE_WRITE64_MEMBER(gfx_fifo1_w); |
r17401 | r17402 | |
631 | 633 | int m_gfx_unknown_v1; |
632 | 634 | int m_gfx_status_byte; |
633 | 635 | |
| 636 | bool m_has_psac; |
| 637 | |
634 | 638 | DECLARE_DRIVER_INIT(racjamdx); |
635 | 639 | DECLARE_DRIVER_INIT(bujutsu); |
636 | 640 | DECLARE_DRIVER_INIT(cobra); |
r17401 | r17402 | |
766 | 770 | { |
767 | 771 | cobra_state *cobra = screen.machine().driver_data<cobra_state>(); |
768 | 772 | |
| 773 | if (cobra->m_has_psac) |
| 774 | { |
| 775 | device_t *k001604 = screen.machine().device("k001604"); |
| 776 | |
| 777 | k001604_draw_back_layer(k001604, bitmap, cliprect); |
| 778 | k001604_draw_front_layer(k001604, bitmap, cliprect); |
| 779 | } |
| 780 | |
769 | 781 | cobra->m_renderer->display(&bitmap, cliprect); |
770 | 782 | return 0; |
771 | 783 | } |
r17401 | r17402 | |
1652 | 1664 | COMBINE_DATA(m_comram[page] + offset); |
1653 | 1665 | } |
1654 | 1666 | |
| 1667 | WRITE32_MEMBER(cobra_state::sub_psac_palette_w) |
| 1668 | { |
| 1669 | COMBINE_DATA(&m_generic_paletteram_32[offset]); |
| 1670 | data = m_generic_paletteram_32[offset]; |
| 1671 | palette_set_color_rgb(machine(), offset, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 1672 | } |
| 1673 | |
1655 | 1674 | READ32_MEMBER(cobra_state::sub_psac2_r) |
1656 | 1675 | { |
1657 | 1676 | m_sub_psac_count++; |
r17401 | r17402 | |
1691 | 1710 | |
1692 | 1711 | if (rec_size > 0) |
1693 | 1712 | { |
| 1713 | /* |
1694 | 1714 | printf("jvs reply "); |
1695 | 1715 | for (int i=0; i < rec_size; i++) |
1696 | 1716 | { |
1697 | 1717 | printf("%02X ", rec_data[i]); |
1698 | 1718 | } |
1699 | 1719 | printf("\n"); |
| 1720 | */ |
| 1721 | |
| 1722 | for (int i=0; i < rec_size; i++) |
| 1723 | { |
| 1724 | ppc4xx_spu_receive_byte(device, rec_data[i]); |
| 1725 | } |
1700 | 1726 | } |
1701 | 1727 | } |
1702 | 1728 | |
r17401 | r17402 | |
1707 | 1733 | AM_RANGE(0x78040000, 0x7804ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE16_LEGACY("rfsnd", rf5c400_r, rf5c400_w, 0xffffffff) |
1708 | 1734 | AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE(sub_ata0_r, sub_ata0_w) |
1709 | 1735 | AM_RANGE(0x780c0010, 0x780c001f) AM_MIRROR(0x80000000) AM_READWRITE(sub_ata1_r, sub_ata1_w) |
1710 | | AM_RANGE(0x78220000, 0x7823ffff) AM_MIRROR(0x80000000) AM_RAM // PSAC RAM |
1711 | | AM_RANGE(0x78240000, 0x78241fff) AM_MIRROR(0x80000000) AM_RAM // PSAC unknown |
| 1736 | AM_RANGE(0x78200000, 0x782000ff) AM_MIRROR(0x80000000) AM_DEVREADWRITE_LEGACY("k001604", k001604_reg_r, k001604_reg_w) // PSAC registers |
| 1737 | AM_RANGE(0x78210000, 0x78217fff) AM_MIRROR(0x80000000) AM_RAM_WRITE(sub_psac_palette_w) AM_SHARE("paletteram") // PSAC palette RAM |
| 1738 | AM_RANGE(0x78220000, 0x7823ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE_LEGACY("k001604", k001604_tile_r, k001604_tile_w) // PSAC tile RAM |
| 1739 | AM_RANGE(0x78240000, 0x7827ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE_LEGACY("k001604", k001604_char_r, k001604_char_w) // PSAC character RAM |
1712 | 1740 | AM_RANGE(0x78300000, 0x7830000f) AM_MIRROR(0x80000000) AM_READWRITE(sub_psac2_r, sub_psac2_w) // PSAC |
1713 | 1741 | AM_RANGE(0x7e000000, 0x7e000003) AM_MIRROR(0x80000000) AM_READWRITE(sub_unk7e_r, sub_debug_w) |
1714 | 1742 | AM_RANGE(0x7e040000, 0x7e041fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8_LEGACY("m48t58", timekeeper_r, timekeeper_w, 0xffffffff) /* M48T58Y RTC/NVRAM */ |
1715 | 1743 | AM_RANGE(0x7e180000, 0x7e180003) AM_MIRROR(0x80000000) AM_READWRITE(sub_unk1_r, sub_unk1_w) // TMS57002? |
1716 | 1744 | AM_RANGE(0x7e200000, 0x7e200003) AM_MIRROR(0x80000000) AM_READWRITE(sub_config_r, sub_config_w) |
1717 | | // AM_RANGE(0x7e240000, 0x7e27ffff) AM_MIRROR(0x80000000) AM_RAM // PSAC (ROZ) in Racing Jam. |
1718 | 1745 | // AM_RANGE(0x7e280000, 0x7e28ffff) AM_MIRROR(0x80000000) AM_RAM // LANC |
1719 | 1746 | // AM_RANGE(0x7e300000, 0x7e30ffff) AM_MIRROR(0x80000000) AM_RAM // LANC |
1720 | 1747 | AM_RANGE(0x7e380000, 0x7e380003) AM_MIRROR(0x80000000) AM_READWRITE(sub_mainbd_r, sub_mainbd_w) |
r17401 | r17402 | |
2745 | 2772 | }; |
2746 | 2773 | |
2747 | 2774 | |
| 2775 | static const k001604_interface cobra_k001604_intf = |
| 2776 | { |
| 2777 | 0, 1, /* gfx index 1 & 2 */ |
| 2778 | 0, 1, /* layer_size, roz_size */ |
| 2779 | 0 /* slrasslt hack */ |
| 2780 | }; |
| 2781 | |
| 2782 | |
2748 | 2783 | static void ide_interrupt(device_t *device, int state) |
2749 | 2784 | { |
2750 | 2785 | cobra_state *cobra = device->machine().driver_data<cobra_state>(); |
r17401 | r17402 | |
2831 | 2866 | |
2832 | 2867 | MCFG_M48T58_ADD("m48t58") |
2833 | 2868 | |
| 2869 | MCFG_K001604_ADD("k001604", cobra_k001604_intf) // on the LAN board in Racing Jam DX |
| 2870 | |
2834 | 2871 | MCFG_DEVICE_ADD("cobra_jvs_host", COBRA_JVS_HOST, 4000000) |
2835 | 2872 | MCFG_JVS_DEVICE_ADD("cobra_jvs", COBRA_JVS, "cobra_jvs_host") |
2836 | 2873 | |
r17401 | r17402 | |
2957 | 2994 | |
2958 | 2995 | // hd patches |
2959 | 2996 | // 0x18932c = 0x38600000 skips check_one_scene() |
| 2997 | |
| 2998 | m_has_psac = false; |
2960 | 2999 | } |
2961 | 3000 | |
2962 | 3001 | DRIVER_INIT_MEMBER(cobra_state,racjamdx) |
r17401 | r17402 | |
2967 | 3006 | { |
2968 | 3007 | UINT32 *rom = (UINT32*)machine().root_device().memregion("user2")->base(); |
2969 | 3008 | |
2970 | | rom[0x62094 / 4] = 0x60000000; // skip hardcheck()... |
| 3009 | //rom[0x62094 / 4] = 0x60000000; // skip hardcheck()... |
2971 | 3010 | rom[0x62ddc / 4] = 0x60000000; // skip lanc_hardcheck() |
2972 | 3011 | |
2973 | 3012 | |
r17401 | r17402 | |
3034 | 3073 | rom[0x0e] = (UINT8)(sum >> 8); |
3035 | 3074 | rom[0x0f] = (UINT8)(sum); |
3036 | 3075 | } |
| 3076 | |
| 3077 | m_has_psac = true; |
3037 | 3078 | } |
3038 | 3079 | |
3039 | 3080 | /*****************************************************************************/ |