trunk/src/mame/drivers/coolridr.c
| r21323 | r21324 | |
| 613 | 613 | } |
| 614 | 614 | #endif |
| 615 | 615 | |
| 616 | #define DRAW_PIX \ |
| 617 | if (pix) \ |
| 618 | { \ |
| 619 | { \ |
| 620 | if (!line[drawx]) line[drawx] = clut[pix+0x4000]; \ |
| 621 | } \ |
| 622 | } \ |
| 623 | |
| 616 | 624 | /* This is a RLE-based sprite blitter (US Patent #6,141,122), very unusual from Sega... */ |
| 617 | 625 | void coolridr_state::blit_current_sprite(address_space &space) |
| 618 | 626 | { |
| r21323 | r21324 | |
| 760 | 768 | // to be specific, the center line of the road (actual road object? which currently gets shown as a single pixel column?) |
| 761 | 769 | // and the horizontal road used in the background of the title screen (which currently looks normal) |
| 762 | 770 | // I guess it's some kind of indirect way to do a line effect? |
| 763 | | //UINT32 blit10 = m_spriteblit[10]; |
| 771 | UINT32 blit10 = m_spriteblit[10]; |
| 764 | 772 | |
| 765 | 773 | /************* m_spriteblit[11] *************/ |
| 766 | 774 | |
| r21323 | r21324 | |
| 788 | 796 | |
| 789 | 797 | // we also use this to trigger the actual draw operation |
| 790 | 798 | |
| 791 | | if (indirect_zoom_enable) |
| 792 | | { |
| 793 | | // with this bit enabled blit10 is a look up to the zoom(?) value eg. 03f42600 |
| 794 | | //UINT32 temp = space.read_dword(blit10); |
| 795 | | //PRINT_BLIT_STUFF |
| 796 | | /* for the horizontal road during attract there are tables 0x480 bytes long (0x120 dwords) and the value passed points to the start of them */ |
| 797 | | /* cell sizes for those are are 0011 (v) 0007 (h) with zoom factors of 0020 (half v) 0040 (normal h) */ |
| 798 | | /* tables seem to be 2x 8-bit values, possibly zoom + linescroll, although ingame ones seem to be 2x16-bit (corrupt? more meaning) */ |
| 799 | 799 | |
| 800 | | } |
| 801 | 800 | |
| 801 | |
| 802 | |
| 803 | |
| 802 | 804 | bitmap_rgb32* drawbitmap; |
| 803 | 805 | |
| 804 | 806 | // 0x30 - 0x60 are definitely the left screen, 0x90 - 0xc0 are definitely the right screen.. the modes seem priority related |
| r21323 | r21324 | |
| 807 | 809 | else // 0x90, 0xa0, 0xb0, 0xc0 |
| 808 | 810 | drawbitmap = &m_temp_bitmap_sprites2; |
| 809 | 811 | |
| 810 | | int sizex = used_hCellCount * 16 * hZoom; |
| 811 | 812 | int sizey = used_vCellCount * 16 * vZoom; |
| 812 | | hPosition *= 0x40; |
| 813 | |
| 813 | 814 | vPosition *= 0x40; |
| 814 | 815 | |
| 815 | 816 | switch (vOrigin & 3) |
| r21323 | r21324 | |
| 830 | 831 | break; |
| 831 | 832 | } |
| 832 | 833 | |
| 833 | | switch (hOrigin & 3) |
| 834 | | { |
| 835 | | case 0: |
| 836 | | // left |
| 837 | | break; |
| 838 | | case 1: |
| 839 | | hPosition -= sizex / 2; |
| 840 | | // middle? |
| 841 | | break; |
| 842 | | case 2: |
| 843 | | hPosition -= sizex; |
| 844 | | // right? |
| 845 | | break; |
| 846 | | case 3: |
| 847 | | // invalid? |
| 848 | | break; |
| 849 | | } |
| 850 | 834 | |
| 835 | |
| 851 | 836 | UINT32 lastSpriteNumber = 0xffffffff; |
| 852 | 837 | // Splat some sprites |
| 853 | 838 | for (int v = 0; v < used_vCellCount; v++) |
| r21323 | r21324 | |
| 861 | 846 | } |
| 862 | 847 | |
| 863 | 848 | |
| 864 | | for (int h = 0; h < used_hCellCount; h++) |
| 849 | |
| 850 | UINT16 hZoomTable[16]; |
| 851 | int hPositionTable[16]; |
| 852 | |
| 853 | for (int idx=0;idx<16;idx++) |
| 865 | 854 | { |
| 866 | | const int pixelOffsetX = ((hPosition) + (h* 16 * hZoom)) / 0x40; |
| 855 | if (indirect_zoom_enable) |
| 856 | { |
| 857 | UINT32 dword = space.read_dword(blit10); |
| 867 | 858 | |
| 868 | | if (pixelOffsetX>495) |
| 859 | hZoomTable[idx] = (dword>>16); // add original value? |
| 860 | int linescroll = dword&0xffff; |
| 861 | if (linescroll & 0x8000) linescroll -= 0x10000; |
| 862 | |
| 863 | hPositionTable[idx] = linescroll + hPosition; |
| 864 | blit10+=4; |
| 865 | |
| 866 | |
| 867 | } |
| 868 | else |
| 869 | 869 | { |
| 870 | | h = used_hCellCount; |
| 871 | | continue; |
| 870 | hZoomTable[idx] = hZoom; |
| 871 | hPositionTable[idx] = hPosition; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | |
| 875 | int sizex = used_hCellCount * 16 * hZoomTable[idx]; |
| 876 | |
| 877 | hPositionTable[idx] *= 0x40; |
| 878 | |
| 879 | switch (hOrigin & 3) |
| 880 | { |
| 881 | case 0: |
| 882 | // left |
| 883 | break; |
| 884 | case 1: |
| 885 | hPositionTable[idx] -= sizex / 2; |
| 886 | // middle? |
| 887 | break; |
| 888 | case 2: |
| 889 | hPositionTable[idx] -= sizex; |
| 890 | // right? |
| 891 | break; |
| 892 | case 3: |
| 893 | // invalid? |
| 894 | break; |
| 895 | } |
| 896 | |
| 897 | } |
| 898 | |
| 899 | |
| 900 | for (int h = 0; h < used_hCellCount; h++) |
| 901 | { |
| 902 | |
| 874 | 903 | int lookupnum; |
| 875 | 904 | |
| 876 | 905 | // with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text) |
| r21323 | r21324 | |
| 920 | 949 | } |
| 921 | 950 | |
| 922 | 951 | |
| 952 | |
| 923 | 953 | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 924 | 954 | UINT32 spriteNumber = (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) + 1 ]); |
| 925 | 955 | UINT16 tempshape[16*16]; |
| r21323 | r21324 | |
| 980 | 1010 | } |
| 981 | 1011 | |
| 982 | 1012 | |
| 983 | | if (!hZoom || !vZoom) |
| 1013 | if (!vZoom) |
| 984 | 1014 | { |
| 985 | 1015 | m_blitterSerialCount++; |
| 986 | 1016 | return; |
| 987 | 1017 | } |
| 988 | 1018 | |
| 989 | | int blockwide = ((16*hZoom)/0x40); |
| 990 | 1019 | int blockhigh = ((16*vZoom)/0x40); |
| 991 | 1020 | |
| 992 | 1021 | |
| 993 | 1022 | |
| 994 | | UINT32 incx = 0x8000000 / hZoom; |
| 995 | 1023 | UINT32 incy = 0x8000000 / vZoom; |
| 996 | 1024 | |
| 997 | 1025 | // DEBUG: Draw 16x16 block |
| 998 | 1026 | UINT32* line; |
| 999 | 1027 | |
| 1028 | |
| 1029 | |
| 1030 | |
| 1000 | 1031 | if (blit_rotate) |
| 1001 | 1032 | { |
| 1002 | 1033 | if (used_flipy) |
| 1003 | 1034 | { |
| 1004 | 1035 | for (int y = 0; y < blockhigh; y++) |
| 1005 | 1036 | { |
| 1037 | int realy = ((y*incy)>>21); |
| 1038 | if (!hZoomTable[realy]) |
| 1039 | continue; |
| 1040 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1006 | 1041 | const int drawy = pixelOffsetY+y; |
| 1007 | 1042 | if ((drawy>383) || (drawy<0)) continue; |
| 1008 | 1043 | line = &drawbitmap->pix32(drawy); |
| 1009 | | int realy = ((y*incy)>>21); |
| 1044 | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1045 | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1010 | 1046 | |
| 1047 | |
| 1011 | 1048 | if (used_flipx) |
| 1012 | 1049 | { |
| 1013 | 1050 | for (int x = 0; x < blockwide; x++) |
| 1014 | 1051 | { |
| 1052 | |
| 1053 | |
| 1015 | 1054 | const int drawx = pixelOffsetX+x; |
| 1016 | 1055 | if ((drawx>=495 || drawx<0)) continue; |
| 1017 | 1056 | int realx = ((x*incx)>>21); |
| 1018 | 1057 | |
| 1019 | 1058 | UINT16 pix = tempshape[(15-realx)*16+(15-realy)]; |
| 1020 | | if (pix ) |
| 1021 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1059 | DRAW_PIX |
| 1022 | 1060 | } |
| 1023 | 1061 | } |
| 1024 | 1062 | else |
| r21323 | r21324 | |
| 1030 | 1068 | int realx = ((x*incx)>>21); |
| 1031 | 1069 | |
| 1032 | 1070 | UINT16 pix = tempshape[(15-realx)*16+realy]; |
| 1033 | | if (pix ) |
| 1034 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1071 | DRAW_PIX |
| 1035 | 1072 | } |
| 1036 | 1073 | } |
| 1037 | 1074 | } |
| r21323 | r21324 | |
| 1040 | 1077 | { |
| 1041 | 1078 | for (int y = 0; y < blockhigh; y++) |
| 1042 | 1079 | { |
| 1080 | int realy = ((y*incy)>>21); |
| 1081 | if (!hZoomTable[realy]) |
| 1082 | continue; |
| 1083 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1043 | 1084 | const int drawy = pixelOffsetY+y; |
| 1044 | 1085 | if ((drawy>383) || (drawy<0)) continue; |
| 1045 | 1086 | line = &drawbitmap->pix32(drawy); |
| 1046 | | int realy = ((y*incy)>>21); |
| 1087 | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1088 | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1047 | 1089 | |
| 1090 | |
| 1048 | 1091 | if (used_flipx) |
| 1049 | 1092 | { |
| 1050 | 1093 | for (int x = 0; x < blockwide; x++) |
| r21323 | r21324 | |
| 1054 | 1097 | int realx = ((x*incx)>>21); |
| 1055 | 1098 | |
| 1056 | 1099 | UINT16 pix = tempshape[realx*16+(15-realy)]; |
| 1057 | | if (pix ) |
| 1058 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1100 | DRAW_PIX |
| 1059 | 1101 | } |
| 1060 | 1102 | } |
| 1061 | 1103 | else |
| r21323 | r21324 | |
| 1067 | 1109 | int realx = ((x*incx)>>21); |
| 1068 | 1110 | |
| 1069 | 1111 | UINT16 pix = tempshape[realx*16+realy]; |
| 1070 | | if (pix ) |
| 1071 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1112 | DRAW_PIX |
| 1072 | 1113 | } |
| 1073 | 1114 | } |
| 1074 | 1115 | } |
| r21323 | r21324 | |
| 1080 | 1121 | { |
| 1081 | 1122 | for (int y = 0; y < blockhigh; y++) |
| 1082 | 1123 | { |
| 1124 | int realy = ((y*incy)>>21); |
| 1125 | if (!hZoomTable[realy]) |
| 1126 | continue; |
| 1127 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1083 | 1128 | const int drawy = pixelOffsetY+y; |
| 1084 | 1129 | if ((drawy>383) || (drawy<0)) continue; |
| 1085 | 1130 | line = &drawbitmap->pix32(drawy); |
| 1086 | | int realy = ((y*incy)>>21); |
| 1131 | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1132 | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1087 | 1133 | |
| 1134 | |
| 1088 | 1135 | if (used_flipx) |
| 1089 | 1136 | { |
| 1090 | 1137 | for (int x = 0; x < blockwide; x++) |
| r21323 | r21324 | |
| 1094 | 1141 | int realx = ((x*incx)>>21); |
| 1095 | 1142 | |
| 1096 | 1143 | UINT16 pix = tempshape[(15-realy)*16+(15-realx)]; |
| 1097 | | if (pix ) |
| 1098 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1144 | DRAW_PIX |
| 1099 | 1145 | } |
| 1100 | 1146 | } |
| 1101 | 1147 | else |
| r21323 | r21324 | |
| 1106 | 1152 | if ((drawx>=495 || drawx<0)) continue; |
| 1107 | 1153 | int realx = ((x*incx)>>21); |
| 1108 | 1154 | UINT16 pix = tempshape[(15-realy)*16+realx]; |
| 1109 | | if (pix ) |
| 1110 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1155 | DRAW_PIX |
| 1111 | 1156 | } |
| 1112 | 1157 | } |
| 1113 | 1158 | } |
| r21323 | r21324 | |
| 1116 | 1161 | { |
| 1117 | 1162 | for (int y = 0; y < blockhigh; y++) |
| 1118 | 1163 | { |
| 1164 | int realy = ((y*incy)>>21); |
| 1165 | if (!hZoomTable[realy]) |
| 1166 | continue; |
| 1167 | const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40; |
| 1119 | 1168 | const int drawy = pixelOffsetY+y; |
| 1120 | 1169 | if ((drawy>383) || (drawy<0)) continue; |
| 1121 | 1170 | line = &drawbitmap->pix32(drawy); |
| 1122 | | int realy = ((y*incy)>>21); |
| 1171 | int blockwide = ((16*hZoomTable[realy])/0x40); |
| 1172 | UINT32 incx = 0x8000000 / hZoomTable[realy]; |
| 1123 | 1173 | |
| 1174 | |
| 1124 | 1175 | if (used_flipx) |
| 1125 | 1176 | { |
| 1126 | 1177 | for (int x = 0; x < blockwide; x++) |
| r21323 | r21324 | |
| 1130 | 1181 | int realx = ((x*incx)>>21); |
| 1131 | 1182 | |
| 1132 | 1183 | UINT16 pix = tempshape[realy*16+(15-realx)]; |
| 1133 | | if (pix ) |
| 1134 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1184 | DRAW_PIX |
| 1135 | 1185 | } |
| 1136 | 1186 | } |
| 1137 | 1187 | |
| r21323 | r21324 | |
| 1146 | 1196 | int realx = ((x*incx)>>21); |
| 1147 | 1197 | |
| 1148 | 1198 | UINT16 pix = tempshape[realy*16+realx]; |
| 1149 | | if (pix ) |
| 1150 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1199 | DRAW_PIX |
| 1151 | 1200 | } |
| 1152 | 1201 | } |
| 1153 | 1202 | } |
| r21323 | r21324 | |
| 1595 | 1644 | if(offset == 8) |
| 1596 | 1645 | { |
| 1597 | 1646 | //probably writing to upper word disables m68k, to lower word enables it |
| 1598 | | machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, (data) ? ASSERT_LINE : CLEAR_LINE); |
| 1647 | m_soundcpu->set_input_line(INPUT_LINE_RESET, (data) ? ASSERT_LINE : CLEAR_LINE); |
| 1599 | 1648 | return; |
| 1600 | 1649 | } |
| 1601 | 1650 | |
| r21323 | r21324 | |
| 2121 | 2170 | void coolridr_state::machine_start() |
| 2122 | 2171 | { |
| 2123 | 2172 | // machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2124 | | // machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2173 | // m_soundcpu->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2125 | 2174 | |
| 2126 | 2175 | // memcpy(memregion("soundcpu")->base(), memregion("maincpu")->base()+0x100000, 0x80000); |
| 2127 | 2176 | // m_soundcpu->reset(); |
| r21323 | r21324 | |
| 2158 | 2207 | void coolridr_state::machine_reset() |
| 2159 | 2208 | { |
| 2160 | 2209 | // machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2161 | | machine().device("soundcpu")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 2210 | m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); |
| 2162 | 2211 | |
| 2163 | 2212 | // memcpy(m_soundram, memregion("soundcpu")->base()+0x80000, 0x80000); |
| 2164 | 2213 | // m_soundcpu->reset(); |
| r21323 | r21324 | |
| 2188 | 2237 | if (irq > 0) |
| 2189 | 2238 | { |
| 2190 | 2239 | state->m_scsp_last_line = irq; |
| 2191 | | device->machine().device("soundcpu")->execute().set_input_line(irq, ASSERT_LINE); |
| 2240 | state->m_soundcpu->set_input_line(irq, ASSERT_LINE); |
| 2192 | 2241 | } |
| 2193 | 2242 | else |
| 2194 | | device->machine().device("soundcpu")->execute().set_input_line(-irq, CLEAR_LINE); |
| 2243 | state->m_soundcpu->set_input_line(-irq, CLEAR_LINE); |
| 2195 | 2244 | } |
| 2196 | 2245 | |
| 2197 | 2246 | WRITE_LINE_MEMBER(coolridr_state::scsp1_to_sh1_irq) |