trunk/src/mame/drivers/coolridr.c
| r21257 | r21258 | |
| 364 | 364 | #include "rendlay.h" |
| 365 | 365 | |
| 366 | 366 | |
| 367 | |
| 367 | 368 | class coolridr_state : public driver_device |
| 368 | 369 | { |
| 369 | 370 | public: |
| r21257 | r21258 | |
| 912 | 913 | } |
| 913 | 914 | else if (m_blitterSerialCount == 4) |
| 914 | 915 | { |
| 915 | | m_blit4_unused = data & 0xf8fefefe; |
| 916 | | m_blit4 = data & 0x07010101; |
| 916 | if (!(m_blit0 & 1)) // don't bother for non-sprites |
| 917 | { |
| 918 | m_blit4_unused = data & 0xf8fefefe; |
| 919 | m_blit4 = data & 0x07010101; |
| 917 | 920 | |
| 918 | | if (m_blit4_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit4_unused); |
| 921 | if (m_blit4_unused) printf("unknown bits in blit word %d - %08x\n", m_blitterSerialCount, m_blit4_unused); |
| 919 | 922 | |
| 920 | | // ---- -111 ---- ---v ---- ---u ---- ---x |
| 921 | | // 1 = used bits? (unknown purpose.. might be object colour mode) |
| 922 | | // x = x-flip? |
| 923 | | // u = probably y-flip? used on a few objects here and there... |
| 924 | | // v = unknown, not used much, occasional object |
| 923 | // ---- -111 ---- ---v ---- ---u ---- ---x |
| 924 | // 1 = used bits? (unknown purpose.. might be object colour mode) |
| 925 | // x = x-flip? |
| 926 | // u = probably y-flip? used on a few objects here and there... |
| 927 | // v = unknown, not used much, occasional object |
| 928 | } |
| 925 | 929 | } |
| 926 | 930 | else if (m_blitterSerialCount == 5) |
| 927 | 931 | { |
| r21257 | r21258 | |
| 1008 | 1012 | |
| 1009 | 1013 | } |
| 1010 | 1014 | |
| 1011 | | |
| 1012 | | int random; |
| 1013 | | |
| 1014 | | random = 0; |
| 1015 | | |
| 1016 | | // not used much.. |
| 1017 | | /* |
| 1018 | | if (m_blit4 &0x00010000) |
| 1019 | | { |
| 1020 | | //PRINT_BLIT_STUFF |
| 1021 | | m_b1colorNumber = machine().rand() | 0xff000000; |
| 1022 | | random = 1; |
| 1023 | | } |
| 1024 | | else |
| 1025 | | { |
| 1026 | | |
| 1027 | | } |
| 1028 | | */ |
| 1029 | | |
| 1030 | 1015 | //if (m_b1mode) |
| 1031 | 1016 | //{ |
| 1032 | 1017 | // PRINT_BLIT_STUFF |
| r21257 | r21258 | |
| 1278 | 1263 | h = m_hCellCount; |
| 1279 | 1264 | continue; |
| 1280 | 1265 | } |
| 1266 | |
| 1267 | int lookupnum = h + (v*m_hCellCount); |
| 1281 | 1268 | |
| 1282 | | |
| 1283 | | // It's unknown if it's row-major or column-major |
| 1284 | | // TODO: Study the CRT test and "Cool Riders" logo for clues. |
| 1285 | | UINT32 spriteNumber = 0; |
| 1286 | | |
| 1269 | // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text) |
| 1270 | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| 1271 | if (m_indirect_tile_enable) |
| 1287 | 1272 | { |
| 1288 | | int lookupnum = h + (v*m_hCellCount); |
| 1289 | | |
| 1290 | | // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text) |
| 1291 | | // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites |
| 1292 | | if (m_indirect_tile_enable) |
| 1293 | | { |
| 1294 | | const UINT32 memOffset = data; |
| 1295 | | lookupnum = space.read_byte(memOffset + h + (v*m_hCellCount)); |
| 1296 | | } |
| 1273 | const UINT32 memOffset = data; |
| 1274 | lookupnum = space.read_byte(memOffset + h + (v*m_hCellCount)); |
| 1275 | } |
| 1297 | 1276 | |
| 1298 | 1277 | |
| 1299 | | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1300 | | spriteNumber = get_20bit_data( m_b3romoffset, lookupnum); |
| 1278 | // these should be 'cell numbers' (tile numbers) which look up RLE data? |
| 1279 | UINT32 spriteNumber = get_20bit_data( m_b3romoffset, lookupnum ); |
| 1301 | 1280 | |
| 1302 | | int i = 1;// skip first 10 bits for now |
| 1303 | | int data_written = 0; |
| 1281 | int i = 1;// skip first 10 bits for now |
| 1282 | int data_written = 0; |
| 1304 | 1283 | |
| 1305 | | while (data_written<256) |
| 1306 | | { |
| 1284 | while (data_written<256) |
| 1285 | { |
| 1307 | 1286 | |
| 1308 | | UINT16 compdata = get_10bit_data( m_b3romoffset, spriteNumber + i); |
| 1287 | UINT16 compdata = get_10bit_data( m_b3romoffset, spriteNumber + i); |
| 1309 | 1288 | |
| 1310 | | if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100)) |
| 1311 | | { |
| 1312 | | // mm ccrr rrr0 |
| 1313 | | int encodelength = (compdata & 0x03e)>>1; |
| 1314 | | int data = (compdata & 0x3c0) >> 6; |
| 1289 | if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100)) |
| 1290 | { |
| 1291 | // mm ccrr rrr0 |
| 1292 | int encodelength = (compdata & 0x03e)>>1; |
| 1293 | int data = (compdata & 0x3c0) >> 6; |
| 1315 | 1294 | |
| 1316 | | while (data_written<256 && encodelength >=0) |
| 1317 | | { |
| 1318 | | m_tempshape[data_written] = data; |
| 1319 | | encodelength--; |
| 1320 | | data_written++; |
| 1321 | | } |
| 1322 | | } |
| 1323 | | else if ((compdata & 0x300) == 0x200) |
| 1295 | while (data_written<256 && encodelength >=0) |
| 1324 | 1296 | { |
| 1325 | | // mm cccc ccrr |
| 1326 | | int encodelength = (compdata & 0x003); |
| 1327 | | int data = (compdata & 0x3fc) >> 6; |
| 1328 | | |
| 1329 | | while (data_written<256 && encodelength >=0) |
| 1330 | | { |
| 1331 | | m_tempshape[data_written] = data; |
| 1332 | | encodelength--; |
| 1333 | | data_written++; |
| 1334 | | } |
| 1335 | | |
| 1297 | m_tempshape[data_written] = data; |
| 1298 | encodelength--; |
| 1299 | data_written++; |
| 1336 | 1300 | } |
| 1337 | | else |
| 1301 | } |
| 1302 | else if ((compdata & 0x300) == 0x200) |
| 1303 | { |
| 1304 | // mm cccc ccrr |
| 1305 | int encodelength = (compdata & 0x003); |
| 1306 | int data = (compdata & 0x3fc) >> 6; |
| 1307 | |
| 1308 | while (data_written<256 && encodelength >=0) |
| 1338 | 1309 | { |
| 1339 | | // mm cccc cccc |
| 1340 | | m_tempshape[data_written] = data&0xff; |
| 1310 | m_tempshape[data_written] = data; |
| 1311 | encodelength--; |
| 1341 | 1312 | data_written++; |
| 1342 | 1313 | } |
| 1343 | 1314 | |
| 1344 | | i++; |
| 1345 | 1315 | } |
| 1316 | else |
| 1317 | { |
| 1318 | // mm cccc cccc |
| 1319 | m_tempshape[data_written] = data&0xff; |
| 1320 | data_written++; |
| 1321 | } |
| 1346 | 1322 | |
| 1323 | i++; |
| 1324 | } |
| 1325 | |
| 1347 | 1326 | |
| 1348 | | // |
| 1349 | | //if (spriteNumber == 0x00) |
| 1350 | | // continue; |
| 1327 | |
| 1351 | 1328 | |
| 1352 | | } |
| 1329 | |
| 1353 | 1330 | |
| 1354 | 1331 | int blockwide = ((16*m_hZoom)/0x40)-1; |
| 1355 | 1332 | int blockhigh = ((16*m_vZoom)/0x40)-1; |
| r21257 | r21258 | |
| 1357 | 1334 | if (blockwide<=0) blockwide = 1; |
| 1358 | 1335 | if (blockhigh<=0) blockhigh = 1; |
| 1359 | 1336 | |
| 1360 | | |
| 1361 | | UINT32 color = 0xffffffff; |
| 1362 | | // HACKS to draw coloured blocks in easy to distinguish colours |
| 1363 | | if (m_blitterMode == 0x30 || m_blitterMode == 0x90) |
| 1364 | | { |
| 1365 | | if (m_b1colorNumber == 0x5b) |
| 1366 | | color = 0xffff0000; |
| 1367 | | else if (m_b1colorNumber == 0x5d) |
| 1368 | | color = 0xff00ff00; |
| 1369 | | else if (m_b1colorNumber == 0x5e) |
| 1370 | | color = 0xff0000ff; |
| 1371 | | else |
| 1372 | | color = 0xff00ffff; |
| 1373 | | } |
| 1374 | | else if (m_blitterMode == 0x40 || m_blitterMode == 0xa0) |
| 1375 | | { |
| 1376 | | color = 0xff000000 | (((m_b1colorNumber & 0xff) | 0x80)-0x40); |
| 1377 | | } |
| 1378 | | else if (m_blitterMode == 0x50 || m_blitterMode == 0xb0) |
| 1379 | | { |
| 1380 | | color = 0xff000000 | ((((m_b1colorNumber & 0xff) | 0x80)-0x40) << 8); |
| 1381 | | } |
| 1382 | | else if (m_blitterMode == 0x60 || m_blitterMode == 0xc0) |
| 1383 | | { |
| 1384 | | color = 0xff000000 | ((((m_b1colorNumber & 0xff) | 0x80)-0x40) << 16); |
| 1385 | | } |
| 1386 | | if (random == 1) |
| 1387 | | color = m_b1colorNumber; |
| 1388 | | |
| 1389 | 1337 | // DEBUG: Draw 16x16 block |
| 1390 | 1338 | UINT32* line; |
| 1391 | 1339 | for (int y = 0; y < 16; y++) |
| r21257 | r21258 | |
| 1404 | 1352 | if (line[drawx]==0) line[drawx] = clut[pix+0x4000]; |
| 1405 | 1353 | } |
| 1406 | 1354 | } |
| 1407 | | color++; |
| 1355 | |
| 1408 | 1356 | #if 0 // this one does zooming |
| 1409 | 1357 | // DEBUG: Draw 16x16 block |
| 1410 | 1358 | UINT32* line; |