(MESS) untangle gtia and antic some more. nw.

This commit is contained in:
Fabio Priuli 2014-09-06 14:26:51 +00:00
parent 09229cebb1
commit bd63b24a9d
4 changed files with 48 additions and 53 deletions

View File

@ -262,7 +262,6 @@ struct ANTIC {
ANTIC_W w; /* ANTIC write registers */
UINT8 cclock[256+32]; /* color clock buffer filled by ANTIC */
UINT8 pmbits[256+32]; /* player missile buffer filled by GTIA */
UINT16 color_lookup[256]; /* color lookup table */
UINT8 *prio_table[64]; /* player/missile priority tables */
VIDEO *video[312]; /* video buffer */
UINT32 *cclk_expand; /* shared buffer for the following: */

View File

@ -739,7 +739,7 @@ void atari_common_state::video_start()
/* reset the ANTIC color tables */
for( i = 0; i < 256; i ++ )
antic.color_lookup[i] = (m_palette->pen(0) << 8) + m_palette->pen(0);
gtia.color_lookup[i] = (m_palette->pen(0) << 8) + m_palette->pen(0);
LOG(("atari cclk_init\n"));
cclk_init();
@ -788,6 +788,7 @@ void atari_common_state::artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
UINT8 atari_B = ((b+0x70)&0xf0)+c;
UINT8 atari_C = b+c;
UINT8 atari_D = gtia.w.colbk;
UINT16 *color_lookup = gtia.color_lookup;
for( x = 0; x < width * 4; x++ )
{
@ -807,8 +808,8 @@ void atari_common_state::artifacts_gfx(UINT8 *src, UINT8 *dst, int width)
bits |= 3;
break;
default:
*dst++ = antic.color_lookup[n];
*dst++ = antic.color_lookup[n];
*dst++ = color_lookup[n];
*dst++ = color_lookup[n];
continue;
}
switch( (bits >> 1) & 7 )
@ -862,6 +863,7 @@ void atari_common_state::artifacts_txt(UINT8 * src, UINT8 * dst, int width)
UINT8 atari_B = ((b+0x70)&0xf0)+c;
UINT8 atari_C = b+c;
UINT8 atari_D = gtia.w.colpf2;
UINT16 *color_lookup = gtia.color_lookup;
for( x = 0; x < width * 4; x++ )
{
@ -881,8 +883,8 @@ void atari_common_state::artifacts_txt(UINT8 * src, UINT8 * dst, int width)
bits |= 3;
break;
default:
*dst++ = antic.color_lookup[n];
*dst++ = antic.color_lookup[n];
*dst++ = color_lookup[n];
*dst++ = color_lookup[n];
continue;
}
switch( (bits >> 1) & 7 )
@ -933,6 +935,7 @@ void atari_common_state::antic_linerefresh()
UINT8 *src;
UINT32 *dst;
UINT32 scanline[4 + (HCHARS * 2) + 4];
UINT16 *color_lookup = gtia.color_lookup;
/* increment the scanline */
if( ++antic.scanline == machine().first_screen()->height() )
@ -965,22 +968,22 @@ void atari_common_state::antic_linerefresh()
return;
}
}
dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[1] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst[1] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst[2] = color_lookup[PBK] | color_lookup[PBK] << 16;
if ( (antic.cmd & ANTIC_HSCR) == 0 || (antic.pfwidth == 48) || (antic.pfwidth == 32))
{
/* no hscroll */
dst[3] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
dst[3] = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
src += 2;
dst += 4;
for( x = 1; x < HCHARS-1; x++ )
{
*dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
*dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
*dst++ = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
*dst++ = color_lookup[src[BYTE_XOR_LE(2)]] | color_lookup[src[BYTE_XOR_LE(3)]] << 16;
src += 4;
}
dst[0] = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
dst[0] = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
}
else
{
@ -990,47 +993,47 @@ void atari_common_state::antic_linerefresh()
{
case 0:
{
dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst += 4;
for ( x = 1; x < HCHARS-1; x++ )
{
*dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
*dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
*dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
*dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
}
dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
}
break;
/* support for narrow playfield (32) with horizontal scrolling should be added here */
case 40:
{
dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst += 4;
for ( x = 1; x < HCHARS-2; x++ )
{
if ( x == 1 )
{
*dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
*dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
}
else
{
*dst++ = antic.color_lookup[src[BYTE_XOR_LE(0)]] | antic.color_lookup[src[BYTE_XOR_LE(1)]] << 16;
*dst++ = color_lookup[src[BYTE_XOR_LE(0)]] | color_lookup[src[BYTE_XOR_LE(1)]] << 16;
}
*dst++ = antic.color_lookup[src[BYTE_XOR_LE(2)]] | antic.color_lookup[src[BYTE_XOR_LE(3)]] << 16;
*dst++ = color_lookup[src[BYTE_XOR_LE(2)]] | color_lookup[src[BYTE_XOR_LE(3)]] << 16;
src += 4;
}
for ( ; x < HCHARS-1; x++ )
{
*dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
*dst++ = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
*dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
*dst++ = color_lookup[PBK] | color_lookup[PBK] << 16;
}
dst[0] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[0] = color_lookup[PBK] | color_lookup[PBK] << 16;
}
break;
}
}
dst[1] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[2] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[3] = antic.color_lookup[PBK] | antic.color_lookup[PBK] << 16;
dst[1] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst[2] = color_lookup[PBK] | color_lookup[PBK] << 16;
dst[3] = color_lookup[PBK] | color_lookup[PBK] << 16;
draw_scanline8(*antic.bitmap, 12, y, MIN(antic.bitmap->width() - 12, sizeof(scanline)), (const UINT8 *) scanline, NULL);
}
@ -1214,7 +1217,8 @@ TIMER_CALLBACK_MEMBER( atari_common_state::antic_scanline_render )
}
}
gtia_render(video);
if (antic.scanline >= VBL_END && antic.scanline < 256)
gtia_render((UINT8 *)antic.pmbits + PMOFFSET, (UINT8 *)antic.cclock + PMOFFSET - antic.hscrol_old, (UINT8 *)antic.prio_table[gtia.w.prior & 0x3f], (UINT8 *)&antic.pmbits);
antic.steal_cycles += CYCLES_REFRESH;
LOG((" run CPU for %d cycles\n", CYCLES_HSYNC - CYCLES_HSTART - antic.steal_cycles));

View File

@ -44,19 +44,19 @@ static void gtia_state_postload(running_machine &machine);
* set both color clocks equal for one color
**********************************************/
#define SETCOL_B(o,d) \
antic.color_lookup[o] = ((d) << 8) | (d)
gtia.color_lookup[o] = ((d) << 8) | (d)
/**********************************************
* set left color clock for one color
**********************************************/
#define SETCOL_L(o,d) \
*((UINT8*)&antic.color_lookup[o] + 0) = d
*((UINT8*)&gtia.color_lookup[o] + 0) = d
/**********************************************
* set right color clock for one color
**********************************************/
#define SETCOL_R(o,d) \
*((UINT8*)&antic.color_lookup[o] + 1) = d
*((UINT8*)&gtia.color_lookup[o] + 1) = d
@ -841,40 +841,30 @@ static inline void missile_render(UINT8 gfx, int size, UINT8 color, UINT8 *dst)
}
void gtia_render(VIDEO *video)
void gtia_render(UINT8 *src, UINT8 *dst, UINT8 *prio, UINT8 *pmbits)
{
int x;
UINT8 *prio = antic.prio_table[gtia.w.prior & 0x3f];
UINT8 *src, *dst;
if( antic.scanline < VBL_END || antic.scanline >= 256 )
return;
if (gtia.h.grafp0)
player_render(gtia.h.grafp0, gtia.w.sizep0 + 1, P0, &antic.pmbits[gtia.w.hposp0]);
player_render(gtia.h.grafp0, gtia.w.sizep0 + 1, P0, &pmbits[gtia.w.hposp0]);
if (gtia.h.grafp1)
player_render(gtia.h.grafp1, gtia.w.sizep1 + 1, P1, &antic.pmbits[gtia.w.hposp1]);
player_render(gtia.h.grafp1, gtia.w.sizep1 + 1, P1, &pmbits[gtia.w.hposp1]);
if (gtia.h.grafp2)
player_render(gtia.h.grafp2, gtia.w.sizep2 + 1, P2, &antic.pmbits[gtia.w.hposp2]);
player_render(gtia.h.grafp2, gtia.w.sizep2 + 1, P2, &pmbits[gtia.w.hposp2]);
if (gtia.h.grafp3)
player_render(gtia.h.grafp3, gtia.w.sizep3 + 1, P3, &antic.pmbits[gtia.w.hposp3]);
player_render(gtia.h.grafp3, gtia.w.sizep3 + 1, P3, &pmbits[gtia.w.hposp3]);
if (gtia.h.grafm0)
missile_render(gtia.h.grafm0, gtia.w.sizem + 1, M0, &antic.pmbits[gtia.w.hposm0]);
missile_render(gtia.h.grafm0, gtia.w.sizem + 1, M0, &pmbits[gtia.w.hposm0]);
if (gtia.h.grafm1)
missile_render(gtia.h.grafm1, gtia.w.sizem + 1, M1, &antic.pmbits[gtia.w.hposm1]);
missile_render(gtia.h.grafm1, gtia.w.sizem + 1, M1, &pmbits[gtia.w.hposm1]);
if (gtia.h.grafm2)
missile_render(gtia.h.grafm2, gtia.w.sizem + 1, M2, &antic.pmbits[gtia.w.hposm2]);
missile_render(gtia.h.grafm2, gtia.w.sizem + 1, M2, &pmbits[gtia.w.hposm2]);
if (gtia.h.grafm3)
missile_render(gtia.h.grafm3, gtia.w.sizem + 1, M3, &antic.pmbits[gtia.w.hposm3]);
missile_render(gtia.h.grafm3, gtia.w.sizem + 1, M3, &pmbits[gtia.w.hposm3]);
src = antic.pmbits + PMOFFSET;
dst = antic.cclock + PMOFFSET - antic.hscrol_old;
for( x = 0; x < HWIDTH*4; x++, src++, dst++ )
for (int x = 0; x < HWIDTH * 4; x++, src++, dst++)
{
UINT8 pm, pc, pf;
if( !*src )
if (!*src)
continue;
/* get the player/missile combination bits and reset the buffer */
pm = *src;

View File

@ -127,6 +127,8 @@ struct gtia_struct
gtia_readregs r; /* read registers */
gtia_writeregs w; /* write registers */
gtia_helpervars h; /* helper variables */
UINT16 color_lookup[256]; /* color lookup table */
};
@ -135,6 +137,6 @@ extern gtia_struct gtia;
void gtia_init(running_machine &machine, const gtia_interface *intf);
void gtia_render(VIDEO *video);
void gtia_render(UINT8 *src, UINT8 *dst, UINT8 *prio, UINT8 *pmbits);
#endif /* __GTIA_H__ */