Huge update, palette is now device (nw)

note: Aaron please give more descriptive text for release log I have no more strength :)
This commit is contained in:
Miodrag Milanovic 2014-02-27 13:35:15 +00:00
parent f9d3fbaa73
commit 64ac8f6776
2385 changed files with 13083 additions and 12088 deletions

View File

@ -37,6 +37,8 @@ MACHINE_CONFIG_FRAGMENT( specpdq )
MCFG_SCREEN_RAW_PARAMS(25175000, 800, 0, 640, 525, 0, 480)
MCFG_SCREEN_SIZE(1280,1024)
MCFG_SCREEN_VISIBLE_AREA(0, 1152-1, 0, 844-1)
MCFG_PALETTE_ADD("palette", 256)
MACHINE_CONFIG_END
ROM_START( specpdq )
@ -82,7 +84,8 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, const
device_t(mconfig, NUBUS_SPECPDQ, "SuperMac Spectrum PDQ video card", tag, owner, clock, "nb_spdq", __FILE__),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME)
m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME),
m_palette(*this, "palette")
{
m_screen_tag = m_assembled_tag;
}
@ -91,7 +94,8 @@ nubus_specpdq_device::nubus_specpdq_device(const machine_config &mconfig, device
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_video_interface(mconfig, *this),
device_nubus_card_interface(mconfig, *this),
m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME)
m_assembled_tag(tag, ":", SPECPDQ_SCREEN_NAME),
m_palette(*this, "palette")
{
m_screen_tag = m_assembled_tag;
}
@ -132,10 +136,10 @@ void nubus_specpdq_device::device_reset()
m_vbl_disable = 1;
m_mode = 0;
memset(m_vram, 0, VRAM_SIZE);
memset(m_palette, 0, sizeof(m_palette));
memset(m_palette_val, 0, sizeof(m_palette_val));
m_palette[0] = rgb_t(255, 255, 255);
m_palette[0x80] = rgb_t(0, 0, 0);
m_palette_val[0] = rgb_t(255, 255, 255);
m_palette_val[0x80] = rgb_t(0, 0, 0);
}
@ -174,14 +178,14 @@ UINT32 nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &
{
pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
*scanline++ = m_palette[(pixels&0x80)];
*scanline++ = m_palette[((pixels<<1)&0x80)];
*scanline++ = m_palette[((pixels<<2)&0x80)];
*scanline++ = m_palette[((pixels<<3)&0x80)];
*scanline++ = m_palette[((pixels<<4)&0x80)];
*scanline++ = m_palette[((pixels<<5)&0x80)];
*scanline++ = m_palette[((pixels<<6)&0x80)];
*scanline++ = m_palette[((pixels<<7)&0x80)];
*scanline++ = m_palette_val[(pixels&0x80)];
*scanline++ = m_palette_val[((pixels<<1)&0x80)];
*scanline++ = m_palette_val[((pixels<<2)&0x80)];
*scanline++ = m_palette_val[((pixels<<3)&0x80)];
*scanline++ = m_palette_val[((pixels<<4)&0x80)];
*scanline++ = m_palette_val[((pixels<<5)&0x80)];
*scanline++ = m_palette_val[((pixels<<6)&0x80)];
*scanline++ = m_palette_val[((pixels<<7)&0x80)];
}
}
break;
@ -194,10 +198,10 @@ UINT32 nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &
{
pixels = vram[(y * 512) + (BYTE4_XOR_BE(x))];
*scanline++ = m_palette[(pixels&0xc0)];
*scanline++ = m_palette[((pixels<<2)&0xc0)];
*scanline++ = m_palette[((pixels<<4)&0xc0)];
*scanline++ = m_palette[((pixels<<6)&0xc0)];
*scanline++ = m_palette_val[(pixels&0xc0)];
*scanline++ = m_palette_val[((pixels<<2)&0xc0)];
*scanline++ = m_palette_val[((pixels<<4)&0xc0)];
*scanline++ = m_palette_val[((pixels<<6)&0xc0)];
}
}
break;
@ -211,8 +215,8 @@ UINT32 nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &
{
pixels = vram[(y * 1024) + (BYTE4_XOR_BE(x))];
*scanline++ = m_palette[(pixels&0xf0)];
*scanline++ = m_palette[((pixels<<4)&0xf0)];
*scanline++ = m_palette_val[(pixels&0xf0)];
*scanline++ = m_palette_val[((pixels<<4)&0xf0)];
}
}
break;
@ -225,7 +229,7 @@ UINT32 nubus_specpdq_device::screen_update(screen_device &screen, bitmap_rgb32 &
for (x = 0; x < 1152; x++)
{
pixels = vram[(y * 1152) + (BYTE4_XOR_BE(x))];
*scanline++ = m_palette[pixels];
*scanline++ = m_palette_val[pixels];
}
}
break;
@ -297,8 +301,8 @@ WRITE32_MEMBER( nubus_specpdq_device::specpdq_w )
if (m_count == 3)
{
// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", m_clutoffs, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() );
palette_set_color(space.machine(), m_clutoffs, rgb_t(m_colors[0], m_colors[1], m_colors[2]));
m_palette[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_palette->set_pen_color(m_clutoffs, rgb_t(m_colors[0], m_colors[1], m_colors[2]));
m_palette_val[m_clutoffs] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
m_clutoffs++;
if (m_clutoffs > 255)
{

View File

@ -42,7 +42,7 @@ public:
dynamic_buffer m_vram;
UINT32 *m_vram32;
UINT32 m_mode, m_vbl_disable;
UINT32 m_palette[256], m_colors[3], m_count, m_clutoffs;
UINT32 m_palette_val[256], m_colors[3], m_count, m_clutoffs;
emu_timer *m_timer;
astring m_assembled_tag;
@ -51,6 +51,7 @@ private:
int m_width, m_height, m_patofsx, m_patofsy;
UINT32 m_vram_addr, m_vram_src;
UINT8 m_fillbytes[256];
required_device<palette_device> m_palette;
};

View File

@ -49,7 +49,7 @@
#define ATTR_SUBSCRIPT BIT(attr, 6)
#define ATTR_SUPERSCRIPT BIT(attr, 7)
static const rgb_t PALETTE[] =
static const rgb_t PALETTE_MVC[] =
{
rgb_t::black,
rgb_t(0x00, 0x80, 0x00),
@ -81,7 +81,7 @@ void wangpc_mvc_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bit
int x = (sx * 16) + bit;
int color = BIT(data, 15);
bitmap.pix32(y, x) = PALETTE[color];
bitmap.pix32(y, x) = PALETTE_MVC[color];
data <<= 1;
}
@ -117,7 +117,7 @@ void wangpc_mvc_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bit
int color = ((BIT(data, 9) & !ATTR_BLANK) ^ ATTR_REVERSE);
if ((color | bitmap.pix32(y, x)) & ATTR_BOLD) color = 2;
if (color) bitmap.pix32(y, x) = PALETTE[color];
if (color) bitmap.pix32(y, x) = PALETTE_MVC[color];
data <<= 1;
}

View File

@ -138,7 +138,7 @@ static MACHINE_CONFIG_FRAGMENT( wangpc_tig )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_PALETTE_LENGTH(3)
MCFG_PALETTE_ADD("palette", 3)
MCFG_UPD7220_ADD(UPD7720_0_TAG, XTAL_52_832MHz/28, hgdc0_intf, upd7220_0_map) // was /10?
MCFG_UPD7220_ADD(UPD7720_1_TAG, XTAL_52_832MHz/28, hgdc1_intf, upd7220_1_map) // was /16?
@ -169,7 +169,8 @@ wangpc_tig_device::wangpc_tig_device(const machine_config &mconfig, const char *
device_wangpcbus_card_interface(mconfig, *this),
m_hgdc0(*this, UPD7720_0_TAG),
m_hgdc1(*this, UPD7720_1_TAG),
m_option(0)
m_option(0),
m_palette(*this, "palette")
{
}
@ -181,9 +182,9 @@ wangpc_tig_device::wangpc_tig_device(const machine_config &mconfig, const char *
void wangpc_tig_device::device_start()
{
// initialize palette
palette_set_color_rgb(machine(), 0, 0, 0, 0);
palette_set_color_rgb(machine(), 1, 0, 0x80, 0);
palette_set_color_rgb(machine(), 2, 0, 0xff, 0);
m_palette->set_pen_color(0, 0, 0, 0);
m_palette->set_pen_color(1, 0, 0x80, 0);
m_palette->set_pen_color(2, 0, 0xff, 0);
// state saving
save_item(NAME(m_option));

View File

@ -58,6 +58,7 @@ private:
UINT8 m_option;
UINT8 m_attr[16];
UINT8 m_underline;
required_device<palette_device> m_palette;
};

View File

@ -1069,7 +1069,7 @@ void tms34010_get_display_params(device_t *cpu, tms34010_display_params *params)
UINT32 tms34010_device::tms340x0_ind16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
pen_t blackpen = get_black_pen(machine());
pen_t blackpen = screen.palette()->black_pen();
tms34010_display_params params;
tms34010_state *tms = NULL;
device_t *cpu;
@ -1118,7 +1118,7 @@ UINT32 tms34010_device::tms340x0_ind16(screen_device &screen, bitmap_ind16 &bitm
UINT32 tms34010_device::tms340x0_rgb32(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
pen_t blackpen = get_black_pen(machine());
pen_t blackpen = screen.palette()->black_pen();
tms34010_display_params params;
tms34010_state *tms = NULL;
device_t *cpu;

View File

@ -360,7 +360,7 @@ gfx_element::gfx_element(running_machine &machine)
{
}
gfx_element::gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity)
gfx_element::gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity)
: m_width(width),
m_height(height),
m_startx(0),
@ -371,7 +371,7 @@ gfx_element::gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UI
m_color_base(color_base),
m_color_depth(color_granularity),
m_color_granularity(color_granularity),
m_total_colors((machine.total_colors() - color_base) / color_granularity),
m_total_colors((total_colors - color_base) / color_granularity),
m_line_modulo(rowbytes),
m_char_modulo(0),
m_srcdata(base),
@ -581,19 +581,19 @@ void gfx_element::decode(UINT32 code)
no transparency
-------------------------------------------------*/
void gfx_element::opaque(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
{
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty)
{
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
@ -605,13 +605,13 @@ void gfx_element::opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
a single transparent pen
-------------------------------------------------*/
void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 trans_pen)
{
// special case invalid pens to opaque
if (trans_pen > 0xff)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// use pen usage to optimize
code %= elements();
@ -624,22 +624,22 @@ void gfx_element::transpen(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
}
void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 trans_pen)
{
// special case invalid pens to opaque
if (trans_pen > 0xff)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// use pen usage to optimize
code %= elements();
@ -652,11 +652,11 @@ void gfx_element::transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
}
@ -703,13 +703,13 @@ void gfx_element::transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect,
a mask
-------------------------------------------------*/
void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 trans_mask)
{
// special case 0 mask to opaque
if (trans_mask == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// use pen usage to optimize
code %= elements();
@ -722,22 +722,22 @@ void gfx_element::transmask(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
}
void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 trans_mask)
{
// special case 0 mask to opaque
if (trans_mask == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// use pen usage to optimize
code %= elements();
@ -750,11 +750,11 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
}
@ -766,27 +766,27 @@ void gfx_element::transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
transparent, opaque, or shadowing
-------------------------------------------------*/
void gfx_element::transtable(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
const UINT8 *pentable, const pen_t *shadowtable)
{
assert(pentable != NULL);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
}
void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
const UINT8 *pentable, const pen_t *shadowtable)
{
assert(pentable != NULL);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
@ -799,13 +799,13 @@ void gfx_element::transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
remaining pixels with a fixed alpha value
-------------------------------------------------*/
void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 trans_pen, UINT8 alpha_val)
{
// special case alpha = 0xff
if (alpha_val == 0xff)
return transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
return transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
// early out if completely transparent
code %= elements();
@ -813,7 +813,7 @@ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
return;
// get final code and color, and grab lookup tables
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
}
@ -829,31 +829,31 @@ void gfx_element::alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
element with no transparency
-------------------------------------------------*/
void gfx_element::zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::zoom_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
}
void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::zoom_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return opaque(dest, cliprect, code, color, flipx, flipy, destx, desty);
return opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE, NO_PRIORITY);
@ -865,17 +865,17 @@ void gfx_element::zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
element with a single transparent pen
-------------------------------------------------*/
void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::zoom_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 trans_pen)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
return transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
// special case invalid pens to opaque
if (trans_pen > 0xff)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
// use pen usage to optimize
code %= elements();
@ -888,26 +888,26 @@ void gfx_element::zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
}
void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::zoom_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 trans_pen)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
return transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen);
// special case invalid pens to opaque
if (trans_pen > 0xff)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
// use pen usage to optimize
code %= elements();
@ -920,11 +920,11 @@ void gfx_element::zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN, NO_PRIORITY);
}
@ -979,17 +979,17 @@ void gfx_element::zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec
provided as a mask
-------------------------------------------------*/
void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::zoom_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 trans_mask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transmask(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_mask);
return transmask(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_mask);
// special case 0 mask to opaque
if (trans_mask == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
// use pen usage to optimize
code %= elements();
@ -1002,26 +1002,26 @@ void gfx_element::zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
}
void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::zoom_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 trans_mask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transmask(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_mask);
return transmask(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_mask);
// special case 0 mask to opaque
if (trans_mask == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
// use pen usage to optimize
code %= elements();
@ -1034,11 +1034,11 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
return zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley);
}
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK, NO_PRIORITY);
}
@ -1050,7 +1050,7 @@ void gfx_element::zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
are transparent, opaque, or shadowing
-------------------------------------------------*/
void gfx_element::zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::zoom_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
{
@ -1058,16 +1058,16 @@ void gfx_element::zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect,
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transtable(dest, cliprect, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
return transtable(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16, NO_PRIORITY);
}
void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::zoom_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable)
{
@ -1075,10 +1075,10 @@ void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return transtable(dest, cliprect, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
return transtable(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, pentable, shadowtable);
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32, NO_PRIORITY);
@ -1091,17 +1091,17 @@ void gfx_element::zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
the remaining pixels with a fixed alpha value
-------------------------------------------------*/
void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::zoom_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, UINT32 trans_pen, UINT8 alpha_val)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return alpha(dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen, alpha_val);
return alpha(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, trans_pen, alpha_val);
// special case alpha_val = 0xff
if (alpha_val == 0xff)
return zoom_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, trans_pen);
return zoom_transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, trans_pen);
// early out if completely transparent
code %= elements();
@ -1109,7 +1109,7 @@ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
return;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DECLARE_NO_PRIORITY;
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32, NO_PRIORITY);
}
@ -1126,7 +1126,7 @@ void gfx_element::zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
bitmap
-------------------------------------------------*/
void gfx_element::prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask)
{
@ -1134,12 +1134,12 @@ void gfx_element::prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
}
void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask)
{
@ -1147,7 +1147,7 @@ void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
}
@ -1159,13 +1159,13 @@ void gfx_element::prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
priority bitmap
-------------------------------------------------*/
void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen)
{
// special case invalid pens to opaque
if (trans_pen > 0xff)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1178,24 +1178,24 @@ void gfx_element::prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
}
void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen)
{
// special case invalid pens to opaque
if (trans_pen > 0xff)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1208,14 +1208,14 @@ void gfx_element::prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
}
@ -1265,13 +1265,13 @@ void gfx_element::prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprec
a mask, checking against the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_mask)
{
// special case 0 mask to opaque
if (trans_mask == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1284,24 +1284,24 @@ void gfx_element::prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
}
void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_mask)
{
// special case 0 mask to opaque
if (trans_mask == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1314,14 +1314,14 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
}
@ -1333,7 +1333,7 @@ void gfx_element::prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
against the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
{
@ -1343,12 +1343,12 @@ void gfx_element::prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFX_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
}
void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable)
{
@ -1358,7 +1358,7 @@ void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
}
@ -1371,13 +1371,13 @@ void gfx_element::prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
checking against the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen, UINT8 alpha_val)
{
// special case alpha = 0xff
if (alpha_val == 0xff)
return prio_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
return prio_transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
// early out if completely transparent
code %= elements();
@ -1388,7 +1388,7 @@ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFX_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
}
@ -1404,36 +1404,36 @@ void gfx_element::prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
}
void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
return prio_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask);
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_OPAQUE_PRIORITY, UINT8);
}
@ -1445,18 +1445,18 @@ void gfx_element::prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect
checking against the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_pen)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
return prio_transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
// special case invalid pens to opaque
if (trans_pen > 0xff)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1469,29 +1469,29 @@ void gfx_element::prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &clipre
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
}
void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_pen)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
return prio_transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
// special case invalid pens to opaque
if (trans_pen > 0xff)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1504,14 +1504,14 @@ void gfx_element::prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &clipre
// fully opaque; draw as such
if ((usage & (1 << trans_pen)) == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_PRIORITY, UINT8);
}
@ -1573,18 +1573,18 @@ void gfx_element::prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cl
priority bitmap
-------------------------------------------------*/
void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_mask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transmask(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_mask);
return prio_transmask(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_mask);
// special case 0 mask to opaque
if (trans_mask == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1597,29 +1597,29 @@ void gfx_element::prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &clipr
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
}
void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_mask)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transmask(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_mask);
return prio_transmask(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_mask);
// special case 0 mask to opaque
if (trans_mask == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
// use pen usage to optimize
code %= elements();
@ -1632,14 +1632,14 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr
// fully opaque; draw as such
if ((usage & trans_mask) == 0)
return prio_zoom_opaque(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
return prio_zoom_opaque(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask);
}
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSMASK_PRIORITY, UINT8);
}
@ -1651,7 +1651,7 @@ void gfx_element::prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &clipr
checking against the priority bitmap
-------------------------------------------------*/
void gfx_element::prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
const UINT8 *pentable, const pen_t *shadowtable)
@ -1660,18 +1660,18 @@ void gfx_element::prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &clip
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transtable(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
return prio_transtable(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFXZOOM_CORE(UINT16, PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY, UINT8);
}
void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
const UINT8 *pentable, const pen_t *shadowtable)
@ -1680,13 +1680,13 @@ void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &clip
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_transtable(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
return prio_transtable(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, pentable, shadowtable);
// high bit of the mask is implicitly on
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
code %= elements();
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY, UINT8);
}
@ -1700,18 +1700,18 @@ void gfx_element::prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &clip
bitmap
-------------------------------------------------*/
void gfx_element::prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_pen, UINT8 alpha_val)
{
// non-zoom case
if (scalex == 0x10000 && scaley == 0x10000)
return prio_alpha(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen, alpha_val);
return prio_alpha(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen, alpha_val);
// special case alpha_val = 0xff
if (alpha_val == 0xff)
return prio_zoom_transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, trans_pen);
return prio_zoom_transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, scalex, scaley, priority, pmask, trans_pen);
// early out if completely transparent
code %= elements();
@ -1722,7 +1722,7 @@ void gfx_element::prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect,
pmask |= 1 << 31;
// render
const pen_t *paldata = &machine().pens[colorbase() + granularity() * (color % colors())];
const pen_t *paldata = &palette.pen(colorbase() + granularity() * (color % colors()));
DRAWGFXZOOM_CORE(UINT32, PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY, UINT8);
}
@ -1753,7 +1753,7 @@ do
} \
while (0)
void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_transpen_additive(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen)
{
@ -1765,7 +1765,7 @@ void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cl
/* get final code and color, and grab lookup tables */
code %= elements();
color %= colors();
paldata = &machine().pens[colorbase() + granularity() * color];
paldata = &palette.pen(colorbase() + granularity() * color);
/* use pen usage to optimize */
if (has_pen_usage())
@ -1785,7 +1785,7 @@ void gfx_element::prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cl
}
void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::prio_zoom_transpen_additive(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,
UINT32 trans_pen)
@ -1796,7 +1796,7 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl
if (scalex == 0x10000 && scaley == 0x10000)
{
prio_transpen_additive(dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
prio_transpen_additive(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, priority, pmask, trans_pen);
return;
}
@ -1806,7 +1806,7 @@ void gfx_element::prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangl
/* get final code and color, and grab lookup tables */
code %= elements();
color %= colors();
paldata = &machine().pens[colorbase() + granularity() * color];
paldata = &palette.pen(colorbase() + granularity() * color);
/* use pen usage to optimize */
if (has_pen_usage())
@ -1860,7 +1860,7 @@ while (0)
a single transparent pen, storing the alpha value
in alpha field of ARGB32, negative alpha implies alphatable
-------------------------------------------------*/
void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::alphastore(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
int fixedalpha, UINT8 *alphatable)
{
@ -1874,14 +1874,14 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,
/* if we have a fixed alpha, call the standard drawgfx_transpen */
if (fixedalpha == 0xff)
{
transpen(dest, cliprect, code, color, flipx, flipy, destx, desty, 0);
transpen(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, 0);
return;
}
/* get final code and color, and grab lookup tables */
code %= elements();
color %= colors();
paldata = &machine().pens[colorbase() + granularity() * color];
paldata = &palette.pen(colorbase() + granularity() * color);
/* early out if completely transparent */
if (has_pen_usage() && (pen_usage(code) & ~(1 << 0)) == 0)
@ -1903,7 +1903,7 @@ void gfx_element::alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,
a fixed alpha value, or if alpha==-1 then uses
the per-pen alphatable[] array
-------------------------------------------------*/
void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect,
void gfx_element::alphatable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,
UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,
int fixedalpha ,UINT8 *alphatable)
{
@ -1914,7 +1914,7 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect,
/* if we have a fixed alpha, call the standard drawgfx_alpha */
if (fixedalpha >= 0)
{
alpha(dest, cliprect, code, color, flipx, flipy, destx, desty, 0, fixedalpha);
alpha(palette, dest, cliprect, code, color, flipx, flipy, destx, desty, 0, fixedalpha);
return;
}
@ -1924,7 +1924,7 @@ void gfx_element::alphatable(bitmap_rgb32 &dest, const rectangle &cliprect,
/* get final code and color, and grab lookup tables */
code %= elements();
color %= colors();
paldata = &machine().pens[colorbase() + granularity() * color];
paldata = &palette.pen(colorbase() + granularity() * color);
/* early out if completely transparent */
if (has_pen_usage() && (pen_usage(code) & ~(1 << 0)) == 0)
@ -2318,4 +2318,4 @@ void copyrozbitmap_trans(bitmap_rgb32 &dest, const rectangle &cliprect, bitmap_r
}
GFXDECODE_START( empty )
GFXDECODE_END
GFXDECODE_END

View File

@ -30,7 +30,6 @@
#define MCFG_GFXDECODE_INFO(_info) \
gfxdecode_device::static_set_gfxdecodeinfo(*device, GFXDECODE_NAME(_info));
#define MCFG_GFXDECODE_MODIFY(_tag, _info) \
MCFG_DEVICE_MODIFY(_tag) \
MCFG_GFXDECODE_INFO(_info) \
@ -136,7 +135,7 @@ public:
// construction/destruction
gfx_element(running_machine &machine);
gfx_element(running_machine &machine, const gfx_layout &gl, const UINT8 *srcdata, UINT32 total_colors, UINT32 color_base);
gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 color_base, UINT32 color_granularity);
gfx_element(running_machine &machine, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity);
// getters
running_machine &machine() const { return m_machine; }
@ -182,74 +181,74 @@ public:
if (m_dirty[code]) decode(code);
return m_pen_usage[code];
}
// ----- core graphics drawing -----
// specific drawgfx implementations for each transparency type
void opaque(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
void opaque(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
void transpen(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void transpen(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
void opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty);
void transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen);
void transmask(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
void transmask(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
void transtable(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
void transtable(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
void alpha(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha);
void transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
void transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transmask);
void transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
void transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, const UINT8 *pentable, const pen_t *shadowtable);
void alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 transpen, UINT8 alpha);
// ----- zoomed graphics drawing -----
// specific zoom implementations for each transparency type
void zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
void zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
void zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
void zoom_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley);
void zoom_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen);
void zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
void zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
void zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
void zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
void zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha);
void zoom_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
void zoom_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transmask);
void zoom_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
void zoom_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, const UINT8 *pentable, const pen_t *shadowtable);
void zoom_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, UINT32 transpen, UINT8 alpha);
// ----- priority masked graphics drawing -----
// specific prio implementations for each transparency type
void prio_opaque(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
void prio_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
void prio_transpen(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
void prio_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask);
void prio_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_transmask(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_transtable(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
void prio_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
// ----- priority masked zoomed graphics drawing -----
// specific prio_zoom implementations for each transparency type
void prio_zoom_opaque(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
void prio_zoom_opaque(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
void prio_zoom_transpen(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_transpen(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_opaque(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
void prio_zoom_opaque(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask);
void prio_zoom_transpen(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_transpen(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_transpen_raw(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_transpen_raw(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen);
void prio_zoom_transmask(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_zoom_transmask(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_zoom_transtable(bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_zoom_transtable(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_zoom_alpha(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
void prio_zoom_transmask(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_zoom_transmask(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transmask);
void prio_zoom_transtable(palette_device &palette, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_zoom_transtable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, const UINT8 *pentable, const pen_t *shadowtable);
void prio_zoom_alpha(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask, UINT32 transpen, UINT8 alpha);
void prio_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen);
void prio_zoom_transpen_additive(bitmap_rgb32 &dest, const rectangle &cliprect,UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,UINT32 trans_pen);
void alphastore(bitmap_rgb32 &dest, const rectangle &cliprect,UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,int fixedalpha, UINT8 *alphatable);
void alphatable(bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, int fixedalpha ,UINT8 *alphatable);
void prio_transpen_additive(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, bitmap_ind8 &priority, UINT32 pmask, UINT32 trans_pen);
void prio_zoom_transpen_additive(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,UINT32 scalex, UINT32 scaley, bitmap_ind8 &priority, UINT32 pmask,UINT32 trans_pen);
void alphastore(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect,UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty,int fixedalpha, UINT8 *alphatable);
void alphatable(palette_device &palette, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 code, UINT32 color, int flipx, int flipy, INT32 destx, INT32 desty, int fixedalpha ,UINT8 *alphatable);
private:
// internal state
UINT16 m_width; // current pixel width of each element (changeble with source clipping)
@ -453,10 +452,11 @@ public:
// static configuration
static void static_set_gfxdecodeinfo(device_t &device, const gfx_decode_entry *info);
static void static_set_palette(device_t &device, const char *tag);
gfx_element * gfx(int index) { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; }
gfx_element ** gfx() { return m_gfx; }
void set_gfx(int index, gfx_element * val) { assert(index < MAX_GFX_ELEMENTS); m_gfx[index] = val; }
protected:
// device-level overrides

View File

@ -35,6 +35,7 @@ driver_device::driver_device(const machine_config &mconfig, device_type type, co
: device_t(mconfig, type, "Driver Device", tag, NULL, 0, "", __FILE__),
device_memory_interface(mconfig, *this),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_generic_paletteram_8(*this, "paletteram"),
m_generic_paletteram2_8(*this, "paletteram2"),
m_generic_paletteram_16(*this, "paletteram"),
@ -133,16 +134,6 @@ void driver_device::sound_start()
}
//-------------------------------------------------
// palette_init - default implementation which
// does nothing
//-------------------------------------------------
void driver_device::palette_init()
{
}
//-------------------------------------------------
// video_start - default implementation which
// calls to the legacy video_start function
@ -240,12 +231,6 @@ void driver_device::device_start()
// finish image devices init process
image_postdevice_init(machine());
// call palette_init if present
if (!m_callbacks[CB_PALETTE_INIT].isnull())
m_callbacks[CB_PALETTE_INIT]();
else
palette_init();
// start the various pieces
driver_start();
@ -599,123 +584,6 @@ void driver_device::flip_screen_y_set(UINT32 on)
//**************************************************************************
// 8-BIT PALETTE WRITE HANDLERS
//**************************************************************************
// 3-3-2 RGB palette write handlers
WRITE8_MEMBER( driver_device::paletteram_BBGGGRRR_byte_w ) { palette_8bit_byte_w<3,3,2, 0,3,6>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_RRRGGGBB_byte_w ) { palette_8bit_byte_w<3,3,2, 5,2,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_BBGGRRII_byte_w )
{
m_generic_paletteram_8[offset] = data;
int i = (data >> 0) & 3;
palette_set_color_rgb(machine(), offset, pal4bit(((data >> 0) & 0x0c) | i),
pal4bit(((data >> 2) & 0x0c) | i),
pal4bit(((data >> 4) & 0x0c) | i));
}
//**************************************************************************
// 16-BIT PALETTE WRITE HANDLERS
//**************************************************************************
// 4-4-4 RGB palette write handlers
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xxxxBBBBGGGGRRRR_word_w ) { palette_16bit_word_w<4,4,4, 0,4,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xxxxBBBBRRRRGGGG_word_w ) { palette_16bit_word_w<4,4,4, 4,0,8>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 8,0,4>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRBBBBGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 8,0,4>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_le_w ) { palette_16bit_byte_le_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xxxxRRRRGGGGBBBB_word_w ) { palette_16bit_word_w<4,4,4, 8,4,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_be_w ) { palette_16bit_byte_be_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBxxxx_word_w ) { palette_16bit_word_w<4,4,4, 12,8,4>(space, offset, data, mem_mask); }
// 4-4-4-4 IRGB palette write handlers
template<int _IShift, int _RShift, int _GShift, int _BShift>
inline void set_color_irgb(running_machine &machine, pen_t color, UINT16 data)
{
static const UINT8 ztable[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11 };
UINT8 i = ztable[(data >> _IShift) & 15];
UINT8 r = ((data >> _RShift) & 15) * i;
UINT8 g = ((data >> _GShift) & 15) * i;
UINT8 b = ((data >> _BShift) & 15) * i;
palette_set_color_rgb(machine, color, r, g, b);
}
WRITE16_MEMBER( driver_device::paletteram_IIIIRRRRGGGGBBBB_word_w )
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
set_color_irgb<12,8,4,0>(machine(), offset, m_generic_paletteram_16[offset]);
}
WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBIIII_word_w )
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
set_color_irgb<0,12,8,4>(machine(), offset, m_generic_paletteram_16[offset]);
}
// 5-5-5 RGB palette write handlers
WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_le_w ) { palette_16bit_byte_le_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_be_w ) { palette_16bit_byte_be_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xBBBBBGGGGGRRRRR_word_w ) { palette_16bit_word_w<5,5,5, 0,5,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 5,0,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xBBBBBRRRRRGGGGG_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 5,0,10>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_le_w ) { palette_16bit_byte_le_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_be_w ) { palette_16bit_byte_be_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w ) { palette_16bit_byte_split_lo_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w ) { palette_16bit_byte_split_hi_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_word_w ) { palette_16bit_word_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE32_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_dword_be_w ) { palette_16bit_dword_be_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE32_MEMBER( driver_device::paletteram_xRRRRRGGGGGBBBBB_dword_le_w ) { palette_16bit_dword_le_w<5,5,5, 10,5,0>(space, offset, data, mem_mask); }
WRITE8_MEMBER( driver_device::paletteram_xGGGGGRRRRRBBBBB_byte_le_w ) { palette_16bit_byte_le_w<5,5,5, 5,10,0>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xGGGGGRRRRRBBBBB_word_w ) { palette_16bit_word_w<5,5,5, 5,10,0>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xGGGGGBBBBBRRRRR_word_w ) { palette_16bit_word_w<5,5,5, 0,10,5>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_RRRRRGGGGGBBBBBx_word_w ) { palette_16bit_word_w<5,5,5, 11,6,1>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_GGGGGRRRRRBBBBBx_word_w ) { palette_16bit_word_w<5,5,5, 6,11,1>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBRGBx_word_w )
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
data = m_generic_paletteram_16[offset];
palette_set_color_rgb(machine(), offset, pal5bit(((data >> 11) & 0x1e) | ((data >> 3) & 0x01)),
pal5bit(((data >> 7) & 0x1e) | ((data >> 2) & 0x01)),
pal5bit(((data >> 3) & 0x1e) | ((data >> 1) & 0x01)));
}
//**************************************************************************
// 32-BIT PALETTE WRITE HANDLERS
//**************************************************************************
// 8-8-8 RGB palette write handlers
WRITE16_MEMBER( driver_device::paletteram_xrgb_word_be_w ) { palette_32bit_word_be_w<8,8,8, 16,8,0>(space, offset, data, mem_mask); }
WRITE16_MEMBER( driver_device::paletteram_xbgr_word_be_w ) { palette_32bit_word_be_w<8,8,8, 0,8,16>(space, offset, data, mem_mask); }
//**************************************************************************
// MISC READ/WRITE HANDLERS
//**************************************************************************
@ -733,141 +601,3 @@ WRITE8_MEMBER( driver_device::fatal_generic_write )
{
throw emu_fatalerror("Attempted to write to generic address space (offs %X = %02X)\n", offset, data);
}
/***************************************************************************
COMMON PALETTE INITIALIZATION
***************************************************************************/
/*-------------------------------------------------
black - completely black palette
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, all_black)
{
int i;
for (i = 0; i < machine().total_colors(); i++)
{
palette_set_color(machine(),i,rgb_t::black); /* black */
}
}
/*-------------------------------------------------
black_and_white - basic 2-color black & white
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, black_and_white)
{
palette_set_color(machine(),0,rgb_t::black); /* black */
palette_set_color(machine(),1,rgb_t::white); /* white */
}
/*-------------------------------------------------
monochrome_amber - 2-color black & amber
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, monochrome_amber)
{
palette_set_color(machine(), 0, rgb_t::black); /* black */
palette_set_color_rgb(machine(), 1, 0xf7, 0xaa, 0x00); /* amber */
}
/*-------------------------------------------------
monochrome_green - 2-color black & green
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, monochrome_green)
{
palette_set_color(machine(), 0, rgb_t::black); /* black */
palette_set_color_rgb(machine(), 1, 0x00, 0xff, 0x00); /* green */
}
/*-------------------------------------------------
RRRR_GGGG_BBBB - standard 4-4-4 palette,
assuming the commonly used resistor values:
bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE
-- 470 ohm resistor -- RED/GREEN/BLUE
-- 1 kohm resistor -- RED/GREEN/BLUE
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, RRRR_GGGG_BBBB)
{
const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
int i;
for (i = 0; i < machine().total_colors(); i++)
{
int bit0,bit1,bit2,bit3,r,g,b;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
bit3 = (color_prom[i] >> 3) & 0x01;
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* green component */
bit0 = (color_prom[i + machine().total_colors()] >> 0) & 0x01;
bit1 = (color_prom[i + machine().total_colors()] >> 1) & 0x01;
bit2 = (color_prom[i + machine().total_colors()] >> 2) & 0x01;
bit3 = (color_prom[i + machine().total_colors()] >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
/* blue component */
bit0 = (color_prom[i + 2*machine().total_colors()] >> 0) & 0x01;
bit1 = (color_prom[i + 2*machine().total_colors()] >> 1) & 0x01;
bit2 = (color_prom[i + 2*machine().total_colors()] >> 2) & 0x01;
bit3 = (color_prom[i + 2*machine().total_colors()] >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette_set_color(machine(),i,rgb_t(r,g,b));
}
}
/*-------------------------------------------------
RRRRR_GGGGG_BBBBB/BBBBB_GGGGG_RRRRR -
standard 5-5-5 palette for games using a
15-bit color space
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, RRRRR_GGGGG_BBBBB)
{
int i;
for (i = 0; i < 0x8000; i++)
palette_set_color(machine(), i, rgb_t(pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0)));
}
PALETTE_INIT_MEMBER(driver_device, BBBBB_GGGGG_RRRRR)
{
int i;
for (i = 0; i < 0x8000; i++)
palette_set_color(machine(), i, rgb_t(pal5bit(i >> 0), pal5bit(i >> 5), pal5bit(i >> 10)));
}
/*-------------------------------------------------
RRRRR_GGGGGG_BBBBB -
standard 5-6-5 palette for games using a
16-bit color space
-------------------------------------------------*/
PALETTE_INIT_MEMBER(driver_device, RRRRR_GGGGGG_BBBBB)
{
int i;
for (i = 0; i < 0x10000; i++)
palette_set_color(machine(), i, rgb_t(pal5bit(i >> 11), pal6bit(i >> 5), pal5bit(i >> 0)));
}

View File

@ -41,9 +41,6 @@
// core video callbacks
#define MCFG_PALETTE_INIT_OVERRIDE(_class, _func) \
driver_device::static_set_callback(config.root_device(), driver_device::CB_PALETTE_INIT, driver_callback_delegate(&_class::PALETTE_INIT_NAME(_func), #_class "::palette_init_" #_func, downcast<_class *>(owner)));
#define MCFG_VIDEO_START_OVERRIDE(_class, _func) \
driver_device::static_set_callback(config.root_device(), driver_device::CB_VIDEO_START, driver_callback_delegate(&_class::VIDEO_START_NAME(_func), #_class "::video_start_" #_func, downcast<_class *>(owner)));
@ -79,12 +76,6 @@
#define DECLARE_SOUND_RESET(name) void SOUND_RESET_NAME(name)()
#define SOUND_RESET_MEMBER(cls,name) void cls::SOUND_RESET_NAME(name)()
#define PALETTE_INIT_NAME(name) palette_init_##name
#define PALETTE_INIT(name) void PALETTE_INIT_NAME(name)(running_machine &machine) // legacy
#define PALETTE_INIT_CALL_MEMBER(name) PALETTE_INIT_NAME(name)()
#define DECLARE_PALETTE_INIT(name) void PALETTE_INIT_NAME(name)()
#define PALETTE_INIT_MEMBER(cls,name) void cls::PALETTE_INIT_NAME(name)()
#define VIDEO_START_NAME(name) video_start_##name
#define VIDEO_START(name) void VIDEO_START_NAME(name)(running_machine &machine) // legacy
#define VIDEO_START_CALL_MEMBER(name) VIDEO_START_NAME(name)()
@ -105,7 +96,7 @@
// forward declarations
class gfxdecode_device;
class palette_device;
typedef delegate<void ()> driver_callback_delegate;
// legacy callback functions
@ -133,7 +124,6 @@ public:
CB_MACHINE_RESET,
CB_SOUND_START,
CB_SOUND_RESET,
CB_PALETTE_INIT,
CB_VIDEO_START,
CB_VIDEO_RESET,
CB_COUNT
@ -246,89 +236,6 @@ public:
UINT32 flip_screen_x() const { return m_flip_screen_x; }
UINT32 flip_screen_y() const { return m_flip_screen_y; }
// templatized palette writers for 8-bit palette data
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_8bit_byte_w );
// templatized palette writers for 16-bit palette data
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_le_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_be_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_split_lo_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE8_MEMBER( palette_16bit_byte_split_hi_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_16bit_word_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_16bit_dword_le_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_16bit_dword_be_w );
// templatized palette writers for 32-bit palette data
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_32bit_word_le_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE16_MEMBER( palette_32bit_word_be_w );
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift> DECLARE_WRITE32_MEMBER( palette_32bit_dword_w );
// 3-3-2 RGB palette write handlers
DECLARE_WRITE8_MEMBER( paletteram_BBGGGRRR_byte_w );
DECLARE_WRITE8_MEMBER( paletteram_RRRGGGBB_byte_w );
DECLARE_WRITE8_MEMBER( paletteram_BBGGRRII_byte_w );
// 4-4-4 RGB palette write handlers
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_xxxxBBBBGGGGRRRR_word_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_xxxxBBBBRRRRGGGG_word_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_byte_split_hi_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_xxxxRRRRGGGGBBBB_word_w );
DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBxxxx_word_w );
// 4-4-4-4 IRGB palette write handlers
DECLARE_WRITE16_MEMBER( paletteram_IIIIRRRRGGGGBBBB_word_w );
DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBIIII_word_w );
// 5-5-5 RGB palette write handlers
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_xBBBBBGGGGGRRRRR_word_w );
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_byte_split_hi_w );
DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_be_w );
DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w );
DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w );
DECLARE_WRITE16_MEMBER( paletteram_xRRRRRGGGGGBBBBB_word_w );
DECLARE_WRITE32_MEMBER( paletteram_xRRRRRGGGGGBBBBB_dword_be_w );
DECLARE_WRITE32_MEMBER( paletteram_xRRRRRGGGGGBBBBB_dword_le_w );
DECLARE_WRITE8_MEMBER( paletteram_xGGGGGRRRRRBBBBB_byte_le_w );
DECLARE_WRITE16_MEMBER( paletteram_xGGGGGRRRRRBBBBB_word_w );
DECLARE_WRITE16_MEMBER( paletteram_xGGGGGBBBBBRRRRR_word_w );
DECLARE_WRITE16_MEMBER( paletteram_RRRRRGGGGGBBBBBx_word_w );
DECLARE_WRITE16_MEMBER( paletteram_GGGGGRRRRRBBBBBx_word_w );
DECLARE_WRITE16_MEMBER( paletteram_RRRRGGGGBBBBRGBx_word_w );
// 8-8-8 RGB palette write handlers
DECLARE_WRITE16_MEMBER( paletteram_xrgb_word_be_w );
DECLARE_WRITE16_MEMBER( paletteram_xbgr_word_be_w );
// generic input port helpers
DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read );
@ -336,22 +243,11 @@ public:
DECLARE_READ8_MEMBER( fatal_generic_read );
DECLARE_WRITE8_MEMBER( fatal_generic_write );
// generic palette init routines
DECLARE_PALETTE_INIT( all_black );
DECLARE_PALETTE_INIT( black_and_white );
DECLARE_PALETTE_INIT( monochrome_amber );
DECLARE_PALETTE_INIT( monochrome_green );
DECLARE_PALETTE_INIT( RRRR_GGGG_BBBB );
DECLARE_PALETTE_INIT( RRRRR_GGGGG_BBBBB );
DECLARE_PALETTE_INIT( BBBBB_GGGGG_RRRRR );
DECLARE_PALETTE_INIT( RRRRR_GGGGGG_BBBBB );
protected:
// helpers called at startup
virtual void driver_start();
virtual void machine_start();
virtual void sound_start();
virtual void palette_init();
virtual void video_start();
// helpers called at reset
@ -378,6 +274,7 @@ protected:
public:
// generic devices
optional_device<screen_device> m_screen;
optional_device<palette_device> m_palette;
// generic pointers
optional_shared_ptr<UINT8> m_generic_paletteram_8;
@ -422,124 +319,4 @@ device_t *driver_device_creator(const machine_config &mconfig, const char *tag,
}
//**************************************************************************
// PALETTE WRITER TEMPLATES
//**************************************************************************
// write 8-bit palette data
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE8_MEMBER(driver_device::palette_8bit_byte_w)
{
m_generic_paletteram_8[offset] = data;
UINT8 paldata = m_generic_paletteram_8[offset];
palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to consecutive 8-bit addresses with LSB first
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE8_MEMBER(driver_device::palette_16bit_byte_le_w)
{
m_generic_paletteram_8[offset] = data;
UINT16 paldata = m_generic_paletteram_8[offset & ~1] | (m_generic_paletteram_8[offset | 1] << 8);
palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to consecutive 8-bit addresses with MSB first
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE8_MEMBER(driver_device::palette_16bit_byte_be_w)
{
m_generic_paletteram_8[offset] = data;
UINT16 paldata = m_generic_paletteram_8[offset | 1] | (m_generic_paletteram_8[offset & ~1] << 8);
palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to split 8-bit addresses (LSB)
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE8_MEMBER(driver_device::palette_16bit_byte_split_lo_w)
{
m_generic_paletteram_8[offset] = data;
UINT16 paldata = m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8);
palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to split 8-bit addresses (MSB)
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE8_MEMBER(driver_device::palette_16bit_byte_split_hi_w)
{
m_generic_paletteram2_8[offset] = data;
UINT16 paldata = m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8);
palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to 16-bit addresses
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE16_MEMBER(driver_device::palette_16bit_word_w)
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
UINT16 paldata = m_generic_paletteram_16[offset];
palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 16-bit palette data to packed 32-bit addresses (lower entry in lower 16 bits)
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE32_MEMBER(driver_device::palette_16bit_dword_le_w)
{
COMBINE_DATA(&m_generic_paletteram_32[offset]);
if (ACCESSING_BITS_0_15)
{
UINT16 paldata = m_generic_paletteram_32[offset];
palette_set_color_rgb(machine(), offset * 2 + 0, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_GreenBits>(paldata >> _BlueShift));
}
if (ACCESSING_BITS_16_31)
{
UINT16 paldata = m_generic_paletteram_32[offset] >> 16;
palette_set_color_rgb(machine(), offset * 2 + 1, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_GreenBits>(paldata >> _BlueShift));
}
}
// write 16-bit palette data to packed 32-bit addresses (lower entry in upper 16 bits)
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE32_MEMBER(driver_device::palette_16bit_dword_be_w)
{
COMBINE_DATA(&m_generic_paletteram_32[offset]);
if (ACCESSING_BITS_16_31)
{
UINT16 paldata = m_generic_paletteram_32[offset] >> 16;
palette_set_color_rgb(machine(), offset * 2 + 0, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
if (ACCESSING_BITS_0_15)
{
UINT16 paldata = m_generic_paletteram_32[offset];
palette_set_color_rgb(machine(), offset * 2 + 1, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
}
// write 32-bit palette data to consecutive 16-bit addresses with LSW first
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE16_MEMBER(driver_device::palette_32bit_word_le_w)
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
UINT32 paldata = m_generic_paletteram_16[offset & ~1] | (m_generic_paletteram_16[offset | 1] << 16);
palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 32-bit palette data to consecutive 16-bit addresses with MSW first
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE16_MEMBER(driver_device::palette_32bit_word_be_w)
{
COMBINE_DATA(&m_generic_paletteram_16[offset]);
UINT32 paldata = m_generic_paletteram_16[offset | 1] | (m_generic_paletteram_16[offset & ~1] << 16);
palette_set_color_rgb(machine(), offset / 2, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
// write 32-bit palette data to 32-bit addresses
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
WRITE32_MEMBER(driver_device::palette_32bit_dword_w)
{
COMBINE_DATA(&m_generic_paletteram_32[offset]);
UINT32 paldata = m_generic_paletteram_32[offset];
palette_set_color_rgb(machine(), offset, palexpand<_RedBits>(paldata >> _RedShift), palexpand<_GreenBits>(paldata >> _GreenShift), palexpand<_BlueBits>(paldata >> _BlueShift));
}
#endif /* __DRIVER_H__ */

View File

@ -23,12 +23,13 @@
#define MCFG_MACHINE_RESET(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_MACHINE_RESET, MACHINE_RESET_NAME(_func));
#define MCFG_PALETTE_INIT(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_PALETTE_INIT, PALETTE_INIT_NAME(_func));
#define MCFG_VIDEO_START(_func) \
driver_device::static_set_callback(*owner, driver_device::CB_VIDEO_START, VIDEO_START_NAME(_func));
#define MCFG_PALETTE_INIT_LEGACY(_func) \
palette_device::static_set_init(*device, palette_init_delegate(PALETTE_INIT_NAME(_func), "palette_init_" #_func, downcast<palette_device *>(device)));
#define VIDEO_START_CALL(name) VIDEO_START_NAME(name)(machine)

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,41 @@
/******************************************************************************
/***************************************************************************
emupal.h
Emulator palette handling functions.
Palette device.
Copyright Nicola Salmoria and the MAME Team.
Visit http://mamedev.org for licensing and usage restrictions.
****************************************************************************
Copyright Aaron Giles
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
****************************************************************************
There are several levels of abstraction in the way MAME handles the palette,
and several display modes which can be used by the drivers.
@ -72,13 +102,13 @@
Shadows(Highlights) Quick Reference
-----------------------------------
1) declare MCFG_VIDEO_ATTRIBUTES( ... VIDEO_HAS_SHADOWS | VIDEO_HAS_HIGHLIGHTS ... )
1) declare MCFG_VIDEO_ATTRIBUTES( ... )
2) make a pen table fill with DRAWMODE_NONE, DRAWMODE_SOURCE or DRAWMODE_SHADOW
3) (optional) set shadow darkness or highlight brightness by
palette_set_shadow_factor(0.0-1.0) or
palette_set_highlight_factor(1.0-n.n)
set_shadow_factor(0.0-1.0) or
_set_highlight_factor(1.0-n.n)
4) before calling drawgfx use
palette_set_shadow_mode(0) to arm shadows or
@ -99,152 +129,321 @@
#define __EMUPAL_H__
/***************************************************************************
CONSTANTS
***************************************************************************/
//**************************************************************************
// CONSTANTS
//**************************************************************************
#define PALETTE_DEFAULT_SHADOW_FACTOR (0.6)
#define PALETTE_DEFAULT_HIGHLIGHT_FACTOR (1/PALETTE_DEFAULT_SHADOW_FACTOR)
#define PALETTE_INIT_NAME(_Name) palette_init_##_Name
#define DECLARE_PALETTE_INIT(_Name) void PALETTE_INIT_NAME(_Name)(palette_device &palette)
#define PALETTE_INIT(_Name) void PALETTE_INIT_NAME(_Name)(palette_device &dummy, palette_device &palette)
#define PALETTE_INIT_MEMBER(_Class, _Name) void _Class::PALETTE_INIT_NAME(_Name)(palette_device &palette)
// standard 3-3-2 formats
#define PALETTE_FORMAT_BBGGGRRR raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>)
#define PALETTE_FORMAT_RRRGGGBB raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 5,2,0>)
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// standard 2-2-2-2 formats
#define PALETTE_FORMAT_BBGGRRII raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_irgb_decoder<2,2,2,2, 0,2,4,6>)
class colortable_t;
// standard 4-4-4 formats
#define PALETTE_FORMAT_xxxxBBBBGGGGRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 0,4,8>)
#define PALETTE_FORMAT_xxxxBBBBRRRRGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 4,0,8>)
#define PALETTE_FORMAT_xxxxRRRRBBBBGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,0,4>)
#define PALETTE_FORMAT_xxxxRRRRGGGGBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,4,0>)
#define PALETTE_FORMAT_RRRRGGGGBBBBxxxx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 12,8,4>)
// standard 4-4-4-4 formats
#define PALETTE_FORMAT_IIIIRRRRGGGGBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 12,8,4,0>)
#define PALETTE_FORMAT_RRRRGGGGBBBBIIII raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 0,12,8,4>)
// standard 5-5-5 formats
#define PALETTE_FORMAT_xBBBBBGGGGGRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,5,10>)
#define PALETTE_FORMAT_xBBBBBRRRRRGGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,0,10>)
#define PALETTE_FORMAT_xRRRRRGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>)
#define PALETTE_FORMAT_xGGGGGRRRRRBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,10,0>)
#define PALETTE_FORMAT_xGGGGGBBBBBRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,10,5>)
#define PALETTE_FORMAT_RRRRRGGGGGBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 11,6,1>)
#define PALETTE_FORMAT_GGGGGRRRRRBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,11,1>)
#define PALETTE_FORMAT_RRRRGGGGBBBBRGBx raw_to_rgb_converter(2, &raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder)
#define PALETTE_FORMAT_xRGBRRRRGGGGBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::xRGBRRRRGGGGBBBB_decoder)
// standard 8-8-8 formats
#define PALETTE_FORMAT_XRGB raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 16,8,0>)
#define PALETTE_FORMAT_XBGR raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 0,8,16>)
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_PALETTE_ADD(_tag, _entries) \
MCFG_DEVICE_ADD(_tag, PALETTE, 0) \
MCFG_PALETTE_ENTRIES(_entries) \
#define MCFG_PALETTE_ADD_INIT_BLACK(_tag, _entries) \
MCFG_PALETTE_ADD(_tag, _entries) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_all_black), downcast<palette_device *>(device)));
#define MCFG_PALETTE_MODIFY MCFG_DEVICE_MODIFY
/* ----- initialization and configuration ----- */
#define MCFG_PALETTE_INIT_OWNER(_class, _method) \
palette_device::static_set_init(*device, palette_init_delegate(&_class::PALETTE_INIT_NAME(_method), #_class "::palette_init_" #_method, downcast<_class *>(owner)));
#define MCFG_PALETTE_INIT_DEVICE(_tag, _class, _method) \
palette_device::static_set_init(*device, palette_init_delegate(&_class::PALETTE_INIT_NAME(_method), #_class "::palette_init_" #_method, _tag));
/* palette initialization that takes place before the display is created */
void palette_init(running_machine &machine);
#define MCFG_PALETTE_FORMAT(_format) \
palette_device::static_set_format(*device, PALETTE_FORMAT_##_format);
#define MCFG_PALETTE_ENTRIES(_entries) \
palette_device::static_set_entries(*device, _entries);
#define MCFG_PALETTE_ENABLE_SHADOWS() \
palette_device::static_enable_shadows(*device);
#define MCFG_PALETTE_ENABLE_HILIGHTS() \
palette_device::static_enable_hilights(*device);
// standard palettes
#define MCFG_PALETTE_ADD_BLACK_AND_WHITE(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_black_and_white), downcast<palette_device *>(device)));
/* ----- shadow/hilight configuration ----- */
#define MCFG_PALETTE_ADD_WHITE_AND_BLACK(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_white_and_black), downcast<palette_device *>(device)));
/* set the global shadow brightness factor */
void palette_set_shadow_factor(running_machine &machine, double factor);
#define MCFG_PALETTE_ADD_MONOCHROME_AMBER(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_amber), downcast<palette_device *>(device)));
/* set the global highlight brightness factor */
void palette_set_highlight_factor(running_machine &machine, double factor);
#define MCFG_PALETTE_ADD_MONOCHROME_GREEN(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_green), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_BBBBBGGGGGRRRRR(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_BBBBBGGGGGRRRRR), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB(_tag) \
MCFG_PALETTE_ADD(_tag, 65536) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGGBBBBB), downcast<palette_device *>(device)));
// other standard palettes
#define MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS(_tag, _entries) \
MCFG_PALETTE_ADD(_tag, _entries) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms), downcast<palette_device *>(device)));
/* ----- shadow table configuration ----- */
/* select 1 of 4 different live shadow tables */
void palette_set_shadow_mode(running_machine &machine, int mode);
/* configure delta RGB values for 1 of 4 shadow tables */
void palette_set_shadow_dRGB32(running_machine &machine, int mode, int dr, int dg, int db, int noclip);
/* ----- colortable management ----- */
/* allocate a new colortable with the given number of entries */
colortable_t *colortable_alloc(running_machine &machine, UINT32 palettesize);
/* set the value of a colortable entry */
void colortable_entry_set_value(colortable_t *ctable, UINT32 entry, UINT16 value);
/* return the value of a colortable entry */
UINT16 colortable_entry_get_value(colortable_t *ctable, UINT32 entry);
/* change the color of a colortable palette entry */
void colortable_palette_set_color(colortable_t *ctable, UINT32 entry, rgb_t color);
/* return the color of a colortable palette entry */
rgb_t colortable_palette_get_color(colortable_t *ctable, UINT32 entry);
/* return a 32-bit transparency mask for a given gfx element and color */
UINT32 colortable_get_transpen_mask(colortable_t *ctable, gfx_element *gfx, int color, int transcolor);
/* configure groups in a tilemap to represent transparency based on colortable entries (each group maps to a gfx color) */
void colortable_configure_tilemap_groups(colortable_t *ctable, tilemap_t *tmap, gfx_element *gfx, int transcolor);
/* return the number of entries in a colortable */
UINT32 colortable_palette_get_size(colortable_t *ctable);
/* ----- utilities ----- */
/* return the pen for a fixed black color */
pen_t get_black_pen(running_machine &machine);
/* return the pen for a fixed white color */
pen_t get_white_pen(running_machine &machine);
#define MCFG_PALETTE_ADD_HARDCODED(_tag, _array) \
MCFG_PALETTE_ADD(_tag, sizeof(_array) / 3) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms), downcast<palette_device *>(device)));
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
/*-------------------------------------------------
palette_set_color - set a single palette
entry
-------------------------------------------------*/
typedef device_delegate<void (palette_device &)> palette_init_delegate;
INLINE void palette_set_color(running_machine &machine, pen_t pen, rgb_t rgb)
// ======================> raw_to_rgb_converter
class raw_to_rgb_converter
{
machine.palette->entry_set_color(pen, rgb);
}
// helper function
typedef rgb_t (*raw_to_rgb_func)(UINT32 raw);
public:
// constructor
raw_to_rgb_converter(int bytes_per_entry = 0, raw_to_rgb_func func = NULL)
: m_bytes_per_entry(bytes_per_entry),
m_func(func) { }
// getters
int bytes_per_entry() const { return m_bytes_per_entry; }
// helpers
rgb_t operator()(UINT32 raw) const { return (*m_func)(raw); }
// generic raw-to-RGB conversion helpers
template<int _RedBits, int _GreenBits, int _BlueBits, int _RedShift, int _GreenShift, int _BlueShift>
static rgb_t standard_rgb_decoder(UINT32 raw)
{
UINT8 r = palexpand<_RedBits>(raw >> _RedShift);
UINT8 g = palexpand<_GreenBits>(raw >> _GreenShift);
UINT8 b = palexpand<_BlueBits>(raw >> _BlueShift);
return rgb_t(r, g, b);
}
template<int _IntBits, int _RedBits, int _GreenBits, int _BlueBits, int _IntShift, int _RedShift, int _GreenShift, int _BlueShift>
static rgb_t standard_irgb_decoder(UINT32 raw)
{
UINT8 i = palexpand<_IntBits>(raw >> _IntShift);
UINT8 r = (i * palexpand<_RedBits>(raw >> _RedShift)) >> 8;
UINT8 g = (i * palexpand<_GreenBits>(raw >> _GreenShift)) >> 8;
UINT8 b = (i * palexpand<_BlueBits>(raw >> _BlueShift)) >> 8;
return rgb_t(r, g, b);
}
// other standard decoders
static rgb_t RRRRGGGGBBBBRGBx_decoder(UINT32 raw); // bits 3/2/1 are LSb
static rgb_t xRGBRRRRGGGGBBBB_decoder(UINT32 raw); // bits 14/13/12 are LSb
private:
// internal data
int m_bytes_per_entry;
raw_to_rgb_func m_func;
};
/*-------------------------------------------------
palette_set_color_rgb - set a single palette
entry with individual R,G,B components
-------------------------------------------------*/
// ======================> palette_device
INLINE void palette_set_color_rgb(running_machine &machine, pen_t pen, UINT8 r, UINT8 g, UINT8 b)
// device type definition
extern const device_type PALETTE;
class palette_device : public device_t
{
machine.palette->entry_set_color(pen, rgb_t(r, g, b));
}
static const int MAX_SHADOW_PRESETS = 4;
public:
// construction/destruction
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_init(device_t &device, palette_init_delegate init);
static void static_set_format(device_t &device, raw_to_rgb_converter raw_to_rgb);
static void static_set_entries(device_t &device, int entries);
static void static_enable_shadows(device_t &device);
static void static_enable_hilights(device_t &device);
// getters
int entries() const { return m_entries; }
int indirect_entries() const { return m_indirect_entry.count(); }
palette_t *palette() const { return m_palette; }
const pen_t &pen(int index) const { return m_pens[index]; }
const pen_t *pens() const { return m_pens; }
pen_t *shadow_table() const { return m_shadow_table; }
rgb_t pen_color(pen_t pen) { return m_palette->entry_color(pen); }
double pen_contrast(pen_t pen) { return m_palette->entry_contrast(pen); }
pen_t black_pen() const { return m_black_pen; }
pen_t white_pen() const { return m_white_pen; }
memory_array &basemem() { return m_paletteram; }
memory_array &extmem() { return m_paletteram_ext; }
bool shadows_enabled() { return m_enable_shadows; }
bool hilights_enabled() { return m_enable_hilights; }
// setters
void set_pen_color(pen_t pen, rgb_t rgb) { m_palette->entry_set_color(pen, rgb); }
void set_pen_color(pen_t pen, UINT8 r, UINT8 g, UINT8 b) { m_palette->entry_set_color(pen, rgb_t(r, g, b)); }
void set_pen_colors(pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) set_pen_color(color_base++, *colors++); }
void set_pen_contrast(pen_t pen, double bright) { m_palette->entry_set_contrast(pen, bright); }
// indirection (aka colortables)
UINT16 pen_indirect(int index) const { return m_indirect_entry[index]; }
rgb_t indirect_color(int index) const { return m_indirect_colors[index]; }
void set_indirect_color(int index, rgb_t rgb);
void set_pen_indirect(pen_t pen, UINT16 index);
UINT32 transpen_mask(gfx_element &gfx, int color, int transcolor);
void configure_tilemap_groups(tilemap_t &tmap, gfx_element &gfx, int transcolor);
// shadow config
void set_shadow_factor(double factor) { assert(m_shadow_group != 0); m_palette->group_set_contrast(m_shadow_group, factor); }
void set_highlight_factor(double factor) { assert(m_hilight_group != 0); m_palette->group_set_contrast(m_hilight_group, factor); }
void set_shadow_mode(int mode) { assert(mode >= 0 && mode < MAX_SHADOW_PRESETS); m_shadow_table = m_shadow_tables[mode].base; }
// generic read/write handlers
DECLARE_WRITE8_MEMBER(write);
DECLARE_WRITE8_MEMBER(write_ext);
DECLARE_WRITE16_MEMBER(write);
DECLARE_WRITE16_MEMBER(write_ext);
DECLARE_WRITE32_MEMBER(write);
// generic palette init routines
void palette_init_all_black(palette_device &palette);
void palette_init_black_and_white(palette_device &palette);
void palette_init_white_and_black(palette_device &palette);
void palette_init_monochrome_amber(palette_device &palette);
void palette_init_monochrome_green(palette_device &palette);
void palette_init_RRRRGGGGBBBB_proms(palette_device &palette);
void palette_init_RRRRRGGGGGBBBBB(palette_device &palette);
void palette_init_BBBBBGGGGGRRRRR(palette_device &palette);
void palette_init_RRRRRGGGGGGBBBBB(palette_device &palette);
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const;
virtual void device_start();
virtual void device_pre_save();
virtual void device_post_load();
virtual void device_stop();
void allocate_palette();
void allocate_color_tables();
void allocate_shadow_tables();
void update_for_write(offs_t byte_offset, int bytes_modified);
public: // needed by konamigx
void set_shadow_dRGB32(int mode, int dr, int dg, int db, bool noclip);
protected:
void configure_rgb_shadows(int mode, float factor);
private:
// configuration state
int m_entries; // number of entries in the palette
bool m_enable_shadows; // are shadows enabled?
bool m_enable_hilights; // are hilights enabled?
// palette RAM
raw_to_rgb_converter m_raw_to_rgb; // format of palette RAM
memory_array m_paletteram; // base memory
memory_array m_paletteram_ext; // extended memory
// internal state
palette_t * m_palette; // the palette itself
const pen_t * m_pens; // remapped palette pen numbers
bitmap_format m_format; // format assumed for palette data
pen_t * m_shadow_table; // table for looking up a shadowed pen
UINT32 m_shadow_group; // index of the shadow group, or 0 if none
UINT32 m_hilight_group; // index of the hilight group, or 0 if none
pen_t m_white_pen; // precomputed white pen value
pen_t m_black_pen; // precomputed black pen value
// indirection state
dynamic_array<rgb_t> m_indirect_colors; // actual colors set for indirection
dynamic_array<UINT16> m_indirect_entry; // indirection values
struct shadow_table_data
{
pen_t * base; // pointer to the base of the table
INT16 dr; // delta red value
INT16 dg; // delta green value
INT16 db; // delta blue value
bool noclip; // clip?
};
shadow_table_data m_shadow_tables[MAX_SHADOW_PRESETS]; // array of shadow table data
dynamic_array<pen_t> m_save_pen; // pens for save/restore
dynamic_array<float> m_save_contrast; // brightness for save/restore
dynamic_array<pen_t> m_pen_array;
dynamic_array<pen_t> m_shadow_array;
dynamic_array<pen_t> m_hilight_array;
palette_init_delegate m_init;
};
// device type iterator
typedef device_type_iterator<&device_creator<palette_device>, palette_device> palette_device_iterator;
/*-------------------------------------------------
palette_get_color - return a single palette
entry
-------------------------------------------------*/
INLINE rgb_t palette_get_color(running_machine &machine, pen_t pen)
{
return machine.palette->entry_color(pen);
}
/*-------------------------------------------------
palette_set_pen_contrast - set the per-pen
contrast factor
-------------------------------------------------*/
INLINE void palette_set_pen_contrast(running_machine &machine, pen_t pen, double bright)
{
machine.palette->entry_set_contrast(pen, bright);
}
/*-------------------------------------------------
palette_set_colors - set multiple palette
entries from an array of rgb_t values
-------------------------------------------------*/
INLINE void palette_set_colors(running_machine &machine, pen_t color_base, const rgb_t *colors, int color_count)
{
while (color_count--)
machine.palette->entry_set_color(color_base++, *colors++);
}
#endif /* __PALETTE_H__ */
#endif // __EMUPAL_H__

View File

@ -140,7 +140,6 @@ const char info_xml_creator::s_dtd_string[] =
"\t\t\t<!ATTLIST driver cocktail (good|imperfect|preliminary) #IMPLIED>\n"
"\t\t\t<!ATTLIST driver protection (good|imperfect|preliminary) #IMPLIED>\n"
"\t\t\t<!ATTLIST driver savestate (supported|unsupported) #REQUIRED>\n"
"\t\t\t<!ATTLIST driver palettesize CDATA #REQUIRED>\n"
"\t\t<!ELEMENT device (instance*, extension*)>\n"
"\t\t\t<!ATTLIST device type CDATA #REQUIRED>\n"
"\t\t\t<!ATTLIST device tag CDATA #IMPLIED>\n"
@ -1193,8 +1192,6 @@ void info_xml_creator::output_driver()
else
fprintf(m_output, " savestate=\"unsupported\"");
fprintf(m_output, " palettesize=\"%d\"", m_drivlist.config().m_total_colors);
fprintf(m_output, "/>\n");
}

View File

@ -112,17 +112,11 @@ static char giant_string_buffer[65536] = { 0 };
running_machine::running_machine(const machine_config &_config, osd_interface &osd, bool exit_to_game_select)
: firstcpu(NULL),
primary_screen(NULL),
palette(NULL),
pens(NULL),
colortable(NULL),
shadow_table(NULL),
debug_flags(0),
palette_data(NULL),
romload_data(NULL),
ui_input_data(NULL),
debugcpu_data(NULL),
generic_machine_data(NULL),
m_config(_config),
m_system(_config.gamedrv()),
m_osd(osd),
@ -233,7 +227,6 @@ void running_machine::start()
config_init(*this);
m_input = auto_alloc(*this, input_manager(*this));
output_init(*this);
palette_init(*this);
m_render = auto_alloc(*this, render_manager(*this));
generic_machine_init(*this);

View File

@ -226,7 +226,6 @@ public:
// configuration helpers
device_t &add_dynamic_device(device_t &owner, device_type type, const char *tag, UINT32 clock);
UINT32 total_colors() const { return m_config.m_total_colors; }
// immediate operations
int run(bool firstrun);
@ -269,18 +268,11 @@ public:
// video-related information
screen_device * primary_screen; // the primary screen device, or NULL if screenless
palette_t * palette; // global palette object
// palette-related information
const pen_t * pens; // remapped palette pen numbers
colortable_t * colortable; // global colortable for remapping
pen_t * shadow_table; // table for looking up a shadowed pen
// debugger-related information
UINT32 debug_flags; // the current debug flags
// internal core information
palette_private * palette_data; // internal data from palette.c
romload_private * romload_data; // internal data from romload.c
ui_input_private * ui_input_data; // internal data from uiinput.c
debugcpu_private * debugcpu_data; // internal data from debugcpu.c

View File

@ -819,7 +819,7 @@ void laserdisc_device::init_video()
for (int index = 0; index < ARRAY_LENGTH(m_overbitmap); index++)
{
m_overbitmap[index].set_format(format, texformat);
m_overbitmap[index].set_palette(machine().palette);
m_overbitmap[index].set_palette(machine().first_screen()->palette()->palette());
m_overbitmap[index].resize(m_overwidth, m_overheight);
}

View File

@ -70,11 +70,22 @@ DEVICE_START( s3c2400 )
const device_type S3C2400 = &device_creator<s3c2400_device>;
s3c2400_device::s3c2400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, S3C2400, "Samsung S3C2400", tag, owner, clock, "s3c2400", __FILE__)
: device_t(mconfig, S3C2400, "Samsung S3C2400", tag, owner, clock, "s3c2400", __FILE__),
m_palette(*this)
{
m_token = global_alloc_clear(s3c24xx_t);
}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void s3c2400_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<s3c2400_device &>(device).m_palette.set_tag(tag);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
@ -91,6 +102,8 @@ void s3c2400_device::device_config_complete()
void s3c2400_device::device_start()
{
s3c24xx_t *s3c24xx = get_token(this);
s3c24xx->m_palette = m_palette;
DEVICE_START_NAME( s3c2400 )(this);
}

View File

@ -14,9 +14,10 @@
#define S3C2400_TAG "s3c2400"
#define MCFG_S3C2400_ADD(_tag, _clock, _config) \
#define MCFG_S3C2400_ADD(_tag, _clock, _config, _palette_tag) \
MCFG_DEVICE_ADD(_tag, S3C2400, _clock) \
MCFG_DEVICE_CONFIG(_config)
MCFG_DEVICE_CONFIG(_config) \
s3c2400_device::static_set_palette_tag(*device, "^" _palette_tag);
#define S3C2400_INTERFACE(name) \
const s3c2400_interface(name) =
@ -38,6 +39,9 @@ public:
s3c2400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~s3c2400_device() { global_free(m_token); }
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
@ -48,6 +52,7 @@ public:
private:
// internal state
void *m_token;
required_device<palette_device> m_palette;
public:
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
@ -752,7 +757,7 @@ struct s3c24xx_t
devcb_resolved_write8 address_w;
devcb_resolved_read8 nand_data_r;
devcb_resolved_write8 nand_data_w;
palette_device *m_palette;
};
#endif

View File

@ -73,11 +73,22 @@ DEVICE_START( s3c2410 )
const device_type S3C2410 = &device_creator<s3c2410_device>;
s3c2410_device::s3c2410_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, S3C2410, "Samsung S3C2410", tag, owner, clock, "s3c2410", __FILE__)
: device_t(mconfig, S3C2410, "Samsung S3C2410", tag, owner, clock, "s3c2410", __FILE__),
m_palette(*this)
{
m_token = global_alloc_clear(s3c24xx_t);
}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void s3c2410_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<s3c2410_device &>(device).m_palette.set_tag(tag);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
@ -94,6 +105,8 @@ void s3c2410_device::device_config_complete()
void s3c2410_device::device_start()
{
s3c24xx_t *s3c24xx = get_token(this);
s3c24xx->m_palette = m_palette;
DEVICE_START_NAME( s3c2410 )(this);
}

View File

@ -14,9 +14,10 @@
#define S3C2410_TAG "s3c2410"
#define MCFG_S3C2410_ADD(_tag, _clock, _config) \
#define MCFG_S3C2410_ADD(_tag, _clock, _config, _palette_tag) \
MCFG_DEVICE_ADD(_tag, S3C2410, _clock) \
MCFG_DEVICE_CONFIG(_config)
MCFG_DEVICE_CONFIG(_config) \
s3c2410_device::static_set_palette_tag(*device, "^" _palette_tag);
#define S3C2410_INTERFACE(name) \
const s3c2410_interface(name) =
@ -46,6 +47,9 @@ public:
s3c2410_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~s3c2410_device() { global_free(m_token); }
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
// device-level overrides
@ -55,6 +59,7 @@ public:
private:
// internal state
void *m_token;
required_device<palette_device> m_palette;
public:
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
@ -899,7 +904,7 @@ struct s3c24xx_t
devcb_resolved_write8 address_w;
devcb_resolved_read8 nand_data_r;
devcb_resolved_write8 nand_data_w;
palette_device *m_palette;
};
#endif

View File

@ -75,11 +75,23 @@ DEVICE_START( s3c2440 )
const device_type S3C2440 = &device_creator<s3c2440_device>;
s3c2440_device::s3c2440_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, S3C2440, "Samsung S3C2440", tag, owner, clock, "s3c2440", __FILE__)
: device_t(mconfig, S3C2440, "Samsung S3C2440", tag, owner, clock, "s3c2440", __FILE__),
m_palette(*this)
{
m_token = global_alloc_clear(s3c24xx_t);
}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void s3c2440_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<s3c2440_device &>(device).m_palette.set_tag(tag);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
@ -96,6 +108,8 @@ void s3c2440_device::device_config_complete()
void s3c2440_device::device_start()
{
s3c24xx_t *s3c24xx = get_token(this);
s3c24xx->m_palette = m_palette;
DEVICE_START_NAME( s3c2440 )(this);
}

View File

@ -13,9 +13,10 @@
#define S3C2440_TAG "s3c2440"
#define MCFG_S3C2440_ADD(_tag, _clock, _config) \
#define MCFG_S3C2440_ADD(_tag, _clock, _config, _palette_tag) \
MCFG_DEVICE_ADD(_tag, S3C2440, _clock) \
MCFG_DEVICE_CONFIG(_config)
MCFG_DEVICE_CONFIG(_config) \
s3c2440_device::static_set_palette_tag(*device, "^" _palette_tag);
#define S3C2440_INTERFACE(name) \
const s3c2440_interface(name) =
@ -46,6 +47,9 @@ public:
s3c2440_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~s3c2440_device() { global_free(m_token); }
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
protected:
@ -56,6 +60,7 @@ protected:
private:
// internal state
void *m_token;
required_device<palette_device> m_palette;
public:
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
};
@ -971,6 +976,7 @@ struct s3c24xx_t
devcb_resolved_write8 address_w;
devcb_resolved_read8 nand_data_r;
devcb_resolved_write8 nand_data_w;
palette_device *m_palette;
};
#endif

View File

@ -624,7 +624,7 @@ static void s3c24xx_lcd_render_tft_01( device_t *device)
UINT32 data = s3c24xx_lcd_dma_read( device);
for (int j = 0; j < 32; j++)
{
*scanline++ = palette_get_color( device->machine(), (data >> 31) & 0x01);
*scanline++ = s3c24xx->m_palette->pen_color((data >> 31) & 0x01);
data = data << 1;
s3c24xx->lcd.hpos++;
if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 4))
@ -648,7 +648,7 @@ static void s3c24xx_lcd_render_tft_02( device_t *device)
UINT32 data = s3c24xx_lcd_dma_read( device);
for (int j = 0; j < 16; j++)
{
*scanline++ = palette_get_color( device->machine(), (data >> 30) & 0x03);
*scanline++ = s3c24xx->m_palette->pen_color((data >> 30) & 0x03);
data = data << 2;
s3c24xx->lcd.hpos++;
if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 3))
@ -672,7 +672,7 @@ static void s3c24xx_lcd_render_tft_04( device_t *device)
UINT32 data = s3c24xx_lcd_dma_read( device);
for (int j = 0; j < 8; j++)
{
*scanline++ = palette_get_color( device->machine(), (data >> 28) & 0x0F);
*scanline++ = s3c24xx->m_palette->pen_color((data >> 28) & 0x0F);
data = data << 4;
s3c24xx->lcd.hpos++;
if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 2))
@ -696,7 +696,7 @@ static void s3c24xx_lcd_render_tft_08( device_t *device)
UINT32 data = s3c24xx_lcd_dma_read( device);
for (int j = 0; j < 4; j++)
{
*scanline++ = palette_get_color( device->machine(), (data >> 24) & 0xFF);
*scanline++ = s3c24xx->m_palette->pen_color((data >> 24) & 0xFF);
data = data << 8;
s3c24xx->lcd.hpos++;
if (s3c24xx->lcd.hpos >= s3c24xx->lcd.hpos_min + (s3c24xx->lcd.pagewidth_max << 1))
@ -1040,7 +1040,7 @@ static WRITE32_DEVICE_HANDLER( s3c24xx_lcd_palette_w )
{
verboselog( device->machine(), 0, "s3c24xx_lcd_palette_w: unknown mask %08x\n", mem_mask);
}
palette_set_color( device->machine(), offset, s3c24xx_get_color_tft_16( device, data & 0xFFFF));
s3c24xx->m_palette->set_pen_color( offset, s3c24xx_get_color_tft_16( device, data & 0xFFFF));
}
/* Clock & Power Management */

View File

@ -46,7 +46,7 @@ WRITE8_MEMBER(tc0091lvc_device::tc0091lvc_paletteram_w)
g |= ((i & 2) >> 1);
r |= (i & 1);
palette_set_color_rgb(machine(), offset / 2, pal5bit(r), pal5bit(g), pal5bit(b));
m_palette->set_pen_color(offset / 2, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
@ -168,7 +168,8 @@ tc0091lvc_device::tc0091lvc_device(const machine_config &mconfig, const char *ta
: device_t(mconfig, TC0091LVC, "TC0091LVC", tag, owner, clock, "tc0091lvc", __FILE__),
device_memory_interface(mconfig, *this),
m_space_config("tc0091lvc", ENDIANNESS_LITTLE, 8,20, 0, NULL, *ADDRESS_MAP_NAME(tc0091lvc_map8)),
m_gfxdecode(*this)
m_gfxdecode(*this),
m_palette(*this)
{
}
@ -183,6 +184,16 @@ void tc0091lvc_device::static_set_gfxdecode_tag(device_t &device, const char *ta
}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void tc0091lvc_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<tc0091lvc_device &>(device).m_palette.set_tag(tag);
}
void tc0091lvc_device::device_config_complete()
{
@ -289,7 +300,7 @@ void tc0091lvc_device::device_start()
//printf("m_gfx_index %d\n", m_gfx_index);
m_gfxdecode->set_gfx(m_gfx_index, auto_alloc(machine(), gfx_element(machine(), char_layout, (UINT8 *)m_pcg_ram, machine().total_colors() / 16, 0)));
m_gfxdecode->set_gfx(m_gfx_index, auto_alloc(machine(), gfx_element(machine(), char_layout, (UINT8 *)m_pcg_ram, m_palette->entries() / 16, 0)));
}
void tc0091lvc_device::device_reset()
@ -328,7 +339,7 @@ void tc0091lvc_device::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap
fy = !fy;
}
gfx->prio_transpen(bitmap,cliprect,spr_offs,col,fx,fy,x,y,screen.priority(),(col & 0x08) ? 0xaa : 0x00,0);
gfx->prio_transpen(m_palette,bitmap,cliprect,spr_offs,col,fx,fy,x,y,screen.priority(),(col & 0x08) ? 0xaa : 0x00,0);
}
}
@ -338,7 +349,7 @@ UINT32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
int x,y;
UINT8 global_flip;
bitmap.fill(get_black_pen(screen.machine()), cliprect);
bitmap.fill(m_palette->black_pen(), cliprect);
if((m_vregs[4] & 0x20) == 0)
return 0;
@ -359,7 +370,7 @@ UINT32 tc0091lvc_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
res_y = (global_flip) ? 256-y : y;
if(screen.visible_area().contains(res_x, res_y))
bitmap.pix16(res_y, res_x) = screen.machine().pens[m_bitmap_ram[count]];
bitmap.pix16(res_y, res_x) = m_palette->pen(m_bitmap_ram[count]);
count++;
}

View File

@ -19,6 +19,7 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
static void static_set_palette_tag(device_t &device, const char *tag);
DECLARE_READ8_MEMBER( vregs_r );
DECLARE_WRITE8_MEMBER( vregs_w );
@ -80,6 +81,7 @@ protected:
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
address_space_config m_space_config;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
extern const device_type TC0091LVC;
@ -87,5 +89,8 @@ extern const device_type TC0091LVC;
#define MCFG_TC0091LVC_GFXDECODE(_gfxtag) \
tc0091lvc_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);
#define MCFG_TC0091LVC_PALETTE(_palette_tag) \
tc0091lvc_device::static_set_palette_tag(*device, "^" _palette_tag);
#endif

View File

@ -28,7 +28,6 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
m_nvram_handler(NULL),
m_memcard_handler(NULL),
m_video_attributes(0),
m_total_colors(0),
m_default_layout(NULL),
m_gamedrv(gamedrv),
m_options(options),

View File

@ -37,12 +37,6 @@
// indicates VIDEO_UPDATE will add container bits its
#define VIDEO_SELF_RENDER 0x0008
// automatically extend the palette creating a darker copy for shadows
#define VIDEO_HAS_SHADOWS 0x0010
// automatically extend the palette creating a brighter copy for highlights
#define VIDEO_HAS_HIGHLIGHTS 0x0020
// force VIDEO_UPDATE to be called even for skipped frames
#define VIDEO_ALWAYS_UPDATE 0x0080
@ -117,7 +111,6 @@ public:
// other parameters
UINT32 m_video_attributes; // flags describing the video system
UINT32 m_total_colors; // total number of colors in the palette
const char * m_default_layout; // default layout for this machine
// helpers during configuration; not for general use
@ -198,8 +191,6 @@ ATTR_COLD device_t *MACHINE_CONFIG_NAME(_name)(machine_config &config, device_t
// core video parameters
#define MCFG_VIDEO_ATTRIBUTES(_flags) \
config.m_video_attributes = _flags;
#define MCFG_PALETTE_LENGTH(_length) \
config.m_total_colors = _length;
#define MCFG_DEFAULT_LAYOUT(_layout) \
config.m_default_layout = &(_layout)[0];

View File

@ -612,18 +612,18 @@ render_container::render_container(render_manager &manager, screen_device *scree
empty();
// if we have a screen, read and apply the options
if (screen != NULL)
if (m_screen != NULL)
{
// set the initial orientation and brightness/contrast/gamma
m_user.m_orientation = manager.machine().system().flags & ORIENTATION_MASK;
m_user.m_brightness = manager.machine().options().brightness();
m_user.m_contrast = manager.machine().options().contrast();
m_user.m_gamma = manager.machine().options().gamma();
// allocate a client to the main palette
if (m_screen->palette() != NULL)
m_palclient = global_alloc(palette_client(*m_screen->palette()->palette()));
}
// allocate a client to the main palette
if (manager.machine().palette != NULL)
m_palclient = global_alloc(palette_client(*manager.machine().palette));
recompute_lookups();
}

View File

@ -297,5 +297,17 @@ inline void save_manager::save_item(const char *module, const char *tag, int ind
save_memory(module, tag, index, name, &value[0], sizeof(UINT64), value.count());
}
template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, dynamic_array<float> &value, const char *name)
{
save_memory(module, tag, index, name, &value[0], sizeof(float), value.count());
}
template<>
inline void save_manager::save_item(const char *module, const char *tag, int index, dynamic_array<double> &value, const char *name)
{
save_memory(module, tag, index, name, &value[0], sizeof(double), value.count());
}
#endif /* __SAVE_H__ */

View File

@ -53,10 +53,13 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev
m_yoffset(0.0f),
m_xscale(1.0f),
m_yscale(1.0f),
m_palette_tag(NULL),
m_palette_base(0),
m_container(NULL),
m_width(100),
m_height(100),
m_visarea(0, 99, 0, 99),
m_palette(NULL),
m_curbitmap(0),
m_curtexture(0),
m_changed(true),
@ -212,6 +215,19 @@ void screen_device::static_set_screen_vblank(device_t &device, screen_vblank_del
}
//-------------------------------------------------
// static_set_palette - set the screen palette
// configuration
//-------------------------------------------------
void screen_device::static_set_palette(device_t &device, const char *palette, int base)
{
screen_device &screen = downcast<screen_device &>(device);
screen.m_palette_tag = palette;
screen.m_palette_base = base;
}
//-------------------------------------------------
// device_validity_check - verify device
// configuration
@ -237,6 +253,10 @@ void screen_device::device_validity_check(validity_checker &valid) const
// check for zero frame rate
if (m_refresh == 0)
mame_printf_error("Invalid (zero) refresh rate\n");
// check for valid palette
if (m_palette_tag != NULL && siblingdevice(m_palette_tag) == NULL)
mame_printf_error("Unable to location specified palette '%s'\n", m_palette_tag);
}
@ -250,9 +270,26 @@ void screen_device::device_start()
m_screen_update_ind16.bind_relative_to(*owner());
m_screen_update_rgb32.bind_relative_to(*owner());
m_screen_vblank.bind_relative_to(*owner());
// find our palette: first find the specified device, otherwise look for a subdevice
// named 'palette'; finally, look for a global 'palette' at the root
if (m_palette_tag != NULL)
m_palette = siblingdevice<palette_device>(m_palette_tag);
if (m_palette == NULL)
m_palette = subdevice<palette_device>("palette");
if (m_palette == NULL)
m_palette = subdevice<palette_device>(":palette");
// if we have a palette and it's not started, wait for it
if (m_palette != NULL && !m_palette->started())
throw device_missing_dependencies();
// configure bitmap formats and allocate screen bitmaps
texture_format texformat = !m_screen_update_ind16.isnull() ? TEXFORMAT_PALETTE16 : TEXFORMAT_RGB32;
if (m_palette == NULL && texformat == TEXFORMAT_PALETTE16)
throw emu_fatalerror("Screen does not have palette defined\n");
for (int index = 0; index < ARRAY_LENGTH(m_bitmap); index++)
{
m_bitmap[index].set_format(format(), texformat);
@ -495,6 +532,11 @@ void screen_device::realloc_screen_bitmaps()
item->m_bitmap.resize(effwidth, effheight);
// re-set up textures
if (m_palette != NULL)
{
m_bitmap[0].set_palette(m_palette->palette());
m_bitmap[1].set_palette(m_palette->palette());
}
m_texture[0]->set_bitmap(m_bitmap[0], m_visarea, m_bitmap[0].texformat());
m_texture[1]->set_bitmap(m_bitmap[1], m_visarea, m_bitmap[1].texformat());
}
@ -752,7 +794,8 @@ void screen_device::register_screen_bitmap(bitmap_t &bitmap)
// if allocating now, just do it
bitmap.allocate(width(), height());
bitmap.set_palette(machine().palette);
if (m_palette != NULL)
bitmap.set_palette(m_palette->palette());
}
@ -880,7 +923,7 @@ void screen_device::update_burnin()
{
UINT64 *dst = &m_burnin.pix64(y);
const UINT16 *src = &srcbitmap.pix16(srcy >> 16);
const rgb_t *palette = machine().palette->entry_list_adjusted();
const rgb_t *palette = m_palette->palette()->entry_list_adjusted();
for (x = 0, srcx = xstart; x < dstwidth; x++, srcx += xstep)
{
rgb_t pixel = palette[src[srcx >> 16]];

View File

@ -165,11 +165,12 @@ public:
static void static_set_screen_update(device_t &device, screen_update_ind16_delegate callback);
static void static_set_screen_update(device_t &device, screen_update_rgb32_delegate callback);
static void static_set_screen_vblank(device_t &device, screen_vblank_delegate callback);
static void static_set_palette(device_t &device, const char *palette, int base);
// information getters
render_container &container() const { assert(m_container != NULL); return *m_container; }
bitmap_ind8 &priority() { return m_priority; }
palette_device *palette() { return m_palette; }
// dynamic configuration
void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period);
void reset_origin(int beamy = 0, int beamx = 0);
@ -245,6 +246,8 @@ private:
screen_update_ind16_delegate m_screen_update_ind16; // screen update callback (16-bit palette)
screen_update_rgb32_delegate m_screen_update_rgb32; // screen update callback (32-bit RGB)
screen_vblank_delegate m_screen_vblank; // screen vblank callback
const char * m_palette_tag; // tag to our palette
int m_palette_base; // base of our palette
// internal state
render_container * m_container; // pointer to our container
@ -255,6 +258,7 @@ private:
rectangle m_visarea; // current visible area (HBLANK end/start, VBLANK end/start)
// textures and bitmaps
palette_device * m_palette; // our palette
texture_format m_texformat; // texture format
render_texture * m_texture[2]; // 2x textures for the screen bitmap
screen_bitmap m_bitmap[2]; // 2x bitmaps for rendering
@ -366,6 +370,9 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
screen_device::static_set_screen_vblank(*device, screen_vblank_delegate(&_class::_method, #_class "::" #_method, NULL, (_class *)0));
#define MCFG_SCREEN_VBLANK_DEVICE(_device, _class, _method) \
screen_device::static_set_screen_vblank(*device, screen_vblank_delegate(&_class::_method, #_class "::" #_method, _device, (_class *)0));
#define MCFG_SCREEN_PALETTE(_palette_tag) \
screen_device::static_set_palette(*device, _palette_tag, 0);
//**************************************************************************

View File

@ -124,7 +124,7 @@
// VICE palette
static const rgb_t PALETTE[] =
static const rgb_t PALETTE_MOS[] =
{
rgb_t(0x00, 0x00, 0x00),
rgb_t(0xff, 0xff, 0xff),
@ -177,14 +177,14 @@ void mos6560_device::draw_character( int ybegin, int yend, int ch, int yoff, int
{
code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff);
m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE[color[code >> 7]];
m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE[color[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE[color[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE[color[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE[color[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE[color[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE[color[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE[color[code & 1]];
m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE_MOS[color[code >> 7]];
m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE_MOS[color[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE_MOS[color[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE_MOS[color[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 1]];
}
}
@ -202,13 +202,13 @@ void mos6560_device::draw_character_multi( int ybegin, int yend, int ch, int yof
code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff);
m_bitmap.pix32(y + yoff, xoff + 0) =
m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE[color[code >> 6]];
m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE_MOS[color[code >> 6]];
m_bitmap.pix32(y + yoff, xoff + 2) =
m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE[color[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE_MOS[color[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, xoff + 4) =
m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE[color[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE_MOS[color[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, xoff + 6) =
m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE[color[code & 3]];
m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE_MOS[color[code & 3]];
}
}
@ -230,7 +230,7 @@ void mos6560_device::drawlines( int first, int last )
for (line = first; (line < m_ypos) && (line < last); line++)
{
for (j = 0; j < m_total_xsize; j++)
m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor];
}
for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);)
@ -254,7 +254,7 @@ void mos6560_device::drawlines( int first, int last )
{
for (i = ybegin; i <= yend; i++)
for (j = 0; j < m_xpos; j++)
m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor];
}
for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++)
@ -301,7 +301,7 @@ void mos6560_device::drawlines( int first, int last )
{
for (i = ybegin; i <= yend; i++)
for (j = xoff; j < m_total_xsize; j++)
m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
m_bitmap.pix32(yoff + i, j) = PALETTE_MOS[m_framecolor];
}
if (m_matrix8x16)
@ -318,7 +318,7 @@ void mos6560_device::drawlines( int first, int last )
for (; line < last; line++)
for (j = 0; j < m_total_xsize; j++)
m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
m_bitmap.pix32(line, j) = PALETTE_MOS[m_framecolor];
}

View File

@ -84,7 +84,7 @@
#define TED7360_VRETRACERATE ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_VRETRACERATE : TED7360NTSC_VRETRACERATE)
#define TED7360_LINES ((m_clock == TED7360PAL_CLOCK) ? TED7360PAL_LINES : TED7360NTSC_LINES)
static const rgb_t PALETTE[] =
static const rgb_t PALETTE_MOS[] =
{
/* black, white, red, cyan */
/* purple, green, blue, yellow */
@ -488,14 +488,14 @@ void mos7360_device::draw_character(int ybegin, int yend, int ch, int yoff, int
else
code = read_ram(m_chargenaddr + ch * 8 + y);
m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[color[code >> 7]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[color[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[color[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[color[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[color[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[color[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[color[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[color[code & 1]];
m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[color[code >> 7]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[color[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[color[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[color[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[color[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[color[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[color[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[color[code & 1]];
}
}
@ -511,13 +511,13 @@ void mos7360_device::draw_character_multi(int ybegin, int yend, int ch, int yoff
code = read_ram(m_chargenaddr + ch * 8 + y);
m_bitmap.pix32(y + yoff, 0 + xoff) =
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_multi[code >> 6]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_multi[code >> 6]];
m_bitmap.pix32(y + yoff, 2 + xoff) =
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_multi[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_multi[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, 4 + xoff) =
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_multi[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_multi[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, 6 + xoff) =
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_multi[code & 3]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_multi[code & 3]];
}
}
@ -529,14 +529,14 @@ void mos7360_device::draw_bitmap(int ybegin, int yend, int ch, int yoff, int xof
{
code = read_ram(m_bitmapaddr + ch * 8 + y);
m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE[m_c16_bitmap[code >> 7]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_c16_bitmap[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE[m_c16_bitmap[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_c16_bitmap[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE[m_c16_bitmap[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_c16_bitmap[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE[m_c16_bitmap[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_c16_bitmap[code & 1]];
m_bitmap.pix32(y + yoff, 0 + xoff) = PALETTE_MOS[m_c16_bitmap[code >> 7]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 6) & 1]];
m_bitmap.pix32(y + yoff, 2 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 5) & 1]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 4) & 1]];
m_bitmap.pix32(y + yoff, 4 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 3) & 1]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 2) & 1]];
m_bitmap.pix32(y + yoff, 6 + xoff) = PALETTE_MOS[m_c16_bitmap[(code >> 1) & 1]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_c16_bitmap[code & 1]];
}
}
@ -549,13 +549,13 @@ void mos7360_device::draw_bitmap_multi(int ybegin, int yend, int ch, int yoff, i
code = read_ram(m_bitmapaddr + ch * 8 + y);
m_bitmap.pix32(y + yoff, 0 + xoff) =
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE[m_bitmapmulti[code >> 6]];
m_bitmap.pix32(y + yoff, 1 + xoff) = PALETTE_MOS[m_bitmapmulti[code >> 6]];
m_bitmap.pix32(y + yoff, 2 + xoff) =
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE[m_bitmapmulti[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, 3 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 4) & 3]];
m_bitmap.pix32(y + yoff, 4 + xoff) =
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE[m_bitmapmulti[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, 5 + xoff) = PALETTE_MOS[m_bitmapmulti[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, 6 + xoff) =
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE[m_bitmapmulti[code & 3]];
m_bitmap.pix32(y + yoff, 7 + xoff) = PALETTE_MOS[m_bitmapmulti[code & 3]];
}
}
@ -567,7 +567,7 @@ void mos7360_device::draw_cursor(int ybegin, int yend, int yoff, int xoff, int c
{
for (int x = 0; x < 8; x++)
{
m_bitmap.pix32(y + yoff, x + xoff) = PALETTE[color];
m_bitmap.pix32(y + yoff, x + xoff) = PALETTE_MOS[color];
}
}
}
@ -595,7 +595,7 @@ void mos7360_device::drawlines(int first, int last)
{
for (int x = 0; x < m_bitmap.width(); x++)
{
m_bitmap.pix32(line, x) = PALETTE[0];
m_bitmap.pix32(line, x) = PALETTE_MOS[0];
}
}
return;
@ -615,7 +615,7 @@ void mos7360_device::drawlines(int first, int last)
{
for (int x = 0; x < m_bitmap.width(); x++)
{
m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR];
}
}
}
@ -711,12 +711,12 @@ void mos7360_device::drawlines(int first, int last)
{
for (int x = 0; x < xbegin; x++)
{
m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR];
}
for (int x = xend; x < m_bitmap.width(); x++)
{
m_bitmap.pix32(yoff + i, x) = PALETTE[FRAMECOLOR];
m_bitmap.pix32(yoff + i, x) = PALETTE_MOS[FRAMECOLOR];
}
}
}
@ -730,7 +730,7 @@ void mos7360_device::drawlines(int first, int last)
{
for (int x = 0; x < m_bitmap.width(); x++)
{
m_bitmap.pix32(line, x) = PALETTE[FRAMECOLOR];
m_bitmap.pix32(line, x) = PALETTE_MOS[FRAMECOLOR];
}
}
}

View File

@ -948,7 +948,7 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
int scrolly = effective_colscroll(0, height);
for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height)
for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width)
draw_instance(dest, blit, xpos, ypos);
draw_instance(screen, dest, blit, xpos, ypos);
}
// scrolling rows + vertical scroll
@ -985,7 +985,7 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// iterate over X to handle wraparound
for (int xpos = scrollx - m_width; xpos <= original_cliprect.max_x; xpos += m_width)
draw_instance(dest, blit, xpos, ypos);
draw_instance(screen, dest, blit, xpos, ypos);
}
}
}
@ -1021,7 +1021,7 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// iterate over Y to handle wraparound
for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height)
draw_instance(dest, blit, xpos, ypos);
draw_instance(screen, dest, blit, xpos, ypos);
}
}
}
@ -1073,7 +1073,7 @@ g_profiler.start(PROFILER_TILEMAP_DRAW_ROZ);
pixmap();
// then do the roz copy
draw_roz_core(dest, blit, startx, starty, incxx, incxy, incyx, incyy, wraparound);
draw_roz_core(screen, dest, blit, startx, starty, incxx, incxy, incyx, incyy, wraparound);
g_profiler.stop();
}
@ -1095,7 +1095,7 @@ void tilemap_t::draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectan
//-------------------------------------------------
template<class _BitmapClass>
void tilemap_t::draw_instance(_BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos)
void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos)
{
// clip destination coordinates to the tilemap
// note that x2/y2 are exclusive, not inclusive
@ -1183,7 +1183,7 @@ void tilemap_t::draw_instance(_BitmapClass &dest, const blit_parameters &blit, i
x_end = MIN(x_end, x2);
// if we're rendering something, compute the pointers
const rgb_t *clut = (dest.palette() != NULL) ? dest.palette()->entry_list_raw() : reinterpret_cast<const rgb_t *>(machine().pens);
const rgb_t *clut = (dest.palette() != NULL) ? dest.palette()->entry_list_raw() : reinterpret_cast<const rgb_t *>(screen.palette()->pens());
if (prev_trans != WHOLLY_TRANSPARENT)
{
const UINT16 *source0 = source_baseaddr + x_start;
@ -1273,11 +1273,11 @@ do { \
} while (0)
template<class _BitmapClass>
void tilemap_t::draw_roz_core(_BitmapClass &destbitmap, const blit_parameters &blit,
void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, const blit_parameters &blit,
UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound)
{
// pre-cache all the inner loop values
const rgb_t *clut = ((destbitmap.palette() != NULL) ? destbitmap.palette()->entry_list_raw() : reinterpret_cast<const rgb_t *>(machine().pens)) + (blit.tilemap_priority_code >> 16);
const rgb_t *clut = ((destbitmap.palette() != NULL) ? destbitmap.palette()->entry_list_raw() : reinterpret_cast<const rgb_t *>(screen.palette()->pens())) + (blit.tilemap_priority_code >> 16);
bitmap_ind8 &priority_bitmap = *blit.priority;
const int xmask = m_pixmap.width() - 1;
const int ymask = m_pixmap.height() - 1;
@ -1441,7 +1441,7 @@ void tilemap_t::draw_roz_core(_BitmapClass &destbitmap, const blit_parameters &b
// rowscroll and with fixed parameters
//-------------------------------------------------
void tilemap_t::draw_debug(bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly)
void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly)
{
// set up for the blit, using hard-coded parameters (no priority, etc)
blit_parameters blit;
@ -1458,7 +1458,7 @@ void tilemap_t::draw_debug(bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly)
// iterate to handle wraparound
for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height)
for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width)
draw_instance(dest, blit, xpos, ypos);
draw_instance(screen, dest, blit, xpos, ypos);
}

View File

@ -539,7 +539,7 @@ public:
void draw(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 flags, UINT8 priority = 0, UINT8 priority_mask = 0xff);
void draw_roz(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, UINT32 flags, UINT8 priority = 0, UINT8 priority_mask = 0xff);
void draw_roz(screen_device &screen, bitmap_rgb32 &dest, const rectangle &cliprect, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, UINT32 flags, UINT8 priority = 0, UINT8 priority_mask = 0xff);
void draw_debug(bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly);
void draw_debug(screen_device &screen, bitmap_rgb32 &dest, UINT32 scrollx, UINT32 scrolly);
// mappers
// scan in row-major order with optional flipping
@ -609,8 +609,8 @@ private:
void configure_blit_parameters(blit_parameters &blit, bitmap_ind8 &priority_bitmap, const rectangle &cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask);
template<class _BitmapClass> void draw_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, UINT32 flags, UINT8 priority, UINT8 priority_mask);
template<class _BitmapClass> void draw_roz_common(screen_device &screen, _BitmapClass &dest, const rectangle &cliprect, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound, UINT32 flags, UINT8 priority, UINT8 priority_mask);
template<class _BitmapClass> void draw_instance(_BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos);
template<class _BitmapClass> void draw_roz_core(_BitmapClass &destbitmap, const blit_parameters &blit, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound);
template<class _BitmapClass> void draw_instance(screen_device &screen, _BitmapClass &dest, const blit_parameters &blit, int xpos, int ypos);
template<class _BitmapClass> void draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, const blit_parameters &blit, UINT32 startx, UINT32 starty, int incxx, int incxy, int incyx, int incyy, bool wraparound);
// managers and devices
tilemap_manager * m_manager; // reference to the owning manager

View File

@ -152,9 +152,11 @@ static void ui_gfx_exit(running_machine &machine)
bool ui_gfx_is_relevant(running_machine &machine)
{
gfxdecode_device_iterator gfx_deviter(machine.root_device());
palette_device_iterator pal_deviter(machine.root_device());
return machine.total_colors() != 0
|| machine.colortable != NULL
palette_device *palette = pal_deviter.first();
return ((palette !=NULL) && (palette->entries() > 0))
|| gfx_deviter.first() != NULL
|| machine.tilemap().count() != 0;
}
@ -168,7 +170,9 @@ UINT32 ui_gfx_ui_handler(running_machine &machine, render_container *container,
{
ui_gfx_state *state = &ui_gfx;
gfxdecode_device_iterator gfx_deviter(machine.root_device());
palette_device_iterator pal_deviter(machine.root_device());
palette_device *palette = pal_deviter.first();
// if we have nothing, implicitly cancel
if (!ui_gfx_is_relevant(machine))
goto cancel;
@ -183,7 +187,7 @@ again:
{
case 0:
// if we have a palette, display it
if (machine.total_colors() > 0)
if (palette->entries() > 0)
{
palette_handler(machine, container, state);
break;
@ -255,9 +259,12 @@ cancel:
static void palette_handler(running_machine &machine, render_container *container, ui_gfx_state *state)
{
int total = state->palette.which ? colortable_palette_get_size(machine.colortable) : machine.total_colors();
palette_device_iterator pal_deviter(machine.root_device());
palette_device *palette = pal_deviter.first();
int total = state->palette.which ? palette->indirect_entries() : palette->entries();
const char *title = state->palette.which ? "COLORTABLE" : "PALETTE";
const rgb_t *raw_color = machine.palette->entry_list_raw();
const rgb_t *raw_color = palette->palette()->entry_list_raw();;
render_font *ui_font = machine.ui().get_font();
float cellwidth, cellheight;
float chwidth, chheight;
@ -356,7 +363,7 @@ static void palette_handler(running_machine &machine, render_container *containe
int index = state->palette.offset + y * state->palette.count + x;
if (index < total)
{
pen_t pen = state->palette.which ? colortable_palette_get_color(machine.colortable, index) : raw_color[index];
pen_t pen = state->palette.which ? palette->indirect_color(index) : raw_color[index];
container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight,
0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
@ -375,6 +382,9 @@ static void palette_handler(running_machine &machine, render_container *containe
static void palette_handle_keys(running_machine &machine, ui_gfx_state *state)
{
palette_device_iterator pal_deviter(machine.root_device());
palette_device *palette = pal_deviter.first();
int rowcount, screencount;
int total;
@ -399,11 +409,11 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state *state)
// clamp within range
if (state->palette.which < 0)
state->palette.which = 0;
if (state->palette.which > (int)(machine.colortable != NULL))
state->palette.which = (int)(machine.colortable != NULL);
if (state->palette.which > (int)(palette->indirect_entries() > 0))
state->palette.which = (int)(palette->indirect_entries() > 0);
// cache some info in locals
total = state->palette.which ? colortable_palette_get_size(machine.colortable) : machine.total_colors();
total = state->palette.which ? palette->indirect_entries() : palette->entries();
// determine number of entries per row and total
rowcount = state->palette.count;
@ -787,7 +797,7 @@ static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int ind
};
int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width();
int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height();
const rgb_t *palette = (machine.total_colors() != 0) ? machine.palette->entry_list_raw() : NULL;
const rgb_t *palette = (machine.first_screen()->palette()->entries() != 0) ? machine.first_screen()->palette()->palette()->entry_list_raw() : NULL;
UINT32 palette_mask = ~0;
int x, y;
@ -1059,7 +1069,7 @@ static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state *state,
// allocate new stuff
state->bitmap = global_alloc(bitmap_rgb32(width, height));
state->bitmap->set_palette(machine.palette);
state->bitmap->set_palette(machine.first_screen()->palette()->palette());
state->texture = machine.render().texture_alloc();
state->texture->set_bitmap(*state->bitmap, state->bitmap->cliprect(), TEXFORMAT_RGB32);
@ -1071,7 +1081,7 @@ static void tilemap_update_bitmap(running_machine &machine, ui_gfx_state *state,
if (state->bitmap_dirty)
{
tilemap_t *tilemap = machine.tilemap().find(state->tilemap.which);
tilemap->draw_debug(*state->bitmap, state->tilemap.xoffs, state->tilemap.yoffs);
tilemap->draw_debug(*machine.first_screen(), *state->bitmap, state->tilemap.xoffs, state->tilemap.yoffs);
// reset the texture to force an update
state->texture->set_bitmap(*state->bitmap, state->bitmap->cliprect(), TEXFORMAT_RGB32);

View File

@ -703,14 +703,13 @@ void validity_checker::validate_display()
{
// iterate over screen devices looking for paletted screens
screen_device_iterator iter(m_current_config->root_device());
bool palette_modes = false;
for (const screen_device *scrconfig = iter.first(); scrconfig != NULL; scrconfig = iter.next())
if (scrconfig->format() == BITMAP_FORMAT_IND16)
palette_modes = true;
// check for empty palette
if (palette_modes && m_current_config->m_total_colors == 0)
mame_printf_error("Driver has zero palette entries but uses a palette-based bitmap format\n");
{
// check for empty palette
//if (scrconfig->palette()->entries() == 0)
// mame_printf_error("Driver has zero palette entries but uses a palette-based bitmap format\n");
}
}

View File

@ -310,8 +310,8 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file)
png_add_text(&pnginfo, "System", text2);
// now do the actual work
const rgb_t *palette = (machine().palette != NULL) ? machine().palette->entry_list_adjusted() : NULL;
png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, machine().total_colors(), palette);
const rgb_t *palette = (screen->palette() != NULL) ? screen->palette()->palette()->entry_list_adjusted() : NULL;
png_error error = png_write_bitmap(file, &pnginfo, m_snap_bitmap, screen->palette()->entries(), palette);
if (error != PNGERR_NONE)
mame_printf_error("Error generating PNG for snapshot: png_error = %d\n", error);
@ -1230,8 +1230,8 @@ void video_manager::record_frame()
}
// write the next frame
const rgb_t *palette = (machine().palette != NULL) ? machine().palette->entry_list_adjusted() : NULL;
png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, machine().total_colors(), palette);
const rgb_t *palette = (machine().primary_screen->palette() != NULL) ? machine().primary_screen->palette()->palette()->entry_list_adjusted() : NULL;
png_error error = mng_capture_frame(*m_mngfile, &pnginfo, m_snap_bitmap, machine().primary_screen->palette()->entries(), palette);
png_free(&pnginfo);
if (error != PNGERR_NONE)
{
@ -1247,33 +1247,6 @@ void video_manager::record_frame()
g_profiler.stop();
}
//-------------------------------------------------
// video_assert_out_of_range_pixels - assert if
// any pixels in the given bitmap contain an
// invalid palette index
//-------------------------------------------------
bool video_assert_out_of_range_pixels(running_machine &machine, bitmap_ind16 &bitmap)
{
#ifdef MAME_DEBUG
// iterate over rows
int maxindex = machine.palette->max_index();
for (int y = 0; y < bitmap.height(); y++)
{
UINT16 *rowbase = &bitmap.pix16(y);
for (int x = 0; x < bitmap.width(); x++)
if (rowbase[x] > maxindex)
{
osd_break_into_debugger("Out of range pixel");
return true;
}
}
#endif
return false;
}
//-------------------------------------------------
// toggle_throttle
//-------------------------------------------------

View File

@ -178,12 +178,4 @@ private:
static const int PAUSED_REFRESH_RATE = 30;
};
// ----- debugging helpers -----
// assert if any pixels in the given bitmap contain an invalid palette index
bool video_assert_out_of_range_pixels(running_machine &machine, bitmap_ind16 &bitmap);
#endif /* __VIDEO_H__ */

View File

@ -97,25 +97,25 @@ PALETTE_INIT_MEMBER(sega315_5124_device, sega315_5124)
int r = i & 0x03;
int g = (i & 0x0c) >> 2;
int b = (i & 0x30) >> 4;
palette_set_color_rgb(machine(), i, pal2bit(r), pal2bit(g), pal2bit(b));
palette.set_pen_color(i, pal2bit(r), pal2bit(g), pal2bit(b));
}
/* TMS9918 palette */
palette_set_color_rgb(machine(), 64+ 0, 0, 0, 0);
palette_set_color_rgb(machine(), 64+ 1, 0, 0, 0);
palette_set_color_rgb(machine(), 64+ 2, 33, 200, 66);
palette_set_color_rgb(machine(), 64+ 3, 94, 220, 120);
palette_set_color_rgb(machine(), 64+ 4, 84, 85, 237);
palette_set_color_rgb(machine(), 64+ 5, 125, 118, 252);
palette_set_color_rgb(machine(), 64+ 6, 212, 82, 77);
palette_set_color_rgb(machine(), 64+ 7, 66, 235, 245);
palette_set_color_rgb(machine(), 64+ 8, 252, 85, 84);
palette_set_color_rgb(machine(), 64+ 9, 255, 121, 120);
palette_set_color_rgb(machine(), 64+10, 212, 193, 84);
palette_set_color_rgb(machine(), 64+11, 230, 206, 128);
palette_set_color_rgb(machine(), 64+12, 33, 176, 59);
palette_set_color_rgb(machine(), 64+13, 201, 91, 186);
palette_set_color_rgb(machine(), 64+14, 204, 204, 204);
palette_set_color_rgb(machine(), 64+15, 255, 255, 255);
palette.set_pen_color(64+ 0, 0, 0, 0);
palette.set_pen_color(64+ 1, 0, 0, 0);
palette.set_pen_color(64+ 2, 33, 200, 66);
palette.set_pen_color(64+ 3, 94, 220, 120);
palette.set_pen_color(64+ 4, 84, 85, 237);
palette.set_pen_color(64+ 5, 125, 118, 252);
palette.set_pen_color(64+ 6, 212, 82, 77);
palette.set_pen_color(64+ 7, 66, 235, 245);
palette.set_pen_color(64+ 8, 252, 85, 84);
palette.set_pen_color(64+ 9, 255, 121, 120);
palette.set_pen_color(64+10, 212, 193, 84);
palette.set_pen_color(64+11, 230, 206, 128);
palette.set_pen_color(64+12, 33, 176, 59);
palette.set_pen_color(64+13, 201, 91, 186);
palette.set_pen_color(64+14, 204, 204, 204);
palette.set_pen_color(64+15, 255, 255, 255);
}
@ -127,7 +127,7 @@ PALETTE_INIT_MEMBER(sega315_5378_device, sega315_5378)
int r = i & 0x000f;
int g = (i & 0x00f0) >> 4;
int b = (i & 0x0f00) >> 8;
palette_set_color_rgb(machine(), i, pal4bit(r), pal4bit(g), pal4bit(b));
palette.set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b));
}
}
@ -146,6 +146,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const ch
, m_palette_offset( 0 )
, m_supports_224_240( false )
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
, m_palette(*this, "palette")
{
}
@ -158,6 +159,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
, m_palette_offset( palette_offset )
, m_supports_224_240( supports_224_240 )
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
, m_palette(*this, "palette")
{
}
@ -398,13 +400,13 @@ void sega315_5124_device::process_line_timer()
/* Draw left border */
rec.min_x = SEGA315_5124_LBORDER_START;
rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
/* Draw right border */
rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
/* Draw middle of the border */
@ -440,13 +442,13 @@ void sega315_5124_device::process_line_timer()
/* Draw left border */
rec.min_x = SEGA315_5124_LBORDER_START;
rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
/* Draw right border */
rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
select_sprites( vpos - vpos_limit );
@ -472,13 +474,13 @@ void sega315_5124_device::process_line_timer()
/* Draw left border */
rec.min_x = SEGA315_5124_LBORDER_START;
rec.max_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
/* Draw right border */
rec.min_x = SEGA315_5124_LBORDER_START + SEGA315_5124_LBORDER_WIDTH + 256;
rec.max_x = rec.min_x + SEGA315_5124_RBORDER_WIDTH - 1;
m_tmpbitmap.fill(machine().pens[m_current_palette[BACKDROP_COLOR]], rec);
m_tmpbitmap.fill(m_palette->pen(m_current_palette[BACKDROP_COLOR]), rec);
m_y1_bitmap.fill(1, rec);
/* Draw middle of the border */
@ -1432,7 +1434,7 @@ void sega315_5124_device::draw_scanline( int pixel_offset_x, int pixel_plot_y, i
{
for (x = 0; x < 256; x++)
{
p_bitmap[x] = machine().pens[m_current_palette[BACKDROP_COLOR]];
p_bitmap[x] = m_palette->pen(m_current_palette[BACKDROP_COLOR]);
p_y1[x] = 1;
}
}
@ -1440,7 +1442,7 @@ void sega315_5124_device::draw_scanline( int pixel_offset_x, int pixel_plot_y, i
{
for (x = 0; x < 256; x++)
{
p_bitmap[x] = machine().pens[blitline_buffer[x]];
p_bitmap[x] = m_palette->pen(blitline_buffer[x]);
p_y1[x] = ( priority_selected[x] & 0x0f ) ? 0 : 1;
}
}
@ -1590,10 +1592,10 @@ void sega315_5378_device::draw_scanline( int pixel_offset_x, int pixel_plot_y, i
for (x = 0 + 48; x < 160 + 48; x++)
{
rgb_t c1 = machine().pens[line1[x]];
rgb_t c2 = machine().pens[line2[x]];
rgb_t c3 = machine().pens[line3[x]];
rgb_t c4 = machine().pens[line4[x]];
rgb_t c1 = m_palette->pen(line1[x]);
rgb_t c2 = m_palette->pen(line2[x]);
rgb_t c3 = m_palette->pen(line3[x]);
rgb_t c4 = m_palette->pen(line4[x]);
m_tmpbitmap.pix32(pixel_plot_y, pixel_offset_x + x) =
rgb_t((c1.r() / 6 + c2.r() / 3 + c3.r() / 3 + c4.r() / 6 ),
(c1.g() / 6 + c2.g() / 3 + c3.g() / 3 + c4.g() / 6 ),
@ -1606,7 +1608,7 @@ void sega315_5378_device::draw_scanline( int pixel_offset_x, int pixel_plot_y, i
for (x = 0; x < 256; x++)
{
m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x + x) = machine().pens[blitline_buffer[x]];
m_tmpbitmap.pix32(pixel_plot_y + line, pixel_offset_x + x) = m_palette->pen(blitline_buffer[x]);
}
}
@ -1803,7 +1805,8 @@ void sega315_5124_device::device_reset()
}
static MACHINE_CONFIG_FRAGMENT( sega315_5124 )
MCFG_PALETTE_INIT_OVERRIDE(sega315_5124_device, sega315_5124)
MCFG_PALETTE_ADD("palette", SEGA315_5124_PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(sega315_5124_device, sega315_5124)
MACHINE_CONFIG_END
//-------------------------------------------------
@ -1824,7 +1827,8 @@ void sega315_5378_device::device_reset()
}
static MACHINE_CONFIG_FRAGMENT( sega315_5378 )
MCFG_PALETTE_INIT_OVERRIDE(sega315_5378_device, sega315_5378)
MCFG_PALETTE_ADD("palette", SEGA315_5378_PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(sega315_5378_device, sega315_5378)
MACHINE_CONFIG_END
//-------------------------------------------------

View File

@ -166,6 +166,8 @@ protected:
static const device_timer_id TIMER_DRAW = 1;
static const device_timer_id TIMER_CHECK_HINT = 2;
static const device_timer_id TIMER_CHECK_VINT = 3;
required_device<palette_device> m_palette;
};

View File

@ -120,7 +120,8 @@ hd66421_device::hd66421_device(const machine_config &mconfig, const char *tag, d
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(hd66421)),
m_cmd(0),
m_x(0),
m_y(0)
m_y(0),
m_palette(*this, "palette")
{
for (int i = 0; i < 32; i++)
{
@ -220,9 +221,9 @@ UINT32 hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap
bright = 1.0 * temp / 31;
pen[i] = i;
#ifdef HD66421_BRIGHTNESS_DOES_NOT_WORK
palette_set_color(machine(), pen[i], 255 * bright, 255 * bright, 255 * bright);
m_palette->set_pen_color(pen[i], 255 * bright, 255 * bright, 255 * bright);
#else
palette_set_pen_contrast(machine(), pen[i], bright);
m_palette->set_pen_contrast(pen[i], bright);
#endif
}
@ -249,8 +250,36 @@ UINT32 hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitmap
else
{
rectangle rect(0, HD66421_WIDTH - 1, 0, HD66421_HEIGHT - 1);
bitmap.fill(get_white_pen(machine()), rect);
bitmap.fill(m_palette->white_pen(), rect);
}
return 0;
}
PALETTE_INIT_MEMBER(hd66421_device, hd66421)
{
// init palette
for (int i = 0; i < 4; i++)
{
palette.set_pen_color(i, rgb_t::white);
#ifndef HD66421_BRIGHTNESS_DOES_NOT_WORK
palette.set_pen_contrast(i, 1.0 * i / (4 - 1));
#endif
}
}
static MACHINE_CONFIG_FRAGMENT( hd66421 )
MCFG_PALETTE_ADD("palette", 4)
MCFG_PALETTE_INIT_OWNER(hd66421_device, hd66421)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor hd66421_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( hd66421 );
}

View File

@ -48,12 +48,14 @@ public:
DECLARE_WRITE8_MEMBER( reg_idx_w );
DECLARE_READ8_MEMBER( reg_dat_r );
DECLARE_WRITE8_MEMBER( reg_dat_w );
DECLARE_PALETTE_INIT(hd66421);
UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
// device-level overrides
virtual void device_start();
virtual machine_config_constructor device_mconfig_additions() const;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
@ -69,6 +71,7 @@ protected:
private:
UINT8 m_cmd, m_reg[32];
int m_x, m_y;
required_device<palette_device> m_palette;
};

View File

@ -34,8 +34,8 @@ PALETTE_INIT_MEMBER(huc6260_device, huc6260)
int b = pal3bit( ( i ) & 7 );
int y = ( ( 66 * r + 129 * g + 25 * b + 128 ) >> 8 ) + 16;
palette_set_color_rgb( machine(), i, r, g, b );
palette_set_color_rgb( machine(), 512 + i, y, y, y );
palette.set_pen_color( i, r, g, b );
palette.set_pen_color( 512 + i, y, y, y );
}
}
@ -294,7 +294,8 @@ void huc6260_device::device_reset()
}
static MACHINE_CONFIG_FRAGMENT( huc6260 )
MCFG_PALETTE_INIT_OVERRIDE(huc6260_device, huc6260)
MCFG_PALETTE_ADD("palette", HUC6260_PALETTE_SIZE )
MCFG_PALETTE_INIT_OWNER(huc6260_device, huc6260)
MACHINE_CONFIG_END
//-------------------------------------------------

View File

@ -180,7 +180,7 @@ void i8244_device::device_reset()
}
void i8244_device::palette_init()
PALETTE_INIT_MEMBER(i8244_device, i8244)
{
static const UINT8 i8244_colors[3*16] =
{
@ -204,7 +204,7 @@ void i8244_device::palette_init()
for ( int i = 0; i < 16; i++ )
{
palette_set_color_rgb( machine(), i, i8244_colors[i*3], i8244_colors[i*3+1], i8244_colors[i*3+2] );
palette.set_pen_color( i, i8244_colors[i*3], i8244_colors[i*3+1], i8244_colors[i*3+2] );
}
}

View File

@ -86,12 +86,11 @@ public:
template<class _Object> static devcb2_base &set_irq_cb(device_t &device, _Object object) { return downcast<i8244_device &>(device).m_irq_func.set_callback(object); }
template<class _Object> static devcb2_base &set_postprocess_cb(device_t &device, _Object object) { return downcast<i8244_device &>(device).m_postprocess_func.set_callback(object); }
virtual void palette_init();
DECLARE_READ8_MEMBER(read);
DECLARE_WRITE8_MEMBER(write);
DECLARE_READ_LINE_MEMBER(vblank);
DECLARE_READ_LINE_MEMBER(hblank);
DECLARE_PALETTE_INIT(i8244);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

View File

@ -385,7 +385,7 @@ UINT32 i8275_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
m_fifo_write = 0;
if ((m_status_reg & I8275_STATUS_VIDEO_ENABLE)==0) {
bitmap.fill(get_black_pen(machine()), cliprect);
bitmap.fill(rgb_t(0x00,0x00,0x00), cliprect);
} else {
// if value < 16 it is visible otherwise not
m_cursor_blink_cnt++;

View File

@ -356,7 +356,7 @@ void k053250_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect, int
linedata_offs += line_start * linedata_adv; // pre-advance line info offset for the clipped region
// load physical palette base
pal_base = machine().pens + (colorbase << 4) % machine().total_colors();
pal_base = screen->palette()->pens() + (colorbase << 4) % screen->palette()->entries();
// walk the target bitmap within the visible area vertically or horizontally, one line at a time
for (line_pos=line_start; line_pos <= line_end; linedata_offs += linedata_adv, line_pos++)

View File

@ -32,6 +32,17 @@ TODO:
// device type definition
const device_type MB_VCU = &device_creator<mb_vcu_device>;
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void mb_vcu_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<mb_vcu_device &>(device).m_palette.set_tag(tag);
}
static ADDRESS_MAP_START( mb_vcu_vram, AS_0, 8, mb_vcu_device )
AM_RANGE(0x00000,0x7ffff) AM_RAM // enough for a 256x256x4 x 2 pages of framebuffer with 4 layers (TODO: doubled for simplicity)
ADDRESS_MAP_END
@ -72,7 +83,7 @@ WRITE8_MEMBER( mb_vcu_device::mb_vcu_paletteram_w )
bit0 = (m_palram[offset] >> 0) & 0x01;
b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
palette_set_color(machine(), offset, rgb_t(r, g, b));
m_palette->set_pen_color(offset, rgb_t(r, g, b));
}
//-------------------------------------------------
@ -144,7 +155,8 @@ mb_vcu_device::mb_vcu_device(const machine_config &mconfig, const char *tag, dev
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_videoram_space_config("videoram", ENDIANNESS_LITTLE, 8, 19, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_vram)),
m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_pal_ram))
m_paletteram_space_config("palram", ENDIANNESS_LITTLE, 8, 16, 0, NULL, *ADDRESS_MAP_NAME(mb_vcu_pal_ram)),
m_palette(*this)
{
}
@ -470,7 +482,7 @@ WRITE8_MEMBER( mb_vcu_device::background_color_w )
bit0 = (m_bk_color >> 0) & 0x01;
b = combine_3_weights(m_weights_b, bit0, bit1, bit2);
palette_set_color(machine(), 0x100, rgb_t(r, g, b));
m_palette->set_pen_color(0x100, rgb_t(r, g, b));
}
READ8_MEMBER( mb_vcu_device::status_r )
@ -506,7 +518,7 @@ UINT32 mb_vcu_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
{
dot|= m_vregs[1] << 4;
bitmap.pix32(y,x) = machine().pens[dot];
bitmap.pix32(y,x) = m_palette->pen(dot);
}
}
}

View File

@ -17,9 +17,10 @@ Template for skeleton device
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MB_VCU_ADD(_tag,_freq,_config) \
#define MCFG_MB_VCU_ADD(_tag,_freq,_config, _palette_tag) \
MCFG_DEVICE_ADD(_tag, MB_VCU, _freq) \
MCFG_DEVICE_CONFIG(_config)
MCFG_DEVICE_CONFIG(_config) \
mb_vcu_device::static_set_palette_tag(*device, "^" _palette_tag);
//**************************************************************************
// TYPE DEFINITIONS
@ -43,6 +44,9 @@ public:
// construction/destruction
mb_vcu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
// I/O operations
DECLARE_WRITE8_MEMBER( write_vregs );
DECLARE_READ8_MEMBER( read_ram );
@ -91,6 +95,7 @@ private:
double m_weights_r[2];
double m_weights_g[3];
double m_weights_b[3];
required_device<palette_device> m_palette;
};

View File

@ -206,8 +206,8 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_cga )
MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,262,0,200)
MCFG_SCREEN_UPDATE_STATIC( mc6845_cga )
MCFG_PALETTE_LENGTH(/* CGA_PALETTE_SETS * 16*/ 65536 )
MCFG_PALETTE_INIT(pc_cga)
MCFG_PALETTE_ADD("palette", /* CGA_PALETTE_SETS * 16*/ 65536 )
MCFG_PALETTE_INIT_LEGACY(pc_cga)
MCFG_MC6845_ADD(CGA_MC6845_NAME, MC6845, CGA_SCREEN_NAME, XTAL_14_31818MHz/8, mc6845_cga_intf)
@ -231,8 +231,8 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_mc1502 )
MCFG_SCREEN_RAW_PARAMS(XTAL_16MHz,912,0,640,262,0,200)
MCFG_SCREEN_UPDATE_STATIC( cga_poisk2 )
MCFG_PALETTE_LENGTH(/* CGA_PALETTE_SETS * 16*/ 65536 )
MCFG_PALETTE_INIT(pc_cga)
MCFG_PALETTE_ADD("palette", /* CGA_PALETTE_SETS * 16*/ 65536 )
MCFG_PALETTE_INIT_LEGACY(pc_cga)
MCFG_MC6845_ADD(CGA_MC6845_NAME, MC6845, CGA_SCREEN_NAME, XTAL_16MHz/8, mc6845_cga_intf)
@ -292,7 +292,7 @@ static PALETTE_INIT( pc_cga )
for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ )
{
palette_set_color_rgb( machine, i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] );
palette.set_pen_color(i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] );
}
i = 0x8000;
@ -302,7 +302,7 @@ static PALETTE_INIT( pc_cga )
{
for ( b = 0; b < 32; b++ )
{
palette_set_color_rgb( machine, i, r << 3, g << 3, b << 3 );
palette.set_pen_color(i, r << 3, g << 3, b << 3 );
i++;
}
}

View File

@ -127,12 +127,14 @@ const device_type IBM8514A = &device_creator<ibm8514a_device>;
const device_type MACH8 = &device_creator<mach8_device>;
vga_device::vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
m_palette(*this, "^palette")
{
}
vga_device::vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VGA, "VGA", tag, owner, clock, "vga", __FILE__)
: device_t(mconfig, VGA, "VGA", tag, owner, clock, "vga", __FILE__),
m_palette(*this, "^palette")
{
}
@ -215,7 +217,7 @@ void vga_device::device_start()
int i;
for (i = 0; i < 0x100; i++)
palette_set_color_rgb(machine(), i, 0, 0, 0);
m_palette->set_pen_color(i, 0, 0, 0);
// Avoid an infinite loop when displaying. 0 is not possible anyway.
vga.crtc.maximum_scan_line = 1;
@ -249,7 +251,7 @@ void cirrus_vga_device::device_start()
int i;
for (i = 0; i < 0x100; i++)
palette_set_color_rgb(machine(), i, 0, 0, 0);
m_palette->set_pen_color(i, 0, 0, 0);
// Avoid an infinite loop when displaying. 0 is not possible anyway.
vga.crtc.maximum_scan_line = 1;
@ -491,7 +493,7 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
if(!machine().primary_screen->visible_area().contains(c+xi-(pel_shift), line + yi))
continue;
bitmapline[c+xi-(pel_shift)] = machine().pens[vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]];
bitmapline[c+xi-(pel_shift)] = m_palette->pen(vga.memory[(pos & 0xffff)+((xi >> 1)*0x10000)]);
}
}
}
@ -518,7 +520,7 @@ void vga_device::vga_vh_vga(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
if(!machine().primary_screen->visible_area().contains(c+xi-(pel_shift), line + yi))
continue;
bitmapline[c+xi-pel_shift] = machine().pens[vga.memory[(pos+(xi >> 1)) & 0xffff]];
bitmapline[c+xi-pel_shift] = m_palette->pen(vga.memory[(pos+(xi >> 1)) & 0xffff]);
}
}
}
@ -640,7 +642,7 @@ void svga_device::svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
if(!machine().primary_screen->visible_area().contains(c+xi, line + yi))
continue;
bitmapline[c+xi] = machine().pens[vga.memory[(pos+(xi))]];
bitmapline[c+xi] = m_palette->pen(vga.memory[(pos+(xi))]);
}
}
}
@ -844,7 +846,7 @@ UINT8 vga_device::pc_vga_choosevideomode()
for (i=0; i<256;i++)
{
/* TODO: color shifters? */
palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
m_palette->set_pen_color(i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
(vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2,
(vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2);
}
@ -855,16 +857,16 @@ UINT8 vga_device::pc_vga_choosevideomode()
{
for (i=0; i<16;i++)
{
vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f)
|((vga.attribute.data[0x14]&0xf)<<4)];
vga.pens[i] = m_palette->pen((vga.attribute.data[i]&0x0f)
|((vga.attribute.data[0x14]&0xf)<<4));
}
}
else
{
for (i=0; i<16;i++)
{
vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f)
|((vga.attribute.data[0x14]&0xc)<<4)];
vga.pens[i]=m_palette->pen((vga.attribute.data[i]&0x3f)
|((vga.attribute.data[0x14]&0xc)<<4));
}
}
@ -905,7 +907,7 @@ UINT8 svga_device::pc_vga_choosevideomode()
for (i=0; i<256;i++)
{
/* TODO: color shifters? */
palette_set_color_rgb(machine(), i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
m_palette->set_pen_color(i, (vga.dac.color[i & vga.dac.mask].red & 0x3f) << 2,
(vga.dac.color[i & vga.dac.mask].green & 0x3f) << 2,
(vga.dac.color[i & vga.dac.mask].blue & 0x3f) << 2);
}
@ -916,16 +918,16 @@ UINT8 svga_device::pc_vga_choosevideomode()
{
for (i=0; i<16;i++)
{
vga.pens[i] = machine().pens[(vga.attribute.data[i]&0x0f)
|((vga.attribute.data[0x14]&0xf)<<4)];
vga.pens[i] = m_palette->pen((vga.attribute.data[i]&0x0f)
|((vga.attribute.data[0x14]&0xf)<<4));
}
}
else
{
for (i=0; i<16;i++)
{
vga.pens[i]=machine().pens[(vga.attribute.data[i]&0x3f)
|((vga.attribute.data[0x14]&0xc)<<4)];
vga.pens[i]=m_palette->pen((vga.attribute.data[i]&0x3f)
|((vga.attribute.data[0x14]&0xc)<<4));
}
}
@ -980,7 +982,7 @@ UINT32 vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, co
UINT8 cur_mode = pc_vga_choosevideomode();
switch(cur_mode)
{
case SCREEN_OFF: bitmap.fill (get_black_pen(machine()), cliprect);break;
case SCREEN_OFF: bitmap.fill (m_palette->black_pen(), cliprect);break;
case TEXT_MODE: vga_vh_text (bitmap, cliprect); break;
case VGA_MODE: vga_vh_vga (bitmap, cliprect); break;
case EGA_MODE: vga_vh_ega (bitmap, cliprect); break;
@ -997,7 +999,7 @@ UINT32 svga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, c
switch(cur_mode)
{
case SCREEN_OFF: bitmap.fill (get_black_pen(machine()), cliprect);break;
case SCREEN_OFF: bitmap.fill (m_palette->black_pen(), cliprect);break;
case TEXT_MODE: vga_vh_text (bitmap, cliprect); break;
case VGA_MODE: vga_vh_vga (bitmap, cliprect); break;
case EGA_MODE: vga_vh_ega (bitmap, cliprect); break;
@ -1064,8 +1066,8 @@ UINT32 s3_vga_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
}
else /* TODO: other modes */
{
bg_col = screen.machine().pens[s3.cursor_bg[0]];
fg_col = screen.machine().pens[s3.cursor_fg[0]];
bg_col = m_palette->pen(s3.cursor_bg[0]);
fg_col = m_palette->pen(s3.cursor_fg[0]);
}
//popmessage("%08x %08x",(s3.cursor_bg[0])|(s3.cursor_bg[1]<<8)|(s3.cursor_bg[2]<<16)|(s3.cursor_bg[3]<<24)
@ -2113,7 +2115,7 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_vga )
MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
MCFG_SCREEN_UPDATE_DEVICE("vga", vga_device, screen_update)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_DEVICE_ADD("vga", VGA, 0)
MACHINE_CONFIG_END
@ -2122,7 +2124,7 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_trident_vga )
MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
MCFG_SCREEN_UPDATE_DEVICE("vga", trident_vga_device, screen_update)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_DEVICE_ADD("vga", TRIDENT_VGA, 0)
MACHINE_CONFIG_END
@ -2131,7 +2133,7 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_cirrus_vga )
MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
MCFG_SCREEN_UPDATE_DEVICE("vga", cirrus_vga_device, screen_update)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_DEVICE_ADD("vga", CIRRUS_VGA, 0)
MACHINE_CONFIG_END
@ -2140,7 +2142,7 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_gamtor_vga )
MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
MCFG_SCREEN_UPDATE_DEVICE("vga", gamtor_vga_device, screen_update)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_DEVICE_ADD("vga", GAMTOR_VGA, 0)
MACHINE_CONFIG_END
@ -2149,7 +2151,7 @@ MACHINE_CONFIG_FRAGMENT( pcvideo_s3_vga )
MCFG_SCREEN_RAW_PARAMS(XTAL_25_1748MHz,900,0,640,526,0,480)
MCFG_SCREEN_UPDATE_DEVICE("vga", s3_vga_device, screen_update)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_DEVICE_ADD("vga", S3_VGA, 0)
MACHINE_CONFIG_END

View File

@ -190,6 +190,7 @@ protected:
} vga;
emu_timer *m_vblank_timer;
required_device<palette_device> m_palette;
};

View File

@ -360,7 +360,7 @@ int psxgpu_device::DebugTextureDisplay( bitmap_ind16 &bitmap )
}
p_n_interleave[ n_x ] = p_p_vram[ n_yi ][ n_xi ];
}
draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, machine().pens );
draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, screen->palette()->pens() );
}
}
return m_debug.b_texture;
@ -3792,7 +3792,7 @@ PALETTE_INIT_MEMBER( psxgpu_device, psx )
for( n_colour = 0; n_colour < 0x10000; n_colour++ )
{
palette_set_color( machine(), n_colour, pal555(n_colour, 0, 5, 10) );
palette.set_pen_color( n_colour, pal555(n_colour,0, 5, 10) );
}
}
@ -3805,8 +3805,8 @@ MACHINE_CONFIG_FRAGMENT( psxgpu )
MCFG_SCREEN_UPDATE_DEVICE( DEVICE_SELF, psxgpu_device, update_screen )
((screen_device *)device)->register_vblank_callback(vblank_state_delegate(FUNC(psxgpu_device::vblank), (psxgpu_device *) owner));
MCFG_PALETTE_LENGTH( 65536 )
MCFG_PALETTE_INIT_OVERRIDE(psxgpu_device, psx)
MCFG_PALETTE_ADD( "palette", 65536 )
MCFG_PALETTE_INIT_OWNER(psxgpu_device, psx)
MACHINE_CONFIG_END
//-------------------------------------------------

View File

@ -42,10 +42,21 @@ const device_type RAMDAC = &device_creator<ramdac_device>;
ramdac_device::ramdac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, RAMDAC, "ramdac", tag, owner, clock, "ramdac", __FILE__),
device_memory_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(ramdac_palram))
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 10, 0, NULL, *ADDRESS_MAP_NAME(ramdac_palram)),
m_palette(*this)
{
}
//-------------------------------------------------
// static_set_palette_tag: Set the tag of the
// palette device
//-------------------------------------------------
void ramdac_device::static_set_palette_tag(device_t &device, const char *tag)
{
downcast<ramdac_device &>(device).m_palette.set_tag(tag);
}
//-------------------------------------------------
// memory_space_config - return a description of
// any address spaces owned by this device
@ -198,7 +209,7 @@ WRITE8_MEMBER( ramdac_device::ramdac_rgb666_w )
m_palram[offset] = data & 0x3f;
pal_offs = (offset & 0xff);
palette_set_color_rgb(machine(),offset&0xff,pal6bit(m_palram[pal_offs|0x000]),pal6bit(m_palram[pal_offs|0x100]),pal6bit(m_palram[pal_offs|0x200]));
m_palette->set_pen_color(offset&0xff,pal6bit(m_palram[pal_offs|0x000]),pal6bit(m_palram[pal_offs|0x100]),pal6bit(m_palram[pal_offs|0x200]));
}
WRITE8_MEMBER( ramdac_device::ramdac_rgb888_w )
@ -208,5 +219,5 @@ WRITE8_MEMBER( ramdac_device::ramdac_rgb888_w )
m_palram[offset] = data;
pal_offs = (offset & 0xff);
palette_set_color_rgb(machine(),offset&0xff,m_palram[pal_offs|0x000],m_palram[pal_offs|0x100],m_palram[pal_offs|0x200]);
m_palette->set_pen_color(offset&0xff,m_palram[pal_offs|0x000],m_palram[pal_offs|0x100],m_palram[pal_offs|0x200]);
}

View File

@ -16,10 +16,11 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_RAMDAC_ADD(_tag,_config,_map) \
#define MCFG_RAMDAC_ADD(_tag,_config,_map,_palette_tag) \
MCFG_DEVICE_ADD(_tag, RAMDAC, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_ADDRESS_MAP(AS_0, _map)
MCFG_DEVICE_ADDRESS_MAP(AS_0, _map) \
ramdac_device::static_set_palette_tag(*device, "^" _palette_tag);
#define RAMDAC_INTERFACE(name) \
const ramdac_interface (name) =
@ -45,6 +46,9 @@ public:
// construction/destruction
ramdac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// static configuration
static void static_set_palette_tag(device_t &device, const char *tag);
// I/O operations
DECLARE_READ8_MEMBER( index_r );
DECLARE_READ8_MEMBER( pal_r );
@ -75,7 +79,8 @@ private:
UINT8 m_int_index[2];
UINT8 *m_palram;
const address_space_config m_space_config;
const address_space_config m_space_config;
required_device<palette_device> m_palette;
};

View File

@ -108,7 +108,7 @@ enum
};
static const rgb_t PALETTE[] =
static const rgb_t PALETTE_SAA5050[] =
{
rgb_t::black,
rgb_t(0xff, 0x00, 0x00),

View File

@ -2413,7 +2413,7 @@ void saturn_state::stv_vdp2_drawgfxzoom(
if( gfx )
{
const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const UINT8 *source_base = gfx->get_data(code % gfx->elements());
//int sprite_screen_height = (scaley*gfx->height()+0x8000)>>16;
@ -3027,7 +3027,7 @@ void saturn_state::stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle
UINT32 code,UINT32 color, int flipx,int flipy,int offsx,int offsy,
int transparent_color, int alpha)
{
const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const UINT8 *source_base = gfx->get_data(code % gfx->elements());
int x_index_base, y_index, sx, sy, ex, ey;
int xinc, yinc;
@ -3104,7 +3104,7 @@ void saturn_state::stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectan
UINT32 code,UINT32 color, int flipx,int flipy,int offsx,int offsy,
int transparent_color)
{
const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())];
const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors()));
const UINT8 *source_base = gfx->get_data(code % gfx->elements());
int x_index_base, y_index, sx, sy, ex, ey;
int xinc, yinc;
@ -3224,9 +3224,9 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
dot_data += pal_bank;
if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
bitmap.pix32(ydst, xdst) = machine().pens[dot_data];
bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data);
else
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), machine().pens[dot_data], stv2_current_tilemap.alpha);
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha);
}
}
}
@ -3284,9 +3284,9 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
dot_data += pal_bank;
if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
bitmap.pix32(ydst, xdst) = machine().pens[dot_data];
bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data);
else
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), machine().pens[dot_data], stv2_current_tilemap.alpha);
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha);
}
}
}
@ -3341,9 +3341,9 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
dot_data += pal_bank;
if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
bitmap.pix32(ydst, xdst) = machine().pens[dot_data];
bitmap.pix32(ydst, xdst) = m_palette->pen(dot_data);
else
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), machine().pens[dot_data], stv2_current_tilemap.alpha);
bitmap.pix32(ydst, xdst) = alpha_blend_r32(bitmap.pix32(ydst, xdst), m_palette->pen(dot_data), stv2_current_tilemap.alpha);
}
}
}
@ -4348,7 +4348,7 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli
pen = (gfxdata[base_offs+0]<<8)|gfxdata[base_offs+1];
pix = bitmap.pix32(y, x);
bitmap.pix32(y, x) = stv_add_blend(machine().pens[pen & 0x7ff],pix);
bitmap.pix32(y, x) = stv_add_blend(m_palette->pen(pen & 0x7ff),pix);
}
}
}
@ -5431,7 +5431,7 @@ void saturn_state::stv_vdp2_draw_rotation_screen(bitmap_rgb32 &bitmap, const rec
if ( (stv_rbg_cache_data.is_cache_dirty & iRP) ||
memcmp(&stv_rbg_cache_data.layer_data[iRP-1],&stv2_current_tilemap,sizeof(stv2_current_tilemap)) != 0 )
{
m_vdp2.roz_bitmap[iRP-1].fill(get_black_pen(machine()), roz_clip_rect );
m_vdp2.roz_bitmap[iRP-1].fill(m_palette->black_pen(), roz_clip_rect );
stv_vdp2_check_tilemap(m_vdp2.roz_bitmap[iRP-1], roz_clip_rect);
// prepare cache data
stv_rbg_cache_data.watch_vdp2_vram_writes |= iRP;
@ -5588,7 +5588,7 @@ void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cli
/* draw black if BDCLMD and DISP are cleared */
if(!(STV_VDP2_BDCLMD) && !(STV_VDP2_DISP))
bitmap.fill(get_black_pen(machine()), cliprect);
bitmap.fill(m_palette->black_pen(), cliprect);
else
{
base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff;
@ -5782,8 +5782,8 @@ WRITE32_MEMBER ( saturn_state::saturn_vdp2_cram_w )
b = ((m_vdp2_cram[offset] & 0x00ff0000) >> 16);
g = ((m_vdp2_cram[offset] & 0x0000ff00) >> 8);
r = ((m_vdp2_cram[offset] & 0x000000ff) >> 0);
palette_set_color(space.machine(),offset,rgb_t(r,g,b));
palette_set_color(space.machine(),offset^0x400,rgb_t(r,g,b));
m_palette->set_pen_color(offset,rgb_t(r,g,b));
m_palette->set_pen_color(offset^0x400,rgb_t(r,g,b));
}
break;
/*Mode 0*/
@ -5795,16 +5795,16 @@ WRITE32_MEMBER ( saturn_state::saturn_vdp2_cram_w )
b = ((m_vdp2_cram[offset] & 0x00007c00) >> 10);
g = ((m_vdp2_cram[offset] & 0x000003e0) >> 5);
r = ((m_vdp2_cram[offset] & 0x0000001f) >> 0);
palette_set_color_rgb(space.machine(),(offset*2)+1,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color((offset*2)+1,pal5bit(r),pal5bit(g),pal5bit(b));
if(cmode0)
palette_set_color_rgb(space.machine(),((offset*2)+1)^0x400,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color(((offset*2)+1)^0x400,pal5bit(r),pal5bit(g),pal5bit(b));
b = ((m_vdp2_cram[offset] & 0x7c000000) >> 26);
g = ((m_vdp2_cram[offset] & 0x03e00000) >> 21);
r = ((m_vdp2_cram[offset] & 0x001f0000) >> 16);
palette_set_color_rgb(space.machine(),offset*2,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color(offset*2,pal5bit(r),pal5bit(g),pal5bit(b));
if(cmode0)
palette_set_color_rgb(space.machine(),(offset*2)^0x400,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color((offset*2)^0x400,pal5bit(r),pal5bit(g),pal5bit(b));
}
break;
}
@ -5826,8 +5826,8 @@ void saturn_state::refresh_palette_data( void )
b = ((m_vdp2_cram[c_i] & 0x00ff0000) >> 16);
g = ((m_vdp2_cram[c_i] & 0x0000ff00) >> 8);
r = ((m_vdp2_cram[c_i] & 0x000000ff) >> 0);
palette_set_color(machine(),c_i,rgb_t(r,g,b));
palette_set_color(machine(),c_i+0x400,rgb_t(r,g,b));
m_palette->set_pen_color(c_i,rgb_t(r,g,b));
m_palette->set_pen_color(c_i+0x400,rgb_t(r,g,b));
}
}
break;
@ -5840,11 +5840,11 @@ void saturn_state::refresh_palette_data( void )
b = ((m_vdp2_cram[c_i] & 0x00007c00) >> 10);
g = ((m_vdp2_cram[c_i] & 0x000003e0) >> 5);
r = ((m_vdp2_cram[c_i] & 0x0000001f) >> 0);
palette_set_color_rgb(machine(),(c_i*2)+1+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color((c_i*2)+1+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b));
b = ((m_vdp2_cram[c_i] & 0x7c000000) >> 26);
g = ((m_vdp2_cram[c_i] & 0x03e00000) >> 21);
r = ((m_vdp2_cram[c_i] & 0x001f0000) >> 16);
palette_set_color_rgb(machine(),c_i*2+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color(c_i*2+bank*0x400,pal5bit(r),pal5bit(g),pal5bit(b));
}
}
}
@ -5856,11 +5856,11 @@ void saturn_state::refresh_palette_data( void )
b = ((m_vdp2_cram[c_i] & 0x00007c00) >> 10);
g = ((m_vdp2_cram[c_i] & 0x000003e0) >> 5);
r = ((m_vdp2_cram[c_i] & 0x0000001f) >> 0);
palette_set_color_rgb(machine(),(c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color((c_i*2)+1,pal5bit(r),pal5bit(g),pal5bit(b));
b = ((m_vdp2_cram[c_i] & 0x7c000000) >> 26);
g = ((m_vdp2_cram[c_i] & 0x03e00000) >> 21);
r = ((m_vdp2_cram[c_i] & 0x001f0000) >> 16);
palette_set_color_rgb(machine(),c_i*2,pal5bit(r),pal5bit(g),pal5bit(b));
m_palette->set_pen_color(c_i*2,pal5bit(r),pal5bit(g),pal5bit(b));
}
}
break;
@ -6205,7 +6205,7 @@ void saturn_state::stv_vdp2_fade_effects( void )
for(i=0;i<2048;i++)
{
/*Fade A*/
color = palette_get_color(machine(), i);
color = m_palette->pen_color(i);
t_r = (STV_VDP2_COAR & 0x100) ? (color.r() - (0x100 - (STV_VDP2_COAR & 0xff))) : ((STV_VDP2_COAR & 0xff) + color.r());
t_g = (STV_VDP2_COAG & 0x100) ? (color.g() - (0x100 - (STV_VDP2_COAG & 0xff))) : ((STV_VDP2_COAG & 0xff) + color.g());
t_b = (STV_VDP2_COAB & 0x100) ? (color.b() - (0x100 - (STV_VDP2_COAB & 0xff))) : ((STV_VDP2_COAB & 0xff) + color.b());
@ -6218,10 +6218,10 @@ void saturn_state::stv_vdp2_fade_effects( void )
r = t_r;
g = t_g;
b = t_b;
palette_set_color(machine(),i+(2048*1),rgb_t(r,g,b));
m_palette->set_pen_color(i+(2048*1),rgb_t(r,g,b));
/*Fade B*/
color = palette_get_color(machine(), i);
color = m_palette->pen_color(i);
t_r = (STV_VDP2_COBR & 0x100) ? (color.r() - (0xff - (STV_VDP2_COBR & 0xff))) : ((STV_VDP2_COBR & 0xff) + color.r());
t_g = (STV_VDP2_COBG & 0x100) ? (color.g() - (0xff - (STV_VDP2_COBG & 0xff))) : ((STV_VDP2_COBG & 0xff) + color.g());
t_b = (STV_VDP2_COBB & 0x100) ? (color.b() - (0xff - (STV_VDP2_COBB & 0xff))) : ((STV_VDP2_COBB & 0xff) + color.b());
@ -6234,7 +6234,7 @@ void saturn_state::stv_vdp2_fade_effects( void )
r = t_r;
g = t_g;
b = t_b;
palette_set_color(machine(),i+(2048*2),rgb_t(r,g,b));
m_palette->set_pen_color(i+(2048*2),rgb_t(r,g,b));
}
//popmessage("%04x %04x %04x %04x %04x %04x",STV_VDP2_COAR,STV_VDP2_COAG,STV_VDP2_COAB,STV_VDP2_COBR,STV_VDP2_COBG,STV_VDP2_COBB);
}
@ -6581,7 +6581,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
pix += (STV_VDP2_SPCAOS << 8);
pix &= 0x7ff;
pix += color_offset_pal;
bitmap_line[x] = machine().pens[ pix ];
bitmap_line[x] = m_palette->pen( pix );
}
}
@ -6681,15 +6681,15 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if ( STV_VDP2_CCMD )
{
bitmap_line[x] = stv_add_blend( bitmap_line[x], machine().pens[pix] );
bitmap_line[x] = stv_add_blend( bitmap_line[x], m_palette->pen(pix) );
}
else
{
bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
bitmap_line[x] = alpha_blend_r32( bitmap_line[x], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
}
}
else
bitmap_line[x] = machine().pens[pix];
bitmap_line[x] = m_palette->pen(pix);
}
}
@ -6848,15 +6848,15 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if(double_x)
{
bitmap_line[x*2] = machine().pens[ pix ];
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = machine().pens[ pix ];
bitmap_line[x*2+1] = machine().pens[ pix ];
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = machine().pens[ pix ];
bitmap_line[x*2] = m_palette->pen( pix );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = m_palette->pen( pix );
bitmap_line[x*2+1] = m_palette->pen( pix );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = m_palette->pen( pix );
}
else
{
bitmap_line[x] = machine().pens[ pix ];
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = machine().pens[ pix ];
bitmap_line[x] = m_palette->pen( pix );
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = m_palette->pen( pix );
}
}
else // alpha_blend == 1
@ -6865,30 +6865,30 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if(double_x)
{
bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], machine().pens[pix] );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x], machine().pens[pix] );
bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], machine().pens[pix] );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x], machine().pens[pix] );
bitmap_line[x*2] = stv_add_blend( bitmap_line[x*2], m_palette->pen(pix) );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
bitmap_line[x*2+1] = stv_add_blend( bitmap_line[x*2+1], m_palette->pen(pix) );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
}
else
{
bitmap_line[x] = stv_add_blend( bitmap_line[x], machine().pens[pix] );
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], machine().pens[pix] );
bitmap_line[x] = stv_add_blend( bitmap_line[x], m_palette->pen(pix) );
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = stv_add_blend( bitmap_line2[x], m_palette->pen(pix) );
}
}
else
{
if(double_x)
{
bitmap_line[x*2] = alpha_blend_r32( bitmap_line[x*2], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
bitmap_line[x*2+1] = alpha_blend_r32( bitmap_line[x*2+1], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
bitmap_line[x*2] = alpha_blend_r32( bitmap_line[x*2], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2] = alpha_blend_r32( bitmap_line2[x], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
bitmap_line[x*2+1] = alpha_blend_r32( bitmap_line[x*2+1], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x*2+1] = alpha_blend_r32( bitmap_line2[x], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
}
else
{
bitmap_line[x] = alpha_blend_r32( bitmap_line[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = alpha_blend_r32( bitmap_line2[x], machine().pens[pix], ((UINT16)(0x1f-ccr)*0xff)/0x1f );
bitmap_line[x] = alpha_blend_r32( bitmap_line[x], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
if ( interlace_framebuffer == 1 ) bitmap_line2[x] = alpha_blend_r32( bitmap_line2[x], m_palette->pen(pix), ((UINT16)(0x1f-ccr)*0xff)/0x1f );
}
}
}

View File

@ -651,7 +651,7 @@ UINT32 upd3301_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
}
else
{
bitmap.fill(get_black_pen(machine()), cliprect);
bitmap.fill(rgb_t(0x00,0x00,0x00), cliprect);
}
return 0;
}

View File

@ -92,7 +92,8 @@ v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, cons
m_my_delta(0),
m_button_state(0),
m_vdp_ops_count(0),
m_vdp_engine(NULL)
m_vdp_engine(NULL),
m_palette(*this, "palette")
{
static_set_addrmap(*this, AS_DATA, ADDRESS_MAP_NAME(memmap));
}
@ -249,7 +250,7 @@ PALETTE_INIT_MEMBER(v99x8_device, v9938)
// create the full 512 colour palette
for (i=0;i<512;i++)
palette_set_color_rgb(machine(), i, pal3bit(i >> 6), pal3bit(i >> 3), pal3bit(i >> 0));
palette.set_pen_color(i, pal3bit(i >> 6), pal3bit(i >> 3), pal3bit(i >> 0));
}
/*
@ -271,9 +272,9 @@ PALETTE_INIT_MEMBER(v9958_device, v9958)
UINT8 pal[19268*3];
// init v9938 512-color palette
PALETTE_INIT_CALL_MEMBER(v9938);
PALETTE_INIT_NAME(v9938)(palette);
if(machine().total_colors() != 19780)
if(palette.entries() != 19780)
fatalerror("V9958: not enough palette, must be 19780");
// set up YJK table
@ -312,7 +313,7 @@ PALETTE_INIT_MEMBER(v9958_device, v9958)
pal[i*3+0] = r;
pal[i*3+1] = g;
pal[i*3+2] = b;
palette_set_color(machine(), i+512, rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)));
palette.set_pen_color(i+512, rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)));
v99x8_device::s_pal_indYJK[y | j << 5 | k << (5 + 6)] = i + 512;
i++;
}
@ -2020,7 +2021,7 @@ void v99x8_device::set_mode()
void v99x8_device::refresh_16(int line)
{
const pen_t *pens = machine().pens;
const pen_t *pens = m_palette->pens();
int i, double_lines;
UINT8 col[256];
UINT16 *ln, *ln2 = NULL;
@ -3259,7 +3260,8 @@ void v99x8_device::update_command()
}
static MACHINE_CONFIG_FRAGMENT( v9938 )
MCFG_PALETTE_INIT_OVERRIDE(v9938_device, v9938)
MCFG_PALETTE_ADD("palette", 19780)
MCFG_PALETTE_INIT_OWNER(v9938_device, v9938)
MACHINE_CONFIG_END
//-------------------------------------------------
@ -3273,7 +3275,8 @@ machine_config_constructor v9938_device::device_mconfig_additions() const
}
static MACHINE_CONFIG_FRAGMENT( v9958 )
MCFG_PALETTE_INIT_OVERRIDE(v9958_device, v9958)
MCFG_PALETTE_ADD("palette", 19780)
MCFG_PALETTE_INIT_OWNER(v9958_device, v9958)
MACHINE_CONFIG_END
//-------------------------------------------------

View File

@ -235,8 +235,8 @@ private:
void (v99x8_device::*draw_sprite_16)(const pen_t *, UINT16*, UINT8*);
void (v99x8_device::*draw_sprite_16s)(const pen_t *, UINT16*, UINT8*);
} ;
static const v99x8_mode s_modes[];
static const v99x8_mode s_modes[];
required_device<palette_device> m_palette;
protected:
static UINT16 s_pal_indYJK[0x20000];
};

View File

@ -191,7 +191,7 @@ WRITE8_MEMBER(_1942_state::c1942p_palette_w)
int g = (data & 0x38) >> 3;
int b = (data & 0xc0) >> 6;
colortable_palette_set_color(machine().colortable, offset, rgb_t(r<<5,g<<5,b<<6));
m_palette->set_indirect_color(offset, rgb_t(r<<5,g<<5,b<<6));
}
static ADDRESS_MAP_START( c1942p_map, AS_PROGRAM, 8, _1942_state )
@ -541,7 +541,9 @@ static MACHINE_CONFIG_START( 1942, _1942_state )
/* video hardware */
MCFG_GFXDECODE_ADD("gfxdecode", 1942)
MCFG_PALETTE_LENGTH(64*4+4*32*8+16*16)
MCFG_PALETTE_ADD("palette", 64*4+4*32*8+16*16)
MCFG_PALETTE_INIT_OWNER(_1942_state, 1942)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@ -598,8 +600,8 @@ static MACHINE_CONFIG_START( 1942p, _1942_state )
/* video hardware */
MCFG_GFXDECODE_ADD("gfxdecode", 1942p)
MCFG_PALETTE_LENGTH(0x500)
MCFG_PALETTE_INIT_OVERRIDE(_1942_state, 1942p)
MCFG_PALETTE_ADD("palette", 0x500)
MCFG_PALETTE_INIT_OWNER(_1942_state, 1942p)
MCFG_VIDEO_START_OVERRIDE(_1942_state,c1942p)
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -321,7 +321,8 @@ static MACHINE_CONFIG_START( 1943, _1943_state )
MCFG_SCREEN_UPDATE_DRIVER(_1943_state, screen_update_1943)
MCFG_GFXDECODE_ADD("gfxdecode", 1943)
MCFG_PALETTE_LENGTH(32*4+16*16+16*16+16*16)
MCFG_PALETTE_ADD("palette", 32*4+16*16+16*16+16*16)
MCFG_PALETTE_INIT_OWNER(_1943_state, 1943)
// sound hardware
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -118,10 +118,10 @@ void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
ypos = (source[0] & 0x00ff) >> 0;
tileno = (source2[0] & 0x7ffe) >> 1;
xpos |= (source2[0] & 0x0001) << 8;
gfx->transpen(bitmap,cliprect, tileno, 1, 0, 0, xpos, ypos, 0);
gfx->transpen(bitmap,cliprect, tileno, 1, 0, 0, xpos, ypos - 0x100, 0); // wrap
gfx->transpen(bitmap,cliprect, tileno, 1, 0, 0, xpos - 0x200, ypos, 0); // wrap
gfx->transpen(bitmap,cliprect, tileno, 1, 0, 0, xpos - 0x200, ypos - 0x100, 0); // wrap
gfx->transpen(m_palette,bitmap,cliprect, tileno, 1, 0, 0, xpos, ypos, 0);
gfx->transpen(m_palette,bitmap,cliprect, tileno, 1, 0, 0, xpos, ypos - 0x100, 0); // wrap
gfx->transpen(m_palette,bitmap,cliprect, tileno, 1, 0, 0, xpos - 0x200, ypos, 0); // wrap
gfx->transpen(m_palette,bitmap,cliprect, tileno, 1, 0, 0, xpos - 0x200, ypos - 0x100, 0); // wrap
source++;
source2++;
@ -158,7 +158,7 @@ static ADDRESS_MAP_START( k3_map, AS_PROGRAM, 16, k3_state )
AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM
AM_RANGE(0x100000, 0x10ffff) AM_RAM // Main Ram
AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram") // palette
AM_RANGE(0x200000, 0x200fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") // palette
AM_RANGE(0x240000, 0x240fff) AM_RAM AM_SHARE("spritera1")
AM_RANGE(0x280000, 0x280fff) AM_RAM AM_SHARE("spritera2")
AM_RANGE(0x2c0000, 0x2c0fff) AM_RAM_WRITE(k3_bgram_w) AM_SHARE("bgram")
@ -273,8 +273,8 @@ static MACHINE_CONFIG_START( k3, k3_state )
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(k3_state, screen_update_k3)
MCFG_PALETTE_LENGTH(0x800)
MCFG_PALETTE_ADD("palette", 0x800)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -224,7 +224,7 @@ static ADDRESS_MAP_START( drill_map, AS_PROGRAM, 16, _2mindril_state )
AM_RANGE(0x430000, 0x43ffff) AM_READWRITE(f3_pivot_r,f3_pivot_w)
AM_RANGE(0x460000, 0x46000f) AM_WRITE(f3_control_0_w)
AM_RANGE(0x460010, 0x46001f) AM_WRITE(f3_control_1_w)
AM_RANGE(0x500000, 0x501fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0x500000, 0x501fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x502022, 0x502023) AM_WRITENOP //countinously switches between 0 and 2
AM_RANGE(0x600000, 0x600007) AM_DEVREADWRITE8("ymsnd", ym2610_device, read, write, 0x00ff)
AM_RANGE(0x60000c, 0x60000d) AM_READWRITE(drill_irq_r,drill_irq_w)
@ -463,7 +463,8 @@ static MACHINE_CONFIG_START( drill, _2mindril_state )
MCFG_SCREEN_UPDATE_DRIVER(_2mindril_state, screen_update_f3)
MCFG_SCREEN_VBLANK_DRIVER(_2mindril_state, screen_eof_f3)
MCFG_PALETTE_LENGTH(0x2000)
MCFG_PALETTE_ADD("palette", 0x2000)
MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
MCFG_VIDEO_START_OVERRIDE(_2mindril_state,f3)

View File

@ -1101,7 +1101,7 @@ void _39in1_state::pxa255_lcd_dma_kickoff(int channel)
{
UINT16 color = space.read_word((lcd_regs->dma[channel].fsadr &~ 1) + index);
m_pxa255_lcd_palette[index >> 1] = (((((color >> 11) & 0x1f) << 3) | (color >> 13)) << 16) | (((((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3)) << 8) | (((color & 0x1f) << 3) | ((color >> 2) & 0x7));
palette_set_color_rgb(machine(), index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7));
m_palette->set_pen_color(index >> 1, (((color >> 11) & 0x1f) << 3) | (color >> 13), (((color >> 5) & 0x3f) << 2) | ((color >> 9) & 0x3), ((color & 0x1f) << 3) | ((color >> 2) & 0x7));
}
}
else
@ -1580,8 +1580,6 @@ static MACHINE_CONFIG_START( 39in1, _39in1_state )
MCFG_CPU_PROGRAM_MAP(39in1_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", _39in1_state, pxa255_vblank_start)
MCFG_PALETTE_LENGTH(32768)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -1589,7 +1587,7 @@ static MACHINE_CONFIG_START( 39in1, _39in1_state )
MCFG_SCREEN_VISIBLE_AREA(0, 295, 0, 479)
MCFG_SCREEN_UPDATE_DRIVER(_39in1_state, screen_update_39in1)
MCFG_PALETTE_LENGTH(256)
MCFG_PALETTE_ADD("palette", 256)
MCFG_EEPROM_SERIAL_93C66_ADD("eeprom")

View File

@ -211,7 +211,7 @@ static ADDRESS_MAP_START( _3x3puzzle_map, AS_PROGRAM, 16, _3x3puzzle_state )
AM_RANGE(0x201000, 0x201fff) AM_RAM AM_SHARE("videoram2")
AM_RANGE(0x202000, 0x202fff) AM_RAM AM_SHARE("videoram3")
AM_RANGE(0x280000, 0x280001) AM_READ_PORT("VBLANK")
AM_RANGE(0x300000, 0x3005ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE(0x300000, 0x3005ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x400000, 0x400001) AM_WRITE(tilemap1_scrollx_w)
AM_RANGE(0x480000, 0x480001) AM_WRITE(tilemap1_scrolly_w)
AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")
@ -394,7 +394,8 @@ static MACHINE_CONFIG_START( _3x3puzzle, _3x3puzzle_state )
MCFG_GFXDECODE_ADD("gfxdecode", _3x3puzzle)
MCFG_PALETTE_LENGTH(0x600/2)
MCFG_PALETTE_ADD("palette", 0x600/2)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -1075,8 +1075,8 @@ static MACHINE_CONFIG_START( 40love, fortyl_state )
MCFG_SCREEN_UPDATE_DRIVER(fortyl_state, screen_update_fortyl)
MCFG_GFXDECODE_ADD("gfxdecode", 40love)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INIT_OWNER(fortyl_state, fortyl)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -1130,8 +1130,8 @@ static MACHINE_CONFIG_START( undoukai, fortyl_state )
MCFG_SCREEN_UPDATE_DRIVER(fortyl_state, screen_update_fortyl)
MCFG_GFXDECODE_ADD("gfxdecode", 40love)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INIT_OWNER(fortyl_state, fortyl)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -301,13 +301,13 @@ void _4enraya_state::machine_reset()
m_last_snd_ctrl = 0;
}
void _4enraya_state::palette_init()
PALETTE_INIT_MEMBER(_4enraya_state, _4enraya)
{
int i;
/* RGB format */
for(i=0;i<8;i++)
palette_set_color(machine(), i, rgb_t(pal1bit(i >> 0),pal1bit(i >> 1),pal1bit(i >> 2)));
m_palette->set_pen_color(i, rgb_t(pal1bit(i >> 0),pal1bit(i >> 1),pal1bit(i >> 2)));
}
static MACHINE_CONFIG_START( 4enraya, _4enraya_state )
@ -329,8 +329,8 @@ static MACHINE_CONFIG_START( 4enraya, _4enraya_state )
MCFG_GFXDECODE_ADD("gfxdecode", 4enraya)
MCFG_PALETTE_LENGTH(8)
MCFG_PALETTE_ADD("palette", 8)
MCFG_PALETTE_INIT_OWNER(_4enraya_state, _4enraya)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -403,8 +403,8 @@ static MACHINE_CONFIG_START( 4roses, _4roses_state )
MCFG_GFXDECODE_ADD("gfxdecode", 4roses)
MCFG_PALETTE_LENGTH(0x1000)
MCFG_PALETTE_INIT_OVERRIDE(_4roses_state,funworld)
MCFG_PALETTE_ADD("palette", 0x1000)
MCFG_PALETTE_INIT_OWNER(_4roses_state,funworld)
MCFG_VIDEO_START_OVERRIDE(_4roses_state,funworld)
// MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK/8, mc6845_intf) /* 2MHz, guess */

View File

@ -490,7 +490,7 @@ public:
DECLARE_DRIVER_INIT(fclown);
TILE_GET_INFO_MEMBER(get_fclown_tile_info);
virtual void video_start();
virtual void palette_init();
DECLARE_PALETTE_INIT(_5clown);
UINT32 screen_update_fclown(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@ -552,7 +552,7 @@ UINT32 _5clown_state::screen_update_fclown(screen_device &screen, bitmap_ind16 &
return 0;
}
void _5clown_state::palette_init()
PALETTE_INIT_MEMBER(_5clown_state, _5clown)
{
const UINT8 *color_prom = memregion("proms")->base();
/*
@ -569,7 +569,7 @@ void _5clown_state::palette_init()
if (color_prom == 0) return;
for (i = 0;i < machine().total_colors();i++)
for (i = 0;i < m_palette->entries();i++)
{
int bit0, bit1, bit2, bit3, r, g, b, bk;
@ -589,7 +589,7 @@ void _5clown_state::palette_init()
bit2 = (color_prom[i] >> 2) & 0x01;
b = bk * (bit2 * 0xff);
palette_set_color(machine(), i, rgb_t(r, g, b));
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
}
@ -1064,8 +1064,8 @@ static MACHINE_CONFIG_START( fclown, _5clown_state )
MCFG_SCREEN_UPDATE_DRIVER(_5clown_state, screen_update_fclown)
MCFG_GFXDECODE_ADD("gfxdecode", fclown)
MCFG_PALETTE_LENGTH(256)
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_OWNER(_5clown_state, _5clown)
MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK/16, mc6845_intf) /* guess */

View File

@ -1265,8 +1265,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( rollingc, mw8080bw_root, _8080bw_state )
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(_8080bw_state, screen_update_rollingc)
MCFG_PALETTE_LENGTH(16)
MCFG_PALETTE_INIT_OVERRIDE(_8080bw_state, rollingc)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(_8080bw_state, rollingc)
/* sound hardware */
MCFG_FRAGMENT_ADD(invaders_samples_audio)

View File

@ -117,7 +117,7 @@ WRITE8_MEMBER(_88games_state::k052109_051960_w)
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, _88games_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE("banked_rom") /* banked ROM + palette RAM */
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram_1000") /* banked ROM + palette RAM */
AM_RANGE(0x1000, 0x1fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") /* banked ROM + palette RAM */
AM_RANGE(0x2000, 0x2fff) AM_RAM
AM_RANGE(0x3000, 0x37ff) AM_RAM AM_SHARE("nvram")
AM_RANGE(0x3800, 0x3fff) AM_READWRITE(bankedram_r, bankedram_w) AM_SHARE("ram")
@ -359,8 +359,6 @@ static MACHINE_CONFIG_START( 88games, _88games_state )
MCFG_NVRAM_ADD_0FILL("nvram")
/* video hardware */
MCFG_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -368,16 +366,21 @@ static MACHINE_CONFIG_START( 88games, _88games_state )
MCFG_SCREEN_VISIBLE_AREA(13*8, (64-13)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(_88games_state, screen_update_88games)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_GFXDECODE_ADD("gfxdecode", empty)
MCFG_K052109_ADD("k052109", _88games_k052109_intf)
MCFG_K052109_GFXDECODE("gfxdecode")
MCFG_K052109_PALETTE("palette")
MCFG_K051960_ADD("k051960", _88games_k051960_intf)
MCFG_K051960_GFXDECODE("gfxdecode")
MCFG_K051960_PALETTE("palette")
MCFG_K051316_ADD("k051316", _88games_k051316_intf)
MCFG_K051316_GFXDECODE("gfxdecode")
MCFG_K051316_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -71,7 +71,6 @@ public:
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_ace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void ace_postload();
required_device<gfxdecode_device> m_gfxdecode;
@ -98,19 +97,19 @@ UINT32 aceal_state::screen_update_ace(screen_device &screen, bitmap_ind16 &bitma
/* first of all, fill the screen with the background color */
bitmap.fill(0, cliprect);
m_gfxdecode->gfx(1)->opaque(bitmap,cliprect,
m_gfxdecode->gfx(1)->opaque(m_palette,bitmap,cliprect,
0,
0,
0, 0,
m_objpos[0], m_objpos[1]);
m_gfxdecode->gfx(2)->opaque(bitmap,cliprect,
m_gfxdecode->gfx(2)->opaque(m_palette,bitmap,cliprect,
0,
0,
0, 0,
m_objpos[2], m_objpos[3]);
m_gfxdecode->gfx(3)->opaque(bitmap,cliprect,
m_gfxdecode->gfx(3)->opaque(m_palette,bitmap,cliprect,
0,
0,
0, 0,
@ -118,7 +117,7 @@ UINT32 aceal_state::screen_update_ace(screen_device &screen, bitmap_ind16 &bitma
for (offs = 0; offs < 8; offs++)
{
m_gfxdecode->gfx(4)->opaque(bitmap,/* ?? */
m_gfxdecode->gfx(4)->opaque(m_palette,bitmap,/* ?? */
cliprect,
offs,
0,
@ -129,13 +128,6 @@ UINT32 aceal_state::screen_update_ace(screen_device &screen, bitmap_ind16 &bitma
}
void aceal_state::palette_init()
{
palette_set_color(machine(), 0, rgb_t(0x00,0x00,0x00)); /* black */
palette_set_color(machine(), 1, rgb_t(0xff,0xff,0xff)); /* white */
}
WRITE8_MEMBER(aceal_state::ace_characterram_w)
{
if (m_characterram[offset] != data)
@ -360,7 +352,7 @@ static MACHINE_CONFIG_START( ace, aceal_state )
MCFG_SCREEN_UPDATE_DRIVER(aceal_state, screen_update_ace)
MCFG_GFXDECODE_ADD("gfxdecode", ace)
MCFG_PALETTE_LENGTH(2)
MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
/* sound hardware */
/* ???? */

View File

@ -42,7 +42,7 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(starspnr_payout_r);
DECLARE_DRIVER_INIT(sidewndr);
virtual void video_start();
virtual void palette_init();
DECLARE_PALETTE_INIT(acefruit);
UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(acefruit_vblank);
void acefruit_update_irq(int vpos);
@ -130,7 +130,7 @@ UINT32 acefruit_state::screen_update_acefruit(screen_device &screen, bitmap_ind1
if( color < 0x4 )
{
m_gfxdecode->gfx(1)->opaque(bitmap,cliprect, code, color, 0, 0, col * 16, row * 8 );
m_gfxdecode->gfx(1)->opaque(m_palette,bitmap,cliprect, code, color, 0, 0, col * 16, row * 8 );
}
else if( color >= 0x5 && color <= 0x7 )
{
@ -282,27 +282,27 @@ WRITE8_MEMBER(acefruit_state::acefruit_solenoid_w)
}
}
void acefruit_state::palette_init()
PALETTE_INIT_MEMBER(acefruit_state, acefruit)
{
/* sprites */
palette_set_color( machine(), 0, rgb_t(0x00, 0x00, 0x00) );
palette_set_color( machine(), 1, rgb_t(0x00, 0x00, 0xff) );
palette_set_color( machine(), 2, rgb_t(0x00, 0xff, 0x00) );
palette_set_color( machine(), 3, rgb_t(0xff, 0x7f, 0x00) );
palette_set_color( machine(), 4, rgb_t(0xff, 0x00, 0x00) );
palette_set_color( machine(), 5, rgb_t(0xff, 0xff, 0x00) );
palette_set_color( machine(), 6, rgb_t(0xff, 0xff, 0xff) );
palette_set_color( machine(), 7, rgb_t(0x7f, 0x3f, 0x1f) );
palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 1, rgb_t(0x00, 0x00, 0xff) );
palette.set_pen_color( 2, rgb_t(0x00, 0xff, 0x00) );
palette.set_pen_color( 3, rgb_t(0xff, 0x7f, 0x00) );
palette.set_pen_color( 4, rgb_t(0xff, 0x00, 0x00) );
palette.set_pen_color( 5, rgb_t(0xff, 0xff, 0x00) );
palette.set_pen_color( 6, rgb_t(0xff, 0xff, 0xff) );
palette.set_pen_color( 7, rgb_t(0x7f, 0x3f, 0x1f) );
/* tiles */
palette_set_color( machine(), 8, rgb_t(0x00, 0x00, 0x00) );
palette_set_color( machine(), 9, rgb_t(0xff, 0xff, 0xff) );
palette_set_color( machine(), 10, rgb_t(0x00, 0x00, 0x00) );
palette_set_color( machine(), 11, rgb_t(0x00, 0x00, 0xff) );
palette_set_color( machine(), 12, rgb_t(0x00, 0x00, 0x00) );
palette_set_color( machine(), 13, rgb_t(0x00, 0xff, 0x00) );
palette_set_color( machine(), 14, rgb_t(0x00, 0x00, 0x00) );
palette_set_color( machine(), 15, rgb_t(0xff, 0x00, 0x00) );
palette.set_pen_color( 8, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 9, rgb_t(0xff, 0xff, 0xff) );
palette.set_pen_color( 10, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 11, rgb_t(0x00, 0x00, 0xff) );
palette.set_pen_color( 12, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 13, rgb_t(0x00, 0xff, 0x00) );
palette.set_pen_color( 14, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 15, rgb_t(0xff, 0x00, 0x00) );
}
static ADDRESS_MAP_START( acefruit_map, AS_PROGRAM, 8, acefruit_state )
@ -614,7 +614,8 @@ static MACHINE_CONFIG_START( acefruit, acefruit_state )
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
MCFG_SCREEN_UPDATE_DRIVER(acefruit_state, screen_update_acefruit)
MCFG_PALETTE_LENGTH(16)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(acefruit_state, acefruit)
MCFG_NVRAM_ADD_0FILL("nvram")

View File

@ -177,7 +177,7 @@ void acommand_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
xx = w;
do
{
m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
m_gfxdecode->gfx(2)->transpen(m_palette,bitmap,cliprect,
code,
color,
flipx, flipy,
@ -470,7 +470,7 @@ static ADDRESS_MAP_START( acommand_map, AS_PROGRAM, 16, acommand_state )
AM_RANGE(0x082208, 0x082209) AM_WRITE(ac_unk2_w)
AM_RANGE(0x0a0000, 0x0a3fff) AM_RAM_WRITE(ac_bgvram_w) AM_SHARE("ac_bgvram")
AM_RANGE(0x0b0000, 0x0b3fff) AM_RAM_WRITE(ac_txvram_w) AM_SHARE("ac_txvram")
AM_RANGE(0x0b8000, 0x0bffff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0b8000, 0x0bffff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0f0000, 0x0f7fff) AM_RAM
AM_RANGE(0x0f8000, 0x0f8fff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x0f9000, 0x0fffff) AM_RAM
@ -620,8 +620,8 @@ static MACHINE_CONFIG_START( acommand, acommand_state )
MCFG_SCREEN_UPDATE_DRIVER(acommand_state, screen_update_acommand)
MCFG_GFXDECODE_ADD("gfxdecode", acommand)
MCFG_PALETTE_LENGTH(0x4000)
MCFG_PALETTE_ADD("palette", 0x4000)
MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -79,7 +79,7 @@ static ADDRESS_MAP_START( actfan_map, AS_PROGRAM, 8, actfancr_state )
AM_RANGE(0x072000, 0x0727ff) AM_DEVREADWRITE("tilegen2", deco_bac06_device, pf_data_8bit_swap_r, pf_data_8bit_swap_w)
AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x110000, 0x110001) AM_WRITE(actfancr_buffer_spriteram_w)
AM_RANGE(0x120000, 0x1205ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
AM_RANGE(0x120000, 0x1205ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x130000, 0x130000) AM_READ_PORT("P1")
AM_RANGE(0x130001, 0x130001) AM_READ_PORT("P2")
AM_RANGE(0x130002, 0x130002) AM_READ_PORT("DSW1")
@ -102,7 +102,7 @@ static ADDRESS_MAP_START( triothep_map, AS_PROGRAM, 8, actfancr_state )
AM_RANGE(0x100000, 0x100001) AM_WRITE(actfancr_sound_w)
AM_RANGE(0x110000, 0x110001) AM_WRITE(actfancr_buffer_spriteram_w)
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x130000, 0x1305ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_byte_le_w) AM_SHARE("paletteram")
AM_RANGE(0x130000, 0x1305ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x140000, 0x140001) AM_READNOP /* Value doesn't matter */
AM_RANGE(0x1f0000, 0x1f3fff) AM_RAM AM_SHARE("main_ram") /* Main ram */
AM_RANGE(0x1ff000, 0x1ff001) AM_READWRITE(triothep_control_r, triothep_control_select_w)
@ -326,7 +326,9 @@ static MACHINE_CONFIG_START( actfancr, actfancr_state )
MCFG_SCREEN_UPDATE_DRIVER(actfancr_state, screen_update_actfancr)
MCFG_GFXDECODE_ADD("gfxdecode", actfan)
MCFG_PALETTE_LENGTH(768)
MCFG_PALETTE_ADD("palette", 768)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
deco_bac06_device::set_gfx_region_wide(*device,2,2,2);
@ -338,6 +340,7 @@ static MACHINE_CONFIG_START( actfancr, actfancr_state )
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
deco_mxc06_device::set_gfx_region(*device, 1);
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -378,7 +381,9 @@ static MACHINE_CONFIG_START( triothep, actfancr_state )
MCFG_SCREEN_UPDATE_DRIVER(actfancr_state, screen_update_actfancr)
MCFG_GFXDECODE_ADD("gfxdecode", triothep)
MCFG_PALETTE_LENGTH(768)
MCFG_PALETTE_ADD("palette", 768)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
MCFG_DEVICE_ADD("tilegen1", DECO_BAC06, 0)
deco_bac06_device::set_gfx_region_wide(*device,2,2,0);
@ -390,6 +395,7 @@ static MACHINE_CONFIG_START( triothep, actfancr_state )
MCFG_DEVICE_ADD("spritegen", DECO_MXC06, 0)
deco_mxc06_device::set_gfx_region(*device, 1);
MCFG_DECO_MXC06_GFXDECODE("gfxdecode")
MCFG_DECO_MXC06_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -316,7 +316,7 @@ PALETTE_INIT_MEMBER(adp_state,adp)
{
int i;
for (i = 0; i < machine().total_colors(); i++)
for (i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2, r, g, b;
@ -337,7 +337,7 @@ PALETTE_INIT_MEMBER(adp_state,adp)
bit2 = (i >> 2) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine(), i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r,g,b));
}
}
@ -459,7 +459,7 @@ WRITE8_MEMBER(adp_state::ramdac_io_w)
break;
case 2:
m_pal.b = ((data & 0x3f) << 2) | ((data & 0x30) >> 4);
palette_set_color(machine(), m_pal.offs, rgb_t(m_pal.r, m_pal.g, m_pal.b));
m_palette->set_pen_color(m_pal.offs, rgb_t(m_pal.r, m_pal.g, m_pal.b));
m_pal.offs_internal = 0;
m_pal.offs++;
m_pal.offs&=0xff;
@ -641,9 +641,9 @@ static MACHINE_CONFIG_START( quickjac, adp_state )
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1)
MCFG_SCREEN_UPDATE_DRIVER(adp_state, screen_update)
MCFG_PALETTE_LENGTH(0x10)
MCFG_PALETTE_ADD("palette", 0x10)
MCFG_PALETTE_INIT_OVERRIDE(adp_state,adp)
MCFG_PALETTE_INIT_OWNER(adp_state,adp)
MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map)
@ -677,9 +677,9 @@ static MACHINE_CONFIG_START( skattv, adp_state )
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1)
MCFG_SCREEN_UPDATE_DRIVER(adp_state, screen_update)
MCFG_PALETTE_LENGTH(0x10)
MCFG_PALETTE_ADD("palette", 0x10)
MCFG_PALETTE_INIT_OVERRIDE(adp_state,adp)
MCFG_PALETTE_INIT_OWNER(adp_state,adp)
MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map)
@ -712,9 +712,9 @@ static MACHINE_CONFIG_START( backgamn, adp_state )
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_SCREEN_UPDATE_DRIVER(adp_state, screen_update)
MCFG_PALETTE_LENGTH(0x10)
MCFG_PALETTE_ADD("palette", 0x10)
// MCFG_PALETTE_INIT_OVERRIDE(adp_state,adp)
// MCFG_PALETTE_INIT_OWNER(adp_state,adp)
MCFG_H63484_ADD("h63484", 0, adp_h63484_intf, adp_h63484_map)
@ -734,8 +734,8 @@ static MACHINE_CONFIG_DERIVED( funland, fashiong )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(funland_mem)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_INIT_OVERRIDE(driver_device, all_black)
MCFG_DEVICE_REMOVE("palette")
MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x100)
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( fstation, fashiong )

View File

@ -263,9 +263,7 @@ static MACHINE_CONFIG_START( formatz, aeroboto_state )
MCFG_GFXDECODE_ADD("gfxdecode", aeroboto)
MCFG_PALETTE_LENGTH(256)
MCFG_PALETTE_INIT_OVERRIDE(driver_device, RRRR_GGGG_BBBB)
MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", 256)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -140,7 +140,7 @@ static ADDRESS_MAP_START( pspikes_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_SHARE("bg1videoram")
AM_RANGE(0xffc000, 0xffc3ff) AM_WRITEONLY AM_SHARE("spriteram3")
AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
@ -156,7 +156,7 @@ static ADDRESS_MAP_START( pspikesb_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xffc000, 0xffcbff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0xffd200, 0xffd201) AM_WRITE(pspikesb_gfxbank_w)
AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0")
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1")
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
@ -176,7 +176,7 @@ static ADDRESS_MAP_START( spikes91_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xffc000, 0xffcfff) AM_RAM AM_SHARE("spriteram3")
//AM_RANGE(0xffd200, 0xffd201) AM_WRITE(pspikesb_gfxbank_w)
AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0")
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
@ -191,7 +191,7 @@ static ADDRESS_MAP_START( pspikesc_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_SHARE("bg1videoram")
AM_RANGE(0xffc000, 0xffcbff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
@ -209,7 +209,7 @@ static ADDRESS_MAP_START( karatblz_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x0c0000, 0x0cffff) AM_RAM /* work RAM */
AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM /* work RAM */
AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0ff000, 0x0ff001) AM_READ_PORT("IN0")
AM_RANGE(0x0ff002, 0x0ff003) AM_READ_PORT("IN1") AM_WRITE(karatblz_gfxbank_w)
AM_RANGE(0x0ff004, 0x0ff005) AM_READ_PORT("IN2")
@ -227,7 +227,7 @@ static ADDRESS_MAP_START( spinlbrk_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xff8000, 0xffbfff) AM_RAM /* work RAM */
AM_RANGE(0xffc000, 0xffc7ff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0xffd000, 0xffd1ff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffe7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(spinlbrk_gfxbank_w)
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg2scrollx_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW")
@ -245,7 +245,7 @@ static ADDRESS_MAP_START( turbofrc_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM /* work RAM */
AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0x0fd000, 0x0fdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0fe000, 0x0fe7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0ff000, 0x0ff001) AM_READ_PORT("IN0")
AM_RANGE(0x0ff002, 0x0ff003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg1scrolly_w)
AM_RANGE(0x0ff004, 0x0ff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg2scrollx_w)
@ -265,7 +265,7 @@ static ADDRESS_MAP_START( aerofgtb_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM /* work RAM */
AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1") AM_WRITE(aerofgt_bg1scrolly_w)
AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1") AM_WRITE(aerofgt_bg2scrollx_w)
@ -278,7 +278,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( aerofgt_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x1a0000, 0x1a07ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x1a0000, 0x1a07ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x1b0000, 0x1b07ff) AM_RAM AM_SHARE("rasterram") /* used only for the scroll registers */
AM_RANGE(0x1b0800, 0x1b0801) AM_NOP /* ??? */
AM_RANGE(0x1b0ff0, 0x1b0fff) AM_RAM /* stack area during boot */
@ -309,7 +309,7 @@ static ADDRESS_MAP_START( aerfboot_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM /* work RAM */
AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM //AM_SHARE("spriteram3")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1")
AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1")
@ -338,7 +338,7 @@ static ADDRESS_MAP_START( aerfboo2_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0x0e4000, 0x0e7fff) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x0f8000, 0x0fbfff) AM_RAM /* work RAM */
AM_RANGE(0x0fc000, 0x0fc7ff) AM_RAM AM_SHARE("spriteram3")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0x0fd000, 0x0fd7ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0x0fe000, 0x0fe001) AM_READ_PORT("IN0")
AM_RANGE(0x0fe002, 0x0fe003) AM_READ_PORT("IN1")
AM_RANGE(0x0fe004, 0x0fe005) AM_READ_PORT("DSW1")
@ -365,7 +365,7 @@ static ADDRESS_MAP_START( wbbc97_map, AS_PROGRAM, 16, aerofgt_state )
AM_RANGE(0xff8000, 0xff8fff) AM_RAM_WRITE(aerofgt_bg1videoram_w) AM_SHARE("bg1videoram")
AM_RANGE(0xffc000, 0xffc3ff) AM_WRITEONLY AM_SHARE("spriteram3")
AM_RANGE(0xffd000, 0xffdfff) AM_RAM AM_SHARE("rasterram") /* bg1 scroll registers */
AM_RANGE(0xffe000, 0xffefff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")
AM_RANGE(0xffe000, 0xffefff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xfff000, 0xfff001) AM_READ_PORT("IN0") AM_WRITE(pspikes_palette_bank_w)
AM_RANGE(0xfff002, 0xfff003) AM_READ_PORT("IN1") AM_WRITE(pspikes_gfxbank_w)
AM_RANGE(0xfff004, 0xfff005) AM_READ_PORT("DSW") AM_WRITE(aerofgt_bg1scrolly_w)
@ -1327,13 +1327,14 @@ static MACHINE_CONFIG_START( pspikes, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
MCFG_GFXDECODE_ADD("gfxdecode", pspikes)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@ -1369,7 +1370,8 @@ static MACHINE_CONFIG_START( spikes91, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spikes91)
MCFG_GFXDECODE_ADD("gfxdecode", spikes91)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@ -1401,7 +1403,8 @@ static MACHINE_CONFIG_START( pspikesb, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikesb)
MCFG_GFXDECODE_ADD("gfxdecode", pspikesb)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@ -1431,12 +1434,14 @@ static MACHINE_CONFIG_START( pspikesc, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
MCFG_GFXDECODE_ADD("gfxdecode", pspikes)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,pspikes)
@ -1471,17 +1476,20 @@ static MACHINE_CONFIG_START( karatblz, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_karatblz)
MCFG_GFXDECODE_ADD("gfxdecode", turbofrc)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,karatblz)
@ -1520,18 +1528,21 @@ static MACHINE_CONFIG_START( spinlbrk, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spinlbrk)
MCFG_GFXDECODE_ADD("gfxdecode", turbofrc)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_PRITYPE(1)
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback ) // rom lookup
MCFG_VSYSTEM_SPR2_SET_PRITYPE(1)
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,spinlbrk)
@ -1570,17 +1581,20 @@ static MACHINE_CONFIG_START( turbofrc, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
MCFG_GFXDECODE_ADD("gfxdecode", turbofrc)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@ -1620,17 +1634,20 @@ static MACHINE_CONFIG_START( aerofgtb, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
MCFG_GFXDECODE_ADD("gfxdecode", aerofgtb)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_DEVICE_ADD("vsystem_spr_ol2", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_ol2_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(3)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@ -1670,12 +1687,14 @@ static MACHINE_CONFIG_START( aerofgt, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerofgt)
MCFG_GFXDECODE_ADD("gfxdecode", aerofgt)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr", VSYSTEM_SPR, 0)
MCFG_VSYSTEM_SPR_SET_TILE_INDIRECT( aerofgt_state, aerofgt_tile_callback )
MCFG_VSYSTEM_SPR_SET_GFXREGION(2)
MCFG_VSYSTEM_SPR_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@ -1713,7 +1732,8 @@ static MACHINE_CONFIG_START( aerfboot, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboot)
MCFG_GFXDECODE_ADD("gfxdecode", aerfboot)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@ -1744,7 +1764,8 @@ static MACHINE_CONFIG_START( aerfboo2, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboo2)
MCFG_GFXDECODE_ADD("gfxdecode", aerfboo2)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,turbofrc)
@ -1777,12 +1798,14 @@ static MACHINE_CONFIG_START( wbbc97, aerofgt_state )
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_wbbc97)
MCFG_GFXDECODE_ADD("gfxdecode", wbbc97)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("vsystem_spr_old", VSYSTEM_SPR2, 0)
MCFG_VSYSTEM_SPR2_SET_TILE_INDIRECT( aerofgt_state, aerofgt_old_tile_callback )
MCFG_VSYSTEM_SPR2_SET_GFXREGION(1)
MCFG_VSYSTEM_SPR2_GFXDECODE("gfxdecode")
MCFG_VSYSTEM_SPR2_PALETTE("palette")
MCFG_VIDEO_START_OVERRIDE(aerofgt_state,wbbc97)

View File

@ -324,7 +324,7 @@ WRITE8_MEMBER(airbustr_state::airbustr_paletteram_w)
m_paletteram[offset] = data;
val = (m_paletteram[offset | 1] << 8) | m_paletteram[offset & ~1];
palette_set_color_rgb(machine(), offset / 2, pal5bit(val >> 5), pal5bit(val >> 10), pal5bit(val >> 0));
m_palette->set_pen_color(offset / 2, pal5bit(val >> 5), pal5bit(val >> 10), pal5bit(val >> 0));
}
WRITE8_MEMBER(airbustr_state::airbustr_coin_counter_w)
@ -637,10 +637,11 @@ static MACHINE_CONFIG_START( airbustr, airbustr_state )
MCFG_SCREEN_VBLANK_DRIVER(airbustr_state, screen_eof_airbustr)
MCFG_GFXDECODE_ADD("gfxdecode", airbustr)
MCFG_PALETTE_LENGTH(768)
MCFG_PALETTE_ADD("palette", 768)
MCFG_KANEKO_PANDORA_ADD("pandora", airbustr_pandora_config)
MCFG_KANEKO_PANDORA_GFXDECODE("gfxdecode")
MCFG_KANEKO_PANDORA_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -27,7 +27,7 @@ static ADDRESS_MAP_START( ajax_main_map, AS_PROGRAM, 8, ajax_state )
AM_RANGE(0x0000, 0x01c0) AM_READWRITE(ajax_ls138_f10_r, ajax_ls138_f10_w) /* bankswitch + sound command + FIRQ command */
AM_RANGE(0x0800, 0x0807) AM_DEVREADWRITE("k051960", k051960_device, k051937_r, k051937_w) /* sprite control registers */
AM_RANGE(0x0c00, 0x0fff) AM_DEVREADWRITE("k051960", k051960_device, k051960_r, k051960_w) /* sprite RAM 2128SL at J7 */
AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_byte_be_w) AM_SHARE("paletteram")/* palette */
AM_RANGE(0x1000, 0x1fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")/* palette */
AM_RANGE(0x2000, 0x3fff) AM_RAM AM_SHARE("share1") /* shared RAM with the 6809 */
AM_RANGE(0x4000, 0x5fff) AM_RAM /* RAM 6264L at K10 */
AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank2") /* banked ROM */
@ -219,8 +219,6 @@ static MACHINE_CONFIG_START( ajax, ajax_state )
/* video hardware */
MCFG_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -228,16 +226,21 @@ static MACHINE_CONFIG_START( ajax, ajax_state )
MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(ajax_state, screen_update_ajax)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_GFXDECODE_ADD("gfxdecode", empty)
MCFG_K052109_ADD("k052109", ajax_k052109_intf)
MCFG_K052109_GFXDECODE("gfxdecode")
MCFG_K052109_PALETTE("palette")
MCFG_K051960_ADD("k051960", ajax_k051960_intf)
MCFG_K051960_GFXDECODE("gfxdecode")
MCFG_K051960_PALETTE("palette")
MCFG_K051316_ADD("k051316", ajax_k051316_intf)
MCFG_K051316_GFXDECODE("gfxdecode")
MCFG_K051316_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -35,7 +35,7 @@ public:
DECLARE_WRITE8_MEMBER(hanaroku_out_2_w);
DECLARE_WRITE8_MEMBER(albazc_vregs_w);
virtual void video_start();
virtual void palette_init();
DECLARE_PALETTE_INIT(albazc);
UINT32 screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
@ -46,7 +46,7 @@ public:
/* video */
void albazc_state::palette_init()
PALETTE_INIT_MEMBER(albazc_state, albazc)
{
const UINT8 *color_prom = memregion("proms")->base();
int i;
@ -58,7 +58,7 @@ void albazc_state::palette_init()
g = ((color_prom[i * 2 + 1] & 0xe0) | ((color_prom[i * 2 + 0]& 0x03) <<8)) >> 5;
r = (color_prom[i * 2 + 0] & 0x7c) >> 2;
palette_set_color_rgb(machine(), i, pal5bit(r), pal5bit(g), pal5bit(b));
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
@ -87,7 +87,7 @@ void albazc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
flipy = !flipy;
}
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, code, color, flipx, flipy,
m_gfxdecode->gfx(0)->transpen(m_palette,bitmap,cliprect, code, color, flipx, flipy,
sx, sy, 0);
}
}
@ -285,8 +285,9 @@ static MACHINE_CONFIG_START( hanaroku, albazc_state )
MCFG_SCREEN_UPDATE_DRIVER(albazc_state, screen_update_hanaroku)
MCFG_GFXDECODE_ADD("gfxdecode", hanaroku)
MCFG_PALETTE_LENGTH(0x200)
MCFG_PALETTE_ADD("palette", 0x200)
MCFG_PALETTE_INIT_OWNER(albazc_state, albazc)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -58,8 +58,6 @@ public:
required_shared_ptr<UINT8> m_cus_ram;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
// UINT8 * m_paletteram; // currently this uses generic palette handling
// UINT8 * m_paletteram_2; // currently this uses generic palette handling
/* video-related */
tilemap_t *m_bg_tilemap;
@ -246,8 +244,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, albazg_state )
AM_RANGE(0xa7fc, 0xa7fc) AM_WRITE(prot_lock_w)
AM_RANGE(0xa7ff, 0xa7ff) AM_WRITE_PORT("EEPROMOUT")
AM_RANGE(0xaf80, 0xafff) AM_READWRITE(custom_ram_r, custom_ram_w) AM_SHARE("cus_ram")
AM_RANGE(0xb000, 0xb07f) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_split_lo_w) AM_SHARE("paletteram")
AM_RANGE(0xb080, 0xb0ff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_byte_split_hi_w) AM_SHARE("paletteram2")
AM_RANGE(0xb000, 0xb07f) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xb080, 0xb0ff) AM_RAM_DEVWRITE("palette", palette_device, write_ext) AM_SHARE("palette_ext")
AM_RANGE(0xc000, 0xc3ff) AM_RAM_WRITE(yumefuda_vram_w) AM_SHARE("videoram")
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(yumefuda_cram_w) AM_SHARE("colorram")
AM_RANGE(0xe000, 0xffff) AM_RAM
@ -405,8 +403,9 @@ static MACHINE_CONFIG_START( yumefuda, albazg_state )
MCFG_MC6845_ADD("crtc", H46505, "screen", MASTER_CLOCK/16, mc6845_intf) /* hand tuned to get ~60 fps */
MCFG_GFXDECODE_ADD("gfxdecode", yumefuda )
MCFG_PALETTE_LENGTH(0x80)
MCFG_GFXDECODE_ADD("gfxdecode", yumefuda )
MCFG_PALETTE_ADD("palette", 0x80)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
/* sound hardware */

View File

@ -837,7 +837,7 @@ static MACHINE_CONFIG_START( aleck64, aleck64_state )
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(aleck64_state, screen_update_n64)
MCFG_PALETTE_LENGTH(0x1000)
MCFG_PALETTE_ADD("palette", 0x1000)
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -104,7 +104,7 @@ VIDEO_START_MEMBER(alg_state,alg)
VIDEO_START_CALL_MEMBER(amiga);
/* configure pen 4096 as transparent in the renderer and use it for the genlock color */
palette_set_color(machine(), 4096, rgb_t(0,0,0,0));
m_palette->set_pen_color(4096, rgb_t(0,0,0,0));
amiga_set_genlock_color(machine(), 4096);
}
@ -457,8 +457,8 @@ static MACHINE_CONFIG_START( alg_r1, alg_state )
MCFG_SCREEN_SIZE(512*2, 262)
MCFG_SCREEN_VISIBLE_AREA((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
MCFG_PALETTE_LENGTH(4097)
MCFG_PALETTE_INIT_OVERRIDE(alg_state,amiga)
MCFG_PALETTE_ADD("palette", 4097)
MCFG_PALETTE_INIT_OWNER(alg_state,amiga)
MCFG_VIDEO_START_OVERRIDE(alg_state,alg)

View File

@ -90,7 +90,7 @@ static MACHINE_CONFIG_START( alien, alien_state )
MCFG_SCREEN_SIZE((32)*8, (32)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_PALETTE_LENGTH(0x1000)
MCFG_PALETTE_ADD("palette", 0x1000)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -34,7 +34,7 @@ READ8_MEMBER(aliens_state::bankedram_r)
WRITE8_MEMBER(aliens_state::bankedram_w)
{
if (m_palette_selected)
paletteram_xBBBBBGGGGGRRRRR_byte_be_w(space, offset, data);
m_palette->write(space, offset, data);
else
m_ram[offset] = data;
}
@ -241,8 +241,6 @@ static MACHINE_CONFIG_START( aliens, aliens_state )
/* video hardware */
MCFG_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(59.17) /* verified on pcb */
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@ -250,13 +248,17 @@ static MACHINE_CONFIG_START( aliens, aliens_state )
MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(aliens_state, screen_update_aliens)
MCFG_PALETTE_LENGTH(512)
MCFG_PALETTE_ADD("palette", 512)
MCFG_PALETTE_ENABLE_SHADOWS()
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
MCFG_GFXDECODE_ADD("gfxdecode", empty)
MCFG_K052109_ADD("k052109", aliens_k052109_intf)
MCFG_K052109_GFXDECODE("gfxdecode")
MCFG_K052109_PALETTE("palette")
MCFG_K051960_ADD("k051960", aliens_k051960_intf)
MCFG_K051960_GFXDECODE("gfxdecode")
MCFG_K051960_PALETTE("palette")
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -1964,8 +1964,8 @@ static MACHINE_CONFIG_START( sstingry, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_sstingry)
MCFG_GFXDECODE_ADD("gfxdecode", sstingry)
MCFG_PALETTE_LENGTH(256 + 1)
MCFG_PALETTE_INIT_OVERRIDE(alpha68k_state,kyros)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -2009,9 +2009,9 @@ static MACHINE_CONFIG_START( kyros, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
MCFG_GFXDECODE_ADD("gfxdecode", kyros)
MCFG_PALETTE_LENGTH(256 + 1)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INIT_OVERRIDE(alpha68k_state,kyros)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -2054,9 +2054,9 @@ static MACHINE_CONFIG_START( jongbou, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
MCFG_GFXDECODE_ADD("gfxdecode", jongbou)
MCFG_PALETTE_LENGTH(256 + 1)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INIT_OVERRIDE(alpha68k_state,kyros)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -2089,8 +2089,8 @@ static MACHINE_CONFIG_START( alpha68k_I, alpha68k_state )
MCFG_GFXDECODE_ADD("gfxdecode", paddle)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_INIT_OVERRIDE(alpha68k_state,paddlem)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -2130,7 +2130,7 @@ static MACHINE_CONFIG_START( alpha68k_II, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II)
MCFG_GFXDECODE_ADD("gfxdecode", alpha68k_II)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_VIDEO_START_OVERRIDE(alpha68k_state,alpha68k)
@ -2179,7 +2179,7 @@ static MACHINE_CONFIG_START( alpha68k_II_gm, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II)
MCFG_GFXDECODE_ADD("gfxdecode", alpha68k_II)
MCFG_PALETTE_LENGTH(2048)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_VIDEO_START_OVERRIDE(alpha68k_state,alpha68k)
@ -2222,7 +2222,7 @@ static MACHINE_CONFIG_START( alpha68k_V, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V)
MCFG_GFXDECODE_ADD("gfxdecode", alpha68k_V)
MCFG_PALETTE_LENGTH(4096)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_VIDEO_START_OVERRIDE(alpha68k_state,alpha68k)
@ -2264,7 +2264,7 @@ static MACHINE_CONFIG_START( alpha68k_V_sb, alpha68k_state )
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V_sb)
MCFG_GFXDECODE_ADD("gfxdecode", alpha68k_V)
MCFG_PALETTE_LENGTH(4096)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_VIDEO_START_OVERRIDE(alpha68k_state,alpha68k)
@ -2306,8 +2306,8 @@ static MACHINE_CONFIG_START( tnextspc, alpha68k_state )
MCFG_GFXDECODE_ADD("gfxdecode", tnextspc)
MCFG_PALETTE_LENGTH(1024)
MCFG_PALETTE_INIT_OVERRIDE(alpha68k_state,paddlem)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -451,7 +451,7 @@ public:
virtual void machine_start();
virtual void machine_reset();
virtual void video_start();
virtual void palette_init();
DECLARE_PALETTE_INIT(amaticmg);
DECLARE_PALETTE_INIT(amaticmg2);
UINT32 screen_update_amaticmg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_amaticmg2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -488,7 +488,7 @@ UINT32 amaticmg_state::screen_update_amaticmg(screen_device &screen, bitmap_ind1
/* TODO: this looks so out of place ... */
color = (m_attr[count]&0xf0)>>3;
gfx->opaque(bitmap,cliprect,tile,color,0,0,x*4,y*8);
gfx->opaque(m_palette,bitmap,cliprect,tile,color,0,0,x*4,y*8);
count++;
}
}
@ -512,7 +512,7 @@ UINT32 amaticmg_state::screen_update_amaticmg2(screen_device &screen, bitmap_ind
tile += ((m_attr[count]&0xff)<<8);
color = 0;
gfx->opaque(bitmap,cliprect,tile,color,0,0,x*4,y*8);
gfx->opaque(m_palette,bitmap,cliprect,tile,color,0,0,x*4,y*8);
count++;
}
}
@ -520,7 +520,7 @@ UINT32 amaticmg_state::screen_update_amaticmg2(screen_device &screen, bitmap_ind
return 0;
}
void amaticmg_state::palette_init()
PALETTE_INIT_MEMBER(amaticmg_state, amaticmg)
{
const UINT8 *color_prom = memregion("proms")->base();
int bit0, bit1, bit2 , r, g, b;
@ -541,7 +541,7 @@ void amaticmg_state::palette_init()
bit2 = (color_prom[0] >> 5) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine(), i, rgb_t(r, g, b));
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
@ -559,7 +559,7 @@ PALETTE_INIT_MEMBER(amaticmg_state,amaticmg2)
g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
r = ((color_prom[0] & 0x3e) >> 1);
palette_set_color_rgb(machine(), i >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
palette.set_pen_color(i >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
color_prom+=2;
}
}
@ -884,8 +884,8 @@ static MACHINE_CONFIG_START( amaticmg, amaticmg_state )
MCFG_GFXDECODE_ADD("gfxdecode", amaticmg)
MCFG_PALETTE_LENGTH(0x200)
MCFG_PALETTE_ADD("palette", 0x200)
MCFG_PALETTE_INIT_OWNER(amaticmg_state, amaticmg)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -916,8 +916,9 @@ static MACHINE_CONFIG_DERIVED( amaticmg2, amaticmg )
MCFG_SCREEN_UPDATE_DRIVER(amaticmg_state, screen_update_amaticmg2)
MCFG_GFXDECODE_MODIFY("gfxdecode", amaticmg2)
MCFG_PALETTE_INIT_OVERRIDE(amaticmg_state,amaticmg2)
MCFG_PALETTE_LENGTH(0x10000)
MCFG_DEVICE_REMOVE("palette")
MCFG_PALETTE_ADD("palette", 0x10000)
MCFG_PALETTE_INIT_OWNER(amaticmg_state,amaticmg2)
MACHINE_CONFIG_END

View File

@ -243,8 +243,8 @@ static MACHINE_CONFIG_START( ambush, ambush_state )
MCFG_SCREEN_UPDATE_DRIVER(ambush_state, screen_update_ambush)
MCFG_GFXDECODE_ADD("gfxdecode", ambush)
MCFG_PALETTE_LENGTH(256)
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_OWNER(ambush_state, ambush)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -1185,8 +1185,8 @@ static MACHINE_CONFIG_START( ampoker2, ampoker2_state )
MCFG_SCREEN_UPDATE_DRIVER(ampoker2_state, screen_update_ampoker2)
MCFG_GFXDECODE_ADD("gfxdecode", ampoker2)
MCFG_PALETTE_LENGTH(512)
MCFG_PALETTE_ADD("palette", 512)
MCFG_PALETTE_INIT_OWNER(ampoker2_state, ampoker2)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -274,8 +274,8 @@ static MACHINE_CONFIG_START( amspdwy, amspdwy_state )
MCFG_SCREEN_UPDATE_DRIVER(amspdwy_state, screen_update_amspdwy)
MCFG_GFXDECODE_ADD("gfxdecode", amspdwy)
MCFG_PALETTE_LENGTH(32)
MCFG_PALETTE_ADD("palette", 32)
MCFG_PALETTE_FORMAT(BBGGGRRR)
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -613,7 +613,7 @@ static MACHINE_CONFIG_START( angelkds, angelkds_state )
MCFG_SCREEN_UPDATE_DRIVER(angelkds_state, screen_update_angelkds)
MCFG_GFXDECODE_ADD("gfxdecode", angelkds)
MCFG_PALETTE_LENGTH(0x100)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -456,9 +456,9 @@ static MACHINE_CONFIG_DERIVED( appoooh, appoooh_common )
MCFG_SCREEN_UPDATE_DRIVER(appoooh_state, screen_update_appoooh)
MCFG_GFXDECODE_ADD("gfxdecode", appoooh)
MCFG_PALETTE_LENGTH(32*8+32*8)
MCFG_PALETTE_ADD("palette", 32*8+32*8)
MCFG_PALETTE_INIT_OVERRIDE(appoooh_state,appoooh)
MCFG_PALETTE_INIT_OWNER(appoooh_state,appoooh)
MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh)
MACHINE_CONFIG_END
@ -474,9 +474,9 @@ static MACHINE_CONFIG_DERIVED( robowres, appoooh_common )
MCFG_SCREEN_UPDATE_DRIVER(appoooh_state, screen_update_robowres)
MCFG_GFXDECODE_ADD("gfxdecode", robowres)
MCFG_PALETTE_LENGTH(32*8+32*8)
MCFG_PALETTE_ADD("palette", 32*8+32*8)
MCFG_PALETTE_INIT_OVERRIDE(appoooh_state,robowres)
MCFG_PALETTE_INIT_OWNER(appoooh_state,robowres)
MCFG_VIDEO_START_OVERRIDE(appoooh_state,appoooh)
MACHINE_CONFIG_END

View File

@ -106,7 +106,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, aquarium_state )
AM_RANGE(0xc01000, 0xc01fff) AM_RAM_WRITE(aquarium_bak_videoram_w) AM_SHARE("bak_videoram")
AM_RANGE(0xc02000, 0xc03fff) AM_RAM_WRITE(aquarium_txt_videoram_w) AM_SHARE("txt_videoram")
AM_RANGE(0xc80000, 0xc81fff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0xd00000, 0xd00fff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0xd00000, 0xd00fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xd80014, 0xd8001f) AM_WRITEONLY AM_SHARE("scroll")
AM_RANGE(0xd80068, 0xd80069) AM_WRITENOP /* probably not used */
AM_RANGE(0xd80080, 0xd80081) AM_READ_PORT("DSW")
@ -316,8 +316,8 @@ static MACHINE_CONFIG_START( aquarium, aquarium_state )
MCFG_SCREEN_UPDATE_DRIVER(aquarium_state, screen_update_aquarium)
MCFG_GFXDECODE_ADD("gfxdecode", aquarium)
MCFG_PALETTE_LENGTH(0x1000/2)
MCFG_PALETTE_ADD("palette", 0x1000/2)
MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

View File

@ -371,8 +371,8 @@ static MACHINE_CONFIG_START( arabian, arabian_state )
MCFG_SCREEN_VISIBLE_AREA(0, 255, 11, 244)
MCFG_SCREEN_UPDATE_DRIVER(arabian_state, screen_update_arabian)
MCFG_PALETTE_LENGTH(256*32)
MCFG_PALETTE_ADD("palette", 256*32)
MCFG_PALETTE_INIT_OWNER(arabian_state, arabian)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -328,7 +328,7 @@ static MACHINE_CONFIG_START( arcadecl, arcadecl_state )
/* video hardware */
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
MCFG_GFXDECODE_ADD("gfxdecode", arcadecl)
MCFG_PALETTE_LENGTH(512)
MCFG_PALETTE_ADD("palette", 512)
MCFG_ATARI_MOTION_OBJECTS_ADD("mob", "screen", arcadecl_state::s_mob_config)
MCFG_ATARI_MOTION_OBJECTS_GFXDECODE("gfxdecode")

View File

@ -346,8 +346,8 @@ static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state )
MCFG_SCREEN_VISIBLE_AREA((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga)
MCFG_PALETTE_LENGTH(4096)
MCFG_PALETTE_INIT_OVERRIDE(arcadia_amiga_state,amiga)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_INIT_OWNER(arcadia_amiga_state,amiga)
MCFG_VIDEO_START_OVERRIDE(arcadia_amiga_state,amiga)

Some files were not shown because too many files have changed in this diff Show More