trunk/src/mame/drivers/coolridr.c
| r21313 | r21314 | |
| 375 | 375 | m_blitterSerialCount(0x00), |
| 376 | 376 | m_blitterMode(0x00), |
| 377 | 377 | m_textOffset(0x0000), |
| 378 | | m_vCellCount(0x0000), |
| 379 | | m_hCellCount(0x0000), |
| 380 | | m_vPosition(0x0000), |
| 381 | | m_hPosition(0x0000), |
| 382 | 378 | m_maincpu(*this, "maincpu"), |
| 383 | 379 | m_subcpu(*this,"sub"), |
| 384 | 380 | m_soundcpu(*this,"soundcpu"), |
| r21313 | r21314 | |
| 399 | 395 | INT16 m_blitterSerialCount; |
| 400 | 396 | UINT8 m_blitterMode; |
| 401 | 397 | UINT16 m_textOffset; |
| 402 | | UINT16 m_vCellCount; |
| 403 | | UINT16 m_hCellCount; |
| 404 | 398 | UINT32 m_blitterClearMode; |
| 405 | 399 | INT16 m_blitterClearCount; |
| 406 | | int m_vPosition; |
| 407 | | int m_hPosition; |
| 408 | 400 | |
| 409 | | UINT16 m_vOrigin; |
| 410 | | UINT16 m_hOrigin; |
| 411 | | UINT16 m_vZoom; |
| 412 | | UINT16 m_hZoom; |
| 413 | | UINT32 m_blit0; // ? |
| 414 | | UINT32 m_blit1_unused; // ? |
| 415 | | UINT32 m_b1mode; // ? |
| 416 | | UINT32 m_b1colorNumber; |
| 417 | | UINT32 m_blit2_unused; // ? |
| 418 | | UINT32 m_b2tpen; |
| 419 | | UINT32 m_b2colorNumber; |
| 401 | // store the blit params here |
| 402 | UINT32 m_spriteblit[12]; |
| 420 | 403 | |
| 421 | | UINT32 m_blit3_unused; // ? |
| 422 | | UINT32 m_b3romoffset; // |
| 423 | | UINT32 m_blit4_unused; |
| 424 | | UINT32 m_blit4; // ? |
| 425 | | UINT32 m_b4flipx; |
| 426 | | UINT32 m_b4flipy; |
| 427 | | UINT32 m_b4rotate; |
| 404 | |
| 428 | 405 | |
| 429 | | UINT32 m_blit5_unused; // indirection enable + other bits? |
| 430 | | int m_indirect_tile_enable; // from m_blit5 |
| 431 | | int m_indirect_zoom_enable; // from m_blit5 |
| 432 | 406 | |
| 433 | | UINT32 m_blit10; // an address |
| 434 | 407 | |
| 435 | | UINT16 m_tempshape[16*16]; |
| 436 | 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 437 | 414 | required_device<cpu_device> m_maincpu; |
| 438 | 415 | required_device<cpu_device> m_subcpu; |
| 439 | 416 | required_device<cpu_device> m_soundcpu; |
| r21313 | r21314 | |
| 499 | 476 | }; |
| 500 | 477 | |
| 501 | 478 | #define PRINT_BLIT_STUFF \ |
| 502 | | printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", m_blit0, m_blit1_unused,m_b1mode,m_b1colorNumber, m_blit2_unused,m_b2tpen,m_b2colorNumber, m_blit3_unused,m_b3romoffset, m_blit4_unused, m_blit4, m_b4flipy,m_b4rotate, m_b4flipx, m_blit5_unused, m_indirect_tile_enable, m_indirect_zoom_enable, m_vCellCount, m_hCellCount, m_vZoom, m_hZoom, m_blit10, data, m_vPosition, m_hPosition); \ |
| 479 | printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", blit0, blit1_unused,b1mode,b1colorNumber, blit2_unused,b2tpen,b2colorNumber, blit3_unused,b3romoffset, blit4_unused, blit4, blit_flipy,blit_rotate, blit_flipx, blit5_unused, indirect_tile_enable, indirect_zoom_enable, vCellCount, hCellCount, vZoom, hZoom, blit10, data, vPosition, hPosition); \ |
| 503 | 480 | |
| 504 | 481 | |
| 505 | 482 | /* video */ |
| r21313 | r21314 | |
| 819 | 796 | // (See ifdef'ed out code below for a closer examination) |
| 820 | 797 | |
| 821 | 798 | // Serialized counts |
| 822 | | if (m_blitterSerialCount == 0) |
| 799 | if (m_blitterSerialCount < 12) |
| 823 | 800 | { |
| 801 | m_spriteblit[m_blitterSerialCount] = data; |
| 802 | m_blitterSerialCount++; |
| 803 | } |
| 804 | else |
| 805 | { |
| 806 | printf("more than 11 dwords (%d) in blit?\n", m_blitterSerialCount); |
| 807 | } |
| 808 | |
| 809 | // use the 11th blit write also as the trigger |
| 810 | if (m_blitterSerialCount == 12) |
| 811 | { |
| 812 | // first parse the bits |
| 813 | |
| 814 | /************* m_spriteblit[0] *************/ |
| 815 | |
| 824 | 816 | // set to 0x00000001 on some objects during the 'film strip' part of attract, otherwise 0 |
| 825 | 817 | // those objects don't seem visible anyway so might have some special meaning |
| 826 | 818 | // this is also set at times during the game |
| 827 | 819 | // |
| 828 | | // the sprites with 1 set appear to have 0x00000000 in everything after the 4th write (m_blit4 and above) |
| 820 | // the sprites with 1 set appear to have 0x00000000 in everything after the 4th write (blit4 and above) |
| 829 | 821 | // so likely have some other meaning and are NOT regular sprite data |
| 830 | | m_blit0 = data; |
| 822 | UINT32 blit0 = m_spriteblit[0]; |
| 831 | 823 | |
| 824 | // abort early.. |
| 825 | if (blit0!=0) |
| 826 | return; |
| 832 | 827 | |
| 828 | /************* m_spriteblit[1] *************/ |
| 829 | |
| 830 | // 000u0ccc - c = colour? u = 0/1 |
| 831 | UINT32 blit1_unused = m_spriteblit[1] & 0xfffef800; |
| 832 | UINT32 b1mode = (m_spriteblit[1] & 0x00010000)>>16; |
| 833 | //UINT32 b1colorNumber = (m_spriteblit[1] & 0x000007ff); // Probably more bits |
| 833 | 834 | |
| 835 | if (blit1_unused!=0) printf("blit1 unknown bits set %08x\n", m_spriteblit[1]); |
| 836 | |
| 837 | /************* m_spriteblit[3] *************/ |
| 838 | |
| 839 | // seems to be more complex than just transparency |
| 840 | UINT32 blit2_unused = m_spriteblit[2]&0xff80f800; |
| 841 | UINT32 b2tpen = (m_spriteblit[2] & 0x007f0000)>>16; |
| 842 | //UINT32 b2colorNumber = (m_spriteblit[2] & 0x000007ff); |
| 834 | 843 | |
| 835 | | |
| 836 | | // if (data!=0) printf("blit %08x\n", data); |
| 837 | | } |
| 838 | | else if (m_blitterSerialCount == 1) |
| 839 | | { |
| 840 | | m_blit1_unused = 0; m_b1mode = 0; m_b1colorNumber = 0; |
| 841 | | |
| 842 | | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 844 | if (blit2_unused!=0) printf("blit1 unknown bits set %08x\n", m_spriteblit[2]); |
| 845 | if (b1mode) |
| 843 | 846 | { |
| 844 | | // 000u0ccc - c = colour? u = 0/1 |
| 845 | | m_blit1_unused = data & 0xfffef800; |
| 846 | | m_b1mode = (data & 0x00010000)>>16; |
| 847 | | m_b1colorNumber = (data & 0x000007ff); // Probably more bits |
| 848 | | |
| 849 | | if (m_blit1_unused!=0) printf("blit1 unknown bits set %08x\n", data); |
| 847 | if (b2tpen != 0x7f) printf("b1mode 1, b2tpen!=0x7f\n"); |
| 850 | 848 | } |
| 851 | | } |
| 852 | | else if (m_blitterSerialCount == 2) |
| 853 | | { |
| 854 | | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 849 | else |
| 855 | 850 | { |
| 856 | | |
| 857 | | // seems to be more complex than just transparency |
| 858 | | m_blit2_unused = data&0xff80f800; |
| 859 | | m_b2tpen = (data & 0x007f0000)>>16; |
| 860 | | m_b2colorNumber = (data & 0x000007ff); |
| 861 | | |
| 862 | | if (m_blit2_unused!=0) printf("blit1 unknown bits set %08x\n", data); |
| 863 | | if (m_b1mode) |
| 864 | | { |
| 865 | | if (m_b2tpen != 0x7f) printf("m_b1mode 1, m_b2tpen!=0x7f\n"); |
| 866 | | } |
| 867 | | else |
| 868 | | { |
| 869 | | // 0x01/0x02 trips in rare cases (start of one of the attract levels) maybe this is some kind of alpha instead? |
| 870 | | if ((m_b2tpen != 0x00) && (m_b2tpen != 0x01) && (m_b2tpen != 0x02)) printf("m_b1mode 0, m_b2tpen!=0x00,0x01 or 0x02 (is %02x)\n", m_b2tpen); |
| 871 | | } |
| 872 | | |
| 873 | | // 00??0uuu |
| 874 | | // ?? seems to be 00 or 7f, set depending on b1mode |
| 875 | | // uuu, at least 11 bits used, maybe 12 usually the same as m_blit1_unused? leftover? |
| 851 | // 0x01/0x02 trips in rare cases (start of one of the attract levels) maybe this is some kind of alpha instead? |
| 852 | if ((b2tpen != 0x00) && (b2tpen != 0x01) && (b2tpen != 0x02)) printf("b1mode 0, b2tpen!=0x00,0x01 or 0x02 (is %02x)\n", b2tpen); |
| 876 | 853 | } |
| 854 | // 00??0uuu |
| 855 | // ?? seems to be 00 or 7f, set depending on b1mode |
| 856 | // uuu, at least 11 bits used, maybe 12 usually the same as blit1_unused? leftover? |
| 857 | |
| 858 | /************* m_spriteblit[3] *************/ |
| 877 | 859 | |
| 878 | | } |
| 879 | | else if (m_blitterSerialCount == 3) |
| 880 | | { |
| 881 | | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 882 | | { |
| 883 | | m_blit3_unused = data & 0xffe00000; |
| 884 | | m_b3romoffset = (data & 0x001fffff)*2; |
| 885 | | // if this is an offset into the compressed data then it's probably a word offset into each rom (each is 0x400000 bytes) with the data from all 10 being used in parallel as per the notes from Charles |
| 886 | | // this needs verifying as it could instead be an index into some other ram area already decompressed.. |
| 887 | | // 0000xxxx |
| 888 | | // to |
| 889 | | // 001fxxxx |
| 860 | UINT32 blit3_unused = m_spriteblit[3] & 0xffe00000; |
| 861 | UINT32 b3romoffset = (m_spriteblit[3] & 0x001fffff)*2; |
| 862 | // if this is an offset into the compressed m_spriteblit[3] then it's probably a word offset into each rom (each is 0x400000 bytes) with the m_spriteblit[3] from all 10 being used in parallel as per the notes from Charles |
| 863 | // this needs verifying as it could instead be an index into some other ram area already decompressed.. |
| 864 | // 0000xxxx |
| 865 | // to |
| 866 | // 001fxxxx |
| 890 | 867 | |
| 891 | | if (m_blit3_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit4_unused); |
| 892 | | if (m_b3romoffset!=0) |
| 893 | | { |
| 894 | | #if 0 |
| 895 | | // if we look in rom IC6 (+0x2400000) then the word before our offset is very often 0x0000 probably indicating that's the last word used |
| 896 | | printf("rom offset %08x, previous values : ", m_b3romoffset); |
| 897 | | for (int i=0;i<8;i++) |
| 898 | | { |
| 899 | | UINT32 dat20 = get_20bit_data( m_b3romoffset, i); |
| 900 | | printf("%05x ",dat20); |
| 901 | | } |
| 902 | | printf("\n"); |
| 903 | | #endif |
| 904 | | #if 0 |
| 905 | | // look at the values actually at the address we're using.. |
| 906 | | // often have a similar form to |
| 907 | | // 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080, |
| 908 | | // 1 2 3 4 5 6 7 8 9 10 |
| 909 | | // so you can see 1/6 2/7, 3/8, 4/9, 5/10 are often similar or the same |
| 910 | | if (m_b3romoffset == 0x0000848e) |
| 911 | | { |
| 912 | | printf("rom offset %08x, values : \n", m_b3romoffset); |
| 868 | if (blit3_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, blit3_unused); |
| 869 | |
| 913 | 870 | |
| 914 | | for (int b=0;b<8;b++) |
| 915 | | { |
| 916 | | for (int i=0;i<8;i++) |
| 917 | | { |
| 918 | | UINT32 dat20 = get_20bit_data( m_b3romoffset, i+b*8); |
| 919 | | printf("%05x ",dat20); |
| 920 | | } |
| 921 | | printf("\n"); |
| 922 | | } |
| 923 | | printf("\n"); |
| 924 | | } |
| 925 | | /* |
| 926 | | rom offset 0000848e, values : |
| 927 | | 00a00 00a00 00a00 00a00 00a00 00a02 00a3d 00a98 |
| 928 | | 00afa 00b3f 00b95 00be9 00c4d 00c89 00a00 00cd3 |
| 929 | | 00d17 00d4b 00d94 00dee 00e50 00eb0 00f16 00f62 |
| 930 | | 00fce 00a00 00a00 00a00 00a00 00a00 00a00 00a00 |
| 931 | | 00a00 00a00 00a00 00a00 00ff2 0101d 01060 0109d |
| 932 | | 010d2 01112 01148 01194 011be 00a00 011f1 0121c |
| 933 | | 0123f 01272 012af 012f0 0132c 01377 013af 01400 |
| 934 | | 00a00 00a00 00a00 00a00 00a00 00a00 00000 00000 |
| 935 | | */ |
| 871 | /************* m_spriteblit[4] *************/ |
| 936 | 872 | |
| 873 | UINT32 blit4_unused = m_spriteblit[4] & 0xf8fefefe; |
| 874 | //UINT32 blit4 = m_spriteblit[4] & 0x07000000; |
| 875 | UINT32 blit_flipx = m_spriteblit[4] & 0x00000001; |
| 876 | UINT32 blit_flipy = (m_spriteblit[4] & 0x00000100)>>8; |
| 877 | UINT32 blit_rotate = (m_spriteblit[4] & 0x00010000)>>16; |
| 878 | if (blit4_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, blit4_unused); |
| 937 | 879 | |
| 880 | // ---- -111 ---- ---r ---- ---y ---- ---x |
| 881 | // 1 = used bits? (unknown purpose.. might be object colour mode) |
| 882 | // x = x-flip |
| 883 | // y = y-flip |
| 884 | // r = unknown, not used much, occasional object - rotate |
| 885 | |
| 886 | /************* m_spriteblit[5] *************/ |
| 938 | 887 | |
| 888 | UINT32 blit5_unused = m_spriteblit[5]&0xfffefffe; |
| 889 | // this might enable the text indirection thing? |
| 890 | int indirect_tile_enable = (m_spriteblit[5] & 0x00010000)>>16; |
| 891 | int indirect_zoom_enable = (m_spriteblit[5] & 0x00000001); |
| 939 | 892 | |
| 940 | 893 | |
| 941 | | // these are used for slider bars in test mode |
| 942 | | // rom offset 00140000, values : 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080, |
| 943 | | // rom offset 00140008, values : 0004, 9000, 4900, 0490, 0049, 0004, 9000, 4900, 0490, 0049, |
| 894 | if (blit5_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, blit5_unused); |
| 895 | // 00010000 (text) |
| 896 | // 00000001 (other) |
| 944 | 897 | |
| 945 | | // or as groups of 20-bits 00080 00080 00080 00080 00080 00080 00080 00080 |
| 946 | | // or as groups of 20-bits 00049 00049 00049 00049 00049 00049 00049 00049 |
| 947 | 898 | |
| 948 | | #endif |
| 949 | | } |
| 950 | 899 | |
| 951 | 900 | |
| 952 | | } |
| 953 | | } |
| 954 | | else if (m_blitterSerialCount == 4) |
| 955 | | { |
| 956 | | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 957 | | { |
| 958 | | m_blit4_unused = data & 0xf8fefefe; |
| 959 | | m_blit4 = data & 0x07000000; |
| 960 | | m_b4flipx = data & 0x00000001; |
| 961 | | m_b4flipy = (data & 0x00000100)>>8; |
| 962 | | m_b4rotate = (data & 0x00010000)>>16; |
| 963 | | if (m_blit4_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit4_unused); |
| 901 | /************* m_spriteblit[6] *************/ |
| 964 | 902 | |
| 965 | | // ---- -111 ---- ---r ---- ---y ---- ---x |
| 966 | | // 1 = used bits? (unknown purpose.. might be object colour mode) |
| 967 | | // x = x-flip |
| 968 | | // y = y-flip |
| 969 | | // r = unknown, not used much, occasional object - rotate |
| 970 | | } |
| 971 | | } |
| 972 | | else if (m_blitterSerialCount == 5) |
| 973 | | { |
| 974 | | m_blit5_unused = data&0xfffefffe; |
| 975 | | // this might enable the text indirection thing? |
| 976 | | m_indirect_tile_enable = (data & 0x00010000)>>16; |
| 977 | | m_indirect_zoom_enable = (data & 0x00000001); |
| 903 | UINT16 vCellCount = (m_spriteblit[6] & 0xffff0000) >> 16; |
| 904 | UINT16 hCellCount = (m_spriteblit[6] & 0x0000ffff); |
| 905 | |
| 906 | /************* m_spriteblit[7] *************/ |
| 907 | |
| 908 | UINT16 vOrigin = (m_spriteblit[7] & 0xffff0000) >> 16; |
| 909 | UINT16 hOrigin = (m_spriteblit[7] & 0x0000ffff); |
| 910 | //printf("%04x %04x\n", vOrigin, hOrigin); |
| 911 | |
| 912 | /************* m_spriteblit[8] *************/ |
| 978 | 913 | |
| 914 | UINT16 vZoom = (m_spriteblit[8] & 0xffff0000) >> 16; |
| 915 | UINT16 hZoom = (m_spriteblit[8] & 0x0000ffff); |
| 916 | |
| 917 | /************* m_spriteblit[9] *************/ |
| 979 | 918 | |
| 980 | | if (m_blit5_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit5_unused); |
| 981 | | // 00010000 (text) |
| 982 | | // 00000001 (other) |
| 919 | int vPosition = (m_spriteblit[9] & 0xffff0000) >> 16; |
| 920 | int hPosition = (m_spriteblit[9] & 0x0000ffff); |
| 983 | 921 | |
| 984 | | } |
| 985 | | else if (m_blitterSerialCount == 6) |
| 986 | | { |
| 987 | | m_vCellCount = (data & 0xffff0000) >> 16; |
| 988 | | m_hCellCount = (data & 0x0000ffff); |
| 989 | | } |
| 990 | | else if (m_blitterSerialCount == 7) |
| 991 | | { |
| 992 | | m_vOrigin = (data & 0xffff0000) >> 16; |
| 993 | | m_hOrigin = (data & 0x0000ffff); |
| 994 | | //printf("%04x %04x\n", m_vOrigin, m_hOrigin); |
| 995 | | } |
| 996 | | else if (m_blitterSerialCount == 8) |
| 997 | | { |
| 998 | | m_vZoom = (data & 0xffff0000) >> 16; |
| 999 | | m_hZoom = (data & 0x0000ffff); |
| 1000 | | } |
| 1001 | | else if (m_blitterSerialCount == 9) |
| 1002 | | { |
| 1003 | | m_vPosition = (data & 0xffff0000) >> 16; |
| 1004 | | m_hPosition = (data & 0x0000ffff); |
| 922 | if (hPosition & 0x8000) hPosition -= 0x10000; |
| 923 | if (vPosition & 0x8000) vPosition -= 0x10000; |
| 924 | |
| 925 | /************* m_spriteblit[10] *************/ |
| 1005 | 926 | |
| 1006 | | if (m_hPosition & 0x8000) m_hPosition -= 0x10000; |
| 1007 | | if (m_vPosition & 0x8000) m_vPosition -= 0x10000; |
| 1008 | | } |
| 1009 | | else if (m_blitterSerialCount == 10) |
| 1010 | | { |
| 1011 | 927 | // this is an address on some objects.. |
| 1012 | 928 | // to be specific, the center line of the road (actual road object? which currently gets shown as a single pixel column?) |
| 1013 | 929 | // and the horizontal road used in the background of the title screen (which currently looks normal) |
| 1014 | 930 | // I guess it's some kind of indirect way to do a line effect? |
| 1015 | | m_blit10 = data; |
| 931 | //UINT32 blit10 = m_spriteblit[10]; |
| 1016 | 932 | |
| 1017 | | // if (data!=0) printf("blit %08x\n", data); |
| 1018 | | } |
| 1019 | | else if (m_blitterSerialCount == 11) |
| 1020 | | { |
| 1021 | | if (m_blit0 & 1) |
| 933 | /************* m_spriteblit[11] *************/ |
| 934 | |
| 935 | UINT32 textlookup = m_spriteblit[11]; |
| 936 | |
| 937 | /* DRAW */ |
| 938 | |
| 939 | if (blit0 & 1) |
| 1022 | 940 | { |
| 1023 | 941 | // NOT A SPRITE |
| 1024 | 942 | |
| r21313 | r21314 | |
| 1029 | 947 | } |
| 1030 | 948 | else |
| 1031 | 949 | { |
| 1032 | | UINT16 used_hCellCount = m_hCellCount; |
| 1033 | | UINT16 used_vCellCount = m_vCellCount; |
| 1034 | | UINT16 used_flipx = m_b4flipx; |
| 1035 | | UINT16 used_flipy = m_b4flipy; |
| 950 | UINT16 used_hCellCount = hCellCount; |
| 951 | UINT16 used_vCellCount = vCellCount; |
| 952 | UINT16 used_flipx = blit_flipx; |
| 953 | UINT16 used_flipy = blit_flipy; |
| 1036 | 954 | |
| 1037 | | if (m_b4rotate) |
| 955 | if (blit_rotate) |
| 1038 | 956 | { |
| 1039 | | used_hCellCount = m_vCellCount; |
| 1040 | | used_vCellCount = m_hCellCount; |
| 1041 | | used_flipx = m_b4flipy; |
| 1042 | | used_flipy = m_b4flipx; |
| 957 | used_hCellCount = vCellCount; |
| 958 | used_vCellCount = hCellCount; |
| 959 | used_flipx = blit_flipy; |
| 960 | used_flipy = blit_flipx; |
| 1043 | 961 | // do the zoom params rotate? |
| 1044 | 962 | } |
| 1045 | 963 | |
| r21313 | r21314 | |
| 1050 | 968 | |
| 1051 | 969 | // we also use this to trigger the actual draw operation |
| 1052 | 970 | |
| 1053 | | //printf("blit %08x\n", data); |
| 1054 | | |
| 1055 | | // debug, hide objects without m_blit10 set |
| 1056 | | //if (m_blit10==0) return; |
| 1057 | | //if (m_blit0==0) return; |
| 1058 | | |
| 1059 | | //if (m_blit10!=0) |
| 1060 | | if (m_indirect_zoom_enable) |
| 971 | |
| 972 | //if (blit10!=0) |
| 973 | if (indirect_zoom_enable) |
| 1061 | 974 | { |
| 1062 | | // with this bit enabled m_blit10 is a look up to the zoom(?) value eg. 03f42600 |
| 1063 | | //UINT32 temp = space.read_dword(m_blit10); |
| 975 | // with this bit enabled blit10 is a look up to the zoom(?) value eg. 03f42600 |
| 976 | //UINT32 temp = space.read_dword(blit10); |
| 1064 | 977 | //PRINT_BLIT_STUFF |
| 1065 | 978 | /* for the horizontal road during attract there are tables 0x480 bytes long (0x120 dwords) and the value passed points to the start of them */ |
| 1066 | 979 | /* cell sizes for those are are 0011 (v) 0007 (h) with zoom factors of 0020 (half v) 0040 (normal h) */ |
| r21313 | r21314 | |
| 1076 | 989 | else // 0x90, 0xa0, 0xb0, 0xc0 |
| 1077 | 990 | drawbitmap = &m_temp_bitmap_sprites2; |
| 1078 | 991 | |
| 1079 | | int sizex = used_hCellCount * 16 * m_hZoom; |
| 1080 | | int sizey = used_vCellCount * 16 * m_vZoom; |
| 1081 | | m_hPosition *= 0x40; |
| 1082 | | m_vPosition *= 0x40; |
| 992 | int sizex = used_hCellCount * 16 * hZoom; |
| 993 | int sizey = used_vCellCount * 16 * vZoom; |
| 994 | hPosition *= 0x40; |
| 995 | vPosition *= 0x40; |
| 1083 | 996 | |
| 1084 | | switch (m_vOrigin & 3) |
| 997 | switch (vOrigin & 3) |
| 1085 | 998 | { |
| 1086 | 999 | case 0: |
| 1087 | 1000 | // top |
| 1088 | 1001 | break; |
| 1089 | 1002 | case 1: |
| 1090 | | m_vPosition -= sizey / 2 ; |
| 1003 | vPosition -= sizey / 2 ; |
| 1091 | 1004 | // middle? |
| 1092 | 1005 | break; |
| 1093 | 1006 | case 2: |
| 1094 | | m_vPosition -= sizey; |
| 1007 | vPosition -= sizey; |
| 1095 | 1008 | // bottom? |
| 1096 | 1009 | break; |
| 1097 | 1010 | case 3: |
| r21313 | r21314 | |
| 1099 | 1012 | break; |
| 1100 | 1013 | } |
| 1101 | 1014 | |
| 1102 | | switch (m_hOrigin & 3) |
| 1015 | switch (hOrigin & 3) |
| 1103 | 1016 | { |
| 1104 | 1017 | case 0: |
| 1105 | 1018 | // left |
| 1106 | 1019 | break; |
| 1107 | 1020 | case 1: |
| 1108 | | m_hPosition -= sizex / 2; |
| 1021 | hPosition -= sizex / 2; |
| 1109 | 1022 | // middle? |
| 1110 | 1023 | break; |
| 1111 | 1024 | case 2: |
| 1112 | | m_hPosition -= sizex; |
| 1025 | hPosition -= sizex; |
| 1113 | 1026 | // right? |
| 1114 | 1027 | break; |
| 1115 | 1028 | case 3: |
| r21313 | r21314 | |
| 1121 | 1034 | // Splat some sprites |
| 1122 | 1035 | for (int v = 0; v < used_vCellCount; v++) |
| 1123 | 1036 | { |
| 1124 | | const int pixelOffsetY = ((m_vPosition) + (v* 16 * m_vZoom)) / 0x40; |
| 1037 | const int pixelOffsetY = ((vPosition) + (v* 16 * vZoom)) / 0x40; |
| 1125 | 1038 | |
| 1126 | 1039 | if (pixelOffsetY>383) |
| 1127 | 1040 | { |
| r21313 | r21314 | |
| 1132 | 1045 | |
| 1133 | 1046 | for (int h = 0; h < used_hCellCount; h++) |
| 1134 | 1047 | { |
| 1135 | | const int pixelOffsetX = ((m_hPosition) + (h* 16 * m_hZoom)) / 0x40; |
| 1048 | const int pixelOffsetX = ((hPosition) + (h* 16 * hZoom)) / 0x40; |
| 1136 | 1049 | |
| 1137 | 1050 | if (pixelOffsetX>495) |
| 1138 | 1051 | { |
| r21313 | r21314 | |
| 1142 | 1055 | |
| 1143 | 1056 | int lookupnum; |
| 1144 | 1057 | |
| 1145 | | // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text) |
| 1058 | // with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text) |
| 1146 | 1059 | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| 1147 | | if (m_indirect_tile_enable) |
| 1060 | if (indirect_tile_enable) |
| 1148 | 1061 | { |
| 1149 | | lookupnum = space.read_byte(data + h + (v*used_hCellCount)); |
| 1062 | lookupnum = space.read_byte(textlookup + h + (v*used_hCellCount)); |
| 1150 | 1063 | } |
| 1151 | 1064 | else |
| 1152 | 1065 | { |
| 1153 | | if (!m_b4rotate) |
| 1066 | if (!blit_rotate) |
| 1154 | 1067 | { |
| 1155 | 1068 | if (!used_flipy) |
| 1156 | 1069 | { |
| r21313 | r21314 | |
| 1190 | 1103 | |
| 1191 | 1104 | |
| 1192 | 1105 | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1193 | | UINT32 spriteNumber = (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) + 1 ]); |
| 1194 | | |
| 1106 | UINT32 spriteNumber = (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) + 1 ]); |
| 1107 | UINT16 tempshape[16*16]; |
| 1108 | |
| 1195 | 1109 | // skip the decoding if it's the same tile as last time! |
| 1196 | 1110 | if (spriteNumber != lastSpriteNumber) |
| 1197 | 1111 | { |
| r21313 | r21314 | |
| 1203 | 1117 | while (data_written<256) |
| 1204 | 1118 | { |
| 1205 | 1119 | |
| 1206 | | UINT16 compdata = m_expanded_10bit_gfx[ (m_b3romoffset << 3) + spriteNumber + i]; |
| 1120 | UINT16 compdata = m_expanded_10bit_gfx[ (b3romoffset << 3) + spriteNumber + i]; |
| 1207 | 1121 | |
| 1208 | 1122 | if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100)) |
| 1209 | 1123 | { |
| 1210 | 1124 | // mm ccrr rrr0 |
| 1211 | 1125 | int encodelength = (compdata & 0x03e)>>1; |
| 1212 | | int data = (compdata & 0x3c0) >> 6; |
| 1126 | int rledata = (compdata & 0x3c0) >> 6; |
| 1213 | 1127 | |
| 1214 | 1128 | // guess, blank tiles have the following form |
| 1215 | 1129 | // 00120 (00000024,0) | 010 03f |
| r21313 | r21314 | |
| 1217 | 1131 | |
| 1218 | 1132 | while (data_written<256 && encodelength >=0) |
| 1219 | 1133 | { |
| 1220 | | m_tempshape[data_written] = data; |
| 1134 | tempshape[data_written] = rledata; |
| 1221 | 1135 | encodelength--; |
| 1222 | 1136 | data_written++; |
| 1223 | 1137 | } |
| r21313 | r21314 | |
| 1226 | 1140 | { |
| 1227 | 1141 | // mm cccc ccrr |
| 1228 | 1142 | int encodelength = (compdata & 0x003); |
| 1229 | | int data = (compdata & 0x3fc) >> 6; |
| 1143 | int rledata = (compdata & 0x3fc) >> 6; |
| 1230 | 1144 | |
| 1231 | 1145 | while (data_written<256 && encodelength >=0) |
| 1232 | 1146 | { |
| 1233 | | m_tempshape[data_written] = data; |
| 1147 | tempshape[data_written] = rledata; |
| 1234 | 1148 | encodelength--; |
| 1235 | 1149 | data_written++; |
| 1236 | 1150 | } |
| r21313 | r21314 | |
| 1239 | 1153 | else |
| 1240 | 1154 | { |
| 1241 | 1155 | // mm cccc cccc |
| 1242 | | m_tempshape[data_written] = data&0xff; |
| 1156 | tempshape[data_written] = compdata&0xff; |
| 1243 | 1157 | data_written++; |
| 1244 | 1158 | } |
| 1245 | 1159 | |
| r21313 | r21314 | |
| 1248 | 1162 | } |
| 1249 | 1163 | |
| 1250 | 1164 | |
| 1251 | | if (!m_hZoom || !m_vZoom) |
| 1165 | if (!hZoom || !vZoom) |
| 1252 | 1166 | { |
| 1253 | 1167 | m_blitterSerialCount++; |
| 1254 | 1168 | return; |
| 1255 | 1169 | } |
| 1256 | 1170 | |
| 1257 | | int blockwide = ((16*m_hZoom)/0x40); |
| 1258 | | int blockhigh = ((16*m_vZoom)/0x40); |
| 1171 | int blockwide = ((16*hZoom)/0x40); |
| 1172 | int blockhigh = ((16*vZoom)/0x40); |
| 1259 | 1173 | |
| 1260 | 1174 | |
| 1261 | 1175 | |
| 1262 | | UINT32 incx = 0x8000000 / m_hZoom; |
| 1263 | | UINT32 incy = 0x8000000 / m_vZoom; |
| 1176 | UINT32 incx = 0x8000000 / hZoom; |
| 1177 | UINT32 incy = 0x8000000 / vZoom; |
| 1264 | 1178 | |
| 1265 | 1179 | // DEBUG: Draw 16x16 block |
| 1266 | 1180 | UINT32* line; |
| 1267 | | if (m_b4rotate) |
| 1181 | if (blit_rotate) |
| 1268 | 1182 | { |
| 1269 | 1183 | if (used_flipy) |
| 1270 | 1184 | { |
| r21313 | r21314 | |
| 1283 | 1197 | if ((drawx>=495 || drawx<0)) continue; |
| 1284 | 1198 | int realx = ((x*incx)>>21); |
| 1285 | 1199 | |
| 1286 | | UINT16 pix = m_tempshape[(15-realx)*16+(15-realy)]; |
| 1200 | UINT16 pix = tempshape[(15-realx)*16+(15-realy)]; |
| 1287 | 1201 | if (pix ) |
| 1288 | 1202 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1289 | 1203 | } |
| r21313 | r21314 | |
| 1296 | 1210 | if ((drawx>=495 || drawx<0)) continue; |
| 1297 | 1211 | int realx = ((x*incx)>>21); |
| 1298 | 1212 | |
| 1299 | | UINT16 pix = m_tempshape[(15-realx)*16+realy]; |
| 1213 | UINT16 pix = tempshape[(15-realx)*16+realy]; |
| 1300 | 1214 | if (pix ) |
| 1301 | 1215 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1302 | 1216 | } |
| r21313 | r21314 | |
| 1320 | 1234 | if ((drawx>=495 || drawx<0)) continue; |
| 1321 | 1235 | int realx = ((x*incx)>>21); |
| 1322 | 1236 | |
| 1323 | | UINT16 pix = m_tempshape[realx*16+(15-realy)]; |
| 1237 | UINT16 pix = tempshape[realx*16+(15-realy)]; |
| 1324 | 1238 | if (pix ) |
| 1325 | 1239 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1326 | 1240 | } |
| r21313 | r21314 | |
| 1333 | 1247 | if ((drawx>=495 || drawx<0)) continue; |
| 1334 | 1248 | int realx = ((x*incx)>>21); |
| 1335 | 1249 | |
| 1336 | | UINT16 pix = m_tempshape[realx*16+realy]; |
| 1250 | UINT16 pix = tempshape[realx*16+realy]; |
| 1337 | 1251 | if (pix ) |
| 1338 | 1252 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1339 | 1253 | } |
| r21313 | r21314 | |
| 1360 | 1274 | if ((drawx>=495 || drawx<0)) continue; |
| 1361 | 1275 | int realx = ((x*incx)>>21); |
| 1362 | 1276 | |
| 1363 | | UINT16 pix = m_tempshape[(15-realy)*16+(15-realx)]; |
| 1277 | UINT16 pix = tempshape[(15-realy)*16+(15-realx)]; |
| 1364 | 1278 | if (pix ) |
| 1365 | 1279 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1366 | 1280 | } |
| r21313 | r21314 | |
| 1372 | 1286 | const int drawx = pixelOffsetX+x; |
| 1373 | 1287 | if ((drawx>=495 || drawx<0)) continue; |
| 1374 | 1288 | int realx = ((x*incx)>>21); |
| 1375 | | UINT16 pix = m_tempshape[(15-realy)*16+realx]; |
| 1289 | UINT16 pix = tempshape[(15-realy)*16+realx]; |
| 1376 | 1290 | if (pix ) |
| 1377 | 1291 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1378 | 1292 | } |
| r21313 | r21314 | |
| 1396 | 1310 | if ((drawx>=495 || drawx<0)) continue; |
| 1397 | 1311 | int realx = ((x*incx)>>21); |
| 1398 | 1312 | |
| 1399 | | UINT16 pix = m_tempshape[realy*16+(15-realx)]; |
| 1313 | UINT16 pix = tempshape[realy*16+(15-realx)]; |
| 1400 | 1314 | if (pix ) |
| 1401 | 1315 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1402 | 1316 | } |
| r21313 | r21314 | |
| 1412 | 1326 | if ((drawx>=495 || drawx<0)) continue; |
| 1413 | 1327 | int realx = ((x*incx)>>21); |
| 1414 | 1328 | |
| 1415 | | UINT16 pix = m_tempshape[realy*16+realx]; |
| 1329 | UINT16 pix = tempshape[realy*16+realx]; |
| 1416 | 1330 | if (pix ) |
| 1417 | 1331 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1418 | 1332 | } |
| r21313 | r21314 | |
| 1420 | 1334 | } |
| 1421 | 1335 | } |
| 1422 | 1336 | } |
| 1423 | | #if 0 // this one does zooming |
| 1424 | | // DEBUG: Draw 16x16 block |
| 1425 | | UINT32* line; |
| 1426 | | for (int y = 0; y < blockhigh; y++) |
| 1427 | | { |
| 1428 | | const int drawy = pixelOffsetY+y; |
| 1429 | | if ((drawy>383) || (drawy<0)) continue; |
| 1430 | | line = &drawbitmap->pix32(drawy); |
| 1431 | 1337 | |
| 1432 | | for (int x = 0; x < blockwide; x++) |
| 1433 | | { |
| 1434 | | const int drawx = pixelOffsetX+x; |
| 1435 | | if ((drawx>=495 || drawx<0)) continue; |
| 1436 | 1338 | |
| 1437 | | if (line[drawx]==0) line[drawx] = color; |
| 1438 | | } |
| 1439 | | } |
| 1440 | | #endif |
| 1441 | | |
| 1442 | 1339 | } |
| 1443 | 1340 | } |
| 1444 | 1341 | |
| r21313 | r21314 | |
| 1446 | 1343 | |
| 1447 | 1344 | } |
| 1448 | 1345 | } |
| 1449 | | else |
| 1450 | | { |
| 1451 | | printf("more than 11 dwords (%d) in blit?\n", m_blitterSerialCount); |
| 1452 | | } |
| 1453 | 1346 | |
| 1454 | | |
| 1455 | | m_blitterSerialCount++; |
| 1456 | 1347 | } |
| 1457 | 1348 | // ?? |
| 1458 | 1349 | else if (m_blitterMode == 0x10) // at startup |