src/mame/video/stvvdp2.c
| r12453 | r12454 | |
| 1 | 1 | /* Sega Saturn VDP2 */ |
| 2 | 2 | |
| 3 | | /*Debug features,remember to zero it if you publish this file.*/ |
| 4 | 3 | #define DEBUG_MODE 0 |
| 5 | 4 | |
| 6 | 5 | /* |
| r12453 | r12454 | |
| 380 | 379 | |
| 381 | 380 | /*180024 - Special Function Code Select |
| 382 | 381 | |
| 383 | | 180026 - Special Function Code |
| 382 | */ |
| 384 | 383 | |
| 384 | #define STV_VDP2_SFSEL ((state->m_vdp2_regs[0x024/4] >> 16)&0x0000ffff) |
| 385 | |
| 386 | /*180026 - Special Function Code |
| 387 | |
| 388 | */ |
| 389 | |
| 390 | #define STV_VDP2_SFCODE ((state->m_vdp2_regs[0x024/4] >> 0)&0x0000ffff) |
| 391 | |
| 392 | |
| 393 | /* |
| 385 | 394 | 180028 - CHCTLA - Character Control (NBG0, NBG1) |
| 386 | 395 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 387 | 396 | | -- | -- | N1CHCN1 | N1CHCN0 | N1BMSZ1 | N1BMSZ0 | N1BMEN | N1CHSZ | |
| r12453 | r12454 | |
| 674 | 683 | /* Supplementary Character Bits (in 1 byte mode) */ |
| 675 | 684 | #define STV_VDP2_R0SPCN ((STV_VDP2_PNCR & 0x001f) >> 0) |
| 676 | 685 | |
| 677 | | /* 18003A - PLSZ - Plane Size (incomplete) |
| 686 | /* 18003A - PLSZ - Plane Size |
| 678 | 687 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 679 | 688 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 680 | 689 | |----07----|----06----|----05----|----04----|----03----|----02----|----01----|----00----| |
| r12453 | r12454 | |
| 689 | 698 | 10 invalid |
| 690 | 699 | 11 2H Pages x 2V Pages */ |
| 691 | 700 | #define STV_VDP2_RBOVR ((STV_VDP2_PLSZ & 0xc000) >> 14) |
| 701 | #define STV_VDP2_RBPLSZ ((STV_VDP2_PLSZ & 0x3000) >> 12) |
| 692 | 702 | #define STV_VDP2_RAOVR ((STV_VDP2_PLSZ & 0x0c00) >> 10) |
| 703 | #define STV_VDP2_RAPLSZ ((STV_VDP2_PLSZ & 0x0300) >> 8) |
| 704 | #define STV_VDP2_N3PLSZ ((STV_VDP2_PLSZ & 0x00c0) >> 6) |
| 705 | #define STV_VDP2_N2PLSZ ((STV_VDP2_PLSZ & 0x0030) >> 4) |
| 706 | #define STV_VDP2_N1PLSZ ((STV_VDP2_PLSZ & 0x000c) >> 2) |
| 693 | 707 | #define STV_VDP2_N0PLSZ ((STV_VDP2_PLSZ & 0x0003) >> 0) |
| 694 | | #define STV_VDP2_N1PLSZ ((STV_VDP2_PLSZ & 0x000c) >> 2) |
| 695 | | #define STV_VDP2_N2PLSZ ((STV_VDP2_PLSZ & 0x0030) >> 4) |
| 696 | | #define STV_VDP2_N3PLSZ ((STV_VDP2_PLSZ & 0x00c0) >> 6) |
| 697 | | #define STV_VDP2_RAPLSZ ((STV_VDP2_PLSZ & 0x0300) >> 8) |
| 698 | | #define STV_VDP2_RBPLSZ ((STV_VDP2_PLSZ & 0x3000) >> 12) |
| 699 | 708 | |
| 700 | 709 | /* 18003C - MPOFN - Map Offset (NBG0, NBG1, NBG2, NBG3) |
| 701 | 710 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| r12453 | r12454 | |
| 707 | 716 | #define STV_VDP2_MPOFN_ ((state->m_vdp2_regs[0x03c/4] >> 16)&0x0000ffff) |
| 708 | 717 | |
| 709 | 718 | /* Higher 3 bits of the map offset for each layer */ |
| 719 | #define STV_VDP2_N3MP_ ((STV_VDP2_MPOFN_ & 0x7000) >> 12) |
| 720 | #define STV_VDP2_N2MP_ ((STV_VDP2_MPOFN_ & 0x0700) >> 8) |
| 721 | #define STV_VDP2_N1MP_ ((STV_VDP2_MPOFN_ & 0x0070) >> 4) |
| 710 | 722 | #define STV_VDP2_N0MP_ ((STV_VDP2_MPOFN_ & 0x0007) >> 0) |
| 711 | | #define STV_VDP2_N1MP_ ((STV_VDP2_MPOFN_ & 0x0070) >> 4) |
| 712 | | #define STV_VDP2_N2MP_ ((STV_VDP2_MPOFN_ & 0x0700) >> 8) |
| 713 | | #define STV_VDP2_N3MP_ ((STV_VDP2_MPOFN_ & 0x7000) >> 12) |
| 714 | 723 | |
| 715 | 724 | |
| 716 | 725 | |
| r12453 | r12454 | |
| 1321 | 1330 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1322 | 1331 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1323 | 1332 | |
| 1333 | #define STV_VDP2_VCSTAU ((state->m_vdp2_regs[0x09c/4] >> 16)&0x00000007) |
| 1334 | |
| 1335 | |
| 1324 | 1336 | /* 18009e - Vertical Cell Table Address (NBG0, NBG1) |
| 1325 | 1337 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1326 | 1338 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1328 | 1340 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1329 | 1341 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1330 | 1342 | |
| 1343 | #define STV_VDP2_VCSTAL ((state->m_vdp2_regs[0x09c/4] >> 0)&0x0000fffe) |
| 1344 | |
| 1345 | |
| 1331 | 1346 | /* 1800a0 - LSTA0U - Line Scroll Table Address (NBG0) |
| 1332 | 1347 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1333 | 1348 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1336 | 1351 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1337 | 1352 | |
| 1338 | 1353 | /*bit 2 unused when VRAM = 4 Mbits*/ |
| 1339 | | #define STV_VDP2_LSTA0U ((state->m_vdp2_regs[0x0a0/4] >> 16)&0x00000003) |
| 1354 | #define STV_VDP2_LSTA0U ((state->m_vdp2_regs[0x0a0/4] >> 16)&0x00000007) |
| 1340 | 1355 | |
| 1341 | 1356 | /* 1800a2 - LSTA0L - Line Scroll Table Address (NBG0) |
| 1342 | 1357 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| r12453 | r12454 | |
| 1355 | 1370 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1356 | 1371 | |
| 1357 | 1372 | /*bit 2 unused when VRAM = 4 Mbits*/ |
| 1358 | | #define STV_VDP2_LSTA1U ((state->m_vdp2_regs[0x0a4/4] >> 16)&0x00000003) |
| 1373 | #define STV_VDP2_LSTA1U ((state->m_vdp2_regs[0x0a4/4] >> 16)&0x00000007) |
| 1359 | 1374 | |
| 1360 | 1375 | /* 1800a6 - LSTA1L - Line Scroll Table Address (NBG1) |
| 1361 | 1376 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| r12453 | r12454 | |
| 1384 | 1399 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1385 | 1400 | #define STV_VDP2_LCTAL ((state->m_vdp2_regs[0x0a8/4] >> 0) & 0xffff) |
| 1386 | 1401 | |
| 1387 | | #define STV_VDP2_LCTA (state->m_vdp2_regs[0x0a8/4] & 0x0003ffff) |
| 1402 | #define STV_VDP2_LCTA (((STV_VDP2_LCTAU & 0x0007) << 16) | (STV_VDP2_LCTAL & 0xfffe)) |
| 1388 | 1403 | |
| 1389 | 1404 | /* 1800ac - Back Screen Table Address |
| 1390 | 1405 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| r12453 | r12454 | |
| 1393 | 1408 | | -- | -- | -- | -- | -- | BKTA18 | BKTA17 | BKTA16 | |
| 1394 | 1409 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1395 | 1410 | |
| 1411 | #define STV_VDP2_BKTAU ((state->m_vdp2_regs[0x0ac/4] >> 16) & 0xffff) |
| 1412 | |
| 1413 | #define STV_VDP2_BKCLMD ((STV_VDP2_BKTAU & 0x8000) >> 15) |
| 1414 | |
| 1415 | |
| 1396 | 1416 | /* 1800ae - Back Screen Table Address |
| 1397 | 1417 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1398 | 1418 | | BKTA15 | BKTA14 | BKTA13 | BKTA12 | BKTA11 | BKTA10 | BKTA9 | BKTA8 | |
| r12453 | r12454 | |
| 1400 | 1420 | | BKTA7 | BKTA7 | BKTA6 | BKTA5 | BKTA4 | BKTA3 | BKTA2 | BKTA0 | |
| 1401 | 1421 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1402 | 1422 | |
| 1403 | | #define STV_VDP2_BKTA_UL (state->m_vdp2_regs[0x0ac/4]) |
| 1423 | #define STV_VDP2_BKTAL ((state->m_vdp2_regs[0x0ac/4] >> 0) & 0xffff) |
| 1404 | 1424 | |
| 1405 | | #define STV_VDP2_BKCLMD ((STV_VDP2_BKTA_UL & 0x80000000) >> 31) |
| 1406 | | #define STV_VDP2_BKTA ((STV_VDP2_BKTA_UL & 0x0007ffff) >> 0) |
| 1425 | #define STV_VDP2_BKTA (((STV_VDP2_BKTAU & 0x0007) << 16) | (STV_VDP2_BKTAL & 0xfffe)) |
| 1407 | 1426 | |
| 1408 | 1427 | /* 1800b0 - RPMD - Rotation Parameter Mode |
| 1409 | 1428 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| r12453 | r12454 | |
| 1656 | 1675 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1657 | 1676 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1658 | 1677 | |
| 1678 | #define STV_VDP2_WCTLD ((state->m_vdp2_regs[0x0d4/4] >> 0)&0x0000ffff) |
| 1679 | #define STV_VDP2_CCLOG ((STV_VDP2_WCTLD & 0x8000) >> 15) |
| 1680 | #define STV_VDP2_CCSWE ((STV_VDP2_WCTLD & 0x2000) >> 13) |
| 1681 | #define STV_VDP2_CCSWA ((STV_VDP2_WCTLD & 0x1000) >> 12) |
| 1682 | #define STV_VDP2_CCW1E ((STV_VDP2_WCTLD & 0x0800) >> 11) |
| 1683 | #define STV_VDP2_CCW1A ((STV_VDP2_WCTLD & 0x0400) >> 10) |
| 1684 | #define STV_VDP2_CCW0E ((STV_VDP2_WCTLD & 0x0200) >> 9) |
| 1685 | #define STV_VDP2_CCW0A ((STV_VDP2_WCTLD & 0x0100) >> 8) |
| 1686 | #define STV_VDP2_RPLOG ((STV_VDP2_WCTLD & 0x0080) >> 7) |
| 1687 | #define STV_VDP2_RPW1E ((STV_VDP2_WCTLD & 0x0008) >> 3) |
| 1688 | #define STV_VDP2_RPW1A ((STV_VDP2_WCTLD & 0x0004) >> 2) |
| 1689 | #define STV_VDP2_RPW0E ((STV_VDP2_WCTLD & 0x0002) >> 1) |
| 1690 | #define STV_VDP2_RPW0A ((STV_VDP2_WCTLD & 0x0001) >> 0) |
| 1691 | |
| 1659 | 1692 | /* 1800d8 - Line Window Table Address (W0) |
| 1660 | 1693 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1661 | 1694 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1663 | 1696 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1664 | 1697 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1665 | 1698 | |
| 1699 | #define STV_VDP2_LWTA0U ((state->m_vdp2_regs[0x0d8/4] >> 16)&0x0000ffff) |
| 1700 | |
| 1701 | #define STV_VDP2_W0LWE ((STV_VDP2_LWTA0U & 0x8000) >> 15) |
| 1702 | |
| 1666 | 1703 | /* 1800da - Line Window Table Address (W0) |
| 1667 | 1704 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1668 | 1705 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1670 | 1707 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1671 | 1708 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1672 | 1709 | |
| 1710 | #define STV_VDP2_LWTA0L ((state->m_vdp2_regs[0x0d8/4] >> 0)&0x0000ffff) |
| 1711 | |
| 1712 | /* bit 19 isn't used when VRAM = 4 Mbit */ |
| 1713 | #define STV_VDP2_W0LWTA (((STV_VDP2_LWTA0U & 0x0007) << 16) | (STV_VDP2_LWTA0L & 0xfffe)) |
| 1714 | |
| 1715 | |
| 1673 | 1716 | /* 1800dc - Line Window Table Address (W1) |
| 1674 | 1717 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1675 | 1718 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1677 | 1720 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1678 | 1721 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1679 | 1722 | |
| 1723 | #define STV_VDP2_LWTA1U ((state->m_vdp2_regs[0x0dc/4] >> 16)&0x0000ffff) |
| 1724 | |
| 1725 | #define STV_VDP2_W1LWE ((STV_VDP2_LWTA0U & 0x8000) >> 15) |
| 1726 | |
| 1727 | |
| 1680 | 1728 | /* 1800de - Line Window Table Address (W1) |
| 1681 | 1729 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1682 | 1730 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| r12453 | r12454 | |
| 1684 | 1732 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1685 | 1733 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1686 | 1734 | |
| 1735 | #define STV_VDP2_LWTA1L ((state->m_vdp2_regs[0x0dc/4] >> 0)&0x0000ffff) |
| 1736 | |
| 1737 | /* bit 19 isn't used when VRAM = 4 Mbit */ |
| 1738 | #define STV_VDP2_W1LWTA (((STV_VDP2_LWTA1U & 0x0007) << 16) | (STV_VDP2_LWTA1L & 0xfffe)) |
| 1739 | |
| 1740 | |
| 1687 | 1741 | /* 1800e0 - Sprite Control |
| 1688 | 1742 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1689 | 1743 | | -- | -- | SPCCCS1 | SPCCCS0 | -- | SPCCN2 | SPCCN1 | SPCCN0 | |
| r12453 | r12454 | |
| 1755 | 1809 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1756 | 1810 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1757 | 1811 | |
| 1812 | #define STV_VDP2_SFPRMD ((state->m_vdp2_regs[0x0e8/4] >> 0)&0x0000ffff) |
| 1813 | |
| 1814 | |
| 1758 | 1815 | /* 1800ec - Colour Calculation Control |
| 1759 | 1816 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1760 | 1817 | | BOKEN | BOKN2 | BOKN1 | BOKN0 | -- | EXCCEN | CCRTMD | CCMD | |
| r12453 | r12454 | |
| 1780 | 1837 | | -- | -- | -- | -- | -- | -- | -- | -- | |
| 1781 | 1838 | \----------|----------|----------|----------|----------|----------|----------|---------*/ |
| 1782 | 1839 | |
| 1840 | #define STV_VDP2_SFCCMD ((state->m_vdp2_regs[0xec/4]>>0)&0x0000ffff) |
| 1841 | |
| 1783 | 1842 | /* 1800f0 - Priority Number (Sprite 0,1) |
| 1784 | 1843 | bit-> /----15----|----14----|----13----|----12----|----11----|----10----|----09----|----08----\ |
| 1785 | 1844 | | -- | -- | -- | -- | -- | S1PRIN2 | S1PRIN1 | S1PRIN0 | |
| r12453 | r12454 | |
| 2040 | 2099 | UINT8 roz; /*Debug roz on screen*/ |
| 2041 | 2100 | } debug; |
| 2042 | 2101 | |
| 2043 | | /* |
| 2044 | | Errors are currently mapped as follows: |
| 2045 | | x--- ---- ---- ---- ---- ---- ---- ---- VRAM Size = 8 Mbit |
| 2046 | | -x-- ---- ---- ---- ---- ---- ---- ---- CRKTE used |
| 2047 | | ---- ---- ---- ---- ---- ---- ---- --x- Mosaic Control |
| 2048 | | ---- ---- ---- ---- ---- ---- ---- ---x Window on tilemap |
| 2049 | | */ |
| 2050 | | #define VDP2_ERR(_bit_) (debug.error & _bit_) |
| 2051 | | #define VDP2_CHK(_bit_) (debug.error^=_bit_) |
| 2052 | | |
| 2053 | 2102 | /* Not sure if to use this for the rotating tilemaps as well or just use different draw functions, might add too much bloat */ |
| 2054 | 2103 | static struct stv_vdp2_tilemap_capabilities |
| 2055 | 2104 | { |
| r12453 | r12454 | |
| 2088 | 2137 | UINT8 fade_control; |
| 2089 | 2138 | UINT8 window_control; |
| 2090 | 2139 | |
| 2140 | UINT8 line_screen_enabled; |
| 2141 | |
| 2091 | 2142 | // UINT8 real_map_offset[16]; |
| 2092 | 2143 | |
| 2093 | 2144 | int layer_name; /* just to keep track */ |
| r12453 | r12454 | |
| 4149 | 4200 | } |
| 4150 | 4201 | } |
| 4151 | 4202 | |
| 4203 | static void stv_vdp2_draw_line(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 4204 | { |
| 4205 | saturn_state *state = machine.driver_data<saturn_state>(); |
| 4206 | int x,y; |
| 4207 | UINT8* gfxdata = state->m_vdp2.gfx_decode; |
| 4208 | UINT32 base_offs,base_mask; |
| 4209 | UINT16 pix; |
| 4210 | UINT8 interlace; |
| 4211 | |
| 4212 | interlace = (STV_VDP2_LSMD == 3)+1; |
| 4213 | |
| 4214 | { |
| 4215 | base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; |
| 4216 | |
| 4217 | for(y=cliprect->min_y;y<=cliprect->max_y;y++) |
| 4218 | { |
| 4219 | base_offs = (STV_VDP2_LCTA & base_mask) << 1; |
| 4220 | |
| 4221 | if(STV_VDP2_LCCLMD) |
| 4222 | base_offs += (y / interlace) << 1; |
| 4223 | |
| 4224 | for(x=cliprect->min_x;x<=cliprect->max_x;x++) |
| 4225 | { |
| 4226 | UINT16 pen; |
| 4227 | |
| 4228 | pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1]; |
| 4229 | pix = *BITMAP_ADDR16(bitmap, y,x); |
| 4230 | |
| 4231 | *BITMAP_ADDR16(bitmap, y, x) = stv_add_blend(machine.pens[pen & 0x7ff],pix); |
| 4232 | } |
| 4233 | } |
| 4234 | } |
| 4235 | } |
| 4236 | |
| 4152 | 4237 | static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 4153 | 4238 | { |
| 4154 | 4239 | /* the idea is here we check the tilemap capabilities / whats enabled and call an appropriate tilemap drawing routine, or |
| r12453 | r12454 | |
| 4184 | 4269 | else |
| 4185 | 4270 | { |
| 4186 | 4271 | stv_vdp2_draw_basic_tilemap(machine, bitmap, &mycliprect); |
| 4187 | | |
| 4188 | | if((stv2_current_tilemap.window_control & 6) != 0 && VDP2_ERR(1)) |
| 4189 | | { |
| 4190 | | VDP2_CHK(1); |
| 4191 | | mame_printf_debug("Window control enabled on a tilemap plane = %02x\n",stv2_current_tilemap.window_control); |
| 4192 | | } |
| 4193 | 4272 | } |
| 4194 | 4273 | |
| 4195 | | if(STV_VDP2_MZCTL & 0x1f) |
| 4274 | if(stv2_current_tilemap.line_screen_enabled) |
| 4275 | stv_vdp2_draw_line(machine,bitmap,cliprect); |
| 4276 | |
| 4277 | |
| 4196 | 4278 | { |
| 4197 | | printf("Mosaic control enabled = %04x\n",STV_VDP2_MZCTL); |
| 4279 | /* Capcom Collection Dai 2 - Choh Makaimura (Duh!) */ |
| 4280 | if(STV_VDP2_MZCTL & 0x1f && 0) |
| 4281 | popmessage("Mosaic control enabled = %04x\n",STV_VDP2_MZCTL); |
| 4282 | |
| 4283 | /* Bio Hazard bit 1 */ |
| 4284 | if(STV_VDP2_LNCLEN & ~2) |
| 4285 | popmessage("Line Colour screen enabled %04x %08x, contact MAMEdev",STV_VDP2_LNCLEN,STV_VDP2_LCTAU<<16|STV_VDP2_LCTAL); |
| 4286 | |
| 4287 | /* Bio Hazard 0x400 = extended color calculation enabled */ |
| 4288 | //if(STV_VDP2_CCCR & 0xf600) |
| 4289 | if(STV_VDP2_CCCR & 0xf200) |
| 4290 | popmessage("Gradation enabled %04x, contact MAMEdev",STV_VDP2_CCCR); |
| 4291 | |
| 4292 | /* Advanced VG, Shining Force 3 */ |
| 4293 | if(STV_VDP2_SFCCMD && 0) |
| 4294 | popmessage("Special Color Calculation enable %04x, contact MAMEdev",STV_VDP2_SFCCMD); |
| 4295 | |
| 4296 | if(STV_VDP2_SDCTL & 0x0120) |
| 4297 | popmessage("%s shadow select bit enabled, contact MAMEdev",STV_VDP2_SDCTL & 0x100 ? "Transparent" : "Back"); |
| 4298 | |
| 4299 | if(STV_VDP2_SFSEL) |
| 4300 | popmessage("Special Function Code Select enable %04x %04x, contact MAMEdev",STV_VDP2_SFSEL,STV_VDP2_SFCODE); |
| 4301 | |
| 4302 | if(STV_VDP2_ZMCTL) |
| 4303 | popmessage("Reduction enable %04x, contact MAMEdev",STV_VDP2_ZMCTL); |
| 4304 | |
| 4305 | if(STV_VDP2_SCRCTL & 0x0101) |
| 4306 | popmessage("Vertical cell scroll enable %04x, contact MAMEdev",STV_VDP2_SCRCTL); |
| 4307 | |
| 4308 | if(STV_VDP2_WCTLD & 0x2606) |
| 4309 | popmessage("Special window enabled %04x, contact MAMEdev",STV_VDP2_WCTLD); |
| 4310 | |
| 4311 | if(STV_VDP2_W0LWE || STV_VDP2_W1LWE) |
| 4312 | popmessage("Line Window %s enabled, contact MAMEdev",STV_VDP2_W0LWE ? "0" : "1"); |
| 4313 | |
| 4314 | if(STV_VDP2_SFPRMD) |
| 4315 | popmessage("Special Priority Mode enabled %04x, contact MAMEdev",STV_VDP2_SFPRMD); |
| 4198 | 4316 | } |
| 4199 | 4317 | } |
| 4200 | 4318 | |
| r12453 | r12454 | |
| 4592 | 4710 | static void stv_vdp2_draw_NBG0(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 4593 | 4711 | { |
| 4594 | 4712 | saturn_state *state = machine.driver_data<saturn_state>(); |
| 4713 | UINT32 base_mask; |
| 4595 | 4714 | |
| 4715 | base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; |
| 4716 | |
| 4596 | 4717 | /* |
| 4597 | 4718 | Colours : 16, 256, 2048, 32768, 16770000 |
| 4598 | 4719 | Char Size : 1x1 cells, 2x2 cells |
| r12453 | r12454 | |
| 4656 | 4777 | |
| 4657 | 4778 | stv2_current_tilemap.linescroll_enable = STV_VDP2_N0LSCX; |
| 4658 | 4779 | stv2_current_tilemap.linescroll_interval = (((STV_VDP2_LSMD & 3) == 2) ? (2) : (1)) << (STV_VDP2_N0LSS); |
| 4659 | | stv2_current_tilemap.linescroll_table_address = ((STV_VDP2_LSTA0U << 16) | STV_VDP2_LSTA0L) * 2; |
| 4780 | stv2_current_tilemap.linescroll_table_address = (((STV_VDP2_LSTA0U << 16) | STV_VDP2_LSTA0L) & base_mask) * 2; |
| 4660 | 4781 | stv2_current_tilemap.vertical_linescroll_enable = STV_VDP2_N0LSCY; |
| 4661 | 4782 | stv2_current_tilemap.linezoom_enable = STV_VDP2_N0LZMX; |
| 4662 | 4783 | |
| r12453 | r12454 | |
| 4672 | 4793 | (STV_VDP2_N0W1A << 5) | |
| 4673 | 4794 | (STV_VDP2_N0SWA << 6); |
| 4674 | 4795 | |
| 4796 | stv2_current_tilemap.line_screen_enabled = STV_VDP2_N0LCEN; |
| 4797 | |
| 4675 | 4798 | stv2_current_tilemap.layer_name=0; |
| 4676 | 4799 | |
| 4677 | 4800 | if ( stv2_current_tilemap.enabled && (!(STV_VDP2_R1ON))) /* TODO: check cycle pattern for RBG1 */ |
| r12453 | r12454 | |
| 4688 | 4811 | static void stv_vdp2_draw_NBG1(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 4689 | 4812 | { |
| 4690 | 4813 | saturn_state *state = machine.driver_data<saturn_state>(); |
| 4814 | UINT32 base_mask; |
| 4691 | 4815 | |
| 4816 | base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; |
| 4817 | |
| 4692 | 4818 | /* |
| 4693 | 4819 | Colours : 16, 256, 2048, 32768 |
| 4694 | 4820 | Char Size : 1x1 cells, 2x2 cells |
| r12453 | r12454 | |
| 4751 | 4877 | |
| 4752 | 4878 | stv2_current_tilemap.linescroll_enable = STV_VDP2_N1LSCX; |
| 4753 | 4879 | stv2_current_tilemap.linescroll_interval = (((STV_VDP2_LSMD & 3) == 2) ? (2) : (1)) << (STV_VDP2_N1LSS); |
| 4754 | | stv2_current_tilemap.linescroll_table_address = ((STV_VDP2_LSTA1U << 16) | STV_VDP2_LSTA1L) * 2; |
| 4880 | stv2_current_tilemap.linescroll_table_address = (((STV_VDP2_LSTA1U << 16) | STV_VDP2_LSTA1L) & base_mask) * 2; |
| 4755 | 4881 | stv2_current_tilemap.vertical_linescroll_enable = STV_VDP2_N1LSCY; |
| 4756 | 4882 | stv2_current_tilemap.linezoom_enable = STV_VDP2_N1LZMX; |
| 4757 | 4883 | |
| r12453 | r12454 | |
| 4767 | 4893 | (STV_VDP2_N1W1A << 5) | |
| 4768 | 4894 | (STV_VDP2_N1SWA << 6); |
| 4769 | 4895 | |
| 4896 | stv2_current_tilemap.line_screen_enabled = STV_VDP2_N1LCEN; |
| 4897 | |
| 4770 | 4898 | stv2_current_tilemap.layer_name=1; |
| 4771 | 4899 | |
| 4772 | 4900 | if ( stv2_current_tilemap.enabled ) |
| r12453 | r12454 | |
| 4867 | 4995 | (STV_VDP2_N2W1A << 5) | |
| 4868 | 4996 | (STV_VDP2_N2SWA << 6); |
| 4869 | 4997 | |
| 4998 | stv2_current_tilemap.line_screen_enabled = STV_VDP2_N2LCEN; |
| 4999 | |
| 4870 | 5000 | stv2_current_tilemap.layer_name=2; |
| 4871 | 5001 | |
| 4872 | 5002 | stv2_current_tilemap.plane_size = STV_VDP2_N2PLSZ; |
| r12453 | r12454 | |
| 4968 | 5098 | (STV_VDP2_N3W1A << 5) | |
| 4969 | 5099 | (STV_VDP2_N3SWA << 6); |
| 4970 | 5100 | |
| 5101 | stv2_current_tilemap.line_screen_enabled = STV_VDP2_N3LCEN; |
| 5102 | |
| 4971 | 5103 | stv2_current_tilemap.layer_name=3; |
| 4972 | 5104 | |
| 4973 | 5105 | stv2_current_tilemap.plane_size = STV_VDP2_N3PLSZ; |
| r12453 | r12454 | |
| 5240 | 5372 | stv2_current_tilemap.vertical_linescroll_enable = 0; |
| 5241 | 5373 | stv2_current_tilemap.linezoom_enable = 0; |
| 5242 | 5374 | |
| 5375 | stv2_current_tilemap.line_screen_enabled = STV_VDP2_R0LCEN; |
| 5376 | |
| 5243 | 5377 | /*Use 0x80 as a normal/rotate switch*/ |
| 5244 | 5378 | stv2_current_tilemap.layer_name=0x80; |
| 5245 | 5379 | |
| r12453 | r12454 | |
| 5296 | 5430 | b = (dot & 0x7c00) >> 10; |
| 5297 | 5431 | g = (dot & 0x03e0) >> 5; |
| 5298 | 5432 | r = (dot & 0x001f) >> 0; |
| 5433 | if(STV_VDP2_BKCOEN) |
| 5434 | stv_vdp2_compute_color_offset_RGB555( machine, &r, &g, &b, STV_VDP2_BKCOSL ); |
| 5299 | 5435 | |
| 5300 | 5436 | *BITMAP_ADDR16(bitmap, y,x) = b | g << 5 | r << 10; |
| 5301 | 5437 | } |
| r12453 | r12454 | |
| 6623 | 6759 | } |
| 6624 | 6760 | |
| 6625 | 6761 | #if DEBUG_MODE |
| 6626 | | if(STV_VDP2_VRAMSZ && VDP2_ERR(0x80000000)) |
| 6627 | | { |
| 6628 | | VDP2_CHK(0x80000000); |
| 6629 | | mame_printf_debug("Warning: VRAM Size = 8 MBit!\n"); |
| 6630 | | } |
| 6631 | | if(STV_VDP2_CRKTE && VDP2_ERR(0x40000000)) |
| 6632 | | { |
| 6633 | | VDP2_CHK(0x40000000); |
| 6634 | | mame_printf_debug("Warning: Color RAM Coefficient Table Ctrl used\n"); |
| 6635 | | } |
| 6636 | | |
| 6637 | 6762 | /*popmessage("N0 %02x %04x %02x %04x N1 %02x %04x %02x %04x" |
| 6638 | 6763 | ,STV_VDP2_N0ZMXI,STV_VDP2_N0ZMXD |
| 6639 | 6764 | ,STV_VDP2_N0ZMYI,STV_VDP2_N0ZMYD |