trunk/src/emu/sound/mos6560.c
| r17716 | r17717 | |
| 148 | 148 | }; |
| 149 | 149 | |
| 150 | 150 | |
| 151 | | //************************************************************************** |
| 152 | | // INLINE HELPERS |
| 153 | | //************************************************************************** |
| 154 | 151 | |
| 155 | | //------------------------------------------------- |
| 156 | | // initialize_palette - |
| 157 | | //------------------------------------------------- |
| 158 | | |
| 159 | | inline void mos6560_device::initialize_palette() |
| 160 | | { |
| 161 | | palette_set_colors(machine(), 0, PALETTE, ARRAY_LENGTH(PALETTE)); |
| 162 | | } |
| 163 | | |
| 164 | 152 | /***************************************************************************** |
| 165 | 153 | IMPLEMENTATION |
| 166 | 154 | *****************************************************************************/ |
| r17716 | r17717 | |
| 189 | 177 | { |
| 190 | 178 | code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); |
| 191 | 179 | |
| 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]]; |
| 200 | 188 | } |
| 201 | 189 | } |
| 202 | 190 | |
| r17716 | r17717 | |
| 213 | 201 | { |
| 214 | 202 | code = read_videoram((m_chargenaddr + ch * m_charheight + y) & 0x3fff); |
| 215 | 203 | |
| 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]]; |
| 224 | 212 | } |
| 225 | 213 | } |
| 226 | 214 | |
| r17716 | r17717 | |
| 242 | 230 | for (line = first; (line < m_ypos) && (line < last); line++) |
| 243 | 231 | { |
| 244 | 232 | 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]; |
| 246 | 234 | } |
| 247 | 235 | |
| 248 | 236 | for (vline = line - m_ypos; (line < last) && (line < m_ypos + m_ysize);) |
| r17716 | r17717 | |
| 266 | 254 | { |
| 267 | 255 | for (i = ybegin; i <= yend; i++) |
| 268 | 256 | 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]; |
| 270 | 258 | } |
| 271 | 259 | |
| 272 | 260 | for (xoff = m_xpos; (xoff < m_xpos + m_xsize) && (xoff < m_total_xsize); xoff += 8, offs++) |
| r17716 | r17717 | |
| 313 | 301 | { |
| 314 | 302 | for (i = ybegin; i <= yend; i++) |
| 315 | 303 | 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]; |
| 317 | 305 | } |
| 318 | 306 | |
| 319 | 307 | if (m_matrix8x16) |
| r17716 | r17717 | |
| 330 | 318 | |
| 331 | 319 | for (; line < last; line++) |
| 332 | 320 | 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]; |
| 334 | 322 | } |
| 335 | 323 | |
| 336 | 324 | |
| r17716 | r17717 | |
| 489 | 477 | main screen bitmap |
| 490 | 478 | -------------------------------------------------*/ |
| 491 | 479 | |
| 492 | | UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 480 | UINT32 mos6560_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 493 | 481 | { |
| 494 | 482 | copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect); |
| 495 | 483 | |
| r17716 | r17717 | |
| 792 | 780 | break; |
| 793 | 781 | } |
| 794 | 782 | |
| 795 | | // initialize palette |
| 796 | | initialize_palette(); |
| 797 | | |
| 798 | 783 | sound_start(); |
| 799 | 784 | |
| 800 | 785 | save_item(NAME(m_lightpenreadtime)); |
trunk/src/emu/sound/mos6560.h
| r17716 | r17717 | |
| 50 | 50 | MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \ |
| 51 | 51 | MCFG_SCREEN_VISIBLE_AREA(MOS6560_MAME_XPOS, MOS6560_MAME_XPOS + MOS6560_MAME_XSIZE - 1, MOS6560_MAME_YPOS, MOS6560_MAME_YPOS + MOS6560_MAME_YSIZE - 1) \ |
| 52 | 52 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \ |
| 53 | | MCFG_PALETTE_LENGTH(16) \ |
| 54 | 53 | MCFG_SOUND_ADD(_tag, MOS6560, _clock) \ |
| 55 | 54 | MCFG_DEVICE_CONFIG(_config) \ |
| 56 | 55 | MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ |
| r17716 | r17717 | |
| 63 | 62 | MCFG_SCREEN_SIZE((MOS6561_XSIZE + 7) & ~7, MOS6561_YSIZE) \ |
| 64 | 63 | MCFG_SCREEN_VISIBLE_AREA(MOS6561_MAME_XPOS, MOS6561_MAME_XPOS + MOS6561_MAME_XSIZE - 1, MOS6561_MAME_YPOS, MOS6561_MAME_YPOS + MOS6561_MAME_YSIZE - 1) \ |
| 65 | 64 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \ |
| 66 | | MCFG_PALETTE_LENGTH(16) \ |
| 67 | 65 | MCFG_SOUND_ADD(_tag, MOS6561, _clock) \ |
| 68 | 66 | MCFG_DEVICE_CONFIG(_config) \ |
| 69 | 67 | MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ |
| r17716 | r17717 | |
| 76 | 74 | MCFG_SCREEN_SIZE((MOS6560_XSIZE + 7) & ~7, MOS6560_YSIZE) \ |
| 77 | 75 | MCFG_SCREEN_VISIBLE_AREA(0, 23*8 - 1, 0, 22*8 - 1) \ |
| 78 | 76 | MCFG_SCREEN_UPDATE_DEVICE(_tag, mos6560_device, screen_update) \ |
| 79 | | MCFG_PALETTE_LENGTH(16) \ |
| 80 | 77 | MCFG_SOUND_ADD(_tag, MOS656X_ATTACK_UFO, _clock) \ |
| 81 | 78 | MCFG_DEVICE_CONFIG(_config) \ |
| 82 | 79 | MCFG_DEVICE_ADDRESS_MAP(AS_0, _videoram_map) \ |
| r17716 | r17717 | |
| 160 | 157 | |
| 161 | 158 | DECLARE_WRITE_LINE_MEMBER( lp_w ); |
| 162 | 159 | |
| 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); |
| 164 | 161 | void raster_interrupt_gen(); |
| 165 | 162 | |
| 166 | 163 | protected: |
| r17716 | r17717 | |
| 179 | 176 | // sound stream update overrides |
| 180 | 177 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 181 | 178 | |
| 182 | | inline void initialize_palette(); |
| 183 | 179 | inline UINT8 read_videoram(offs_t offset); |
| 184 | 180 | inline UINT8 read_colorram(offs_t offset); |
| 185 | 181 | |
| r17716 | r17717 | |
| 198 | 194 | |
| 199 | 195 | UINT8 m_reg[16]; |
| 200 | 196 | |
| 201 | | bitmap_ind16 m_bitmap; |
| 197 | bitmap_rgb32 m_bitmap; |
| 202 | 198 | |
| 203 | 199 | int m_rasterline, m_lastline; |
| 204 | 200 | double m_lightpenreadtime; |