Previous 199869 Revisions Next

r17717 Saturday 8th September, 2012 at 10:05:20 UTC by Curt Coder
mos6560: Refactored to use an rgb32 bitmap. (nw)
[src/emu/sound]mos6560.c mos6560.h

trunk/src/emu/sound/mos6560.c
r17716r17717
148148};
149149
150150
151//**************************************************************************
152//  INLINE HELPERS
153//**************************************************************************
154151
155//-------------------------------------------------
156//  initialize_palette -
157//-------------------------------------------------
158
159inline void mos6560_device::initialize_palette()
160{
161   palette_set_colors(machine(), 0, PALETTE, ARRAY_LENGTH(PALETTE));
162}
163
164152/*****************************************************************************
165153    IMPLEMENTATION
166154*****************************************************************************/
r17716r17717
189177   {
190178      code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff);
191179
192      m_bitmap.pix16(y + yoff, xoff + 0) = color[code >> 7];
193      m_bitmap.pix16(y + yoff, xoff + 1) = color[(code >> 6) & 1];
194      m_bitmap.pix16(y + yoff, xoff + 2) = color[(code >> 5) & 1];
195      m_bitmap.pix16(y + yoff, xoff + 3) = color[(code >> 4) & 1];
196      m_bitmap.pix16(y + yoff, xoff + 4) = color[(code >> 3) & 1];
197      m_bitmap.pix16(y + yoff, xoff + 5) = color[(code >> 2) & 1];
198      m_bitmap.pix16(y + yoff, xoff + 6) = color[(code >> 1) & 1];
199      m_bitmap.pix16(y + yoff, xoff + 7) = color[code & 1];
180      m_bitmap.pix32(y + yoff, xoff + 0) = PALETTE[color[code >> 7]];
181      m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE[color[(code >> 6) & 1]];
182      m_bitmap.pix32(y + yoff, xoff + 2) = PALETTE[color[(code >> 5) & 1]];
183      m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE[color[(code >> 4) & 1]];
184      m_bitmap.pix32(y + yoff, xoff + 4) = PALETTE[color[(code >> 3) & 1]];
185      m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE[color[(code >> 2) & 1]];
186      m_bitmap.pix32(y + yoff, xoff + 6) = PALETTE[color[(code >> 1) & 1]];
187      m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE[color[code & 1]];
200188   }
201189}
202190
r17716r17717
213201   {
214202      code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff);
215203
216      m_bitmap.pix16(y + yoff, xoff + 0) =
217         m_bitmap.pix16(y + yoff, xoff + 1) = color[code >> 6];
218      m_bitmap.pix16(y + yoff, xoff + 2) =
219         m_bitmap.pix16(y + yoff, xoff + 3) = color[(code >> 4) & 3];
220      m_bitmap.pix16(y + yoff, xoff + 4) =
221         m_bitmap.pix16(y + yoff, xoff + 5) = color[(code >> 2) & 3];
222      m_bitmap.pix16(y + yoff, xoff + 6) =
223         m_bitmap.pix16(y + yoff, xoff + 7) = color[code & 3];
204      m_bitmap.pix32(y + yoff, xoff + 0) =
205         m_bitmap.pix32(y + yoff, xoff + 1) = PALETTE[color[code >> 6]];
206      m_bitmap.pix32(y + yoff, xoff + 2) =
207         m_bitmap.pix32(y + yoff, xoff + 3) = PALETTE[color[(code >> 4) & 3]];
208      m_bitmap.pix32(y + yoff, xoff + 4) =
209         m_bitmap.pix32(y + yoff, xoff + 5) = PALETTE[color[(code >> 2) & 3]];
210      m_bitmap.pix32(y + yoff, xoff + 6) =
211         m_bitmap.pix32(y + yoff, xoff + 7) = PALETTE[color[code & 3]];
224212   }
225213}
226214
r17716r17717
242230   for (line = first; (line < m_ypos) && (line < last); line++)
243231   {
244232      for (j = 0; j < m_total_xsize; j++)
245         m_bitmap.pix16(line, j) = m_framecolor;
233         m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
246234   }
247235
248236   for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);)
r17716r17717
266254      {
267255         for (i = ybegin; i <= yend; i++)
268256            for (j = 0; j < m_xpos; j++)
269               m_bitmap.pix16(yoff + i, j) = m_framecolor;
257               m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
270258      }
271259
272260      for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++)
r17716r17717
313301      {
314302         for (i = ybegin; i <= yend; i++)
315303            for (j = xoff; j < m_total_xsize; j++)
316               m_bitmap.pix16(yoff + i, j) = m_framecolor;
304               m_bitmap.pix32(yoff + i, j) = PALETTE[m_framecolor];
317305      }
318306
319307      if (m_matrix8x16)
r17716r17717
330318
331319   for (; line < last; line++)
332320      for (j = 0; j < m_total_xsize; j++)
333         m_bitmap.pix16(line, j) = m_framecolor;
321         m_bitmap.pix32(line, j) = PALETTE[m_framecolor];
334322}
335323
336324
r17716r17717
489477     main screen bitmap
490478-------------------------------------------------*/
491479
492UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
480UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
493481{
494482   copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
495483
r17716r17717
792780      break;
793781   }
794782
795   // initialize palette
796   initialize_palette();
797
798783   sound_start();
799784
800785   save_item(NAME(m_lightpenreadtime));
trunk/src/emu/sound/mos6560.h
r17716r17717
5050   MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
5151   MCFG_SCREEN_VISIBLE_AREA(MOS6560_MAME_XPOS, MOS6560_MAME_XPOS + MOS6560_MAME_XSIZE - 1, MOS6560_MAME_YPOS, MOS6560_MAME_YPOS + MOS6560_MAME_YSIZE - 1) \
5252   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
53   MCFG_PALETTE_LENGTH(16) \
5453   MCFG_SOUND_ADD(_tag, MOS6560, _clock) \
5554   MCFG_DEVICE_CONFIG(_config) \
5655   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
r17716r17717
6362   MCFG_SCREEN_SIZE((MOS6561_XSIZE + 7) & ~7, MOS6561_YSIZE) \
6463   MCFG_SCREEN_VISIBLE_AREA(MOS6561_MAME_XPOS, MOS6561_MAME_XPOS + MOS6561_MAME_XSIZE - 1, MOS6561_MAME_YPOS, MOS6561_MAME_YPOS + MOS6561_MAME_YSIZE - 1) \
6564   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
66   MCFG_PALETTE_LENGTH(16) \
6765   MCFG_SOUND_ADD(_tag, MOS6561, _clock) \
6866   MCFG_DEVICE_CONFIG(_config) \
6967   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
r17716r17717
7674   MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \
7775   MCFG_SCREEN_VISIBLE_AREA(0, 23*8 - 1, 0, 22*8 - 1) \
7876   MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \
79   MCFG_PALETTE_LENGTH(16) \
8077   MCFG_SOUND_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \
8178   MCFG_DEVICE_CONFIG(_config) \
8279   MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \
r17716r17717
160157
161158   DECLARE_WRITE_LINE_MEMBER( lp_w );
162159
163   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
160   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
164161   void raster_interrupt_gen();
165162
166163protected:
r17716r17717
179176   // sound stream update overrides
180177   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
181178
182   inline void initialize_palette();
183179   inline UINT8 read_videoram(offs_t offset);
184180   inline UINT8 read_colorram(offs_t offset);
185181
r17716r17717
198194
199195   UINT8 m_reg[16];
200196
201   bitmap_ind16 m_bitmap;
197   bitmap_rgb32 m_bitmap;
202198
203199   int m_rasterline, m_lastline;
204200   double m_lightpenreadtime;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team