trunk/src/mame/drivers/coolridr.c
| r21439 | r21440 | |
| 408 | 408 | UINT32 m_spriteblit[12]; |
| 409 | 409 | |
| 410 | 410 | UINT32 m_clipvals[2][3]; |
| 411 | UINT8 m_clipblitterMode[2]; // hack |
| 411 | 412 | |
| 412 | 413 | |
| 413 | | |
| 414 | 414 | required_device<cpu_device> m_maincpu; |
| 415 | 415 | required_device<cpu_device> m_subcpu; |
| 416 | 416 | required_device<cpu_device> m_soundcpu; |
| r21439 | r21440 | |
| 1314 | 1314 | if (clipminY>clipmaxY) clipminY = clipmaxY; |
| 1315 | 1315 | |
| 1316 | 1316 | |
| 1317 | | |
| 1318 | | // b1colorNumber = object->state->machine().rand()&0xfff; |
| 1317 | //b1colorNumber = object->state->machine().rand()&0xfff; |
| 1319 | 1318 | } |
| 1320 | 1319 | |
| 1321 | 1320 | /* DRAW */ |
| r21439 | r21440 | |
| 1765 | 1764 | |
| 1766 | 1765 | if (m_blitterMode&0x80) |
| 1767 | 1766 | { |
| 1768 | | m_clipvals[1][0] = m_spriteblit[1]; |
| 1769 | | m_clipvals[1][1] = m_spriteblit[2]; |
| 1770 | | m_clipvals[1][2] = m_spriteblit[3]; |
| 1767 | // HACK... |
| 1768 | // the end sequences do this.. 4f / af cliprects |
| 1769 | //(mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007) |
| 1770 | //(mode 50) unknown sprite list type 1 - 0000 017f 0000 01f0 (0000017f 000701f7 00000007) |
| 1771 | // THEN writes the sprite that needs to be clipped(!) |
| 1772 | // this ends up disabling the cliprect before the sprite that actually needs it |
| 1773 | // |
| 1774 | // all other cliprect blits seem to be written after mode 50, so this hack just prevents |
| 1775 | // writes with a higher value than the last one from taking effect, fixing the ending... |
| 1776 | // especially noticable with 'LoveMachine' |
| 1777 | // (mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007) |
| 1778 | // (mode 50) unknown sprite list type 1 - 0000 017f 0000 01f0 (0000017f 000701f7 00000007) |
| 1779 | // said ending also ends up drawing a red bar under the image, which isn't clipped out and |
| 1780 | // is sent before the clip window anyway(?)... |
| 1771 | 1781 | |
| 1782 | // lightning also needs clipping (doesn't have the red bar problem) |
| 1783 | // (mode 4f) unknown sprite list type 1 - 0054 0105 0059 0198 (00540105 0060019f 00000007) |
| 1784 | |
| 1785 | if (m_clipblitterMode[1] >= m_blitterMode) |
| 1786 | { |
| 1787 | m_clipvals[1][0] = m_spriteblit[1]; |
| 1788 | m_clipvals[1][1] = m_spriteblit[2]; |
| 1789 | m_clipvals[1][2] = m_spriteblit[3]; |
| 1790 | m_clipblitterMode[1] = m_blitterMode; |
| 1791 | } |
| 1792 | |
| 1772 | 1793 | } |
| 1773 | 1794 | else |
| 1774 | 1795 | { |
| 1775 | | m_clipvals[0][0] = m_spriteblit[1]; |
| 1776 | | m_clipvals[0][1] = m_spriteblit[2]; |
| 1777 | | m_clipvals[0][2] = m_spriteblit[3]; |
| 1778 | | //printf("unknown sprite list type 1 - %04x %04x %04x %04x (%08x %08x %08x)\n", (m_spriteblit[1]&0xffff0000)>>16,(m_spriteblit[1]&0x0000ffff)>>0, ((m_spriteblit[2]&0xffff0000)>>16)-((m_spriteblit[3]&0x0000ffff)>>0),((m_spriteblit[2]&0x0000ffff)>>0)-((m_spriteblit[3]&0x0000ffff)>>0), m_spriteblit[1],m_spriteblit[2],m_spriteblit[3]); |
| 1796 | if (m_clipblitterMode[0] >= m_blitterMode) |
| 1797 | { |
| 1798 | m_clipvals[0][0] = m_spriteblit[1]; |
| 1799 | m_clipvals[0][1] = m_spriteblit[2]; |
| 1800 | m_clipvals[0][2] = m_spriteblit[3]; |
| 1801 | m_clipblitterMode[0] = m_blitterMode; |
| 1802 | } |
| 1803 | printf("(mode %02x) unknown sprite list type 1 - %04x %04x %04x %04x (%08x %08x %08x)\n", m_blitterMode, (m_spriteblit[1]&0xffff0000)>>16,(m_spriteblit[1]&0x0000ffff)>>0, ((m_spriteblit[2]&0xffff0000)>>16)-((m_spriteblit[3]&0x0000ffff)>>0),((m_spriteblit[2]&0x0000ffff)>>0)-((m_spriteblit[3]&0x0000ffff)>>0), m_spriteblit[1],m_spriteblit[2],m_spriteblit[3]); |
| 1804 | |
| 1779 | 1805 | } |
| 1780 | 1806 | |
| 1781 | 1807 | // abort early |
| r21439 | r21440 | |
| 1836 | 1862 | testobject->blittype = m_blittype; |
| 1837 | 1863 | osd_work_queue *queue; |
| 1838 | 1864 | // which queue, which bitmap |
| 1839 | | if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60) |
| 1865 | if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60) |
| 1840 | 1866 | { |
| 1841 | 1867 | testobject->drawbitmap = &m_temp_bitmap_sprites[0]; |
| 1842 | 1868 | testobject->zbitmap = &m_zbuffer_bitmap; |
| r21439 | r21440 | |
| 1847 | 1873 | |
| 1848 | 1874 | queue = m_work_queue[0]; |
| 1849 | 1875 | } |
| 1850 | | else // 0x90, 0xa0, 0xb0, 0xc0 |
| 1876 | else // 0x90, 0xa0, 0xaf, 0xb0, 0xc0 |
| 1851 | 1877 | { |
| 1852 | 1878 | testobject->drawbitmap = &m_temp_bitmap_sprites2[0]; |
| 1853 | 1879 | testobject->zbitmap = &m_zbuffer_bitmap2; |
| r21439 | r21440 | |
| 1867 | 1893 | { |
| 1868 | 1894 | m_blitterMode = (data & 0x00ff0000) >> 16; |
| 1869 | 1895 | |
| 1870 | | if (m_blitterMode == 0x4f) |
| 1896 | |
| 1897 | if (m_blitterMode == 0xf4) |
| 1871 | 1898 | { |
| 1872 | | /* used during end sequence, purpose unknown */ |
| 1873 | | } |
| 1874 | | else if (m_blitterMode == 0xf4) |
| 1875 | | { |
| 1876 | 1899 | // Some sort of addressing state. |
| 1877 | 1900 | // In the case of text, simply writes 4 characters per 32-bit word. |
| 1878 | 1901 | // These values may be loaded into RAM somewhere as they are written. |
| r21439 | r21440 | |
| 1887 | 1910 | |
| 1888 | 1911 | |
| 1889 | 1912 | } |
| 1890 | | else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60 |
| 1891 | | || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xb0 || m_blitterMode == 0xc0) |
| 1913 | else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60 |
| 1914 | || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xaf || m_blitterMode == 0xb0 || m_blitterMode == 0xc0) |
| 1892 | 1915 | { |
| 1916 | // 4f / af are used to send the clipping window during the end sequence, I don't know if the 'f' bit has any special meaning |
| 1917 | // we need a hack for the blit window to set by them to work at all |
| 1918 | |
| 1893 | 1919 | // The blitter function(s). |
| 1894 | 1920 | // After this is set a fixed count of 11 32-bit words are sent to the data register. |
| 1895 | 1921 | // The lower word always seems to be 0x0001 and the upper byte always 0xac. |
| r21439 | r21440 | |
| 1914 | 1940 | |
| 1915 | 1941 | // i've seen this triggered once or twice |
| 1916 | 1942 | // might be there are more z-bits, or it's just overflowing when there are too many sprites |
| 1917 | | if (data & 0x0000f000) |
| 1918 | | printf("blitter mode with mask 0x0000f000\n"); |
| 1943 | // also set on the 4f/af cliprect during the ending |
| 1944 | //if (data & 0x0000f000) |
| 1945 | // printf("blitter mode with mask 0x0000f000 (%08x)\n", data & 0x0000f000); |
| 1919 | 1946 | |
| 1920 | 1947 | |
| 1921 | 1948 | |
| r21439 | r21440 | |
| 1957 | 1984 | space.write_dword(memOffset, data); |
| 1958 | 1985 | m_blitterSerialCount += 0x04; |
| 1959 | 1986 | } |
| 1960 | | else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60 |
| 1961 | | || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xb0 || m_blitterMode == 0xc0) |
| 1987 | else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x4f || m_blitterMode == 0x50 || m_blitterMode == 0x60 |
| 1988 | || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xaf || m_blitterMode == 0xb0 || m_blitterMode == 0xc0) |
| 1962 | 1989 | { |
| 1963 | 1990 | // Serialized counts |
| 1964 | 1991 | if (m_blitterSerialCount < 12) |
| r21439 | r21440 | |
| 2007 | 2034 | } |
| 2008 | 2035 | else |
| 2009 | 2036 | { |
| 2010 | | logerror("unk blit mode %02x\n", m_blitterMode); |
| 2037 | printf("unk blit mode %02x\n", m_blitterMode); |
| 2011 | 2038 | } |
| 2012 | 2039 | } |
| 2013 | 2040 | |
| r21439 | r21440 | |
| 2080 | 2107 | m_clipvals[0][0] = 0; |
| 2081 | 2108 | m_clipvals[0][1] = 0; |
| 2082 | 2109 | m_clipvals[0][2] = 0; |
| 2110 | m_clipblitterMode[0] = 0xff; |
| 2083 | 2111 | } |
| 2084 | 2112 | else if(m_blitterClearMode == 0x8c800000) |
| 2085 | 2113 | { |
| r21439 | r21440 | |
| 2091 | 2119 | m_clipvals[1][0] = 0; |
| 2092 | 2120 | m_clipvals[1][1] = 0; |
| 2093 | 2121 | m_clipvals[1][2] = 0; |
| 2122 | m_clipblitterMode[1] = 0xff; |
| 2094 | 2123 | } |
| 2095 | 2124 | |
| 2096 | 2125 | //printf("frame\n"); |