Previous 199869 Revisions Next

r21324 Friday 22nd February, 2013 at 18:33:03 UTC by David Haywood
looking at the road, not quite right
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21323r21324
613613}
614614#endif
615615
616#define DRAW_PIX \
617   if (pix) \
618   { \
619      { \
620         if (!line[drawx]) line[drawx] = clut[pix+0x4000]; \
621      } \
622   } \
623
616624/* This is a RLE-based sprite blitter (US Patent #6,141,122), very unusual from Sega... */
617625void coolridr_state::blit_current_sprite(address_space &space)
618626{
r21323r21324
760768   // to be specific, the center line of the road (actual road object? which currently gets shown as a single pixel column?)
761769   // and the horizontal road used in the background of the title screen (which currently looks normal)
762770   // 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];
764772
765773   /************* m_spriteblit[11] *************/
766774   
r21323r21324
788796
789797   // we also use this to trigger the actual draw operation
790798
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) */
799799
800   }
801800
801   
802
803
802804   bitmap_rgb32* drawbitmap;
803805
804806   // 0x30 - 0x60 are definitely the left screen, 0x90 - 0xc0 are definitely the right screen.. the modes seem priority related
r21323r21324
807809   else // 0x90, 0xa0, 0xb0, 0xc0
808810      drawbitmap = &m_temp_bitmap_sprites2;
809811
810   int sizex = used_hCellCount * 16 * hZoom;
811812   int sizey = used_vCellCount * 16 * vZoom;
812   hPosition *= 0x40;
813
813814   vPosition *= 0x40;
814815
815816   switch (vOrigin & 3)
r21323r21324
830831      break;
831832   }
832833
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   }
850834
835
851836   UINT32 lastSpriteNumber = 0xffffffff;
852837   // Splat some sprites
853838   for (int v = 0; v < used_vCellCount; v++)
r21323r21324
861846      }
862847
863848
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++)
865854      {
866         const int pixelOffsetX = ((hPosition) + (h* 16 * hZoom)) / 0x40;
855         if (indirect_zoom_enable)
856         {
857            UINT32 dword = space.read_dword(blit10);
867858
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
869869         {
870            h = used_hCellCount;
871            continue;
870            hZoomTable[idx] = hZoom;
871            hPositionTable[idx] = hPosition;
872872         }
873873
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
874903         int lookupnum;
875904
876905         // with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text)
r21323r21324
920949         }
921950
922951
952
923953         // these should be 'cell numbers' (tile numbers) which look up RLE data?
924954         UINT32 spriteNumber = (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) + 1 ]);
925955         UINT16 tempshape[16*16];
r21323r21324
9801010         }
9811011
9821012
983         if (!hZoom || !vZoom)
1013         if (!vZoom)
9841014         {
9851015            m_blitterSerialCount++;
9861016            return;
9871017         }
9881018
989         int blockwide = ((16*hZoom)/0x40);
9901019         int blockhigh = ((16*vZoom)/0x40);
9911020
9921021
9931022
994         UINT32 incx = 0x8000000 / hZoom;
9951023         UINT32 incy = 0x8000000 / vZoom;
9961024
9971025         // DEBUG: Draw 16x16 block
9981026         UINT32* line;
9991027
1028
1029   
1030
10001031         if (blit_rotate)
10011032         {
10021033            if (used_flipy)
10031034            {
10041035               for (int y = 0; y < blockhigh; y++)
10051036               {
1037                  int realy = ((y*incy)>>21);
1038                  if (!hZoomTable[realy])
1039                     continue;
1040                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
10061041                  const int drawy = pixelOffsetY+y;
10071042                  if ((drawy>383) || (drawy<0)) continue;
10081043                  line = &drawbitmap->pix32(drawy);
1009                  int realy = ((y*incy)>>21);
1044                  int blockwide = ((16*hZoomTable[realy])/0x40);
1045                  UINT32 incx = 0x8000000 / hZoomTable[realy];
10101046
1047
10111048                  if (used_flipx)
10121049                  {
10131050                     for (int x = 0; x < blockwide; x++)
10141051                     {
1052                       
1053
10151054                        const int drawx = pixelOffsetX+x;
10161055                        if ((drawx>=495 || drawx<0)) continue;
10171056                        int realx = ((x*incx)>>21);
10181057
10191058                        UINT16 pix = tempshape[(15-realx)*16+(15-realy)];
1020                        if (pix )
1021                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1059                        DRAW_PIX
10221060                     }
10231061                  }
10241062                  else
r21323r21324
10301068                        int realx = ((x*incx)>>21);
10311069
10321070                        UINT16 pix = tempshape[(15-realx)*16+realy];
1033                        if (pix )
1034                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1071                        DRAW_PIX
10351072                     }
10361073                  }
10371074               }
r21323r21324
10401077            {
10411078               for (int y = 0; y < blockhigh; y++)
10421079               {
1080                  int realy = ((y*incy)>>21);
1081                  if (!hZoomTable[realy])
1082                     continue;   
1083                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
10431084                  const int drawy = pixelOffsetY+y;
10441085                  if ((drawy>383) || (drawy<0)) continue;
10451086                  line = &drawbitmap->pix32(drawy);
1046                  int realy = ((y*incy)>>21);
1087                  int blockwide = ((16*hZoomTable[realy])/0x40);
1088                  UINT32 incx = 0x8000000 / hZoomTable[realy];
10471089
1090
10481091                  if (used_flipx)
10491092                  {
10501093                     for (int x = 0; x < blockwide; x++)
r21323r21324
10541097                        int realx = ((x*incx)>>21);
10551098
10561099                        UINT16 pix = tempshape[realx*16+(15-realy)];
1057                        if (pix )
1058                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1100                        DRAW_PIX
10591101                     }
10601102                  }
10611103                  else
r21323r21324
10671109                        int realx = ((x*incx)>>21);
10681110
10691111                        UINT16 pix = tempshape[realx*16+realy];
1070                        if (pix )
1071                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1112                        DRAW_PIX
10721113                     }
10731114                  }
10741115               }
r21323r21324
10801121            {
10811122               for (int y = 0; y < blockhigh; y++)
10821123               {
1124                  int realy = ((y*incy)>>21);
1125                  if (!hZoomTable[realy])
1126                     continue;
1127                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
10831128                  const int drawy = pixelOffsetY+y;
10841129                  if ((drawy>383) || (drawy<0)) continue;
10851130                  line = &drawbitmap->pix32(drawy);
1086                  int realy = ((y*incy)>>21);
1131                  int blockwide = ((16*hZoomTable[realy])/0x40);
1132                  UINT32 incx = 0x8000000 / hZoomTable[realy];
10871133
1134
10881135                  if (used_flipx)
10891136                  {
10901137                     for (int x = 0; x < blockwide; x++)
r21323r21324
10941141                        int realx = ((x*incx)>>21);
10951142
10961143                        UINT16 pix = tempshape[(15-realy)*16+(15-realx)];
1097                        if (pix )
1098                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1144                        DRAW_PIX
10991145                     }
11001146                  }
11011147                  else
r21323r21324
11061152                        if ((drawx>=495 || drawx<0)) continue;
11071153                        int realx = ((x*incx)>>21);
11081154                        UINT16 pix = tempshape[(15-realy)*16+realx];
1109                        if (pix )
1110                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1155                        DRAW_PIX
11111156                     }
11121157                  }
11131158               }
r21323r21324
11161161            {
11171162               for (int y = 0; y < blockhigh; y++)
11181163               {
1164                  int realy = ((y*incy)>>21);
1165                  if (!hZoomTable[realy])
1166                     continue;
1167                  const int pixelOffsetX = ((hPositionTable[realy]) + (h* 16 * hZoomTable[realy])) / 0x40;
11191168                  const int drawy = pixelOffsetY+y;
11201169                  if ((drawy>383) || (drawy<0)) continue;
11211170                  line = &drawbitmap->pix32(drawy);
1122                  int realy = ((y*incy)>>21);
1171                  int blockwide = ((16*hZoomTable[realy])/0x40);
1172                  UINT32 incx = 0x8000000 / hZoomTable[realy];
11231173
1174
11241175                  if (used_flipx)
11251176                  {
11261177                     for (int x = 0; x < blockwide; x++)
r21323r21324
11301181                        int realx = ((x*incx)>>21);
11311182
11321183                        UINT16 pix = tempshape[realy*16+(15-realx)];
1133                        if (pix )
1134                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1184                        DRAW_PIX
11351185                     }
11361186                  }
11371187
r21323r21324
11461196                        int realx = ((x*incx)>>21);
11471197
11481198                        UINT16 pix = tempshape[realy*16+realx];
1149                        if (pix )
1150                           if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
1199                        DRAW_PIX
11511200                     }
11521201                  }
11531202               }
r21323r21324
15951644   if(offset == 8)
15961645   {
15971646      //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);
15991648      return;
16001649   }
16011650
r21323r21324
21212170void coolridr_state::machine_start()
21222171{
21232172//  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);
21252174
21262175//   memcpy(memregion("soundcpu")->base(), memregion("maincpu")->base()+0x100000, 0x80000);
21272176//   m_soundcpu->reset();
r21323r21324
21582207void coolridr_state::machine_reset()
21592208{
21602209//  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);
21622211
21632212//   memcpy(m_soundram, memregion("soundcpu")->base()+0x80000, 0x80000);
21642213//  m_soundcpu->reset();
r21323r21324
21882237   if (irq > 0)
21892238   {
21902239      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);
21922241   }
21932242   else
2194      device->machine().device("soundcpu")->execute().set_input_line(-irq, CLEAR_LINE);
2243      state->m_soundcpu->set_input_line(-irq, CLEAR_LINE);
21952244}
21962245
21972246WRITE_LINE_MEMBER(coolridr_state::scsp1_to_sh1_irq)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team