Previous 199869 Revisions Next

r21266 Thursday 21st February, 2013 at 17:49:55 UTC by David Haywood
confirmed + implemented flip bits
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21265r21266
419419   UINT32 m_b3romoffset; //
420420   UINT32 m_blit4_unused;
421421   UINT32 m_blit4; // ?
422   UINT32 m_b4flipx;
423   UINT32 m_b4flipy;
422424
423425   UINT32 m_blit5_unused; // indirection enable + other bits?
424426   int m_indirect_tile_enable; // from m_blit5
r21265r21266
489491};
490492
491493#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); \
493495
494496
495497/* video */
r21265r21266
871873               if (!(m_blit0 & 1)) // don't bother for non-sprites
872874               {
873875                  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;
876879                  if (m_blit4_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, m_blit4_unused);
877880
878                  // ---- -111 ---- ---v ---- ---u ---- ---x
881                  // ---- -111 ---- ---r ---- ---y ---- ---x
879882                  // 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
883886               }
884887            }
885888            else if (m_blitterSerialCount == 5)
r21265r21266
12011204                     }
12021205                  }
12031206#endif
1207                  UINT32 lastSpriteNumber = 0xffffffff;
12041208
12051209                  // Splat some sprites
12061210                  for (int v = 0; v < m_vCellCount; v++)
r21265r21266
12241228                           continue;
12251229                        }
12261230
1227                        int lookupnum = h + (v*m_hCellCount);
1231                        int lookupnum;
12281232
12291233                        // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text)
12301234                        // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites
12311235                        if (m_indirect_tile_enable)
12321236                        {
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));
12351238                        }
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);
12361254
1255                           }
1256                        }
12371257
1258                       
12381259                        // these should be 'cell numbers' (tile numbers) which look up RLE data?
12391260                        UINT32 spriteNumber = (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) + 1 ]);
12401261
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)
12451264                        {
1265                           lastSpriteNumber = spriteNumber;
12461266
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;
12481269
1249                           if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100))
1270                           while (data_written<256)
12501271                           {
1251                              // mm ccrr rrr0
1252                              int encodelength = (compdata & 0x03e)>>1;
1253                              int data = (compdata & 0x3c0) >> 6;
12541272
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];
12581274
1259                              while (data_written<256 && encodelength >=0)
1275                              if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100))
12601276                              {
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                                 }
12641291                              }
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;
12711297
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
12731307                              {
1274                                 m_tempshape[data_written] = data;
1275                                 encodelength--;
1308                                 // mm cccc cccc
1309                                 m_tempshape[data_written] = data&0xff;
12761310                                 data_written++;
12771311                              }
12781312
1313                              i++;
12791314                           }
1280                           else
1281                           {
1282                              // mm cccc cccc
1283                              m_tempshape[data_written] = data&0xff;
1284                              data_written++;
1285                           }
1286
1287                           i++;
12881315                        }
12891316
12901317
12911318
12921319
12931320
1294
12951321                        int blockwide = ((16*m_hZoom)/0x40)-1;
12961322                        int blockhigh = ((16*m_vZoom)/0x40)-1;
12971323                        // hack
r21265r21266
13001326
13011327                        // DEBUG: Draw 16x16 block
13021328                        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
13041364                        {
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++)
13101366                           {
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);
13131370
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                              }
13171395                           }
13181396                        }
13191397

Previous 199869 Revisions Next


© 1997-2024 The MAME Team