Previous 199869 Revisions Next

r31952 Saturday 6th September, 2014 at 14:26:51 UTC by Fabio Priuli
(MESS) untangle gtia and antic some more. nw.
[src/mame/includes]atari.h
[src/mame/video]atari.c gtia.c gtia.h

trunk/src/mame/includes/atari.h
r31951r31952
262262   ANTIC_W w;                  /* ANTIC write registers */
263263   UINT8   cclock[256+32];     /* color clock buffer filled by ANTIC */
264264   UINT8   pmbits[256+32];     /* player missile buffer filled by GTIA */
265   UINT16  color_lookup[256];  /* color lookup table */
266265   UINT8   *prio_table[64];    /* player/missile priority tables */
267266   VIDEO   *video[312];        /* video buffer */
268267   UINT32  *cclk_expand;       /* shared buffer for the following: */
trunk/src/mame/video/atari.c
r31951r31952
739739
740740   /* reset the ANTIC color tables */
741741   for( i = 0; i < 256; i ++ )
742      antic.color_lookup[i] = (m_palette->pen(0) << 8) + m_palette->pen(0);
742      gtia.color_lookup[i] = (m_palette->pen(0) << 8) + m_palette->pen(0);
743743
744744   LOG(("atari cclk_init\n"));
745745   cclk_init();
r31951r31952
788788   UINT8 atari_B = ((b+0x70)&0xf0)+c;
789789   UINT8 atari_C = b+c;
790790   UINT8 atari_D = gtia.w.colbk;
791   UINT16 *color_lookup = gtia.color_lookup;
791792
792793   for( x = 0; x < width * 4; x++ )
793794   {
r31951r31952
807808         bits |= 3;
808809         break;
809810      default:
810         *dst++ = antic.color_lookup[n];
811         *dst++ = antic.color_lookup[n];
811         *dst++ = color_lookup[n];
812         *dst++ = color_lookup[n];
812813         continue;
813814      }
814815      switch( (bits >> 1) & 7 )
r31951r31952
862863   UINT8 atari_B = ((b+0x70)&0xf0)+c;
863864   UINT8 atari_C = b+c;
864865   UINT8 atari_D = gtia.w.colpf2;
866   UINT16 *color_lookup = gtia.color_lookup;
865867
866868   for( x = 0; x < width * 4; x++ )
867869   {
r31951r31952
881883         bits |= 3;
882884         break;
883885      default:
884         *dst++ = antic.color_lookup[n];
885         *dst++ = antic.color_lookup[n];
886         *dst++ = color_lookup[n];
887         *dst++ = color_lookup[n];
886888         continue;
887889      }
888890      switch( (bits >> 1) & 7 )
r31951r31952
933935   UINT8 *src;
934936   UINT32 *dst;
935937   UINT32 scanline[4 + (HCHARS * 2) + 4];
938   UINT16 *color_lookup = gtia.color_lookup;
936939
937940   /* increment the scanline */
938941   if( ++antic.scanline == machine().first_screen()->height() )
r31951r31952
965968         return;
966969      }
967970   }
968   dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
969   dst[1] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
970   dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
971   dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
972   dst[1] = color_lookup[PBK] | color_lookup[PBK] << 16;
973   dst[2] = color_lookup[PBK] | color_lookup[PBK] << 16;
971974   if ( (antic.cmd & ANTIC_HSCR) == 0  || (antic.pfwidth == 48) || (antic.pfwidth == 32))
972975   {
973976      /* no hscroll */
974      dst[3] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
977      dst[3] = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
975978      src += 2;
976979      dst += 4;
977980      for( x = 1; x < HCHARS-1; x++ )
978981      {
979         *dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
980         *dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
982         *dst++ = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
983         *dst++ = color_lookup[src[BYTE_XOR_LE(2)]] | color_lookup[src[BYTE_XOR_LE(3)]] << 16;
981984         src += 4;
982985      }
983      dst[0] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
986      dst[0] = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
984987   }
985988   else
986989   {
r31951r31952
990993      {
991994         case 0:
992995            {
993               dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
996               dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
994997               dst += 4;
995998               for ( x = 1; x < HCHARS-1; x++ )
996999               {
997                  *dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
998                  *dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1000                  *dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
1001                  *dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
9991002               }
1000               dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1003               dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
10011004            }
10021005            break;
10031006         /* support for narrow playfield (32) with horizontal scrolling should be added here */
10041007         case 40:
10051008            {
1006               dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1009               dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
10071010               dst += 4;
10081011               for ( x = 1; x < HCHARS-2; x++ )
10091012               {
10101013                  if ( x == 1 )
10111014                  {
1012                     *dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1015                     *dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
10131016                  }
10141017                  else
10151018                  {
1016                     *dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
1019                     *dst++ = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
10171020                  }
1018                  *dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
1021                  *dst++ = color_lookup[src[BYTE_XOR_LE(2)]] | color_lookup[src[BYTE_XOR_LE(3)]] << 16;
10191022                  src += 4;
10201023               }
10211024               for ( ; x < HCHARS-1; x++ )
10221025               {
1023                  *dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1024                  *dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1026                  *dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
1027                  *dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
10251028               }
1026               dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1029               dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
10271030            }
10281031            break;
10291032      }
10301033   }
1031   dst[1] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1032   dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1033   dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
1034   dst[1] = color_lookup[PBK] | color_lookup[PBK] << 16;
1035   dst[2] = color_lookup[PBK] | color_lookup[PBK] << 16;
1036   dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
10341037
10351038   draw_scanline8(*antic.bitmap, 12, y, MIN(antic.bitmap->width() - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL);
10361039}
r31951r31952
12141217      }
12151218   }
12161219
1217   gtia_render(video);
1220   if (antic.scanline >= VBL_END && antic.scanline < 256)
1221      gtia_render((UINT8 *)antic.pmbits + PMOFFSET, (UINT8 *)antic.cclock + PMOFFSET - antic.hscrol_old, (UINT8 *)antic.prio_table[gtia.w.prior & 0x3f], (UINT8 *)&antic.pmbits);
12181222
12191223   antic.steal_cycles += CYCLES_REFRESH;
12201224   LOG(("           run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles));
trunk/src/mame/video/gtia.c
r31951r31952
4444 * set both color clocks equal for one color
4545 **********************************************/
4646#define SETCOL_B(o,d) \
47   antic.color_lookup[o] = ((d) << 8) | (d)
47   gtia.color_lookup[o] = ((d) << 8) | (d)
4848
4949/**********************************************
5050 * set left color clock for one color
5151 **********************************************/
5252#define SETCOL_L(o,d) \
53   *((UINT8*)&antic.color_lookup[o] + 0) = d
53   *((UINT8*)&gtia.color_lookup[o] + 0) = d
5454
5555/**********************************************
5656 * set right color clock for one color
5757 **********************************************/
5858#define SETCOL_R(o,d) \
59   *((UINT8*)&antic.color_lookup[o] + 1) = d
59   *((UINT8*)&gtia.color_lookup[o] + 1) = d
6060
6161
6262
r31951r31952
841841}
842842
843843
844void gtia_render(VIDEO *video)
844void gtia_render(UINT8 *src, UINT8 *dst, UINT8 *prio, UINT8 *pmbits)
845845{
846   int x;
847   UINT8 *prio = antic.prio_table[gtia.w.prior & 0x3f];
848   UINT8 *src, *dst;
849
850   if( antic.scanline < VBL_END || antic.scanline >= 256 )
851      return;
852
853846   if (gtia.h.grafp0)
854      player_render(gtia.h.grafp0, gtia.w.sizep0 + 1, P0, &antic.pmbits[gtia.w.hposp0]);
847      player_render(gtia.h.grafp0, gtia.w.sizep0 + 1, P0, &pmbits[gtia.w.hposp0]);
855848   if (gtia.h.grafp1)
856      player_render(gtia.h.grafp1, gtia.w.sizep1 + 1, P1, &antic.pmbits[gtia.w.hposp1]);
849      player_render(gtia.h.grafp1, gtia.w.sizep1 + 1, P1, &pmbits[gtia.w.hposp1]);
857850   if (gtia.h.grafp2)
858      player_render(gtia.h.grafp2, gtia.w.sizep2 + 1, P2, &antic.pmbits[gtia.w.hposp2]);
851      player_render(gtia.h.grafp2, gtia.w.sizep2 + 1, P2, &pmbits[gtia.w.hposp2]);
859852   if (gtia.h.grafp3)
860      player_render(gtia.h.grafp3, gtia.w.sizep3 + 1, P3, &antic.pmbits[gtia.w.hposp3]);
853      player_render(gtia.h.grafp3, gtia.w.sizep3 + 1, P3, &pmbits[gtia.w.hposp3]);
861854   
862855   if (gtia.h.grafm0)
863      missile_render(gtia.h.grafm0, gtia.w.sizem + 1, M0, &antic.pmbits[gtia.w.hposm0]);
856      missile_render(gtia.h.grafm0, gtia.w.sizem + 1, M0, &pmbits[gtia.w.hposm0]);
864857   if (gtia.h.grafm1)
865      missile_render(gtia.h.grafm1, gtia.w.sizem + 1, M1, &antic.pmbits[gtia.w.hposm1]);
858      missile_render(gtia.h.grafm1, gtia.w.sizem + 1, M1, &pmbits[gtia.w.hposm1]);
866859   if (gtia.h.grafm2)
867      missile_render(gtia.h.grafm2, gtia.w.sizem + 1, M2, &antic.pmbits[gtia.w.hposm2]);
860      missile_render(gtia.h.grafm2, gtia.w.sizem + 1, M2, &pmbits[gtia.w.hposm2]);
868861   if (gtia.h.grafm3)
869      missile_render(gtia.h.grafm3, gtia.w.sizem + 1, M3, &antic.pmbits[gtia.w.hposm3]);
862      missile_render(gtia.h.grafm3, gtia.w.sizem + 1, M3, &pmbits[gtia.w.hposm3]);
870863
871   src = antic.pmbits + PMOFFSET;
872   dst = antic.cclock + PMOFFSET - antic.hscrol_old;
873
874   for( x = 0; x < HWIDTH*4; x++, src++, dst++ )
864   for (int x = 0; x < HWIDTH * 4; x++, src++, dst++)
875865   {
876866      UINT8 pm, pc, pf;
877      if( !*src )
867      if (!*src)
878868         continue;
879869      /* get the player/missile combination bits and reset the buffer */
880870      pm = *src;
trunk/src/mame/video/gtia.h
r31951r31952
127127   gtia_readregs   r;          /* read registers */
128128   gtia_writeregs  w;          /* write registers */
129129   gtia_helpervars h;          /* helper variables */
130
131   UINT16  color_lookup[256];  /* color lookup table */
130132};
131133
132134
r31951r31952
135137
136138void gtia_init(running_machine &machine, const gtia_interface *intf);
137139
138void gtia_render(VIDEO *video);
140void gtia_render(UINT8 *src, UINT8 *dst, UINT8 *prio, UINT8 *pmbits);
139141
140142#endif /* __GTIA_H__ */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team