trunk/src/mame/drivers/coolridr.c
| r21246 | r21247 | |
| 450 | 450 | UINT8 sound_data; |
| 451 | 451 | |
| 452 | 452 | UINT8* m_compressedgfx; |
| 453 | UINT32 get_20bit_data(UINT32 romoffset, int _20bitwordnum); |
| 453 | 454 | |
| 454 | 455 | DECLARE_READ32_MEMBER(sysh1_sound_dma_r); |
| 455 | 456 | DECLARE_WRITE32_MEMBER(sysh1_sound_dma_w); |
| r21246 | r21247 | |
| 613 | 614 | #endif |
| 614 | 615 | |
| 615 | 616 | |
| 617 | |
| 618 | |
| 619 | #define READ_COMPRESSED_ROM(chip) \ |
| 620 | m_compressedgfx[(chip)*0x400000 + romoffset] << 8 | m_compressedgfx[(chip)*0x0400000 + romoffset +1]; \ |
| 621 | |
| 622 | // this helps you feth the 20bit words from an address in the compressed data |
| 623 | UINT32 coolridr_state::get_20bit_data(UINT32 romoffset, int _20bitwordnum) |
| 624 | { |
| 625 | UINT16 testvalue, testvalue2; |
| 626 | |
| 627 | int temp = _20bitwordnum & 3; |
| 628 | int inc = 0; |
| 629 | if (_20bitwordnum&4) inc = 5; |
| 630 | |
| 631 | romoffset += (_20bitwordnum>>3)*2; |
| 632 | |
| 633 | |
| 634 | |
| 635 | if (temp==0) |
| 636 | { |
| 637 | testvalue = READ_COMPRESSED_ROM(0+inc); |
| 638 | testvalue2 = READ_COMPRESSED_ROM(1+inc); |
| 639 | return (testvalue << 4) | (testvalue2 & 0xf000) >> 12; |
| 640 | } |
| 641 | else if (temp==1) |
| 642 | { |
| 643 | testvalue = READ_COMPRESSED_ROM(1+inc); |
| 644 | testvalue2 = READ_COMPRESSED_ROM(2+inc); |
| 645 | return ((testvalue & 0x0fff) << 8) | (testvalue2 & 0xff00) >> 8; |
| 646 | } |
| 647 | else if (temp==2) |
| 648 | { |
| 649 | testvalue = READ_COMPRESSED_ROM(2+inc); |
| 650 | testvalue2 = READ_COMPRESSED_ROM(3+inc); |
| 651 | return ((testvalue & 0x00ff) << 12) | (testvalue2 & 0xfff0) >> 4; |
| 652 | } |
| 653 | else // temp == 3 |
| 654 | { |
| 655 | testvalue = READ_COMPRESSED_ROM(3+inc); |
| 656 | testvalue2 = READ_COMPRESSED_ROM(4+inc); |
| 657 | return ((testvalue & 0x000f) << 16) | (testvalue2); |
| 658 | } |
| 659 | |
| 660 | } |
| 661 | |
| 616 | 662 | /* This is a RLE-based sprite blitter (US Patent #6,141,122), very unusual from Sega... */ |
| 617 | 663 | WRITE32_MEMBER(coolridr_state::sysh1_txt_blit_w) |
| 618 | 664 | { |
| r21246 | r21247 | |
| 798 | 844 | #if 0 |
| 799 | 845 | // 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 |
| 800 | 846 | printf("rom offset %08x, previous values : ", m_b3romoffset); |
| 801 | | for (int i=0;i<10;i++) |
| 847 | for (int i=0;i<8;i++) |
| 802 | 848 | { |
| 803 | | UINT16 testvalue = m_compressedgfx[i*0x400000 + m_b3romoffset - 2] << 8 | m_compressedgfx[i*0x0400000 + m_b3romoffset - 1]; |
| 804 | | if ((i==0) || (i==5)) printf("%04x", testvalue); |
| 805 | | if ((i==1) || (i==6)) printf("%01x %03x", (testvalue & 0xf000) >> 12, testvalue & 0x0fff); |
| 806 | | if ((i==2) || (i==7)) printf("%02x %02x", (testvalue & 0xff00) >> 8, testvalue & 0x00ff); |
| 807 | | if ((i==3) || (i==8)) printf("%03x %01x", (testvalue & 0xfff0) >> 4, testvalue & 0x000f); |
| 808 | | if ((i==4) || (i==9)) printf("%04x ", testvalue); |
| 849 | UINT32 dat20 = get_20bit_data( m_b3romoffset, i); |
| 850 | printf("%05x ",dat20); |
| 809 | 851 | } |
| 810 | 852 | printf("\n"); |
| 811 | 853 | #endif |
| r21246 | r21247 | |
| 815 | 857 | // 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080, |
| 816 | 858 | // 1 2 3 4 5 6 7 8 9 10 |
| 817 | 859 | // so you can see 1/6 2/7, 3/8, 4/9, 5/10 are often similar or the same |
| 818 | | printf("rom offset %08x, values : ", m_b3romoffset); |
| 819 | | for (int i=0;i<10;i++) |
| 860 | if (m_b3romoffset == 0x0000848e) |
| 820 | 861 | { |
| 821 | | UINT16 testvalue = m_compressedgfx[i*0x400000 + m_b3romoffset] << 8 | m_compressedgfx[i*0x0400000 + m_b3romoffset +1]; |
| 822 | | if ((i==0) || (i==5)) printf("%04x", testvalue); |
| 823 | | if ((i==1) || (i==6)) printf("%01x %03x", (testvalue & 0xf000) >> 12, testvalue & 0x0fff); |
| 824 | | if ((i==2) || (i==7)) printf("%02x %02x", (testvalue & 0xff00) >> 8, testvalue & 0x00ff); |
| 825 | | if ((i==3) || (i==8)) printf("%03x %01x", (testvalue & 0xfff0) >> 4, testvalue & 0x000f); |
| 826 | | if ((i==4) || (i==9)) printf("%04x ", testvalue); |
| 827 | | |
| 862 | printf("rom offset %08x, values : \n", m_b3romoffset); |
| 863 | |
| 864 | for (int b=0;b<8;b++) |
| 865 | { |
| 866 | for (int i=0;i<8;i++) |
| 867 | { |
| 868 | UINT32 dat20 = get_20bit_data( m_b3romoffset, i+b*8); |
| 869 | printf("%05x ",dat20); |
| 870 | } |
| 871 | printf("\n"); |
| 872 | } |
| 873 | printf("\n"); |
| 828 | 874 | } |
| 829 | | printf("\n"); |
| 875 | /* |
| 876 | rom offset 0000848e, values : |
| 877 | 00a00 00a00 00a00 00a00 00a00 00a02 00a3d 00a98 |
| 878 | 00afa 00b3f 00b95 00be9 00c4d 00c89 00a00 00cd3 |
| 879 | 00d17 00d4b 00d94 00dee 00e50 00eb0 00f16 00f62 |
| 880 | 00fce 00a00 00a00 00a00 00a00 00a00 00a00 00a00 |
| 881 | 00a00 00a00 00a00 00a00 00ff2 0101d 01060 0109d |
| 882 | 010d2 01112 01148 01194 011be 00a00 011f1 0121c |
| 883 | 0123f 01272 012af 012f0 0132c 01377 013af 01400 |
| 884 | 00a00 00a00 00a00 00a00 00a00 00a00 00000 00000 |
| 885 | */ |
| 830 | 886 | |
| 831 | 887 | |
| 888 | |
| 889 | |
| 890 | |
| 832 | 891 | // these are used for slider bars in test mode |
| 833 | 892 | // rom offset 00140000, values : 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080, |
| 834 | 893 | // rom offset 00140008, values : 0004, 9000, 4900, 0490, 0049, 0004, 9000, 4900, 0490, 0049, |
| r21246 | r21247 | |
| 1039 | 1098 | |
| 1040 | 1099 | // It's unknown if it's row-major or column-major |
| 1041 | 1100 | // TODO: Study the CRT test and "Cool Riders" logo for clues. |
| 1042 | | UINT8 spriteNumber = 0; |
| 1101 | UINT32 spriteNumber = 0; |
| 1043 | 1102 | |
| 1044 | 1103 | // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text) |
| 1045 | 1104 | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| r21246 | r21247 | |
| 1056 | 1115 | continue; |
| 1057 | 1116 | #endif |
| 1058 | 1117 | } |
| 1118 | else |
| 1119 | { |
| 1120 | int lookupnum = h + (v*h); |
| 1121 | |
| 1122 | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1123 | spriteNumber = get_20bit_data( m_b3romoffset, lookupnum); |
| 1124 | /* |
| 1059 | 1125 | |
| 1126 | printf("%05x ",spriteNumber); |
| 1127 | //if ((h == m_hCellCount-1) && (v == m_vCellCount-1)) |
| 1128 | // printf("\n"); |
| 1060 | 1129 | |
| 1130 | if ((h == m_hCellCount-1)) |
| 1131 | printf("\n"); |
| 1132 | |
| 1133 | */ |
| 1134 | |
| 1135 | //if (spriteNumber == 0x00) |
| 1136 | // continue; |
| 1137 | |
| 1138 | } |
| 1139 | |
| 1061 | 1140 | int blockwide = ((16*m_hZoom)/0x40)-1; |
| 1062 | 1141 | int blockhigh = ((16*m_vZoom)/0x40)-1; |
| 1063 | 1142 | // hack |
| r21246 | r21247 | |
| 1111 | 1190 | } |
| 1112 | 1191 | } |
| 1113 | 1192 | } |
| 1193 | |
| 1194 | //printf("\n"); |
| 1195 | |
| 1114 | 1196 | } |
| 1115 | 1197 | } |
| 1116 | 1198 | else |