trunk/src/mame/drivers/coolridr.c
| r21265 | r21266 | |
| 419 | 419 | UINT32 m_b3romoffset; // |
| 420 | 420 | UINT32 m_blit4_unused; |
| 421 | 421 | UINT32 m_blit4; // ? |
| 422 | UINT32 m_b4flipx; |
| 423 | UINT32 m_b4flipy; |
| 422 | 424 | |
| 423 | 425 | UINT32 m_blit5_unused; // indirection enable + other bits? |
| 424 | 426 | int m_indirect_tile_enable; // from m_blit5 |
| r21265 | r21266 | |
| 489 | 491 | }; |
| 490 | 492 | |
| 491 | 493 | #define PRINT_BLIT_STUFF \ |
| 492 | | printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x) %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_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); \ |
| 494 | printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %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_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); \ |
| 493 | 495 | |
| 494 | 496 | |
| 495 | 497 | /* video */ |
| r21265 | r21266 | |
| 871 | 873 | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 872 | 874 | { |
| 873 | 875 | m_blit4_unused = data & 0xf8fefefe; |
| 874 | | m_blit4 = data & 0x07010101; |
| 875 | | |
| 876 | m_blit4 = data & 0x07010000; |
| 877 | m_b4flipx = data & 0x00000001; |
| 878 | m_b4flipy = (data & 0x00000100)>>8; |
| 876 | 879 | if (m_blit4_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit4_unused); |
| 877 | 880 | |
| 878 | | // ---- -111 ---- ---v ---- ---u ---- ---x |
| 881 | // ---- -111 ---- ---r ---- ---y ---- ---x |
| 879 | 882 | // 1 = used bits? (unknown purpose.. might be object colour mode) |
| 880 | | // x = x-flip? |
| 881 | | // u = probably y-flip? used on a few objects here and there... |
| 882 | | // v = unknown, not used much, occasional object |
| 883 | // x = x-flip |
| 884 | // y = y-flip |
| 885 | // r = unknown, not used much, occasional object - rotate |
| 883 | 886 | } |
| 884 | 887 | } |
| 885 | 888 | else if (m_blitterSerialCount == 5) |
| r21265 | r21266 | |
| 1201 | 1204 | } |
| 1202 | 1205 | } |
| 1203 | 1206 | #endif |
| 1207 | UINT32 lastSpriteNumber = 0xffffffff; |
| 1204 | 1208 | |
| 1205 | 1209 | // Splat some sprites |
| 1206 | 1210 | for (int v = 0; v < m_vCellCount; v++) |
| r21265 | r21266 | |
| 1224 | 1228 | continue; |
| 1225 | 1229 | } |
| 1226 | 1230 | |
| 1227 | | int lookupnum = h + (v*m_hCellCount); |
| 1231 | int lookupnum; |
| 1228 | 1232 | |
| 1229 | 1233 | // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text) |
| 1230 | 1234 | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| 1231 | 1235 | if (m_indirect_tile_enable) |
| 1232 | 1236 | { |
| 1233 | | const UINT32 memOffset = data; |
| 1234 | | lookupnum = space.read_byte(memOffset + h + (v*m_hCellCount)); |
| 1237 | lookupnum = space.read_byte(data + h + (v*m_hCellCount)); |
| 1235 | 1238 | } |
| 1239 | else |
| 1240 | { |
| 1241 | if (!m_b4flipy) |
| 1242 | { |
| 1243 | if (!m_b4flipx) |
| 1244 | lookupnum = h + (v*m_hCellCount); |
| 1245 | else |
| 1246 | lookupnum = (m_hCellCount-h-1) + (v*m_hCellCount); |
| 1247 | } |
| 1248 | else |
| 1249 | { |
| 1250 | if (!m_b4flipx) |
| 1251 | lookupnum = h + ((m_vCellCount-v-1)*m_hCellCount); |
| 1252 | else |
| 1253 | lookupnum = (m_hCellCount-h-1) + ((m_vCellCount-v-1)*m_hCellCount); |
| 1236 | 1254 | |
| 1255 | } |
| 1256 | } |
| 1237 | 1257 | |
| 1258 | |
| 1238 | 1259 | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1239 | 1260 | UINT32 spriteNumber = (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) + 1 ]); |
| 1240 | 1261 | |
| 1241 | | int i = 1;// skip first 10 bits for now |
| 1242 | | int data_written = 0; |
| 1243 | | |
| 1244 | | while (data_written<256) |
| 1262 | // skip the decoding if it's the same tile as last time! |
| 1263 | if (spriteNumber != lastSpriteNumber) |
| 1245 | 1264 | { |
| 1265 | lastSpriteNumber = spriteNumber; |
| 1246 | 1266 | |
| 1247 | | UINT16 compdata = m_expanded_10bit_gfx[ (m_b3romoffset << 3) + spriteNumber + i]; |
| 1267 | int i = 1;// skip first 10 bits for now |
| 1268 | int data_written = 0; |
| 1248 | 1269 | |
| 1249 | | if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100)) |
| 1270 | while (data_written<256) |
| 1250 | 1271 | { |
| 1251 | | // mm ccrr rrr0 |
| 1252 | | int encodelength = (compdata & 0x03e)>>1; |
| 1253 | | int data = (compdata & 0x3c0) >> 6; |
| 1254 | 1272 | |
| 1255 | | // guess, blank tiles have the following form |
| 1256 | | // 00120 (00000024,0) | 010 03f |
| 1257 | | if (compdata&1) encodelength = 255; |
| 1273 | UINT16 compdata = m_expanded_10bit_gfx[ (m_b3romoffset << 3) + spriteNumber + i]; |
| 1258 | 1274 | |
| 1259 | | while (data_written<256 && encodelength >=0) |
| 1275 | if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100)) |
| 1260 | 1276 | { |
| 1261 | | m_tempshape[data_written] = data; |
| 1262 | | encodelength--; |
| 1263 | | data_written++; |
| 1277 | // mm ccrr rrr0 |
| 1278 | int encodelength = (compdata & 0x03e)>>1; |
| 1279 | int data = (compdata & 0x3c0) >> 6; |
| 1280 | |
| 1281 | // guess, blank tiles have the following form |
| 1282 | // 00120 (00000024,0) | 010 03f |
| 1283 | if (compdata&1) encodelength = 255; |
| 1284 | |
| 1285 | while (data_written<256 && encodelength >=0) |
| 1286 | { |
| 1287 | m_tempshape[data_written] = data; |
| 1288 | encodelength--; |
| 1289 | data_written++; |
| 1290 | } |
| 1264 | 1291 | } |
| 1265 | | } |
| 1266 | | else if ((compdata & 0x300) == 0x200) |
| 1267 | | { |
| 1268 | | // mm cccc ccrr |
| 1269 | | int encodelength = (compdata & 0x003); |
| 1270 | | int data = (compdata & 0x3fc) >> 6; |
| 1292 | else if ((compdata & 0x300) == 0x200) |
| 1293 | { |
| 1294 | // mm cccc ccrr |
| 1295 | int encodelength = (compdata & 0x003); |
| 1296 | int data = (compdata & 0x3fc) >> 6; |
| 1271 | 1297 | |
| 1272 | | while (data_written<256 && encodelength >=0) |
| 1298 | while (data_written<256 && encodelength >=0) |
| 1299 | { |
| 1300 | m_tempshape[data_written] = data; |
| 1301 | encodelength--; |
| 1302 | data_written++; |
| 1303 | } |
| 1304 | |
| 1305 | } |
| 1306 | else |
| 1273 | 1307 | { |
| 1274 | | m_tempshape[data_written] = data; |
| 1275 | | encodelength--; |
| 1308 | // mm cccc cccc |
| 1309 | m_tempshape[data_written] = data&0xff; |
| 1276 | 1310 | data_written++; |
| 1277 | 1311 | } |
| 1278 | 1312 | |
| 1313 | i++; |
| 1279 | 1314 | } |
| 1280 | | else |
| 1281 | | { |
| 1282 | | // mm cccc cccc |
| 1283 | | m_tempshape[data_written] = data&0xff; |
| 1284 | | data_written++; |
| 1285 | | } |
| 1286 | | |
| 1287 | | i++; |
| 1288 | 1315 | } |
| 1289 | 1316 | |
| 1290 | 1317 | |
| 1291 | 1318 | |
| 1292 | 1319 | |
| 1293 | 1320 | |
| 1294 | | |
| 1295 | 1321 | int blockwide = ((16*m_hZoom)/0x40)-1; |
| 1296 | 1322 | int blockhigh = ((16*m_vZoom)/0x40)-1; |
| 1297 | 1323 | // hack |
| r21265 | r21266 | |
| 1300 | 1326 | |
| 1301 | 1327 | // DEBUG: Draw 16x16 block |
| 1302 | 1328 | UINT32* line; |
| 1303 | | for (int y = 0; y < 16; y++) |
| 1329 | if (m_b4flipy) |
| 1330 | { |
| 1331 | for (int y = 0; y < 16; y++) |
| 1332 | { |
| 1333 | const int drawy = pixelOffsetY+y; |
| 1334 | if ((drawy>383) || (drawy<0)) continue; |
| 1335 | line = &drawbitmap->pix32(drawy); |
| 1336 | |
| 1337 | if (m_b4flipx) |
| 1338 | { |
| 1339 | for (int x = 0; x < 16; x++) |
| 1340 | { |
| 1341 | const int drawx = pixelOffsetX+x; |
| 1342 | if ((drawx>=495 || drawx<0)) continue; |
| 1343 | |
| 1344 | UINT16 pix = m_tempshape[(15-y)*16+(15-x)]; |
| 1345 | if (pix ) |
| 1346 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1347 | } |
| 1348 | } |
| 1349 | else |
| 1350 | { |
| 1351 | for (int x = 0; x < 16; x++) |
| 1352 | { |
| 1353 | const int drawx = pixelOffsetX+x; |
| 1354 | if ((drawx>=495 || drawx<0)) continue; |
| 1355 | |
| 1356 | UINT16 pix = m_tempshape[(15-y)*16+x]; |
| 1357 | if (pix ) |
| 1358 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1359 | } |
| 1360 | } |
| 1361 | } |
| 1362 | } |
| 1363 | else |
| 1304 | 1364 | { |
| 1305 | | const int drawy = pixelOffsetY+y; |
| 1306 | | if ((drawy>383) || (drawy<0)) continue; |
| 1307 | | line = &drawbitmap->pix32(drawy); |
| 1308 | | |
| 1309 | | for (int x = 0; x < 16; x++) |
| 1365 | for (int y = 0; y < 16; y++) |
| 1310 | 1366 | { |
| 1311 | | const int drawx = pixelOffsetX+x; |
| 1312 | | if ((drawx>=495 || drawx<0)) continue; |
| 1367 | const int drawy = pixelOffsetY+y; |
| 1368 | if ((drawy>383) || (drawy<0)) continue; |
| 1369 | line = &drawbitmap->pix32(drawy); |
| 1313 | 1370 | |
| 1314 | | UINT16 pix = m_tempshape[y*16+x]; |
| 1315 | | if (pix ) |
| 1316 | | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1371 | if (m_b4flipx) |
| 1372 | { |
| 1373 | for (int x = 0; x < 16; x++) |
| 1374 | { |
| 1375 | const int drawx = pixelOffsetX+x; |
| 1376 | if ((drawx>=495 || drawx<0)) continue; |
| 1377 | |
| 1378 | UINT16 pix = m_tempshape[y*16+(15-x)]; |
| 1379 | if (pix ) |
| 1380 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1381 | } |
| 1382 | } |
| 1383 | else |
| 1384 | { |
| 1385 | for (int x = 0; x < 16; x++) |
| 1386 | { |
| 1387 | const int drawx = pixelOffsetX+x; |
| 1388 | if ((drawx>=495 || drawx<0)) continue; |
| 1389 | |
| 1390 | UINT16 pix = m_tempshape[y*16+x]; |
| 1391 | if (pix ) |
| 1392 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1393 | } |
| 1394 | } |
| 1317 | 1395 | } |
| 1318 | 1396 | } |
| 1319 | 1397 | |