Previous 199869 Revisions Next

r21314 Friday 22nd February, 2013 at 13:48:54 UTC by David Haywood
code reorganization
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21313r21314
375375      m_blitterSerialCount(0x00),
376376      m_blitterMode(0x00),
377377      m_textOffset(0x0000),
378      m_vCellCount(0x0000),
379      m_hCellCount(0x0000),
380      m_vPosition(0x0000),
381      m_hPosition(0x0000),
382378      m_maincpu(*this, "maincpu"),
383379      m_subcpu(*this,"sub"),
384380      m_soundcpu(*this,"soundcpu"),
r21313r21314
399395   INT16  m_blitterSerialCount;
400396   UINT8  m_blitterMode;
401397   UINT16 m_textOffset;
402   UINT16 m_vCellCount;
403   UINT16 m_hCellCount;
404398   UINT32 m_blitterClearMode;
405399   INT16 m_blitterClearCount;
406   int m_vPosition;
407   int m_hPosition;
408400
409   UINT16 m_vOrigin;
410   UINT16 m_hOrigin;
411   UINT16 m_vZoom;
412   UINT16 m_hZoom;
413   UINT32 m_blit0; // ?
414   UINT32 m_blit1_unused; // ?
415   UINT32 m_b1mode; // ?
416   UINT32 m_b1colorNumber;
417   UINT32 m_blit2_unused; // ?
418   UINT32 m_b2tpen;
419   UINT32 m_b2colorNumber;
401   // store the blit params here
402   UINT32 m_spriteblit[12];
420403
421   UINT32 m_blit3_unused; // ?
422   UINT32 m_b3romoffset; //
423   UINT32 m_blit4_unused;
424   UINT32 m_blit4; // ?
425   UINT32 m_b4flipx;
426   UINT32 m_b4flipy;
427   UINT32 m_b4rotate;
404   
428405
429   UINT32 m_blit5_unused; // indirection enable + other bits?
430   int m_indirect_tile_enable; // from m_blit5
431   int m_indirect_zoom_enable; // from m_blit5
432406
433   UINT32 m_blit10; // an address
434407
435   UINT16 m_tempshape[16*16];
436408
409
410
411
412   
413
437414   required_device<cpu_device> m_maincpu;
438415   required_device<cpu_device> m_subcpu;
439416   required_device<cpu_device> m_soundcpu;
r21313r21314
499476};
500477
501478#define PRINT_BLIT_STUFF \
502   printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %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_b4rotate, 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); \
479   printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", blit0, blit1_unused,b1mode,b1colorNumber, blit2_unused,b2tpen,b2colorNumber, blit3_unused,b3romoffset, blit4_unused, blit4, blit_flipy,blit_rotate, blit_flipx, blit5_unused, indirect_tile_enable, indirect_zoom_enable, vCellCount, hCellCount, vZoom, hZoom, blit10, data, vPosition, hPosition); \
503480
504481
505482/* video */
r21313r21314
819796            //                (See ifdef'ed out code below for a closer examination)
820797
821798            // Serialized counts
822            if (m_blitterSerialCount == 0)
799            if (m_blitterSerialCount < 12)
823800            {
801               m_spriteblit[m_blitterSerialCount] = data;
802               m_blitterSerialCount++;
803            }
804            else
805            {
806               printf("more than 11 dwords (%d) in blit?\n", m_blitterSerialCount);
807            }
808
809            // use the 11th blit write also as the trigger
810            if (m_blitterSerialCount == 12)
811            {
812               // first parse the bits
813
814               /************* m_spriteblit[0] *************/
815
824816               // set to 0x00000001 on some objects during the 'film strip' part of attract, otherwise 0
825817               // those objects don't seem visible anyway so might have some special meaning
826818               // this is also set at times during the game
827819               //
828               // the sprites with 1 set appear to have 0x00000000 in everything after the 4th write (m_blit4 and above)
820               // the sprites with 1 set appear to have 0x00000000 in everything after the 4th write (blit4 and above)
829821               // so likely have some other meaning and are NOT regular sprite data
830               m_blit0 = data;
822               UINT32 blit0 = m_spriteblit[0];
831823
824               // abort early..
825               if (blit0!=0)
826                  return;
832827
828               /************* m_spriteblit[1] *************/
829               
830               // 000u0ccc  - c = colour? u = 0/1
831               UINT32 blit1_unused = m_spriteblit[1] & 0xfffef800;
832               UINT32 b1mode = (m_spriteblit[1] & 0x00010000)>>16;
833               //UINT32 b1colorNumber = (m_spriteblit[1] & 0x000007ff);    // Probably more bits
833834
835               if (blit1_unused!=0) printf("blit1 unknown bits set %08x\n", m_spriteblit[1]);
836         
837               /************* m_spriteblit[3] *************/
838               
839               // seems to be more complex than just transparency
840               UINT32 blit2_unused = m_spriteblit[2]&0xff80f800;
841               UINT32 b2tpen = (m_spriteblit[2] & 0x007f0000)>>16;
842               //UINT32 b2colorNumber = (m_spriteblit[2] & 0x000007ff);
834843
835
836            //   if (data!=0) printf("blit %08x\n", data);
837            }
838            else if (m_blitterSerialCount == 1)
839            {
840               m_blit1_unused = 0; m_b1mode = 0; m_b1colorNumber = 0;
841
842               if (!(m_blit0 & 1)) // don't bother for non-sprites
844               if (blit2_unused!=0) printf("blit1 unknown bits set %08x\n", m_spriteblit[2]);
845               if (b1mode)
843846               {
844                  // 000u0ccc  - c = colour? u = 0/1
845                  m_blit1_unused = data & 0xfffef800;
846                  m_b1mode = (data & 0x00010000)>>16;
847                  m_b1colorNumber = (data & 0x000007ff);    // Probably more bits
848
849                  if (m_blit1_unused!=0) printf("blit1 unknown bits set %08x\n", data);
847                  if (b2tpen != 0x7f) printf("b1mode 1, b2tpen!=0x7f\n");
850848               }
851            }
852            else if (m_blitterSerialCount == 2)
853            {
854               if (!(m_blit0 & 1)) // don't bother for non-sprites
849               else
855850               {
856
857                  // seems to be more complex than just transparency
858                  m_blit2_unused = data&0xff80f800;
859                  m_b2tpen = (data & 0x007f0000)>>16;
860                  m_b2colorNumber = (data & 0x000007ff);
861
862                  if (m_blit2_unused!=0) printf("blit1 unknown bits set %08x\n", data);
863                  if (m_b1mode)
864                  {
865                     if (m_b2tpen != 0x7f) printf("m_b1mode 1, m_b2tpen!=0x7f\n");
866                  }
867                  else
868                  {
869                     // 0x01/0x02 trips in rare cases (start of one of the attract levels) maybe this is some kind of alpha instead?
870                     if ((m_b2tpen != 0x00) && (m_b2tpen != 0x01) && (m_b2tpen != 0x02)) printf("m_b1mode 0, m_b2tpen!=0x00,0x01 or 0x02 (is %02x)\n", m_b2tpen);
871                  }
872
873                   // 00??0uuu
874                   // ?? seems to be 00 or 7f, set depending on b1mode
875                   // uuu, at least 11 bits used, maybe 12 usually the same as m_blit1_unused? leftover?
851                  // 0x01/0x02 trips in rare cases (start of one of the attract levels) maybe this is some kind of alpha instead?
852                  if ((b2tpen != 0x00) && (b2tpen != 0x01) && (b2tpen != 0x02)) printf("b1mode 0, b2tpen!=0x00,0x01 or 0x02 (is %02x)\n", b2tpen);
876853               }
854                // 00??0uuu
855                // ?? seems to be 00 or 7f, set depending on b1mode
856                // uuu, at least 11 bits used, maybe 12 usually the same as blit1_unused? leftover?
857         
858               /************* m_spriteblit[3] *************/
877859
878            }
879            else if (m_blitterSerialCount == 3)
880            {
881               if (!(m_blit0 & 1)) // don't bother for non-sprites
882               {
883                  m_blit3_unused = data & 0xffe00000;
884                  m_b3romoffset = (data & 0x001fffff)*2;
885                  // if this is an offset into the compressed data then it's probably a word offset into each rom (each is 0x400000 bytes) with the data from all 10 being used in parallel as per the notes from Charles
886                  // this needs verifying as it could instead be an index into some other ram area already decompressed..
887                  // 0000xxxx
888                  //  to
889                  // 001fxxxx
860               UINT32 blit3_unused = m_spriteblit[3] & 0xffe00000;
861               UINT32 b3romoffset = (m_spriteblit[3] & 0x001fffff)*2;
862               // if this is an offset into the compressed m_spriteblit[3] then it's probably a word offset into each rom (each is 0x400000 bytes) with the m_spriteblit[3] from all 10 being used in parallel as per the notes from Charles
863               // this needs verifying as it could instead be an index into some other ram area already decompressed..
864               // 0000xxxx
865               //  to
866               // 001fxxxx
890867
891                  if (m_blit3_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, m_blit4_unused);
892                  if (m_b3romoffset!=0)
893                  {
894#if 0
895                     // if we look in rom IC6 (+0x2400000) then the word before our offset is very often 0x0000 probably indicating that's the last word used
896                     printf("rom offset %08x, previous values : ", m_b3romoffset);
897                     for (int i=0;i<8;i++)
898                     {
899                        UINT32 dat20 = get_20bit_data( m_b3romoffset, i);
900                        printf("%05x ",dat20);
901                     }
902                     printf("\n");
903#endif
904#if 0
905                     // look at the values actually at the address we're using..
906                     // often have a similar form to
907                     // 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080,
908                     //   1     2     3     4     5     6     7     8     9    10
909                     // so you can see 1/6  2/7,  3/8,  4/9,  5/10 are often similar or the same
910                     if (m_b3romoffset == 0x0000848e)
911                     {
912                        printf("rom offset %08x, values : \n", m_b3romoffset);
868               if (blit3_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, blit3_unused);
869               
913870
914                        for (int b=0;b<8;b++)
915                        {
916                           for (int i=0;i<8;i++)
917                           {
918                              UINT32 dat20 = get_20bit_data( m_b3romoffset, i+b*8);
919                              printf("%05x ",dat20);
920                           }
921                           printf("\n");
922                        }
923                        printf("\n");
924                     }
925                     /*
926                     rom offset 0000848e, values :
927                     00a00 00a00 00a00 00a00 00a00 00a02 00a3d 00a98
928                     00afa 00b3f 00b95 00be9 00c4d 00c89 00a00 00cd3
929                     00d17 00d4b 00d94 00dee 00e50 00eb0 00f16 00f62
930                     00fce 00a00 00a00 00a00 00a00 00a00 00a00 00a00
931                     00a00 00a00 00a00 00a00 00ff2 0101d 01060 0109d
932                     010d2 01112 01148 01194 011be 00a00 011f1 0121c
933                     0123f 01272 012af 012f0 0132c 01377 013af 01400
934                     00a00 00a00 00a00 00a00 00a00 00a00 00000 00000
935                     */
871               /************* m_spriteblit[4] *************/
936872
873               UINT32 blit4_unused = m_spriteblit[4] & 0xf8fefefe;
874               //UINT32 blit4 = m_spriteblit[4] & 0x07000000;
875               UINT32 blit_flipx = m_spriteblit[4] & 0x00000001;
876               UINT32 blit_flipy = (m_spriteblit[4] & 0x00000100)>>8;
877               UINT32 blit_rotate = (m_spriteblit[4] & 0x00010000)>>16;
878               if (blit4_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, blit4_unused);
937879
880               // ---- -111 ---- ---r ---- ---y ---- ---x
881               // 1 = used bits? (unknown purpose.. might be object colour mode)
882               // x = x-flip
883               // y = y-flip
884               // r = unknown, not used much, occasional object - rotate
885           
886               /************* m_spriteblit[5] *************/
938887
888               UINT32 blit5_unused = m_spriteblit[5]&0xfffefffe;
889               // this might enable the text indirection thing?
890               int indirect_tile_enable = (m_spriteblit[5] & 0x00010000)>>16;
891               int indirect_zoom_enable = (m_spriteblit[5] & 0x00000001);
939892
940893
941                     // these are used for slider bars in test mode
942                     //   rom offset 00140000, values : 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080,
943                     //   rom offset 00140008, values : 0004, 9000, 4900, 0490, 0049, 0004, 9000, 4900, 0490, 0049,
894               if (blit5_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, blit5_unused);
895               // 00010000 (text)
896               // 00000001 (other)
944897
945                     // or as groups of 20-bits  00080 00080 00080 00080 00080 00080 00080 00080
946                     // or as groups of 20-bits  00049 00049 00049 00049 00049 00049 00049 00049
947898
948#endif
949                  }
950899
951900
952               }
953            }
954            else if (m_blitterSerialCount == 4)
955            {
956               if (!(m_blit0 & 1)) // don't bother for non-sprites
957               {
958                  m_blit4_unused = data & 0xf8fefefe;
959                  m_blit4 = data & 0x07000000;
960                  m_b4flipx = data & 0x00000001;
961                  m_b4flipy = (data & 0x00000100)>>8;
962                  m_b4rotate = (data & 0x00010000)>>16;
963                  if (m_blit4_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, m_blit4_unused);
901               /************* m_spriteblit[6] *************/
964902
965                  // ---- -111 ---- ---r ---- ---y ---- ---x
966                  // 1 = used bits? (unknown purpose.. might be object colour mode)
967                  // x = x-flip
968                  // y = y-flip
969                  // r = unknown, not used much, occasional object - rotate
970               }
971            }
972            else if (m_blitterSerialCount == 5)
973            {
974               m_blit5_unused = data&0xfffefffe;
975               // this might enable the text indirection thing?
976               m_indirect_tile_enable = (data & 0x00010000)>>16;
977               m_indirect_zoom_enable = (data & 0x00000001);
903               UINT16 vCellCount = (m_spriteblit[6] & 0xffff0000) >> 16;
904               UINT16 hCellCount = (m_spriteblit[6] & 0x0000ffff);
905         
906               /************* m_spriteblit[7] *************/
907     
908               UINT16 vOrigin = (m_spriteblit[7] & 0xffff0000) >> 16;
909               UINT16 hOrigin = (m_spriteblit[7] & 0x0000ffff);
910               //printf("%04x %04x\n", vOrigin, hOrigin);
911         
912               /************* m_spriteblit[8] *************/
978913
914               UINT16 vZoom = (m_spriteblit[8] & 0xffff0000) >> 16;
915               UINT16 hZoom = (m_spriteblit[8] & 0x0000ffff);
916         
917               /************* m_spriteblit[9] *************/
979918
980               if (m_blit5_unused) printf("unknown bits in blit word %d -  %08x\n", m_blitterSerialCount, m_blit5_unused);
981               // 00010000 (text)
982               // 00000001 (other)
919               int vPosition = (m_spriteblit[9] & 0xffff0000) >> 16;
920               int hPosition = (m_spriteblit[9] & 0x0000ffff);
983921
984            }
985            else if (m_blitterSerialCount == 6)
986            {
987               m_vCellCount = (data & 0xffff0000) >> 16;
988               m_hCellCount = (data & 0x0000ffff);
989            }
990            else if (m_blitterSerialCount == 7)
991            {
992               m_vOrigin = (data & 0xffff0000) >> 16;
993               m_hOrigin = (data & 0x0000ffff);
994               //printf("%04x %04x\n", m_vOrigin, m_hOrigin);
995            }
996            else if (m_blitterSerialCount == 8)
997            {
998               m_vZoom = (data & 0xffff0000) >> 16;
999               m_hZoom = (data & 0x0000ffff);
1000            }
1001            else if (m_blitterSerialCount == 9)
1002            {
1003               m_vPosition = (data & 0xffff0000) >> 16;
1004               m_hPosition = (data & 0x0000ffff);
922               if (hPosition & 0x8000) hPosition -= 0x10000;
923               if (vPosition & 0x8000) vPosition -= 0x10000;
924         
925               /************* m_spriteblit[10] *************/
1005926
1006               if (m_hPosition & 0x8000) m_hPosition -= 0x10000;
1007               if (m_vPosition & 0x8000) m_vPosition -= 0x10000;
1008            }
1009            else if (m_blitterSerialCount == 10)
1010            {
1011927               // this is an address on some objects..
1012928               // to be specific, the center line of the road (actual road object? which currently gets shown as a single pixel column?)
1013929               // and the horizontal road used in the background of the title screen (which currently looks normal)
1014930               // I guess it's some kind of indirect way to do a line effect?
1015               m_blit10 = data;
931               //UINT32 blit10 = m_spriteblit[10];
1016932
1017            //   if (data!=0) printf("blit %08x\n", data);
1018            }
1019            else if (m_blitterSerialCount == 11)
1020            {
1021               if (m_blit0 & 1)
933               /************* m_spriteblit[11] *************/
934               
935               UINT32 textlookup =  m_spriteblit[11];
936
937               /* DRAW */
938               
939               if (blit0 & 1)
1022940               {
1023941                  // NOT A SPRITE
1024942
r21313r21314
1029947               }
1030948               else
1031949               {
1032                  UINT16 used_hCellCount = m_hCellCount;
1033                  UINT16 used_vCellCount = m_vCellCount;
1034                  UINT16 used_flipx = m_b4flipx;
1035                  UINT16 used_flipy = m_b4flipy;
950                  UINT16 used_hCellCount = hCellCount;
951                  UINT16 used_vCellCount = vCellCount;
952                  UINT16 used_flipx = blit_flipx;
953                  UINT16 used_flipy = blit_flipy;
1036954
1037                  if (m_b4rotate)
955                  if (blit_rotate)
1038956                  {
1039                     used_hCellCount = m_vCellCount;
1040                     used_vCellCount = m_hCellCount;
1041                     used_flipx = m_b4flipy;
1042                     used_flipy = m_b4flipx;
957                     used_hCellCount = vCellCount;
958                     used_vCellCount = hCellCount;
959                     used_flipx = blit_flipy;
960                     used_flipy = blit_flipx;
1043961                     // do the zoom params rotate?
1044962                  }
1045963
r21313r21314
1050968
1051969                  // we also use this to trigger the actual draw operation
1052970
1053                  //printf("blit %08x\n", data);
1054
1055                  // debug, hide objects without m_blit10 set
1056                  //if (m_blit10==0) return;
1057                  //if (m_blit0==0) return;
1058
1059                  //if (m_blit10!=0)
1060                  if (m_indirect_zoom_enable)
971           
972                  //if (blit10!=0)
973                  if (indirect_zoom_enable)
1061974                  {
1062                     // with this bit enabled m_blit10 is a look up to the zoom(?) value eg. 03f42600
1063                     //UINT32 temp = space.read_dword(m_blit10);
975                     // with this bit enabled blit10 is a look up to the zoom(?) value eg. 03f42600
976                     //UINT32 temp = space.read_dword(blit10);
1064977                     //PRINT_BLIT_STUFF
1065978                     /* for the horizontal road during attract there are tables 0x480 bytes long (0x120 dwords) and the value passed points to the start of them */
1066979                     /* cell sizes for those are are 0011 (v) 0007 (h) with zoom factors of 0020 (half v) 0040 (normal h) */
r21313r21314
1076989                  else // 0x90, 0xa0, 0xb0, 0xc0
1077990                     drawbitmap = &m_temp_bitmap_sprites2;
1078991
1079                  int sizex = used_hCellCount * 16 * m_hZoom;
1080                  int sizey = used_vCellCount * 16 * m_vZoom;
1081                  m_hPosition *= 0x40;
1082                  m_vPosition *= 0x40;
992                  int sizex = used_hCellCount * 16 * hZoom;
993                  int sizey = used_vCellCount * 16 * vZoom;
994                  hPosition *= 0x40;
995                  vPosition *= 0x40;
1083996
1084                  switch (m_vOrigin & 3)
997                  switch (vOrigin & 3)
1085998                  {
1086999                  case 0:
10871000                     // top
10881001                     break;
10891002                  case 1:
1090                     m_vPosition -= sizey / 2 ;
1003                     vPosition -= sizey / 2 ;
10911004                     // middle?
10921005                     break;
10931006                  case 2:
1094                     m_vPosition -= sizey;
1007                     vPosition -= sizey;
10951008                     // bottom?
10961009                     break;
10971010                  case 3:
r21313r21314
10991012                     break;
11001013                  }
11011014
1102                  switch (m_hOrigin & 3)
1015                  switch (hOrigin & 3)
11031016                  {
11041017                  case 0:
11051018                     // left
11061019                     break;
11071020                  case 1:
1108                     m_hPosition -= sizex / 2;
1021                     hPosition -= sizex / 2;
11091022                     // middle?
11101023                     break;
11111024                  case 2:
1112                     m_hPosition -= sizex;
1025                     hPosition -= sizex;
11131026                     // right?
11141027                     break;
11151028                  case 3:
r21313r21314
11211034                  // Splat some sprites
11221035                  for (int v = 0; v < used_vCellCount; v++)
11231036                  {
1124                     const int pixelOffsetY = ((m_vPosition) + (v* 16 * m_vZoom)) / 0x40;
1037                     const int pixelOffsetY = ((vPosition) + (v* 16 * vZoom)) / 0x40;
11251038
11261039                     if (pixelOffsetY>383)
11271040                     {
r21313r21314
11321045
11331046                     for (int h = 0; h < used_hCellCount; h++)
11341047                     {
1135                        const int pixelOffsetX = ((m_hPosition) + (h* 16 * m_hZoom)) / 0x40;
1048                        const int pixelOffsetX = ((hPosition) + (h* 16 * hZoom)) / 0x40;
11361049
11371050                        if (pixelOffsetX>495)
11381051                        {
r21313r21314
11421055
11431056                        int lookupnum;
11441057
1145                        // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text)
1058                        // with this bit enabled the tile numbers gets looked up using 'data' (which would be blit11) (eg 03f40000 for startup text)
11461059                        // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites
1147                        if (m_indirect_tile_enable)
1060                        if (indirect_tile_enable)
11481061                        {
1149                           lookupnum = space.read_byte(data + h + (v*used_hCellCount));
1062                           lookupnum = space.read_byte(textlookup + h + (v*used_hCellCount));
11501063                        }
11511064                        else
11521065                        {
1153                           if (!m_b4rotate)
1066                           if (!blit_rotate)
11541067                           {
11551068                              if (!used_flipy)
11561069                              {
r21313r21314
11901103
11911104
11921105                        // these should be 'cell numbers' (tile numbers) which look up RLE data?
1193                        UINT32 spriteNumber = (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (m_b3romoffset << 3) + (lookupnum<<1) + 1 ]);
1194
1106                        UINT32 spriteNumber = (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) +0 ] << 10) | (m_expanded_10bit_gfx[ (b3romoffset << 3) + (lookupnum<<1) + 1 ]);
1107                        UINT16 tempshape[16*16];
1108                       
11951109                        // skip the decoding if it's the same tile as last time!
11961110                        if (spriteNumber != lastSpriteNumber)
11971111                        {
r21313r21314
12031117                           while (data_written<256)
12041118                           {
12051119
1206                              UINT16 compdata = m_expanded_10bit_gfx[ (m_b3romoffset << 3) + spriteNumber + i];
1120                              UINT16 compdata = m_expanded_10bit_gfx[ (b3romoffset << 3) + spriteNumber + i];
12071121
12081122                              if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100))
12091123                              {
12101124                                 // mm ccrr rrr0
12111125                                 int encodelength = (compdata & 0x03e)>>1;
1212                                 int data = (compdata & 0x3c0) >> 6;
1126                                 int rledata = (compdata & 0x3c0) >> 6;
12131127
12141128                                 // guess, blank tiles have the following form
12151129                                 // 00120 (00000024,0) | 010 03f
r21313r21314
12171131
12181132                                 while (data_written<256 && encodelength >=0)
12191133                                 {
1220                                    m_tempshape[data_written] = data;
1134                                    tempshape[data_written] = rledata;
12211135                                    encodelength--;
12221136                                    data_written++;
12231137                                 }
r21313r21314
12261140                              {
12271141                                 // mm cccc ccrr
12281142                                 int encodelength = (compdata & 0x003);
1229                                 int data = (compdata & 0x3fc) >> 6;
1143                                 int rledata = (compdata & 0x3fc) >> 6;
12301144
12311145                                 while (data_written<256 && encodelength >=0)
12321146                                 {
1233                                    m_tempshape[data_written] = data;
1147                                    tempshape[data_written] = rledata;
12341148                                    encodelength--;
12351149                                    data_written++;
12361150                                 }
r21313r21314
12391153                              else
12401154                              {
12411155                                 // mm cccc cccc
1242                                 m_tempshape[data_written] = data&0xff;
1156                                 tempshape[data_written] = compdata&0xff;
12431157                                 data_written++;
12441158                              }
12451159
r21313r21314
12481162                        }
12491163
12501164
1251                        if (!m_hZoom || !m_vZoom)
1165                        if (!hZoom || !vZoom)
12521166                        {
12531167                           m_blitterSerialCount++;
12541168                           return;
12551169                        }
12561170
1257                        int blockwide = ((16*m_hZoom)/0x40);
1258                        int blockhigh = ((16*m_vZoom)/0x40);
1171                        int blockwide = ((16*hZoom)/0x40);
1172                        int blockhigh = ((16*vZoom)/0x40);
12591173   
12601174
12611175
1262                        UINT32 incx = 0x8000000 / m_hZoom;
1263                        UINT32 incy = 0x8000000 / m_vZoom;
1176                        UINT32 incx = 0x8000000 / hZoom;
1177                        UINT32 incy = 0x8000000 / vZoom;
12641178
12651179                        // DEBUG: Draw 16x16 block
12661180                        UINT32* line;
1267                        if (m_b4rotate)
1181                        if (blit_rotate)
12681182                        {
12691183                           if (used_flipy)
12701184                           {
r21313r21314
12831197                                       if ((drawx>=495 || drawx<0)) continue;
12841198                                       int realx = ((x*incx)>>21);
12851199
1286                                       UINT16 pix = m_tempshape[(15-realx)*16+(15-realy)];
1200                                       UINT16 pix = tempshape[(15-realx)*16+(15-realy)];
12871201                                       if (pix )
12881202                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
12891203                                    }
r21313r21314
12961210                                       if ((drawx>=495 || drawx<0)) continue;
12971211                                       int realx = ((x*incx)>>21);
12981212
1299                                       UINT16 pix = m_tempshape[(15-realx)*16+realy];
1213                                       UINT16 pix = tempshape[(15-realx)*16+realy];
13001214                                       if (pix )
13011215                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13021216                                    }
r21313r21314
13201234                                       if ((drawx>=495 || drawx<0)) continue;
13211235                                       int realx = ((x*incx)>>21);
13221236
1323                                       UINT16 pix = m_tempshape[realx*16+(15-realy)];
1237                                       UINT16 pix = tempshape[realx*16+(15-realy)];
13241238                                       if (pix )
13251239                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13261240                                    }
r21313r21314
13331247                                       if ((drawx>=495 || drawx<0)) continue;
13341248                                       int realx = ((x*incx)>>21);
13351249
1336                                       UINT16 pix = m_tempshape[realx*16+realy];
1250                                       UINT16 pix = tempshape[realx*16+realy];
13371251                                       if (pix )
13381252                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13391253                                    }
r21313r21314
13601274                                       if ((drawx>=495 || drawx<0)) continue;
13611275                                       int realx = ((x*incx)>>21);
13621276
1363                                       UINT16 pix = m_tempshape[(15-realy)*16+(15-realx)];
1277                                       UINT16 pix = tempshape[(15-realy)*16+(15-realx)];
13641278                                       if (pix )
13651279                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13661280                                    }
r21313r21314
13721286                                       const int drawx = pixelOffsetX+x;
13731287                                       if ((drawx>=495 || drawx<0)) continue;
13741288                                       int realx = ((x*incx)>>21);
1375                                       UINT16 pix = m_tempshape[(15-realy)*16+realx];
1289                                       UINT16 pix = tempshape[(15-realy)*16+realx];
13761290                                       if (pix )
13771291                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13781292                                    }
r21313r21314
13961310                                       if ((drawx>=495 || drawx<0)) continue;
13971311                                       int realx = ((x*incx)>>21);
13981312
1399                                       UINT16 pix = m_tempshape[realy*16+(15-realx)];
1313                                       UINT16 pix = tempshape[realy*16+(15-realx)];
14001314                                       if (pix )
14011315                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
14021316                                    }
r21313r21314
14121326                                       if ((drawx>=495 || drawx<0)) continue;
14131327                                       int realx = ((x*incx)>>21);
14141328
1415                                       UINT16 pix = m_tempshape[realy*16+realx];
1329                                       UINT16 pix = tempshape[realy*16+realx];
14161330                                       if (pix )
14171331                                          if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
14181332                                    }
r21313r21314
14201334                              }
14211335                           }
14221336                        }
1423#if 0 // this one does zooming
1424                        // DEBUG: Draw 16x16 block
1425                        UINT32* line;
1426                        for (int y = 0; y < blockhigh; y++)
1427                        {
1428                           const int drawy = pixelOffsetY+y;
1429                           if ((drawy>383) || (drawy<0)) continue;
1430                           line = &drawbitmap->pix32(drawy);
14311337
1432                           for (int x = 0; x < blockwide; x++)
1433                           {
1434                              const int drawx = pixelOffsetX+x;
1435                              if ((drawx>=495 || drawx<0)) continue;
14361338
1437                              if (line[drawx]==0) line[drawx] = color;
1438                           }
1439                        }
1440#endif
1441
14421339                     }
14431340                  }
14441341
r21313r21314
14461343
14471344               }
14481345            }
1449            else
1450            {
1451               printf("more than 11 dwords (%d) in blit?\n", m_blitterSerialCount);
1452            }
14531346
1454
1455            m_blitterSerialCount++;
14561347         }
14571348         // ??
14581349         else if (m_blitterMode == 0x10) // at startup

Previous 199869 Revisions Next


© 1997-2024 The MAME Team