/*************************************************************************** Draw the game screen in the given osd_bitmap. Do NOT call osd_update_display() from this function, it will be called by the main emulation engine. ***************************************************************************/ void vigilant_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh) { int i; if (rear_disable) /* opaque foreground */ { for (i = 0;i < 8;i++) palette_used_colors[256 + 16*i] = PALETTE_COLOR_USED; } else { for (i = 0;i < 8;i++) palette_used_colors[256 + 16*i] = PALETTE_COLOR_TRANSPARENT; } /* copy the background palette */ for (i = 0;i < 16;i++) { int r,g,b; r = (paletteram[0x400 + 16 * rear_color + i] << 3) & 0xFF; g = (paletteram[0x500 + 16 * rear_color + i] << 3) & 0xFF; b = (paletteram[0x600 + 16 * rear_color + i] << 3) & 0xFF; palette_change_color(512 + i,r,g,b); r = (paletteram[0x400 + 16 * rear_color + 32 + i] << 3) & 0xFF; g = (paletteram[0x500 + 16 * rear_color + 32 + i] << 3) & 0xFF; b = (paletteram[0x600 + 16 * rear_color + 32 + i] << 3) & 0xFF; palette_change_color(512 + 16 + i,r,g,b); } if (palette_recalc()) { fast_memset(dirtybuffer,1,videoram_size); rear_refresh = 1; } if (rear_disable) /* opaque foreground */ { draw_foreground(bitmap,0,1); draw_sprites(bitmap); draw_foreground(bitmap,1,1); } else { draw_background(bitmap); draw_foreground(bitmap,0,0); draw_sprites(bitmap); draw_foreground(bitmap,1,0); } }
void atarisys2_paletteram_w (int offset, int data) { static const int intensity_table[16] = { #define ZB 115 #define Z3 78 #define Z2 37 #define Z1 17 #define Z0 9 0, ZB+Z0, ZB+Z1, ZB+Z1+Z0, ZB+Z2, ZB+Z2+Z0, ZB+Z2+Z1, ZB+Z2+Z1+Z0, ZB+Z3, ZB+Z3+Z0, ZB+Z3+Z1, ZB+Z3+Z1+Z0,ZB+ Z3+Z2, ZB+Z3+Z2+Z0, ZB+Z3+Z2+Z1, ZB+Z3+Z2+Z1+Z0 }; static const int color_table[16] = { 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf }; int inten, red, green, blue; int oldword = READ_WORD (&paletteram[offset]); int newword = COMBINE_WORD (oldword, data); int indx = offset / 2; WRITE_WORD (&paletteram[offset], newword); inten = intensity_table[newword & 15]; red = (color_table[(newword >> 12) & 15] * inten) >> 4; green = (color_table[(newword >> 8) & 15] * inten) >> 4; blue = (color_table[(newword >> 4) & 15] * inten) >> 4; palette_change_color (indx, red, green, blue); }
void namcos2_68k_video_palette_w( int offset, int data ) { int oldword = READ_WORD(&namcos2_68k_palette_ram[offset&0xffff]); int newword = COMBINE_WORD(oldword, data); int pen,red,green,blue; if(oldword != newword) { WRITE_WORD(&namcos2_68k_palette_ram[offset&0xffff],newword); /* 0x3000 offset is control registers */ if((offset&0x3000)!=0x3000) { pen=(((offset&0xc000)>>2) | (offset&0x0fff))>>1; red =(READ_WORD(&namcos2_68k_palette_ram[offset&0xcfff]))&0x00ff; green=(READ_WORD(&namcos2_68k_palette_ram[(offset&0xcfff)+0x1000]))&0x00ff; blue =(READ_WORD(&namcos2_68k_palette_ram[(offset&0xcfff)+0x2000]))&0x00ff; /* Int color, uchar r/g/b */ palette_change_color(pen,red,green,blue); // if (errorlog) fprintf(errorlog,"CPU#%d PC=$%06x Video Palette write Addr=%08x, Data=%04x\n",cpu_getactivecpu(),cpu_get_pc(),offset,data); if (errorlog) fprintf(errorlog,"CPU#%d PC=$%06x Video Palette PEN=%04x, R=%02x, G=%02x B=%02x\n",cpu_getactivecpu(),cpu_get_pc(),pen,red,green,blue); }
static void namcos1_palette_refresh(int start,int offset,int num) { int color; offset = (offset/0x800)*0x2000 + (offset&0x7ff); for (color = start; color < start + num; color++) { int r,g,b; r = namcos1_paletteram[offset]; g = namcos1_paletteram[offset + 0x0800]; b = namcos1_paletteram[offset + 0x1000]; palette_change_color(color,r,g,b); if (offset >= 0x2000) { r = namcos1_paletteram[offset + 0x2000]; g = namcos1_paletteram[offset + 0x2800]; b = namcos1_paletteram[offset + 0x3000]; palette_change_color(color+TILECOLORS,r,g,b); } offset++; } }
void exidy_color_w(int offset,int data) { int i; exidy_color_latch[offset]=data; for (i=0;i<8;i++) { int r,g,b; r=((exidy_color_latch[COLOR_RED]>>i) & 0x01) * 0xFF; g=((exidy_color_latch[COLOR_GREEN]>>i) & 0x01) * 0xFF; b=((exidy_color_latch[COLOR_BLUE]>>i) & 0x01) * 0xFF; palette_change_color(i,r,g,b); } }
void klax_paletteram_w (int offset, int data) { if (!(data & 0xff000000)) { paletteram[(offset / 2) ^ BYTE_XOR] = data >> 8; { int newword = READ_WORD (&paletteram[(offset / 4) * 2]); int red = (((newword >> 10) & 31) * 224) >> 5; int green = (((newword >> 5) & 31) * 224) >> 5; int blue = (((newword ) & 31) * 224) >> 5; if (red) red += 38; if (green) green += 38; if (blue) blue += 38; palette_change_color ((offset / 4) & 0x1ff, red, green, blue); } }
void capbowl_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh) { int halfwidth = (Machine->visible_area.max_x - Machine->visible_area.min_x + 1) / 2; struct tms34061_display state; int x, y, palindex; /* first get the current display state */ tms34061_get_display_state(&state); /* if we're blanked, just fill with black */ if (state.blanked) { fillbitmap(bitmap, palette_transparent_pen, &Machine->visible_area); return; } /* update the palette and color usage */ for (y = Machine->visible_area.min_y; y <= Machine->visible_area.max_y; y++) if (state.dirty[y]) { UINT8 *src = &state.vram[256 * y]; UINT8 *usage = &color_usage[16 * y]; /* update the palette */ for (x = 0; x < 16; x++) { int r = *src++ & 0x0f; int g = *src >> 4; int b = *src++ & 0x0f; palette_change_color(y * 16 + x, (r << 4) | r, (g << 4) | g, (b << 4) | b); } /* recount the colors */ memset(usage, 0, 16); for (x = 0; x < halfwidth; x++) { int pix = *src++; usage[pix >> 4] = 1; usage[pix & 0x0f] = 1; } }
void toobin_paletteram_w (int offset, int data) { int oldword = READ_WORD (&paletteram[offset]); int newword = COMBINE_WORD (oldword, data); WRITE_WORD (&paletteram[offset], newword); { int red = (((newword >> 10) & 31) * 224) >> 5; int green = (((newword >> 5) & 31) * 224) >> 5; int blue = (((newword ) & 31) * 224) >> 5; if (red) red += 38; if (green) green += 38; if (blue) blue += 38; if (!(newword & 0x8000)) { red = (red * last_intensity) >> 5; green = (green * last_intensity) >> 5; blue = (blue * last_intensity) >> 5; } palette_change_color ((offset / 2) & 0x3ff, red, green, blue); }
/* LT 20-3-1998 */ void invadpt2_sh_port3_w(int offset, int data) { static unsigned char Sound = 0; if (data & 0x01 && ~Sound & 0x01) sample_start (0, 0, 1); if (~data & 0x01 && Sound & 0x01) sample_stop (0); if (data & 0x02 && ~Sound & 0x02) sample_start (1, 1, 0); if (data & 0x04 && ~Sound & 0x04){ sample_start (2, 2, 0); /* turn all colours red here */ palette_change_color(1,0xff,0x00,0x00); palette_change_color(2,0xff,0x00,0x00); palette_change_color(3,0xff,0x00,0x00); palette_change_color(4,0xff,0x00,0x00); palette_change_color(5,0xff,0x00,0x00); palette_change_color(6,0xff,0x00,0x00); } if (~data & 0x04 && Sound & 0x04){ sample_stop (2); palette_change_color(1,0xff,0x20,0x20); palette_change_color(2,0x20,0xff,0x20); palette_change_color(3,0xff,0xff,0x20); palette_change_color(4,0xff,0xff,0xff); palette_change_color(5,0x20,0xff,0xff); palette_change_color(6,0xff,0x20,0xff); } if (data & 0x08 && ~Sound & 0x08) sample_start (3, 3, 0); Sound = data; }