another small step: moved antic start procedure to antic.c. nw.

This commit is contained in:
Fabio Priuli 2014-09-07 13:29:39 +00:00
parent 76aa7e4c3f
commit 5c8f513e14
3 changed files with 735 additions and 723 deletions

View File

@ -560,6 +560,7 @@ struct ANTIC {
extern ANTIC antic;
void antic_start(running_machine &machine);
void antic_vstart(running_machine &machine);
void antic_reset(void);
void antic_render(address_space &space, VIDEO *video, int param1, int param2, int param3);

View File

@ -75,6 +75,691 @@ ANTIC_RENDERER( gtia_mode_3_40 );
ANTIC_RENDERER( gtia_mode_3_48 );
/*************************************************************************
* The priority tables tell which playfield, player or missile colors
* have precedence about the others, depending on the contents of the
* "prior" register. There are 64 possible priority selections.
* The table is here to make it easier to build the 'illegal' priority
* combinations that produce black or 'ILL' color.
*************************************************************************/
/*************************************************************************
* calculate player/missile priorities (GTIA prior at $D00D)
* prior color priorities in descending order
* ------------------------------------------------------------------
* bit 0 PL0 PL1 PL2 PL3 PF0 PF1 PF2 PF3/P4 BK
* all players in front of all playfield colors
* bit 1 PL0 PL1 PF0 PF1 PF2 PF3/P4 PL2 PL3 BK
* pl 0+1 in front of pf 0-3 in front of pl 2+3
* bit 2 PF0 PF1 PF2 PF3/P4 PL0 PL1 PL2 PL3 BK
* all playfield colors in front of all players
* bit 3 PF0 PF1 PL0 PL1 PL2 PL3 PF2 PF3/P4 BK
* pf 0+1 in front of all players in front of pf 2+3
* bit 4 missiles colors are PF3 (P4)
* missiles have the same priority as pf3
* bit 5 PL0+PL1 and PL2+PL3 bits xored
* 00: playfield, 01: PL0/2, 10: PL1/3 11: black (EOR)
* bit 7+6 CTIA mod (00) or GTIA mode 1 to 3 (01, 10, 11)
*************************************************************************/
/* player/missile #4 color is equal to playfield #3 */
#define PM4 PF3
/* bit masks for players and missiles */
#define P0 0x01
#define P1 0x02
#define P2 0x04
#define P3 0x08
#define M0 0x10
#define M1 0x20
#define M2 0x40
#define M3 0x80
/************************************************************************
* Contents of the following table:
*
* PL0 -PL3 are the player/missile colors 0 to 3
* P000-P011 are the 4 available color clocks for playfield color 0
* P100-P111 are the 4 available color clocks for playfield color 1
* P200-P211 are the 4 available color clocks for playfield color 2
* P300-P311 are the 4 available color clocks for playfield color 3
* ILL is some undefined color. On my 800XL it looked light yellow ;)
*
* Each line holds the 8 bitmasks and resulting colors for player and
* missile number 0 to 3 in their fixed priority order.
* The 8 lines per block are for the 8 available playfield colors.
* Yes, 8 colors because the text modes 2,3 and graphics mode F can
* be combined with players. The result is the players color with
* luminance of the modes foreground (ie. colpf1).
* Any combination of players/missiles (256) is checked for the highest
* priority player or missile and the resulting color is stored into
* antic.prio_table. The second part (20-3F) contains the resulting
* color values for the EOR mode, which is derived from the *visible*
* player/missile colors calculated for the first part (00-1F).
* The priorities of combining priority bits (which games use!) are:
************************************************************************/
static const UINT8 _pm_colors[32][8*2*8] = {
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 00
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 01
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 02
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 03
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 04
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 05
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 06
M0, 0,P0, ILL,M1, 0,P1, ILL,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 07
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 08
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 09
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0A
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0B
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0C
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0D
M0, 0,P0, 0,M1, 0,P1, 0,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0E
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0F
M0, 0,P0, 0,M1, 0,P1, 0,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 10
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 11
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3, // 12
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, 0,P3, 0,
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,M0,P400,M1,P400,M2,P400,M3,P400,P2,P200,P3,P300,
P0,P001,P1,P101,M0,P401,M1,P401,M2,P401,M3,P401,P2,P201,P3,P301,
P0,P010,P1,P110,M0,P410,M1,P410,M2,P410,M3,P410,P2,P210,P3,P310,
P0,P011,P1,P111,M0,P411,M1,P411,M2,P411,M3,P411,P2,P211,P3,P311
},
{
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3, // 13
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3,
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,M0,P400,M1,P400,M2,P400,M3,P400,P2,P200,P3,P300,
P0,P001,P1,P101,M0,P401,M1,P401,M2,P401,M3,P401,P2,P201,P3,P301,
P0,P010,P1,P110,M0,P410,M1,P410,M2,P410,M3,P410,P2,P210,P3,P310,
P0,P011,P1,P111,M0,P411,M1,P411,M2,P411,M3,P411,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, PL0,P1, PL1,P2, PL2,P3, PL3, // 14
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P400,M1,P400,M2,P400,M3,P400,P0,P000,P1,P100,P2,P200,P3,P300,
M0,P401,M1,P401,M2,P401,M3,P401,P0,P001,P1,P101,P2,P201,P3,P301,
M0,P410,M1,P410,M2,P410,M3,P410,P0,P010,P1,P110,P2,P210,P3,P310,
M0,P411,M1,P411,M2,P411,M3,P411,P0,P011,P1,P111,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, PL0,P1, PL1, PL2,P3, PL3, // 15
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, ILL,P1, ILL, PL2,P3, PL3,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, 0,P1, 0, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P2,P0,P000,P1,P100,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P2,P0,P001,P1,P101,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P2,P0,P010,P1,P110,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P2,P0,P011,P1,P111,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, PL0,P1, PL1,P2, PL2,P3, PL3, // 16
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, ILL,P1, ILL,P2, 0,P3, 0,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P0,P000,P1,P100,P2,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P0,P001,P1,P101,P2,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P0,P010,P1,P110,P2,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P0,P011,P1,P111,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, PL0,P1, PL1, PL2,P3, PL3, // 17
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, ILL,P1, ILL, PL2,P3, PL3,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, 0,P1, 0, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P2,P0,P000,P1,P100,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P2,P0,P001,P1,P101,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P2,P0,P010,P1,P110,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P2,P0,P011,P1,P111,P211,P3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 18
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 19
P0, ILL,P1, ILL,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P000,M1,P100,M2,P200,M3,P300,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P001,M1,P101,M2,P201,M3,P301,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P010,M1,P110,M2,P210,M3,P310,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P011,M1,P111,M2,P211,M3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1A
P0, ILL,P1, ILL,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1B
P0, ILL,P1, ILL,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1C
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1D
P0, 0,P1, 0,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1E
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1F
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
}
};
/************************************************************************
* prio_init
* Initialize player/missile priority lookup tables
************************************************************************/
void prio_init()
{
int i, j, pm, p, c;
const UINT8 * prio;
/* 32 priority bit combinations */
for( i = 0; i < 32; i++ )
{
/* 8 playfield colors */
for( j = 0; j < 8; j++ )
{
prio = &_pm_colors[i][j*16];
/* 256 player/missile combinations to build */
for( pm = 0; pm < 256; pm++ )
{
c = PFD; /* assume playfield color */
for( p = 0; (c == PFD) && (p < 16); p += 2 )
{
if (((prio[p] & pm) == prio[p]) && (prio[p+1]))
c = prio[p+1];
}
antic.prio_table[i][(j << 8) + pm] = c;
if( (c==PL0 || c==P000 || c==P001 || c==P010 || c==P011) &&
(pm & (P0+P1))==(P0+P1))
c = EOR;
if( (c==PL2 || c==P200 || c==P201 || c==P210 || c==P211) &&
(pm & (P2+P3))==(P2+P3))
c = EOR;
antic.prio_table[32 + i][(j << 8) + pm] = c;
}
}
}
}
/************************************************************************
* cclk_init
* Initialize "color clock" lookup tables
************************************************************************/
static void cclk_init()
{
static const UINT8 _pf_21[4] = {T00,T01,T10,T11};
static const UINT8 _pf_1b[4] = {G00,G01,G10,G11};
static const UINT8 _pf_210b[4] = {PBK,PF0,PF1,PF2};
static const UINT8 _pf_310b[4] = {PBK,PF0,PF1,PF3};
int i;
UINT8 * dst;
/* setup color translation for the ANTIC modes */
for( i = 0; i < 256; i++ )
{
/****** text mode (2,3) **********/
dst = (UINT8 *)&antic.pf_21[0x000+i];
*dst++ = _pf_21[(i>>6)&3];
*dst++ = _pf_21[(i>>4)&3];
*dst++ = _pf_21[(i>>2)&3];
*dst++ = _pf_21[(i>>0)&3];
/****** 4 color text (4,5) with pf2, D, E **********/
dst = (UINT8 *)&antic.pf_x10b[0x000+i];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
dst = (UINT8 *)&antic.pf_x10b[0x100+i];
*dst++ = _pf_310b[(i>>6)&3];
*dst++ = _pf_310b[(i>>4)&3];
*dst++ = _pf_310b[(i>>2)&3];
*dst++ = _pf_310b[(i>>0)&3];
/****** pf0 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x000+i*2];
*dst++ = (i&0x80)?PF0:PBK;
*dst++ = (i&0x40)?PF0:PBK;
*dst++ = (i&0x20)?PF0:PBK;
*dst++ = (i&0x10)?PF0:PBK;
*dst++ = (i&0x08)?PF0:PBK;
*dst++ = (i&0x04)?PF0:PBK;
*dst++ = (i&0x02)?PF0:PBK;
*dst++ = (i&0x01)?PF0:PBK;
/****** pf1 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x200+i*2];
*dst++ = (i&0x80)?PF1:PBK;
*dst++ = (i&0x40)?PF1:PBK;
*dst++ = (i&0x20)?PF1:PBK;
*dst++ = (i&0x10)?PF1:PBK;
*dst++ = (i&0x08)?PF1:PBK;
*dst++ = (i&0x04)?PF1:PBK;
*dst++ = (i&0x02)?PF1:PBK;
*dst++ = (i&0x01)?PF1:PBK;
/****** pf2 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x400+i*2];
*dst++ = (i&0x80)?PF2:PBK;
*dst++ = (i&0x40)?PF2:PBK;
*dst++ = (i&0x20)?PF2:PBK;
*dst++ = (i&0x10)?PF2:PBK;
*dst++ = (i&0x08)?PF2:PBK;
*dst++ = (i&0x04)?PF2:PBK;
*dst++ = (i&0x02)?PF2:PBK;
*dst++ = (i&0x01)?PF2:PBK;
/****** pf3 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x600+i*2];
*dst++ = (i&0x80)?PF3:PBK;
*dst++ = (i&0x40)?PF3:PBK;
*dst++ = (i&0x20)?PF3:PBK;
*dst++ = (i&0x10)?PF3:PBK;
*dst++ = (i&0x08)?PF3:PBK;
*dst++ = (i&0x04)?PF3:PBK;
*dst++ = (i&0x02)?PF3:PBK;
*dst++ = (i&0x01)?PF3:PBK;
/****** 4 color graphics 4 cclks (8) **********/
dst = (UINT8 *)&antic.pf_210b4[i*4];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
/****** 4 color graphics 2 cclks (A) **********/
dst = (UINT8 *)&antic.pf_210b2[i*2];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
/****** high resolution graphics (F) **********/
dst = (UINT8 *)&antic.pf_1b[i];
*dst++ = _pf_1b[(i>>6)&3];
*dst++ = _pf_1b[(i>>4)&3];
*dst++ = _pf_1b[(i>>2)&3];
*dst++ = _pf_1b[(i>>0)&3];
/****** gtia mode 1 **********/
dst = (UINT8 *)&antic.pf_gtia1[i];
*dst++ = GT1+((i>>4)&15);
*dst++ = GT1+((i>>4)&15);
*dst++ = GT1+(i&15);
*dst++ = GT1+(i&15);
/****** gtia mode 2 **********/
dst = (UINT8 *)&antic.pf_gtia2[i];
*dst++ = GT2+((i>>4)&15);
*dst++ = GT2+((i>>4)&15);
*dst++ = GT2+(i&15);
*dst++ = GT2+(i&15);
/****** gtia mode 3 **********/
dst = (UINT8 *)&antic.pf_gtia3[i];
*dst++ = GT3+((i>>4)&15);
*dst++ = GT3+((i>>4)&15);
*dst++ = GT3+(i&15);
*dst++ = GT3+(i&15);
}
/* setup used color tables */
for( i = 0; i < 256; i++ )
{
/* used colors in text modes 2,3 */
antic.uc_21[i] = (i) ? PF2 | PF1 : PF2;
/* used colors in text modes 4,5 and graphics modes D,E */
switch( i & 0x03 )
{
case 0x01: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x02: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x03: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x08: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x0c: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x20: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x30: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x80: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0xc0: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
/* used colors in text modes 6,7 and graphics modes 9,B,C */
if( i )
{
antic.uc_3210b2[0x000+i*2] |= PF0;
antic.uc_3210b2[0x200+i*2] |= PF1;
antic.uc_3210b2[0x400+i*2] |= PF2;
antic.uc_3210b2[0x600+i*2] |= PF3;
}
/* used colors in graphics mode 8 */
switch( i & 0x03 )
{
case 0x01: antic.uc_210b4[i*4] |= PF0; break;
case 0x02: antic.uc_210b4[i*4] |= PF1; break;
case 0x03: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_210b4[i*4] |= PF0; break;
case 0x08: antic.uc_210b4[i*4] |= PF1; break;
case 0x0c: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_210b4[i*4] |= PF0; break;
case 0x20: antic.uc_210b4[i*4] |= PF1; break;
case 0x30: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_210b4[i*4] |= PF0; break;
case 0x80: antic.uc_210b4[i*4] |= PF1; break;
case 0xc0: antic.uc_210b4[i*4] |= PF2; break;
}
/* used colors in graphics mode A */
switch( i & 0x03 )
{
case 0x01: antic.uc_210b2[i*2] |= PF0; break;
case 0x02: antic.uc_210b2[i*2] |= PF1; break;
case 0x03: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_210b2[i*2] |= PF0; break;
case 0x08: antic.uc_210b2[i*2] |= PF1; break;
case 0x0c: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_210b2[i*2] |= PF0; break;
case 0x20: antic.uc_210b2[i*2] |= PF1; break;
case 0x30: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_210b2[i*2] |= PF0; break;
case 0x80: antic.uc_210b2[i*2] |= PF1; break;
case 0xc0: antic.uc_210b2[i*2] |= PF2; break;
}
/* used colors in graphics mode F */
if( i )
antic.uc_1b[i] |= PF1;
/* used colors in GTIA graphics modes */
/* GTIA 1 is 16 different luminances with hue of colbk */
antic.uc_g1[i] = 0x00;
/* GTIA 2 is all 9 colors (8..15 is colbk) */
switch( i & 0x0f )
{
case 0x00: antic.uc_g2[i] = 0x10; break;
case 0x01: antic.uc_g2[i] = 0x20; break;
case 0x02: antic.uc_g2[i] = 0x40; break;
case 0x03: antic.uc_g2[i] = 0x80; break;
case 0x04: antic.uc_g2[i] = 0x01; break;
case 0x05: antic.uc_g2[i] = 0x02; break;
case 0x06: antic.uc_g2[i] = 0x04; break;
case 0x07: antic.uc_g2[i] = 0x08; break;
default: antic.uc_g2[i] = 0x00;
}
/* GTIA 3 is 16 different hues with luminance of colbk */
antic.uc_g3[i] = 0x00;
}
}
ANTIC antic;
void antic_start(running_machine &machine)
@ -84,6 +769,52 @@ void antic_start(running_machine &machine)
machine.save().save_pointer(NAME((UINT8 *) &antic.w), sizeof(antic.w));
}
void antic_vstart(running_machine &machine)
{
LOG(("atari antic_vh_start\n"));
memset(&antic, 0, sizeof(antic));
antic.bitmap = auto_bitmap_ind16_alloc(machine, machine.first_screen()->width(), machine.first_screen()->height());
antic.cclk_expand = auto_alloc_array(machine, UINT32, 21 * 256);
antic.pf_21 = &antic.cclk_expand[ 0 * 256];
antic.pf_x10b = &antic.cclk_expand[ 1 * 256];
antic.pf_3210b2 = &antic.cclk_expand[ 3 * 256];
antic.pf_210b4 = &antic.cclk_expand[11 * 256];
antic.pf_210b2 = &antic.cclk_expand[15 * 256];
antic.pf_1b = &antic.cclk_expand[17 * 256];
antic.pf_gtia1 = &antic.cclk_expand[18 * 256];
antic.pf_gtia2 = &antic.cclk_expand[19 * 256];
antic.pf_gtia3 = &antic.cclk_expand[20 * 256];
antic.used_colors = auto_alloc_array(machine, UINT8, 21 * 256);
memset(antic.used_colors, 0, 21 * 256 * sizeof(UINT8));
antic.uc_21 = &antic.used_colors[ 0 * 256];
antic.uc_x10b = &antic.used_colors[ 1 * 256];
antic.uc_3210b2 = &antic.used_colors[ 3 * 256];
antic.uc_210b4 = &antic.used_colors[11 * 256];
antic.uc_210b2 = &antic.used_colors[15 * 256];
antic.uc_1b = &antic.used_colors[17 * 256];
antic.uc_g1 = &antic.used_colors[18 * 256];
antic.uc_g2 = &antic.used_colors[19 * 256];
antic.uc_g3 = &antic.used_colors[20 * 256];
LOG(("atari cclk_init\n"));
cclk_init();
for (int i = 0; i < 64; i++)
antic.prio_table[i] = auto_alloc_array(machine, UINT8, 8*256);
LOG(("atari prio_init\n"));
prio_init();
for (int i = 0; i < machine.first_screen()->height(); i++)
antic.video[i] = auto_alloc_clear(machine, VIDEO);
}
/**************************************************************
*
* Reset ANTIC

View File

@ -14,744 +14,24 @@
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
/*************************************************************************
* The priority tables tell which playfield, player or missile colors
* have precedence about the others, depending on the contents of the
* "prior" register. There are 64 possible priority selections.
* The table is here to make it easier to build the 'illegal' priority
* combinations that produce black or 'ILL' color.
*************************************************************************/
/*************************************************************************
* calculate player/missile priorities (GTIA prior at $D00D)
* prior color priorities in descending order
* ------------------------------------------------------------------
* bit 0 PL0 PL1 PL2 PL3 PF0 PF1 PF2 PF3/P4 BK
* all players in front of all playfield colors
* bit 1 PL0 PL1 PF0 PF1 PF2 PF3/P4 PL2 PL3 BK
* pl 0+1 in front of pf 0-3 in front of pl 2+3
* bit 2 PF0 PF1 PF2 PF3/P4 PL0 PL1 PL2 PL3 BK
* all playfield colors in front of all players
* bit 3 PF0 PF1 PL0 PL1 PL2 PL3 PF2 PF3/P4 BK
* pf 0+1 in front of all players in front of pf 2+3
* bit 4 missiles colors are PF3 (P4)
* missiles have the same priority as pf3
* bit 5 PL0+PL1 and PL2+PL3 bits xored
* 00: playfield, 01: PL0/2, 10: PL1/3 11: black (EOR)
* bit 7+6 CTIA mod (00) or GTIA mode 1 to 3 (01, 10, 11)
*************************************************************************/
/* player/missile #4 color is equal to playfield #3 */
#define PM4 PF3
/* bit masks for players and missiles */
#define P0 0x01
#define P1 0x02
#define P2 0x04
#define P3 0x08
#define M0 0x10
#define M1 0x20
#define M2 0x40
#define M3 0x80
/************************************************************************
* Contents of the following table:
*
* PL0 -PL3 are the player/missile colors 0 to 3
* P000-P011 are the 4 available color clocks for playfield color 0
* P100-P111 are the 4 available color clocks for playfield color 1
* P200-P211 are the 4 available color clocks for playfield color 2
* P300-P311 are the 4 available color clocks for playfield color 3
* ILL is some undefined color. On my 800XL it looked light yellow ;)
*
* Each line holds the 8 bitmasks and resulting colors for player and
* missile number 0 to 3 in their fixed priority order.
* The 8 lines per block are for the 8 available playfield colors.
* Yes, 8 colors because the text modes 2,3 and graphics mode F can
* be combined with players. The result is the players color with
* luminance of the modes foreground (ie. colpf1).
* Any combination of players/missiles (256) is checked for the highest
* priority player or missile and the resulting color is stored into
* antic.prio_table. The second part (20-3F) contains the resulting
* color values for the EOR mode, which is derived from the *visible*
* player/missile colors calculated for the first part (00-1F).
* The priorities of combining priority bits (which games use!) are:
************************************************************************/
static const UINT8 _pm_colors[32][8*2*8] = {
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 00
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 01
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 02
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 03
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 04
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 05
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 06
M0, 0,P0, ILL,M1, 0,P1, ILL,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 07
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 08
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 09
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0A
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, 0,P2, 0,M3, 0,P3, 0,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0B
M0, ILL,P0, ILL,M1, ILL,P1, ILL,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0C
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0D
M0, 0,P0, 0,M1, 0,P1, 0,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0E
M0, 0,P0, 0,M1, 0,P1, 0,M2, 0,P2, 0,M3, 0,P3, 0,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
M0, PL0,P0, PL0,M1, PL1,P1, PL1,M2, PL2,P2, PL2,M3, PL3,P3, PL3, // 0F
M0, 0,P0, 0,M1, 0,P1, 0,M2, PL2,P2, PL2,M3, PL3,P3, PL3,
M0, 0,P0, 0,M1, 0,P1, 0,M2, ILL,P2, ILL,M3, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,P0,P000,M1,P100,P1,P100,M2,P200,P2,P200,M3,P300,P3,P300,
M0,P001,P0,P001,M1,P101,P1,P101,M2,P201,P2,P201,M3,P301,P3,P301,
M0,P010,P0,P010,M1,P110,P1,P110,M2,P210,P2,P210,M3,P310,P3,P310,
M0,P011,P0,P011,M1,P111,P1,P111,M2,P211,P2,P211,M3,P311,P3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 10
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 11
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3, // 12
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, 0,P3, 0,
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,M0,P400,M1,P400,M2,P400,M3,P400,P2,P200,P3,P300,
P0,P001,P1,P101,M0,P401,M1,P401,M2,P401,M3,P401,P2,P201,P3,P301,
P0,P010,P1,P110,M0,P410,M1,P410,M2,P410,M3,P410,P2,P210,P3,P310,
P0,P011,P1,P111,M0,P411,M1,P411,M2,P411,M3,P411,P2,P211,P3,P311
},
{
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3, // 13
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, PL2,P3, PL3,
P0, PL0,P1, PL1,M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,M0,P400,M1,P400,M2,P400,M3,P400,P2,P200,P3,P300,
P0,P001,P1,P101,M0,P401,M1,P401,M2,P401,M3,P401,P2,P201,P3,P301,
P0,P010,P1,P110,M0,P410,M1,P410,M2,P410,M3,P410,P2,P210,P3,P310,
P0,P011,P1,P111,M0,P411,M1,P411,M2,P411,M3,P411,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, PL0,P1, PL1,P2, PL2,P3, PL3, // 14
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P400,M1,P400,M2,P400,M3,P400,P0,P000,P1,P100,P2,P200,P3,P300,
M0,P401,M1,P401,M2,P401,M3,P401,P0,P001,P1,P101,P2,P201,P3,P301,
M0,P410,M1,P410,M2,P410,M3,P410,P0,P010,P1,P110,P2,P210,P3,P310,
M0,P411,M1,P411,M2,P411,M3,P411,P0,P011,P1,P111,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, PL0,P1, PL1, PL2,P3, PL3, // 15
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, ILL,P1, ILL, PL2,P3, PL3,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, 0,P1, 0, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P2,P0,P000,P1,P100,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P2,P0,P001,P1,P101,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P2,P0,P010,P1,P110,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P2,P0,P011,P1,P111,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, PL0,P1, PL1,P2, PL2,P3, PL3, // 16
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, ILL,P1, ILL,P2, 0,P3, 0,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P0, 0,P1, 0,P2, 0,P3, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P0,P000,P1,P100,P2,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P0,P001,P1,P101,P2,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P0,P010,P1,P110,P2,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P0,P011,P1,P111,P2,P211,P3,P311
},
{
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, PL0,P1, PL1, PL2,P3, PL3, // 17
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, ILL,P1, ILL, PL2,P3, PL3,
M0, PM4,M1, PM4,M2, PM4,M3, PM4,P2,P0, 0,P1, 0, ILL,P3, ILL,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
M0,P000,M1,P100,M2,P200,M3,P300,P2,P0,P000,P1,P100,P200,P3,P300,
M0,P001,M1,P101,M2,P201,M3,P301,P2,P0,P001,P1,P101,P201,P3,P301,
M0,P010,M1,P110,M2,P210,M3,P310,P2,P0,P010,P1,P110,P210,P3,P310,
M0,P011,M1,P111,M2,P211,M3,P311,P2,P0,P011,P1,P111,P211,P3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 18
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 19
P0, ILL,P1, ILL,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P000,M1,P100,M2,P200,M3,P300,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P001,M1,P101,M2,P201,M3,P301,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P010,M1,P110,M2,P210,M3,P310,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P011,M1,P111,M2,P211,M3,P311
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1A
P0, ILL,P1, ILL,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1B
P0, ILL,P1, ILL,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, PL0,P1, PL1,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1C
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1D
P0, 0,P1, 0,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1E
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
},
{
P0, PL0,P1, PL1,P2, PL2,P3, PL3,M0, PM4,M1, PM4,M2, PM4,M3, PM4, // 1F
P0, 0,P1, 0,P2, 0,P3, 0,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
P0, 0,P1, 0,P2, ILL,P3, ILL,M0, PM4,M1, PM4,M2, PM4,M3, PM4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
P0,P000,P1,P100,P2,P200,P3,P300,M0,P400,M1,P400,M2,P400,M3,P400,
P0,P001,P1,P101,P2,P201,P3,P301,M0,P401,M1,P401,M2,P401,M3,P401,
P0,P010,P1,P110,P2,P210,P3,P310,M0,P410,M1,P410,M2,P410,M3,P410,
P0,P011,P1,P111,P2,P211,P3,P311,M0,P411,M1,P411,M2,P411,M3,P411
}
};
/************************************************************************
* prio_init
* Initialize player/missile priority lookup tables
************************************************************************/
void atari_common_state::prio_init()
{
int i, j, pm, p, c;
const UINT8 * prio;
/* 32 priority bit combinations */
for( i = 0; i < 32; i++ )
{
/* 8 playfield colors */
for( j = 0; j < 8; j++ )
{
prio = &_pm_colors[i][j*16];
/* 256 player/missile combinations to build */
for( pm = 0; pm < 256; pm++ )
{
c = PFD; /* assume playfield color */
for( p = 0; (c == PFD) && (p < 16); p += 2 )
{
if (((prio[p] & pm) == prio[p]) && (prio[p+1]))
c = prio[p+1];
}
antic.prio_table[i][(j << 8) + pm] = c;
if( (c==PL0 || c==P000 || c==P001 || c==P010 || c==P011) &&
(pm & (P0+P1))==(P0+P1))
c = EOR;
if( (c==PL2 || c==P200 || c==P201 || c==P210 || c==P211) &&
(pm & (P2+P3))==(P2+P3))
c = EOR;
antic.prio_table[32 + i][(j << 8) + pm] = c;
}
}
}
}
/************************************************************************
* cclk_init
* Initialize "color clock" lookup tables
************************************************************************/
void atari_common_state::cclk_init()
{
static const UINT8 _pf_21[4] = {T00,T01,T10,T11};
static const UINT8 _pf_1b[4] = {G00,G01,G10,G11};
static const UINT8 _pf_210b[4] = {PBK,PF0,PF1,PF2};
static const UINT8 _pf_310b[4] = {PBK,PF0,PF1,PF3};
int i;
UINT8 * dst;
/* setup color translation for the ANTIC modes */
for( i = 0; i < 256; i++ )
{
/****** text mode (2,3) **********/
dst = (UINT8 *)&antic.pf_21[0x000+i];
*dst++ = _pf_21[(i>>6)&3];
*dst++ = _pf_21[(i>>4)&3];
*dst++ = _pf_21[(i>>2)&3];
*dst++ = _pf_21[(i>>0)&3];
/****** 4 color text (4,5) with pf2, D, E **********/
dst = (UINT8 *)&antic.pf_x10b[0x000+i];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
dst = (UINT8 *)&antic.pf_x10b[0x100+i];
*dst++ = _pf_310b[(i>>6)&3];
*dst++ = _pf_310b[(i>>4)&3];
*dst++ = _pf_310b[(i>>2)&3];
*dst++ = _pf_310b[(i>>0)&3];
/****** pf0 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x000+i*2];
*dst++ = (i&0x80)?PF0:PBK;
*dst++ = (i&0x40)?PF0:PBK;
*dst++ = (i&0x20)?PF0:PBK;
*dst++ = (i&0x10)?PF0:PBK;
*dst++ = (i&0x08)?PF0:PBK;
*dst++ = (i&0x04)?PF0:PBK;
*dst++ = (i&0x02)?PF0:PBK;
*dst++ = (i&0x01)?PF0:PBK;
/****** pf1 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x200+i*2];
*dst++ = (i&0x80)?PF1:PBK;
*dst++ = (i&0x40)?PF1:PBK;
*dst++ = (i&0x20)?PF1:PBK;
*dst++ = (i&0x10)?PF1:PBK;
*dst++ = (i&0x08)?PF1:PBK;
*dst++ = (i&0x04)?PF1:PBK;
*dst++ = (i&0x02)?PF1:PBK;
*dst++ = (i&0x01)?PF1:PBK;
/****** pf2 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x400+i*2];
*dst++ = (i&0x80)?PF2:PBK;
*dst++ = (i&0x40)?PF2:PBK;
*dst++ = (i&0x20)?PF2:PBK;
*dst++ = (i&0x10)?PF2:PBK;
*dst++ = (i&0x08)?PF2:PBK;
*dst++ = (i&0x04)?PF2:PBK;
*dst++ = (i&0x02)?PF2:PBK;
*dst++ = (i&0x01)?PF2:PBK;
/****** pf3 color text (6,7), 9, B, C **********/
dst = (UINT8 *)&antic.pf_3210b2[0x600+i*2];
*dst++ = (i&0x80)?PF3:PBK;
*dst++ = (i&0x40)?PF3:PBK;
*dst++ = (i&0x20)?PF3:PBK;
*dst++ = (i&0x10)?PF3:PBK;
*dst++ = (i&0x08)?PF3:PBK;
*dst++ = (i&0x04)?PF3:PBK;
*dst++ = (i&0x02)?PF3:PBK;
*dst++ = (i&0x01)?PF3:PBK;
/****** 4 color graphics 4 cclks (8) **********/
dst = (UINT8 *)&antic.pf_210b4[i*4];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
/****** 4 color graphics 2 cclks (A) **********/
dst = (UINT8 *)&antic.pf_210b2[i*2];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>6)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>4)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>2)&3];
*dst++ = _pf_210b[(i>>0)&3];
*dst++ = _pf_210b[(i>>0)&3];
/****** high resolution graphics (F) **********/
dst = (UINT8 *)&antic.pf_1b[i];
*dst++ = _pf_1b[(i>>6)&3];
*dst++ = _pf_1b[(i>>4)&3];
*dst++ = _pf_1b[(i>>2)&3];
*dst++ = _pf_1b[(i>>0)&3];
/****** gtia mode 1 **********/
dst = (UINT8 *)&antic.pf_gtia1[i];
*dst++ = GT1+((i>>4)&15);
*dst++ = GT1+((i>>4)&15);
*dst++ = GT1+(i&15);
*dst++ = GT1+(i&15);
/****** gtia mode 2 **********/
dst = (UINT8 *)&antic.pf_gtia2[i];
*dst++ = GT2+((i>>4)&15);
*dst++ = GT2+((i>>4)&15);
*dst++ = GT2+(i&15);
*dst++ = GT2+(i&15);
/****** gtia mode 3 **********/
dst = (UINT8 *)&antic.pf_gtia3[i];
*dst++ = GT3+((i>>4)&15);
*dst++ = GT3+((i>>4)&15);
*dst++ = GT3+(i&15);
*dst++ = GT3+(i&15);
}
/* setup used color tables */
for( i = 0; i < 256; i++ )
{
/* used colors in text modes 2,3 */
antic.uc_21[i] = (i) ? PF2 | PF1 : PF2;
/* used colors in text modes 4,5 and graphics modes D,E */
switch( i & 0x03 )
{
case 0x01: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x02: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x03: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x08: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x0c: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x20: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0x30: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_x10b[0x000+i] |= PF0; antic.uc_x10b[0x100+i] |= PF0; break;
case 0x80: antic.uc_x10b[0x000+i] |= PF1; antic.uc_x10b[0x100+i] |= PF1; break;
case 0xc0: antic.uc_x10b[0x000+i] |= PF2; antic.uc_x10b[0x100+i] |= PF3; break;
}
/* used colors in text modes 6,7 and graphics modes 9,B,C */
if( i )
{
antic.uc_3210b2[0x000+i*2] |= PF0;
antic.uc_3210b2[0x200+i*2] |= PF1;
antic.uc_3210b2[0x400+i*2] |= PF2;
antic.uc_3210b2[0x600+i*2] |= PF3;
}
/* used colors in graphics mode 8 */
switch( i & 0x03 )
{
case 0x01: antic.uc_210b4[i*4] |= PF0; break;
case 0x02: antic.uc_210b4[i*4] |= PF1; break;
case 0x03: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_210b4[i*4] |= PF0; break;
case 0x08: antic.uc_210b4[i*4] |= PF1; break;
case 0x0c: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_210b4[i*4] |= PF0; break;
case 0x20: antic.uc_210b4[i*4] |= PF1; break;
case 0x30: antic.uc_210b4[i*4] |= PF2; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_210b4[i*4] |= PF0; break;
case 0x80: antic.uc_210b4[i*4] |= PF1; break;
case 0xc0: antic.uc_210b4[i*4] |= PF2; break;
}
/* used colors in graphics mode A */
switch( i & 0x03 )
{
case 0x01: antic.uc_210b2[i*2] |= PF0; break;
case 0x02: antic.uc_210b2[i*2] |= PF1; break;
case 0x03: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0x0c )
{
case 0x04: antic.uc_210b2[i*2] |= PF0; break;
case 0x08: antic.uc_210b2[i*2] |= PF1; break;
case 0x0c: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0x30 )
{
case 0x10: antic.uc_210b2[i*2] |= PF0; break;
case 0x20: antic.uc_210b2[i*2] |= PF1; break;
case 0x30: antic.uc_210b2[i*2] |= PF2; break;
}
switch( i & 0xc0 )
{
case 0x40: antic.uc_210b2[i*2] |= PF0; break;
case 0x80: antic.uc_210b2[i*2] |= PF1; break;
case 0xc0: antic.uc_210b2[i*2] |= PF2; break;
}
/* used colors in graphics mode F */
if( i )
antic.uc_1b[i] |= PF1;
/* used colors in GTIA graphics modes */
/* GTIA 1 is 16 different luminances with hue of colbk */
antic.uc_g1[i] = 0x00;
/* GTIA 2 is all 9 colors (8..15 is colbk) */
switch( i & 0x0f )
{
case 0x00: antic.uc_g2[i] = 0x10; break;
case 0x01: antic.uc_g2[i] = 0x20; break;
case 0x02: antic.uc_g2[i] = 0x40; break;
case 0x03: antic.uc_g2[i] = 0x80; break;
case 0x04: antic.uc_g2[i] = 0x01; break;
case 0x05: antic.uc_g2[i] = 0x02; break;
case 0x06: antic.uc_g2[i] = 0x04; break;
case 0x07: antic.uc_g2[i] = 0x08; break;
default: antic.uc_g2[i] = 0x00;
}
/* GTIA 3 is 16 different hues with luminance of colbk */
antic.uc_g3[i] = 0x00;
}
}
/************************************************************************
* atari_vh_start
* Initialize the ATARI800 video emulation
************************************************************************/
void atari_common_state::video_start()
{
palette_device *m_palette = machine().first_screen()->palette();
LOG(("atari antic_vh_start\n"));
memset(&antic, 0, sizeof(antic));
antic.bitmap = auto_bitmap_ind16_alloc(machine(), machine().first_screen()->width(), machine().first_screen()->height());
m_antic_render1 = 0;
m_antic_render2 = 0;
m_antic_render3 = 0;
antic.cclk_expand = auto_alloc_array(machine(), UINT32, 21 * 256);
antic.pf_21 = &antic.cclk_expand[ 0 * 256];
antic.pf_x10b = &antic.cclk_expand[ 1 * 256];
antic.pf_3210b2 = &antic.cclk_expand[ 3 * 256];
antic.pf_210b4 = &antic.cclk_expand[11 * 256];
antic.pf_210b2 = &antic.cclk_expand[15 * 256];
antic.pf_1b = &antic.cclk_expand[17 * 256];
antic.pf_gtia1 = &antic.cclk_expand[18 * 256];
antic.pf_gtia2 = &antic.cclk_expand[19 * 256];
antic.pf_gtia3 = &antic.cclk_expand[20 * 256];
antic.used_colors = auto_alloc_array(machine(), UINT8, 21 * 256);
memset(antic.used_colors, 0, 21 * 256 * sizeof(UINT8));
antic.uc_21 = &antic.used_colors[ 0 * 256];
antic.uc_x10b = &antic.used_colors[ 1 * 256];
antic.uc_3210b2 = &antic.used_colors[ 3 * 256];
antic.uc_210b4 = &antic.used_colors[11 * 256];
antic.uc_210b2 = &antic.used_colors[15 * 256];
antic.uc_1b = &antic.used_colors[17 * 256];
antic.uc_g1 = &antic.used_colors[18 * 256];
antic.uc_g2 = &antic.used_colors[19 * 256];
antic.uc_g3 = &antic.used_colors[20 * 256];
for (int i = 0; i < 256; i++)
m_gtia->set_color_lookup(i, (m_palette->pen(0) << 8) + m_palette->pen(0));
LOG(("atari cclk_init\n"));
cclk_init();
for (int i = 0; i < 64; i++)
antic.prio_table[i] = auto_alloc_array(machine(), UINT8, 8*256);
LOG(("atari prio_init\n"));
prio_init();
for (int i = 0; i < machine().first_screen()->height(); i++)
antic.video[i] = auto_alloc_clear(machine(), VIDEO);
antic_vstart(machine());
}
/************************************************************************