atarisy2: use standard palette device ram

This commit is contained in:
Dirk Best 2015-08-12 22:26:08 +02:00
parent ae23d2ca40
commit f03597c902
3 changed files with 16 additions and 21 deletions

View File

@ -751,7 +751,7 @@ WRITE8_MEMBER(atarisy2_state::coincount_w)
/* full memory map derived from schematics */
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w)
AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w)
AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w)
@ -1203,6 +1203,7 @@ static MACHINE_CONFIG_START( atarisy2, atarisy2_state )
/* video hardware */
MCFG_GFXDECODE_ADD("gfxdecode", "palette", atarisy2)
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_FORMAT_CLASS(2, atarisy2_state, RRRRGGGGBBBBIIII)
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, atarisy2_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 128,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, atarisy2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,48, 0)

View File

@ -25,7 +25,6 @@ public:
m_alpha_tilemap(*this, "alpha"),
m_rombank1(*this, "rombank1"),
m_rombank2(*this, "rombank2"),
m_generic_paletteram_16(*this, "paletteram"),
m_slapstic(*this, "slapstic")
{ }
@ -50,7 +49,6 @@ public:
required_memory_bank m_rombank1;
required_memory_bank m_rombank2;
required_shared_ptr<UINT16> m_generic_paletteram_16;
required_device<atari_slapstic_device> m_slapstic;
UINT8 m_sound_reset_state;
@ -112,7 +110,7 @@ public:
DECLARE_WRITE16_MEMBER(yscroll_w);
DECLARE_WRITE16_MEMBER(xscroll_w);
DECLARE_WRITE16_MEMBER(videoram_w);
DECLARE_WRITE16_MEMBER(paletteram_w);
DECLARE_PALETTE_DECODER(RRRRGGGGBBBBIIII);
static const atari_motion_objects_config s_mob_config;
};

View File

@ -166,35 +166,31 @@ WRITE16_MEMBER( atarisy2_state::yscroll_w )
/*************************************
*
* Palette RAM write handler
* Palette RAM to RGB converter
*
*************************************/
WRITE16_MEMBER( atarisy2_state::paletteram_w )
PALETTE_DECODER_MEMBER( atarisy2_state, RRRRGGGGBBBBIIII )
{
static const int ZB = 115, Z3 = 78, Z2 = 37, Z1 = 17, Z0 = 9;
static const int intensity_table[16] =
{
#define ZB 115
#define Z3 78
#define Z2 37
#define Z1 17
#define Z0 9
0, ZB+Z0, ZB+Z1, ZB+Z1+Z0, ZB+Z2, ZB+Z2+Z0, ZB+Z2+Z1, ZB+Z2+Z1+Z0,
ZB+Z3, ZB+Z3+Z0, ZB+Z3+Z1, ZB+Z3+Z1+Z0,ZB+ Z3+Z2, ZB+Z3+Z2+Z0, ZB+Z3+Z2+Z1, ZB+Z3+Z2+Z1+Z0
};
static const int color_table[16] =
{ 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf };
{
0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf
};
int newword, inten, red, green, blue;
int i = intensity_table[raw & 15];
UINT8 r = (color_table[(raw >> 12) & 15] * i) >> 4;
UINT8 g = (color_table[(raw >> 8) & 15] * i) >> 4;
UINT8 b = (color_table[(raw >> 4) & 15] * i) >> 4;
COMBINE_DATA(&m_generic_paletteram_16[offset]);
newword = m_generic_paletteram_16[offset];
inten = intensity_table[newword & 15];
red = (color_table[(newword >> 12) & 15] * inten) >> 4;
green = (color_table[(newword >> 8) & 15] * inten) >> 4;
blue = (color_table[(newword >> 4) & 15] * inten) >> 4;
m_palette->set_pen_color(offset, rgb_t(red, green, blue));
return rgb_t(r, g, b);
}