trunk/src/mame/drivers/cobra.c
| r17531 | r17532 | |
| 1 | 1 | /* Konami Cobra System |
| 2 | 2 | |
| 3 | Driver by Ville Linde |
| 3 | 4 | |
| 5 | |
| 4 | 6 | Games on this hardware |
| 5 | 7 | ---------------------- |
| 6 | 8 | |
| r17531 | r17532 | |
| 158 | 160 | |
| 159 | 161 | 0x0011c: Same as above? |
| 160 | 162 | |
| 163 | 0x00454: (mask 0xff) 0x80000000 Tex related |
| 164 | |
| 161 | 165 | 0x00458: Set to 0x02100000 (0xff) by texselect() |
| 162 | 166 | |
| 163 | | 0x02904: -------- ------xx xx------ -------- Tex mag filter? |
| 164 | | -------- -------- --xxxx-- -------- Tex min filter? |
| 167 | ------xx -------- -------- -------- Texture select (0-3) |
| 168 | -------- ---x---- -------- -------- ? |
| 165 | 169 | |
| 166 | | 0x02908: -------- ----xxx- -------- -------- Tex wrap S (0 = repeat, 1 = mirror, 2 = clamp) |
| 167 | | -------- -------x xx------ -------- Tex wrap T |
| 170 | 0x02900: -------- -------- -------- -------- Texture[0] ? |
| 168 | 171 | |
| 169 | | 0x02910: xxxx---- -------- -------- -------- Texture width shift (size = 1 << X) |
| 170 | | ----xxxx -------- -------- -------- Texture height shift (size = 1 << X) |
| 172 | 0x02904: -------- ------xx xx------ -------- Texture[0] mag filter? |
| 173 | -------- -------- --xxxx-- -------- Texture[0] min filter? |
| 174 | |
| 175 | 0x02908: -------- ----xxx- -------- -------- Texture[0] wrap S (0 = repeat, 1 = mirror, 2 = clamp) |
| 176 | -------- -------x xx------ -------- Texture[0] wrap T |
| 177 | |
| 178 | 0x02910: xxxx---- -------- -------- -------- Texture[0] width shift (size = 1 << X) |
| 179 | ----xxxx -------- -------- -------- Texture[0] height shift (size = 1 << X) |
| 171 | 180 | -------- ----x--- -------- -------- ? |
| 172 | 181 | -------- -------- -x------ -------- ? |
| 173 | | -------- -------- -------- xxx----- Texture format (texel size, 2 = 4-bit, 3 = 8-bit, 4 = 16-bit) |
| 174 | | -------- -------- -------- ---xxx-- Texture format param |
| 182 | -------- -------- -------- xxx----- Texture[0] format (texel size, 2 = 4-bit, 3 = 8-bit, 4 = 16-bit) |
| 183 | -------- -------- -------- ---xxx-- Texture[0] format param |
| 175 | 184 | |
| 176 | | 0x02914: --xxxxxx xxxxxxxx xx------ -------- ? (texture param, set to 0x1243) |
| 185 | 0x02914: xxxxxxxx xxxxxxxx xxxx---- -------- Texture[0] address |
| 177 | 186 | |
| 187 | 0x02980: Texture[1] ? |
| 188 | 0x02984: Texture[1] min/mag filter |
| 189 | 0x02988: Texture[1] wrap |
| 190 | 0x02990: Texture[1] width/height/format |
| 191 | 0x02994: Texture[1] address |
| 192 | |
| 193 | 0x02a00: Texture[2] ? |
| 194 | 0x02a04: Texture[2] min/mag filter |
| 195 | 0x02a08: Texture[2] wrap |
| 196 | 0x02a10: Texture[2] width/height/format |
| 197 | 0x02a14: Texture[2] address |
| 198 | |
| 199 | 0x02a80: Texture[3] ? |
| 200 | 0x02a84: Texture[3] min/mag filter |
| 201 | 0x02a88: Texture[3] wrap |
| 202 | 0x02a90: Texture[3] width/height/format |
| 203 | 0x02a94: Texture[3] address |
| 204 | |
| 178 | 205 | 0x40018: Set to 0x0001040a (0xc0) by mode_stipple() (bits 24..27 = stipple pattern?) |
| 179 | 206 | 0x400d0: Set to 0x80000000 (0x80) by mode_stipple() |
| 180 | | 0x400f4: Set to 0x40000000 (0x80) by texselect() |
| 181 | 207 | |
| 208 | 0x400f4: xxx----- -------- -------- -------- Texture select (0-3) |
| 209 | |
| 210 | xxx----- -------- -------- -------- ? |
| 211 | |
| 182 | 212 | 0x40114: -------- ----x--- -------- -------- Scissor enable |
| 183 | 213 | |
| 184 | 214 | 0x40138: Set to 0x88800000 (0xe0) by mode_viewclip() |
| r17531 | r17532 | |
| 198 | 228 | 0x40198: x------- -------- -------- -------- Alpha test enable? |
| 199 | 229 | -------- xxx----- -------- -------- Alpha test function (0 = never, 1 = less, 2 = lequal, 3 = greater, |
| 200 | 230 | 4 = gequal, 5 = equal, 6 = notequal, 7 = always) |
| 231 | -------- -------- xxxxxxxx xxxxxxxx Alpha test reference value? |
| 201 | 232 | |
| 202 | 233 | 0x4019c: x------- -------- -------- -------- Fog enable |
| 203 | 234 | ----x--- -------- -------- -------- 0 = table fog, 1 = linear fog |
| 204 | 235 | |
| 236 | 0x401a8: (mask 0xff): 0x2CAB34FD ? |
| 237 | 0x401ac: (mask 0xf0): 0x48C70000 ? |
| 238 | 0x401b8: (mask 0x20): 0x00400000 ? |
| 239 | |
| 205 | 240 | 0x401bc: Texture env mode |
| 206 | 241 | xxx----- -------- -------- -------- ? |
| 207 | 242 | ---xxx-- -------- -------- -------- ? |
| r17531 | r17532 | |
| 216 | 251 | 0xa92b0100 = (equal, 16) |
| 217 | 252 | |
| 218 | 253 | -------- -------- xxxxxxxx xxxx---- Stencil reference value? |
| 254 | ----xxxx xxxxxxxx -------- -------- Stencil fill value? |
| 219 | 255 | xxx----- -------- -------- -------- Stencil function? |
| 220 | 256 | |
| 221 | 257 | |
| 222 | 258 | 0x80020: -------- ----xxx- -------- -------- Depth test function (7 = always?) |
| 223 | 259 | |
| 260 | 0x80040: (mask 0x0f) 0x00002CAB (same value as 0x401a8) |
| 261 | 0x80044: (mask 0x0f) 0x000034FD (same value as 0x401a8) |
| 262 | 0x80048: (mask 0x0f) 0x000048C7 (same value as 0x401ac) |
| 263 | |
| 224 | 264 | 0x80050: (mask 0x7c) 0x04445500 = (As, 1-As) Blend register |
| 225 | 265 | 0x04111100 = (1, 1) |
| 226 | 266 | 0x04441100 = (As, 1) |
| r17531 | r17532 | |
| 284 | 324 | #include "video/polynew.h" |
| 285 | 325 | #include "sound/rf5c400.h" |
| 286 | 326 | |
| 287 | | #define GFXFIFO_IN_VERBOSE 0 |
| 288 | | #define GFXFIFO_OUT_VERBOSE 0 |
| 289 | | #define M2SFIFO_VERBOSE 1 |
| 290 | | #define S2MFIFO_VERBOSE 1 |
| 327 | #define GFXFIFO_IN_VERBOSE 0 |
| 328 | #define GFXFIFO_OUT_VERBOSE 0 |
| 329 | #define M2SFIFO_VERBOSE 0 |
| 330 | #define S2MFIFO_VERBOSE 0 |
| 291 | 331 | |
| 332 | #define LOG_DEBUG_STATES 0 |
| 333 | #define LOG_JVS 0 |
| 334 | #define LOG_GFX_RAM_WRITES 0 |
| 335 | #define LOG_DRAW_COMMANDS 0 |
| 292 | 336 | |
| 337 | |
| 293 | 338 | /* Cobra Renderer class */ |
| 294 | 339 | |
| 295 | 340 | struct cobra_polydata |
| 296 | 341 | { |
| 342 | UINT32 alpha_test; |
| 343 | UINT32 zmode; |
| 344 | UINT32 tex_format; |
| 345 | UINT32 tex_address; |
| 297 | 346 | }; |
| 298 | 347 | |
| 299 | | class cobra_renderer : public poly_manager<float, cobra_polydata, 6, 10000> |
| 348 | class cobra_renderer : public poly_manager<float, cobra_polydata, 8, 10000> |
| 300 | 349 | { |
| 301 | 350 | public: |
| 302 | 351 | cobra_renderer(running_machine &machine) |
| 303 | | : poly_manager<float, cobra_polydata, 6, 10000>(machine) |
| 352 | : poly_manager<float, cobra_polydata, 8, 10000>(machine) |
| 304 | 353 | { |
| 305 | 354 | m_texture_ram = auto_alloc_array(machine, UINT32, 0x100000); |
| 306 | 355 | |
| r17531 | r17532 | |
| 338 | 387 | void gfx_fifo_exec(running_machine &machine); |
| 339 | 388 | UINT32 gfx_read_gram(UINT32 address); |
| 340 | 389 | void gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data); |
| 390 | UINT64 gfx_read_reg(running_machine &machine); |
| 391 | void gfx_write_reg(running_machine &machine, UINT64 data); |
| 341 | 392 | |
| 342 | 393 | void display(bitmap_rgb32 *bitmap, const rectangle &cliprect); |
| 343 | 394 | |
| r17531 | r17532 | |
| 352 | 403 | |
| 353 | 404 | UINT32 *m_gfx_gram; |
| 354 | 405 | UINT32 *m_gfx_regmask; |
| 406 | |
| 407 | UINT32 m_gfx_register_select; |
| 408 | UINT64 *m_gfx_register; |
| 355 | 409 | |
| 410 | UINT32 m_texram_ptr; |
| 411 | |
| 356 | 412 | enum |
| 357 | 413 | { |
| 358 | 414 | RE_STATUS_IDLE = 0, |
| 359 | 415 | RE_STATUS_COMMAND = 1, |
| 360 | 416 | }; |
| 417 | |
| 418 | enum |
| 419 | { |
| 420 | POLY_Z = 0, |
| 421 | POLY_R = 1, |
| 422 | POLY_G = 2, |
| 423 | POLY_B = 3, |
| 424 | POLY_A = 4, |
| 425 | POLY_U = 5, |
| 426 | POLY_V = 6, |
| 427 | POLY_W = 7, |
| 428 | }; |
| 361 | 429 | }; |
| 362 | 430 | |
| 363 | 431 | |
| r17531 | r17532 | |
| 433 | 501 | |
| 434 | 502 | bool cobra_jvs::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) |
| 435 | 503 | { |
| 504 | #if LOG_JVS |
| 436 | 505 | printf("jvs switch read: num players %d, bytes %d\n", count_players, bytes_per_switch); |
| 506 | #endif |
| 437 | 507 | |
| 438 | 508 | if (count_players > 2 || bytes_per_switch > 2) |
| 439 | 509 | return false; |
| r17531 | r17532 | |
| 455 | 525 | |
| 456 | 526 | bool cobra_jvs::coin_counters(UINT8 *&buf, UINT8 count) |
| 457 | 527 | { |
| 528 | #if LOG_JVS |
| 458 | 529 | printf("jvs coin counter read: count %d\n", count); |
| 530 | #endif |
| 459 | 531 | |
| 460 | 532 | if (count > 2) |
| 461 | 533 | return false; |
| r17531 | r17532 | |
| 625 | 697 | int m_gfx_re_status; |
| 626 | 698 | UINT32 m_gfx_unk_status; |
| 627 | 699 | |
| 628 | | int m_gfx_register_select; |
| 629 | | UINT64 *m_gfx_register; |
| 630 | 700 | UINT64 m_gfx_fifo_mem[256]; |
| 631 | 701 | int m_gfx_fifo_cache_addr; |
| 632 | 702 | int m_gfx_fifo_loopback; |
| r17531 | r17532 | |
| 642 | 712 | |
| 643 | 713 | void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) |
| 644 | 714 | { |
| 645 | | UINT32 *fb = &m_framebuffer->pix32(scanline); |
| 715 | UINT32 *fb = &m_backbuffer->pix32(scanline); |
| 716 | float *zb = (float*)&m_zbuffer->pix32(scanline); |
| 646 | 717 | |
| 647 | | UINT32 color = 0xff000000; // TODO |
| 718 | float z = extent.param[POLY_Z].start; |
| 719 | float dz = extent.param[POLY_Z].dpdx; |
| 648 | 720 | |
| 721 | float gr = extent.param[POLY_R].start; |
| 722 | float dgr = extent.param[POLY_R].dpdx; |
| 723 | float gg = extent.param[POLY_G].start; |
| 724 | float dgg = extent.param[POLY_G].dpdx; |
| 725 | float gb = extent.param[POLY_B].start; |
| 726 | float dgb = extent.param[POLY_B].dpdx; |
| 727 | float ga = extent.param[POLY_A].start; |
| 728 | float dga = extent.param[POLY_A].dpdx; |
| 729 | |
| 730 | UINT32 zmode = extradata.zmode; |
| 731 | |
| 649 | 732 | for (int x = extent.startx; x < extent.stopx; x++) |
| 650 | 733 | { |
| 651 | | fb[x] = color; |
| 734 | if (z <= zb[x] || zmode == 7) |
| 735 | { |
| 736 | UINT32 r = (int)(gr); |
| 737 | UINT32 g = (int)(gg); |
| 738 | UINT32 b = (int)(gb); |
| 739 | |
| 740 | if (r > 255) r = 255; |
| 741 | if (g > 255) g = 255; |
| 742 | if (b > 255) b = 255; |
| 743 | |
| 744 | r <<= 16; |
| 745 | g <<= 8; |
| 746 | |
| 747 | fb[x] = 0xff000000 | r | g | b; |
| 748 | zb[x] = z; |
| 749 | } |
| 750 | |
| 751 | z += dz; |
| 752 | gr += dgr; |
| 753 | gg += dgg; |
| 754 | gb += dgb; |
| 755 | ga += dga; |
| 652 | 756 | } |
| 653 | 757 | } |
| 654 | 758 | |
| 655 | 759 | void cobra_renderer::render_texture_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid) |
| 656 | 760 | { |
| 657 | | float u = extent.param[0].start; |
| 658 | | float v = extent.param[1].start; |
| 659 | | float du = extent.param[0].dpdx; |
| 660 | | float dv = extent.param[1].dpdx; |
| 661 | | UINT32 *fb = &m_framebuffer->pix32(scanline); |
| 761 | float u = extent.param[POLY_U].start; |
| 762 | float v = extent.param[POLY_V].start; |
| 763 | float du = extent.param[POLY_U].dpdx; |
| 764 | float dv = extent.param[POLY_V].dpdx; |
| 662 | 765 | |
| 663 | | int texture_width = 1 << ((m_gfx_gram[0x2910/4] >> 28) & 0xf); |
| 664 | | int texture_height = 1 << ((m_gfx_gram[0x2910/4] >> 24) & 0xf); |
| 766 | float w = extent.param[POLY_W].start; |
| 767 | float dw = extent.param[POLY_W].dpdx; |
| 665 | 768 | |
| 769 | float z = extent.param[POLY_Z].start; |
| 770 | float dz = extent.param[POLY_Z].dpdx; |
| 771 | |
| 772 | float gr = extent.param[POLY_R].start; |
| 773 | float dgr = extent.param[POLY_R].dpdx; |
| 774 | float gg = extent.param[POLY_G].start; |
| 775 | float dgg = extent.param[POLY_G].dpdx; |
| 776 | float gb = extent.param[POLY_B].start; |
| 777 | float dgb = extent.param[POLY_B].dpdx; |
| 778 | float ga = extent.param[POLY_A].start; |
| 779 | float dga = extent.param[POLY_A].dpdx; |
| 780 | |
| 781 | UINT32 *fb = &m_backbuffer->pix32(scanline); |
| 782 | float *zb = (float*)&m_zbuffer->pix32(scanline); |
| 783 | |
| 784 | UINT32 texture_width = 1 << ((extradata.tex_format >> 28) & 0xf); |
| 785 | UINT32 texture_height = 1 << ((extradata.tex_format >> 24) & 0xf); |
| 786 | UINT32 tex_address = extradata.tex_address; |
| 787 | |
| 788 | UINT32 alpha_test = extradata.alpha_test; |
| 789 | UINT32 zmode = extradata.zmode; |
| 790 | UINT32 tex_format = (extradata.tex_format >> 2) & 0x7; |
| 791 | |
| 666 | 792 | for (int x = extent.startx; x < extent.stopx; x++) |
| 667 | 793 | { |
| 668 | 794 | int iu, iv; |
| 669 | 795 | UINT32 texel; |
| 670 | 796 | |
| 671 | | iu = (int)(u * texture_width); |
| 672 | | iv = (int)(v * texture_height); |
| 797 | if (z <= zb[x] || zmode == 7) |
| 798 | { |
| 799 | float oow; |
| 673 | 800 | |
| 674 | | texel = m_texture_ram[((iv * texture_width) + iu) / 2]; |
| 801 | if (w == 0) |
| 802 | oow = 1.0f; |
| 803 | else |
| 804 | oow = 1.0f / w; |
| 675 | 805 | |
| 676 | | if (iu & 1) |
| 677 | | { |
| 678 | | texel &= 0xffff; |
| 679 | | } |
| 680 | | else |
| 681 | | { |
| 682 | | texel >>= 16; |
| 683 | | } |
| 806 | iu = (int)((u * oow) * texture_width) & 0x7ff; |
| 807 | iv = (int)((v * oow) * texture_height) & 0x7ff; |
| 684 | 808 | |
| 685 | | UINT32 r = (texel & 0x7c00) << 9; |
| 686 | | UINT32 g = (texel & 0x03e0) << 6; |
| 687 | | UINT32 b = (texel & 0x001f) << 3; |
| 809 | texel = m_texture_ram[tex_address + (((iv * texture_width) + iu) / 2)]; |
| 688 | 810 | |
| 689 | | fb[x] = 0xff000000 | r | g | b; |
| 811 | if (iu & 1) |
| 812 | { |
| 813 | texel &= 0xffff; |
| 814 | } |
| 815 | else |
| 816 | { |
| 817 | texel >>= 16; |
| 818 | } |
| 690 | 819 | |
| 820 | UINT32 texr, texg, texb, texa; |
| 821 | |
| 822 | if (tex_format == 6) |
| 823 | { |
| 824 | texr = (texel & 0xf000) >> 8; |
| 825 | texg = (texel & 0x0f00) >> 4; |
| 826 | texb = (texel & 0x00f0) >> 0; |
| 827 | texa = (texel & 0x000f); |
| 828 | } |
| 829 | else |
| 830 | { |
| 831 | texr = (texel & 0xf800) >> 8; |
| 832 | texg = (texel & 0x07c0) >> 3; |
| 833 | texb = (texel & 0x003e) << 2; |
| 834 | texa = (texel & 0x0001) ? 0xff : 0; |
| 835 | } |
| 836 | |
| 837 | UINT32 goua = (int)(ga); |
| 838 | |
| 839 | int a = (texa * goua) >> 8; |
| 840 | |
| 841 | if (a != 0 || !alpha_test) |
| 842 | { |
| 843 | UINT32 gour = (int)(gr); |
| 844 | UINT32 goug = (int)(gg); |
| 845 | UINT32 goub = (int)(gb); |
| 846 | |
| 847 | int r = (texr * gour) >> 8; |
| 848 | int g = (texg * goug) >> 8; |
| 849 | int b = (texb * goub) >> 8; |
| 850 | |
| 851 | if (r > 255) r = 255; |
| 852 | if (g > 255) g = 255; |
| 853 | if (b > 255) b = 255; |
| 854 | |
| 855 | r <<= 16; |
| 856 | g <<= 8; |
| 857 | |
| 858 | fb[x] = 0xff000000 | r | g | b; |
| 859 | zb[x] = z; |
| 860 | } |
| 861 | } |
| 862 | |
| 691 | 863 | u += du; |
| 692 | 864 | v += dv; |
| 865 | w += dw; |
| 866 | z += dz; |
| 867 | |
| 868 | gr += dgr; |
| 869 | gg += dgg; |
| 870 | gb += dgb; |
| 871 | ga += dga; |
| 693 | 872 | } |
| 694 | 873 | } |
| 695 | 874 | |
| r17531 | r17532 | |
| 701 | 880 | if (x >= visarea.min_x && x <= visarea.max_x && |
| 702 | 881 | y >= visarea.min_y && y <= visarea.max_y) |
| 703 | 882 | { |
| 704 | | UINT32 *fb = &m_framebuffer->pix32(y); |
| 883 | UINT32 *fb = &m_backbuffer->pix32(y); |
| 705 | 884 | fb[x] = color; |
| 706 | 885 | } |
| 707 | 886 | } |
| r17531 | r17532 | |
| 729 | 908 | { |
| 730 | 909 | int y = y1 + (dy * (float)(x - x1) / (float)(dx)); |
| 731 | 910 | |
| 732 | | UINT32 *fb = &m_framebuffer->pix32(y); |
| 911 | UINT32 *fb = &m_backbuffer->pix32(y); |
| 733 | 912 | fb[x] = color; |
| 734 | 913 | |
| 735 | 914 | x++; |
| r17531 | r17532 | |
| 742 | 921 | { |
| 743 | 922 | int x = x1 + (dx * (float)(y - y1) / (float)(dy)); |
| 744 | 923 | |
| 745 | | UINT32 *fb = &m_framebuffer->pix32(y); |
| 924 | UINT32 *fb = &m_backbuffer->pix32(y); |
| 746 | 925 | fb[x] = color; |
| 747 | 926 | |
| 748 | 927 | y++; |
| r17531 | r17532 | |
| 1172 | 1351 | // |
| 1173 | 1352 | // 7 6 5 4 3 2 1 0 |
| 1174 | 1353 | //---------------- |
| 1175 | | // x S2M FIFO unknown flag |
| 1354 | // x S2M FIFO interrupt active |
| 1176 | 1355 | // x Graphics board/FIFO busy flag |
| 1177 | | // x M2S FIFO unknown flag |
| 1356 | // x M2S FIFO interrupt active |
| 1178 | 1357 | |
| 1179 | 1358 | int value = 0x01; |
| 1180 | 1359 | |
| r17531 | r17532 | |
| 1299 | 1478 | |
| 1300 | 1479 | if ((m_m2s_int_enable & 0x80) == 0) |
| 1301 | 1480 | { |
| 1481 | m_main_int_active &= ~MAIN_INT_M2S; |
| 1482 | |
| 1302 | 1483 | // clear the interrupt |
| 1303 | 1484 | cputag_set_input_line(space.machine(), "maincpu", INPUT_LINE_IRQ0, CLEAR_LINE); |
| 1304 | 1485 | } |
| r17531 | r17532 | |
| 1321 | 1502 | |
| 1322 | 1503 | if (m_main_debug_state_wc >= 2) |
| 1323 | 1504 | { |
| 1505 | #if LOG_DEBUG_STATES |
| 1324 | 1506 | if (m_main_debug_state != 0) |
| 1325 | 1507 | { |
| 1326 | 1508 | printf("MAIN: debug state %02X\n", m_main_debug_state); |
| 1327 | 1509 | } |
| 1510 | #endif |
| 1328 | 1511 | |
| 1329 | 1512 | m_main_debug_state = 0; |
| 1330 | 1513 | m_main_debug_state_wc = 0; |
| r17531 | r17532 | |
| 1549 | 1732 | |
| 1550 | 1733 | if (m_sub_debug_state_wc >= 2) |
| 1551 | 1734 | { |
| 1735 | #if LOG_DEBUG_STATES |
| 1552 | 1736 | if (m_sub_debug_state != 0) |
| 1553 | 1737 | { |
| 1554 | 1738 | printf("SUB: debug state %02X\n", m_sub_debug_state); |
| 1555 | 1739 | } |
| 1740 | #endif |
| 1556 | 1741 | |
| 1557 | 1742 | m_sub_debug_state = 0; |
| 1558 | 1743 | m_sub_debug_state_wc = 0; |
| r17531 | r17532 | |
| 1689 | 1874 | |
| 1690 | 1875 | static UINT32 sub_unknown_dma_r(device_t *device, int width) |
| 1691 | 1876 | { |
| 1692 | | printf("DMA read from unknown: size %d\n", width); |
| 1877 | //printf("DMA read from unknown: size %d\n", width); |
| 1693 | 1878 | return 0; |
| 1694 | 1879 | } |
| 1695 | 1880 | |
| 1696 | 1881 | static void sub_unknown_dma_w(device_t *device, int width, UINT32 data) |
| 1697 | 1882 | { |
| 1698 | | printf("DMA write to unknown: size %d, data %08X\n", width, data); |
| 1883 | //printf("DMA write to unknown: size %d, data %08X\n", width, data); |
| 1699 | 1884 | } |
| 1700 | 1885 | |
| 1701 | 1886 | static void sub_jvs_w(device_t *device, UINT8 data) |
| 1702 | 1887 | { |
| 1703 | 1888 | cobra_jvs_host *jvs = downcast<cobra_jvs_host *>(device->machine().device("cobra_jvs_host")); |
| 1889 | |
| 1890 | #if LOG_JVS |
| 1704 | 1891 | printf("sub_jvs_w: %02X\n", data); |
| 1892 | #endif |
| 1705 | 1893 | |
| 1706 | 1894 | const UINT8 *rec_data; |
| 1707 | 1895 | UINT32 rec_size; |
| r17531 | r17532 | |
| 1710 | 1898 | |
| 1711 | 1899 | if (rec_size > 0) |
| 1712 | 1900 | { |
| 1713 | | /* |
| 1901 | #if LOG_JVS |
| 1714 | 1902 | printf("jvs reply "); |
| 1715 | 1903 | for (int i=0; i < rec_size; i++) |
| 1716 | 1904 | { |
| 1717 | 1905 | printf("%02X ", rec_data[i]); |
| 1718 | 1906 | } |
| 1719 | 1907 | printf("\n"); |
| 1720 | | */ |
| 1908 | #endif |
| 1721 | 1909 | |
| 1722 | 1910 | for (int i=0; i < rec_size; i++) |
| 1723 | 1911 | { |
| r17531 | r17532 | |
| 1737 | 1925 | AM_RANGE(0x78210000, 0x78217fff) AM_MIRROR(0x80000000) AM_RAM_WRITE(sub_psac_palette_w) AM_SHARE("paletteram") // PSAC palette RAM |
| 1738 | 1926 | AM_RANGE(0x78220000, 0x7823ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE_LEGACY("k001604", k001604_tile_r, k001604_tile_w) // PSAC tile RAM |
| 1739 | 1927 | AM_RANGE(0x78240000, 0x7827ffff) AM_MIRROR(0x80000000) AM_DEVREADWRITE_LEGACY("k001604", k001604_char_r, k001604_char_w) // PSAC character RAM |
| 1928 | AM_RANGE(0x78280000, 0x7828000f) AM_MIRROR(0x80000000) AM_NOP // ??? |
| 1740 | 1929 | AM_RANGE(0x78300000, 0x7830000f) AM_MIRROR(0x80000000) AM_READWRITE(sub_psac2_r, sub_psac2_w) // PSAC |
| 1741 | 1930 | AM_RANGE(0x7e000000, 0x7e000003) AM_MIRROR(0x80000000) AM_READWRITE(sub_unk7e_r, sub_debug_w) |
| 1742 | 1931 | AM_RANGE(0x7e040000, 0x7e041fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8_LEGACY("m48t58", timekeeper_r, timekeeper_w, 0xffffffff) /* M48T58Y RTC/NVRAM */ |
| 1743 | 1932 | AM_RANGE(0x7e180000, 0x7e180003) AM_MIRROR(0x80000000) AM_READWRITE(sub_unk1_r, sub_unk1_w) // TMS57002? |
| 1744 | 1933 | AM_RANGE(0x7e200000, 0x7e200003) AM_MIRROR(0x80000000) AM_READWRITE(sub_config_r, sub_config_w) |
| 1745 | | // AM_RANGE(0x7e280000, 0x7e28ffff) AM_MIRROR(0x80000000) AM_RAM // LANC |
| 1746 | | // AM_RANGE(0x7e300000, 0x7e30ffff) AM_MIRROR(0x80000000) AM_RAM // LANC |
| 1934 | AM_RANGE(0x7e280000, 0x7e28ffff) AM_MIRROR(0x80000000) AM_NOP // LANC |
| 1935 | AM_RANGE(0x7e300000, 0x7e30ffff) AM_MIRROR(0x80000000) AM_NOP // LANC |
| 1747 | 1936 | AM_RANGE(0x7e380000, 0x7e380003) AM_MIRROR(0x80000000) AM_READWRITE(sub_mainbd_r, sub_mainbd_w) |
| 1748 | 1937 | AM_RANGE(0x7ff80000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user2", 0) /* Boot ROM */ |
| 1749 | 1938 | ADDRESS_MAP_END |
| r17531 | r17532 | |
| 1781 | 1970 | |
| 1782 | 1971 | void cobra_renderer::display(bitmap_rgb32 *bitmap, const rectangle &cliprect) |
| 1783 | 1972 | { |
| 1784 | | copybitmap_trans(*bitmap, *m_framebuffer, 0, 0, 0, 0, cliprect, 0); |
| 1973 | if (m_gfx_register[0] & 0x4) |
| 1974 | { |
| 1975 | copybitmap_trans(*bitmap, *m_framebuffer, 0, 0, 0, 0, cliprect, 0); |
| 1976 | } |
| 1977 | else |
| 1978 | { |
| 1979 | copybitmap_trans(*bitmap, *m_backbuffer, 0, 0, 0, 0, cliprect, 0); |
| 1980 | } |
| 1785 | 1981 | } |
| 1786 | 1982 | |
| 1787 | 1983 | void cobra_renderer::gfx_init(running_machine &machine) |
| 1788 | 1984 | { |
| 1789 | | cobra_state *cobra = machine.driver_data<cobra_state>(); |
| 1985 | const rectangle& visarea = machine.primary_screen->visible_area(); |
| 1790 | 1986 | |
| 1791 | 1987 | m_gfx_gram = auto_alloc_array(machine, UINT32, 0x40000); |
| 1792 | 1988 | |
| 1793 | | cobra->m_gfx_register = auto_alloc_array(machine, UINT64, 0x3000); |
| 1989 | m_gfx_register = auto_alloc_array(machine, UINT64, 0x3000); |
| 1990 | m_gfx_register_select = 0; |
| 1991 | |
| 1992 | float zvalue = 10000000.0f; |
| 1993 | m_zbuffer->fill(*(int*)&zvalue, visarea); |
| 1794 | 1994 | } |
| 1795 | 1995 | |
| 1796 | 1996 | void cobra_renderer::gfx_exit(running_machine &machine) |
| r17531 | r17532 | |
| 1806 | 2006 | fputc((UINT8)(m_texture_ram[i] >> 0), file); |
| 1807 | 2007 | } |
| 1808 | 2008 | fclose(file); |
| 1809 | | */ |
| 2009 | */ |
| 1810 | 2010 | } |
| 1811 | 2011 | |
| 1812 | 2012 | void cobra_renderer::gfx_reset(running_machine &machine) |
| r17531 | r17532 | |
| 1859 | 2059 | } |
| 1860 | 2060 | break; |
| 1861 | 2061 | } |
| 2062 | |
| 2063 | case 0xc: // 0xCxxxx |
| 2064 | { |
| 2065 | switch (address & 0xffff) |
| 2066 | { |
| 2067 | case 0x3020: |
| 2068 | case 0x0020: |
| 2069 | { |
| 2070 | m_texram_ptr = (data & mask) * 4; |
| 2071 | break; |
| 2072 | } |
| 2073 | } |
| 2074 | |
| 2075 | break; |
| 2076 | } |
| 1862 | 2077 | } |
| 1863 | 2078 | |
| 1864 | 2079 | if (address & 3) |
| r17531 | r17532 | |
| 1871 | 2086 | m_gfx_gram[address/4] |= data & mask; |
| 1872 | 2087 | } |
| 1873 | 2088 | |
| 2089 | UINT64 cobra_renderer::gfx_read_reg(running_machine &machine) |
| 2090 | { |
| 2091 | return m_gfx_register[m_gfx_register_select]; |
| 2092 | } |
| 2093 | |
| 2094 | void cobra_renderer::gfx_write_reg(running_machine &machine, UINT64 data) |
| 2095 | { |
| 2096 | switch (m_gfx_register_select) |
| 2097 | { |
| 2098 | case 0x0000: |
| 2099 | { |
| 2100 | const rectangle& visarea = machine.primary_screen->visible_area(); |
| 2101 | |
| 2102 | copybitmap_trans(*m_framebuffer, *m_backbuffer, 0, 0, 0, 0, visarea, 0); |
| 2103 | m_backbuffer->fill(0xff000000, visarea); |
| 2104 | |
| 2105 | float zvalue = 10000000.0f; |
| 2106 | m_zbuffer->fill(*(int*)&zvalue, visarea); |
| 2107 | break; |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | m_gfx_register[m_gfx_register_select] = data; |
| 2112 | } |
| 2113 | |
| 1874 | 2114 | void cobra_renderer::gfx_fifo_exec(running_machine &machine) |
| 1875 | 2115 | { |
| 1876 | 2116 | cobra_state *cobra = machine.driver_data<cobra_state>(); |
| r17531 | r17532 | |
| 1879 | 2119 | return; |
| 1880 | 2120 | |
| 1881 | 2121 | const rectangle& visarea = machine.primary_screen->visible_area(); |
| 1882 | | vertex_t vert[8]; |
| 2122 | vertex_t vert[32]; |
| 1883 | 2123 | |
| 1884 | 2124 | cobra_fifo *fifo_in = cobra->m_gfxfifo_in; |
| 1885 | 2125 | cobra_fifo *fifo_out = cobra->m_gfxfifo_out; |
| r17531 | r17532 | |
| 1941 | 2181 | if (w2 == 0x10500010) |
| 1942 | 2182 | { |
| 1943 | 2183 | // GFX register select |
| 1944 | | cobra->m_gfx_register_select = w[3]; |
| 2184 | m_gfx_register_select = w[3]; |
| 1945 | 2185 | |
| 1946 | | printf("GFX: register select %04X\n", cobra->m_gfx_register_select); |
| 2186 | printf("GFX: register select %08X\n", m_gfx_register_select); |
| 1947 | 2187 | } |
| 1948 | 2188 | else if (w2 == 0x10500018) |
| 1949 | 2189 | { |
| 1950 | 2190 | // register write to the register selected above? |
| 1951 | 2191 | // 64-bit registers, top 32-bits in word 2, low 32-bit in word 3 |
| 1952 | | printf("GFX: register write %04X: %08X %08X\n", cobra->m_gfx_register_select, w[2], w[3]); |
| 2192 | printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]); |
| 1953 | 2193 | |
| 1954 | | cobra->m_gfx_register[cobra->m_gfx_register_select] = ((UINT64)(w[2]) << 32) | w[3]; |
| 2194 | gfx_write_reg(machine, ((UINT64)(w[2]) << 32) | w[3]); |
| 1955 | 2195 | } |
| 1956 | 2196 | else if (w2 == 0x10521000) |
| 1957 | 2197 | { |
| r17531 | r17532 | |
| 1984 | 2224 | logerror("gfxfifo_exec: unknown %08X %08X\n", w1, w2); |
| 1985 | 2225 | } |
| 1986 | 2226 | |
| 1987 | | printf("gfxfifo_exec: unhandled %08X %08X\n", w1, w2); |
| 2227 | //printf("gfxfifo_exec: unhandled %08X %08X\n", w1, w2); |
| 1988 | 2228 | |
| 1989 | 2229 | fifo_in->pop(NULL, &in3); |
| 1990 | 2230 | fifo_in->pop(NULL, &in4); |
| r17531 | r17532 | |
| 2008 | 2248 | case 0xf1: |
| 2009 | 2249 | case 0xf4: |
| 2010 | 2250 | { |
| 2011 | | printf("gfxfifo_exec: unhandled %08X %08X\n", w1, w2); |
| 2251 | //printf("gfxfifo_exec: unhandled %08X %08X\n", w1, w2); |
| 2012 | 2252 | |
| 2013 | 2253 | cobra->m_gfx_re_status = RE_STATUS_IDLE; |
| 2014 | 2254 | break; |
| r17531 | r17532 | |
| 2056 | 2296 | } |
| 2057 | 2297 | |
| 2058 | 2298 | |
| 2299 | |
| 2300 | float vp_width = u2f(m_gfx_gram[0x00090/4]); |
| 2301 | float vp_height = u2f(m_gfx_gram[0x000a4/4]); |
| 2302 | float vp_center_x = u2f(m_gfx_gram[0x0009c/4]); |
| 2303 | float vp_center_y = u2f(m_gfx_gram[0x000ac/4]); |
| 2304 | |
| 2305 | if (vp_width == 0.0f) |
| 2306 | { |
| 2307 | vp_width = 256.0f; |
| 2308 | vp_center_x = 256.0f; |
| 2309 | } |
| 2310 | |
| 2311 | #if LOG_DRAW_COMMANDS |
| 2312 | printf("--- Draw command %08X %08X ---\n", w1, w2); |
| 2313 | #endif |
| 2314 | |
| 2315 | |
| 2059 | 2316 | // extract vertex data |
| 2060 | 2317 | for (int i=0; i < units; i++) |
| 2061 | 2318 | { |
| 2062 | | UINT64 in; |
| 2319 | float x, y, z, w; |
| 2320 | float r, g, b, a; |
| 2321 | w = 1.0f; |
| 2322 | |
| 2323 | UINT64 in[4]; |
| 2063 | 2324 | if (w2 & 0x40000000) // line flags |
| 2064 | 2325 | { |
| 2065 | | fifo_in->pop(NULL, &in); |
| 2326 | fifo_in->pop(NULL, &in[0]); |
| 2066 | 2327 | } |
| 2067 | 2328 | |
| 2068 | 2329 | if (w2 & 0x20000000) // unknown float (0.0f ... 1.0f) |
| 2069 | 2330 | { |
| 2070 | | fifo_in->pop(NULL, &in); |
| 2331 | fifo_in->pop(NULL, &in[1]); |
| 2071 | 2332 | } |
| 2072 | 2333 | |
| 2073 | | fifo_in->pop(NULL, &vert[i].x); // X coord |
| 2074 | | fifo_in->pop(NULL, &vert[i].y); // Y coord |
| 2075 | | fifo_in->pop(NULL, &in); // coord? |
| 2076 | | fifo_in->pop(NULL, &in); // Z coord |
| 2334 | fifo_in->pop(NULL, &x); // X coord |
| 2335 | fifo_in->pop(NULL, &y); // Y coord |
| 2336 | fifo_in->pop(NULL, &in[2]); // coord? |
| 2337 | fifo_in->pop(NULL, &z); // Z coord |
| 2077 | 2338 | |
| 2078 | 2339 | if (w2 & 0x00200000) // texture coords |
| 2079 | 2340 | { |
| 2080 | | fifo_in->pop(NULL, &in); // W coord (1 / Z) |
| 2081 | | fifo_in->pop(NULL, &vert[i].p[0]); // U coord |
| 2082 | | fifo_in->pop(NULL, &vert[i].p[1]); // V coord |
| 2341 | fifo_in->pop(NULL, &w); // W coord (1 / Z) |
| 2342 | fifo_in->pop(NULL, &vert[i].p[POLY_U]); // U/Z coord |
| 2343 | fifo_in->pop(NULL, &vert[i].p[POLY_V]); // V/Z coord |
| 2083 | 2344 | } |
| 2084 | 2345 | |
| 2085 | | fifo_in->pop(NULL, &in); // ? (float 0.0f ... 1.0f) |
| 2086 | | fifo_in->pop(NULL, &in); // ? (float 0.0f ... 1.0f) |
| 2087 | | fifo_in->pop(NULL, &in); // ? (float 0.0f ... 1.0f) |
| 2088 | | fifo_in->pop(NULL, &in); // ? (float 0.0f ... 1.0f) |
| 2346 | fifo_in->pop(NULL, &a); // Gouraud Color Alpha |
| 2347 | fifo_in->pop(NULL, &r); // Gouraud Color R |
| 2348 | fifo_in->pop(NULL, &g); // Gouraud Color G |
| 2349 | fifo_in->pop(NULL, &b); // Gouraud Color B |
| 2089 | 2350 | |
| 2090 | 2351 | if (w2 & 0x00000001) // unknown float (0.0f ... 1.0f) |
| 2091 | 2352 | { |
| 2092 | | fifo_in->pop(NULL, &in); |
| 2353 | fifo_in->pop(NULL, &in[3]); |
| 2093 | 2354 | } |
| 2355 | |
| 2356 | vert[i].x = ((x / z) * vp_width) + vp_center_x; |
| 2357 | vert[i].y = ((y / z) * vp_height) + vp_center_y; |
| 2358 | vert[i].p[POLY_Z] = z; |
| 2359 | vert[i].p[POLY_W] = w; |
| 2360 | vert[i].p[POLY_R] = r * 255.0f; |
| 2361 | vert[i].p[POLY_G] = g * 255.0f; |
| 2362 | vert[i].p[POLY_B] = b * 255.0f; |
| 2363 | vert[i].p[POLY_A] = a * 255.0f; |
| 2364 | |
| 2365 | |
| 2366 | #if LOG_DRAW_COMMANDS |
| 2367 | if (w2 & 0x40000000) |
| 2368 | { |
| 2369 | printf(" ?: %08X\n", (UINT32)in[0]); |
| 2370 | } |
| 2371 | if (w2 & 0x20000000) |
| 2372 | { |
| 2373 | printf(" ?: %08X\n", (UINT32)in[1]); |
| 2374 | } |
| 2375 | |
| 2376 | printf(" x: %f\n", x); |
| 2377 | printf(" y: %f\n", y); |
| 2378 | printf(" ?: %08X\n", (UINT32)in[2]); |
| 2379 | printf(" z: %f\n", z); |
| 2380 | |
| 2381 | if (w2 & 0x00200000) |
| 2382 | { |
| 2383 | printf(" w: %f\n", w); |
| 2384 | printf(" u: %f\n", vert[i].p[POLY_U]); |
| 2385 | printf(" v: %f\n", vert[i].p[POLY_V]); |
| 2386 | } |
| 2387 | |
| 2388 | printf(" a: %f\n", a); |
| 2389 | printf(" r: %f\n", r); |
| 2390 | printf(" g: %f\n", g); |
| 2391 | printf(" b: %f\n", b); |
| 2392 | |
| 2393 | if (w2 & 0x00000001) |
| 2394 | { |
| 2395 | printf(" ?: %08X\n", (UINT32)in[3]); |
| 2396 | } |
| 2397 | |
| 2398 | printf("\n"); |
| 2399 | #endif |
| 2094 | 2400 | } |
| 2095 | 2401 | |
| 2096 | 2402 | |
| 2403 | cobra_polydata &extra = object_data_alloc(); |
| 2404 | |
| 2405 | int texture = (m_gfx_gram[0x400f4/4] >> 29); |
| 2406 | |
| 2407 | extra.alpha_test = m_gfx_gram[0x40198/4] & 0x80000000; |
| 2408 | extra.zmode = (m_gfx_gram[0x80020/4] >> 17) & 0x7; |
| 2409 | extra.tex_format = m_gfx_gram[(0x2910 + (texture << 7)) / 4]; |
| 2410 | extra.tex_address = (m_gfx_gram[(0x2914 + (texture << 7)) / 4] >> 12) & 0xfffff; |
| 2411 | |
| 2412 | |
| 2097 | 2413 | // render |
| 2098 | 2414 | switch ((w1 >> 24) & 0xf) |
| 2099 | 2415 | { |
| r17531 | r17532 | |
| 2104 | 2420 | render_delegate rd = render_delegate(FUNC(cobra_renderer::render_texture_scan), this); |
| 2105 | 2421 | for (int i=2; i < units; i++) |
| 2106 | 2422 | { |
| 2107 | | render_triangle(visarea, rd, 6, vert[i-2], vert[i-1], vert[i]); |
| 2423 | render_triangle(visarea, rd, 8, vert[i-2], vert[i-1], vert[i]); |
| 2108 | 2424 | } |
| 2109 | 2425 | } |
| 2110 | 2426 | else |
| r17531 | r17532 | |
| 2112 | 2428 | render_delegate rd = render_delegate(FUNC(cobra_renderer::render_color_scan), this); |
| 2113 | 2429 | for (int i=2; i < units; i++) |
| 2114 | 2430 | { |
| 2115 | | render_triangle(visarea, rd, 6, vert[i-2], vert[i-1], vert[i]); |
| 2116 | | //draw_point(visarea, vert[i-2], 0xffff0000); |
| 2117 | | //draw_point(visarea, vert[i-1], 0xffff0000); |
| 2118 | | //draw_point(visarea, vert[i], 0xffff0000); |
| 2431 | render_triangle(visarea, rd, 5, vert[i-2], vert[i-1], vert[i]); |
| 2119 | 2432 | } |
| 2120 | 2433 | } |
| 2121 | 2434 | break; |
| r17531 | r17532 | |
| 2176 | 2489 | int x = (m_gfx_gram[0x118/4] >> 16) & 0xffff; |
| 2177 | 2490 | int y = m_gfx_gram[0x118/4] & 0xffff; |
| 2178 | 2491 | |
| 2492 | x &= 0x3ff; |
| 2493 | y &= 0x3ff; |
| 2494 | |
| 2179 | 2495 | for (i=0; i < num; i+=4) |
| 2180 | 2496 | { |
| 2181 | 2497 | UINT32 *buffer; |
| r17531 | r17532 | |
| 2312 | 2628 | |
| 2313 | 2629 | gfx_write_gram(reg, mask, w2); |
| 2314 | 2630 | |
| 2631 | #if LOG_GFX_RAM_WRITES |
| 2315 | 2632 | if (reg != 0x118 && reg != 0x114 && reg != 0x11c) |
| 2316 | 2633 | { |
| 2317 | 2634 | printf("gfxfifo_exec: ram write %05X (mask %08X): %08X (%f)\n", reg, mask, w2, u2f(w2)); |
| 2318 | 2635 | } |
| 2636 | #endif |
| 2319 | 2637 | |
| 2320 | 2638 | cobra->m_gfx_re_status = RE_STATUS_IDLE; |
| 2321 | 2639 | break; |
| r17531 | r17532 | |
| 2412 | 2730 | |
| 2413 | 2731 | cobra->m_gfx_unk_status |= 0x400; |
| 2414 | 2732 | |
| 2415 | | if (cobra->m_gfx_re_word_count == 0) |
| 2733 | if (cobra->m_gfx_re_word_count == 0 && num_left > 0) |
| 2416 | 2734 | printf("gfxfifo_exec: tex_ints %d words left\n", num - cobra->m_gfx_re_word_count); |
| 2417 | 2735 | |
| 2418 | 2736 | for (int i=0; i < num_left; i++) |
| r17531 | r17532 | |
| 2421 | 2739 | fifo_in->pop(NULL, ¶m); |
| 2422 | 2740 | cobra->m_gfx_re_word_count++; |
| 2423 | 2741 | |
| 2424 | | UINT32 addr = m_gfx_gram[0xc3020/4]; |
| 2425 | | m_texture_ram[addr] = (UINT32)(param); |
| 2426 | | m_gfx_gram[0xc3020/4]++; |
| 2742 | m_texture_ram[m_texram_ptr] = (UINT32)(param); |
| 2743 | m_texram_ptr++; |
| 2427 | 2744 | } |
| 2428 | 2745 | |
| 2429 | 2746 | |
| r17531 | r17532 | |
| 2610 | 2927 | |
| 2611 | 2928 | // reads back the register selected by gfx register select |
| 2612 | 2929 | |
| 2613 | | m_gfxfifo_out->push(&space.device(), (UINT32)((m_gfx_register[m_gfx_register_select] >> 32))); |
| 2614 | | m_gfxfifo_out->push(&space.device(), (UINT32)(m_gfx_register[m_gfx_register_select])); |
| 2930 | UINT64 regdata = m_renderer->gfx_read_reg(space.machine()); |
| 2931 | |
| 2932 | m_gfxfifo_out->push(&space.device(), (UINT32)(regdata >> 32)); |
| 2933 | m_gfxfifo_out->push(&space.device(), (UINT32)(regdata)); |
| 2615 | 2934 | } |
| 2616 | 2935 | else if (data == U64(0x00a0000110520800)) |
| 2617 | 2936 | { |
| r17531 | r17532 | |
| 2682 | 3001 | |
| 2683 | 3002 | if (m_gfx_debug_state_wc >= 2) |
| 2684 | 3003 | { |
| 3004 | #if LOG_DEBUG_STATES |
| 2685 | 3005 | if (m_gfx_debug_state != 0) |
| 2686 | 3006 | { |
| 2687 | 3007 | printf("GFX: debug state %02X\n", m_gfx_debug_state); |
| 2688 | 3008 | } |
| 3009 | #endif |
| 2689 | 3010 | |
| 2690 | 3011 | m_gfx_debug_state = 0; |
| 2691 | 3012 | m_gfx_debug_state_wc = 0; |
| r17531 | r17532 | |
| 2797 | 3118 | |
| 2798 | 3119 | static INTERRUPT_GEN( cobra_vblank ) |
| 2799 | 3120 | { |
| 3121 | /* |
| 2800 | 3122 | cobra_state *cobra = device->machine().driver_data<cobra_state>(); |
| 2801 | 3123 | |
| 2802 | 3124 | if (cobra->m_vblank_enable & 0x80) |
| r17531 | r17532 | |
| 2804 | 3126 | cputag_set_input_line(device->machine(), "maincpu", INPUT_LINE_IRQ0, ASSERT_LINE); |
| 2805 | 3127 | cobra->m_gfx_unk_flag = 0x80; |
| 2806 | 3128 | } |
| 3129 | */ |
| 2807 | 3130 | } |
| 2808 | 3131 | |
| 2809 | 3132 | |
| r17531 | r17532 | |
| 2853 | 3176 | |
| 2854 | 3177 | MCFG_SCREEN_ADD("screen", RASTER) |
| 2855 | 3178 | MCFG_SCREEN_REFRESH_RATE(60) |
| 2856 | | MCFG_SCREEN_SIZE(512, 384) |
| 2857 | | MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383) |
| 3179 | MCFG_SCREEN_SIZE(512, 400) |
| 3180 | MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 399) |
| 2858 | 3181 | MCFG_PALETTE_LENGTH(65536) |
| 2859 | 3182 | MCFG_SCREEN_UPDATE_STATIC(cobra) |
| 2860 | 3183 | |
| r17531 | r17532 | |
| 2973 | 3296 | { |
| 2974 | 3297 | UINT8 *rom = (UINT8*)machine().root_device().memregion("m48t58")->base(); |
| 2975 | 3298 | rom[0x00] = 0x47; // G |
| 3299 | rom[0x01] = 0x4e; // N // N = 2-player, Q = 1-player? |
| 2976 | 3300 | rom[0x02] = 0x36; // 6 |
| 2977 | 3301 | rom[0x03] = 0x34; // 4 |
| 2978 | 3302 | rom[0x04] = 0x35; // 5 |
| r17531 | r17532 | |
| 2993 | 3317 | } |
| 2994 | 3318 | |
| 2995 | 3319 | // hd patches |
| 2996 | | // 0x18932c = 0x38600000 skips check_one_scene() |
| 3320 | // (gfx) |
| 3321 | // 0x18932c = 0x38600000 skips check_one_scene() |
| 2997 | 3322 | |
| 3323 | // (main) |
| 3324 | // 0x5025ac = 0x60000000 [0x4082055c] skip IRQ fail... |
| 3325 | // 0x503ec4 = 0x60000000 [0x4186fff8] |
| 3326 | |
| 2998 | 3327 | m_has_psac = false; |
| 2999 | 3328 | } |
| 3000 | 3329 | |
| r17531 | r17532 | |
| 3006 | 3335 | { |
| 3007 | 3336 | UINT32 *rom = (UINT32*)machine().root_device().memregion("user2")->base(); |
| 3008 | 3337 | |
| 3009 | | //rom[0x62094 / 4] = 0x60000000; // skip hardcheck()... |
| 3338 | rom[0x62094 / 4] = 0x60000000; // skip hardcheck()... |
| 3010 | 3339 | rom[0x62ddc / 4] = 0x60000000; // skip lanc_hardcheck() |
| 3011 | 3340 | |
| 3012 | 3341 | |
| r17531 | r17532 | |
| 3074 | 3403 | rom[0x0f] = (UINT8)(sum); |
| 3075 | 3404 | } |
| 3076 | 3405 | |
| 3406 | // hd patches |
| 3407 | // (gfx) |
| 3408 | // 0x144354 = 0x38600000 [0x4bfffb91] skips check_one_scene() |
| 3409 | |
| 3410 | // (sub) |
| 3411 | // 0x2a5394 = 0x4800001c [0x4182001c] sound chip check? |
| 3412 | // 0x2a53f4 = 0x4800001c [0x4082001c] ? |
| 3413 | // 0x2a546c = 0x60000000 [0x48001a0d] ? |
| 3414 | // 0x2a5510 = 0x48000014 [0x419e0014] ? |
| 3415 | |
| 3416 | // (main) |
| 3417 | // 0x14aa48 = 0x60000000 [0x4182fff4] ? |
| 3418 | |
| 3077 | 3419 | m_has_psac = true; |
| 3078 | 3420 | } |
| 3079 | 3421 | |