summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2012-09-08 10:05:20 +0000
committer Curt Coder <curtcoder@mail.com>2012-09-08 10:05:20 +0000
commit539cd6d083458d208a88c86e38c278e0b789134d (patch)
treef04b2ca3fa490a4402acf43a89a17b58bbf60c4a /src/emu
parenta18efa439f620b8b679f9717fc2adc1d4776b928 (diff)
mos6560: Refactored to use an rgb32 bitmap. (nw)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/sound/mos6560.c57
-rw-r--r--src/emu/sound/mos6560.h8
2 files changed, 23 insertions, 42 deletions
diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c
index 73dedc8d81d..422b69d1687 100644
--- a/src/emu/sound/mos6560.c
+++ b/src/emu/sound/mos6560.c
@@ -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));
diff --git a/src/emu/sound/mos6560.h b/src/emu/sound/mos6560.h
index ad532160df6..87dcfc08725 100644
--- a/src/emu/sound/mos6560.h
+++ b/src/emu/sound/mos6560.h
@@ -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;