mos6560: Refactored to use an rgb32 bitmap. (nw)

This commit is contained in:
Curt Coder 2012-09-08 10:05:20 +00:00
parent a18efa439f
commit 539cd6d083
2 changed files with 23 additions and 42 deletions

View File

@ -148,18 +148,6 @@ static const rgb_t PALETTE[] =
};
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
//-------------------------------------------------
// initialize_palette -
//-------------------------------------------------
inline void mos6560_device::initialize_palette()
{
palette_set_colors(machine(), 0, PALETTE, ARRAY_LENGTH(PALETTE));
}
/*****************************************************************************
IMPLEMENTATION
@ -189,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.pix16(y + yoff, xoff + 0) = color[code >> 7];
m_bitmap.pix16(y + yoff, xoff + 1) = color[(code >> 6) & 1];
m_bitmap.pix16(y + yoff, xoff + 2) = color[(code >> 5) & 1];
m_bitmap.pix16(y + yoff, xoff + 3) = color[(code >> 4) & 1];
m_bitmap.pix16(y + yoff, xoff + 4) = color[(code >> 3) & 1];
m_bitmap.pix16(y + yoff, xoff + 5) = color[(code >> 2) & 1];
m_bitmap.pix16(y + yoff, xoff + 6) = color[(code >> 1) & 1];
m_bitmap.pix16(y + yoff, xoff + 7) = color[code & 1];
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]];
}
}
@ -213,14 +201,14 @@ 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.pix16(y + yoff, xoff + 0) =
m_bitmap.pix16(y + yoff, xoff + 1) = color[code >> 6];
m_bitmap.pix16(y + yoff, xoff + 2) =
m_bitmap.pix16(y + yoff, xoff + 3) = color[(code >> 4) & 3];
m_bitmap.pix16(y + yoff, xoff + 4) =
m_bitmap.pix16(y + yoff, xoff + 5) = color[(code >> 2) & 3];
m_bitmap.pix16(y + yoff, xoff + 6) =
m_bitmap.pix16(y + yoff, xoff + 7) = color[code & 3];
m_bitmap.pix32(y + yoff, xoff + 0) =
m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE[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 + 4) =
m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE[color[(code >> 2) & 3]];
m_bitmap.pix32(y + yoff, xoff + 6) =
m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE[color[code & 3]];
}
}
@ -242,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.pix16(line, j) = m_framecolor;
m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
}
for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);)
@ -266,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.pix16(yoff + i, j) = m_framecolor;
m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
}
for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++)
@ -313,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.pix16(yoff + i, j) = m_framecolor;
m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
}
if (m_matrix8x16)
@ -330,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.pix16(line, j) = m_framecolor;
m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
}
@ -489,7 +477,7 @@ void mos6560_device::raster_interrupt_gen()
main screen bitmap
-------------------------------------------------*/
UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
@ -792,9 +780,6 @@ void mos6560_device::device_start()
break;
}
// initialize palette
initialize_palette();
sound_start();
save_item(NAME(m_lightpenreadtime));

View File

@ -50,7 +50,6 @@
MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(MOS6560_MAME_XPOS, MOS6560_MAME_XPOS + MOS6560_MAME_XSIZE - 1, MOS6560_MAME_YPOS, MOS6560_MAME_YPOS + MOS6560_MAME_YSIZE - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
MCFG_PALETTE_LENGTH(16) \
MCFG_SOUND_ADD(_tag, MOS6560, _clock) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
@ -63,7 +62,6 @@
MCFG_SCREEN_SIZE((MOS6561_XSIZE + 7) & ~7, MOS6561_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(MOS6561_MAME_XPOS, MOS6561_MAME_XPOS + MOS6561_MAME_XSIZE - 1, MOS6561_MAME_YPOS, MOS6561_MAME_YPOS + MOS6561_MAME_YSIZE - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
MCFG_PALETTE_LENGTH(16) \
MCFG_SOUND_ADD(_tag, MOS6561, _clock) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
@ -76,7 +74,6 @@
MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
MCFG_SCREEN_VISIBLE_AREA(0, 23*8 - 1, 0, 22*8 - 1) \
MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
MCFG_PALETTE_LENGTH(16) \
MCFG_SOUND_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
@ -160,7 +157,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( lp_w );
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void raster_interrupt_gen();
protected:
@ -179,7 +176,6 @@ protected:
// sound stream update overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
inline void initialize_palette();
inline UINT8 read_videoram(offs_t offset);
inline UINT8 read_colorram(offs_t offset);
@ -198,7 +194,7 @@ protected:
UINT8 m_reg[16];
bitmap_ind16 m_bitmap;
bitmap_rgb32 m_bitmap;
int m_rasterline, m_lastline;
double m_lightpenreadtime;