const pen_t *tlc34076_get_pens(device_t *device) { tlc34076_state *state = get_safe_token(device); offs_t i; for (i = 0; i < 0x100; i++) { int r, g, b; if ((i & state->regs[PIXEL_READ_MASK]) == i) { r = state->local_paletteram[3 * i + 0]; g = state->local_paletteram[3 * i + 1]; b = state->local_paletteram[3 * i + 2]; if (state->dacbits == 6) { r = pal6bit(r); g = pal6bit(g); b = pal6bit(b); } } else { r = 0; g = 0; b = 0; } state->pens[i] = MAKE_RGB(r, g, b); } return state->pens; }
const pen_t *tlc34076_device::get_pens() { offs_t i; for (i = 0; i < 0x100; i++) { int r, g, b; if ((i & m_regs[PIXEL_READ_MASK]) == i) { r = m_local_paletteram[3 * i + 0]; g = m_local_paletteram[3 * i + 1]; b = m_local_paletteram[3 * i + 2]; if (m_dacbits == 6) { r = pal6bit(r); g = pal6bit(g); b = pal6bit(b); } } else { r = 0; g = 0; b = 0; } m_pens[i] = MAKE_RGB(r, g, b); } return m_pens; }
static WRITE8_HANDLER( dunhuang_paldata_w ) { dunhuang_paldata[dunhuang_paloffs] = data; palette_set_color_rgb( machine, dunhuang_paloffs/3, pal6bit(dunhuang_paldata[(dunhuang_paloffs/3)*3+0]), pal6bit(dunhuang_paldata[(dunhuang_paloffs/3)*3+1]), pal6bit(dunhuang_paldata[(dunhuang_paloffs/3)*3+2]) ); dunhuang_paloffs = (dunhuang_paloffs + 1) % (3*256); }
static WRITE8_HANDLER( dunhuang_paldata_w ) { dunhuang_state *state = space->machine().driver_data<dunhuang_state>(); state->m_paldata[state->m_paloffs] = data; palette_set_color_rgb( space->machine(), state->m_paloffs/3, pal6bit(state->m_paldata[(state->m_paloffs/3)*3+0]), pal6bit(state->m_paldata[(state->m_paloffs/3)*3+1]), pal6bit(state->m_paldata[(state->m_paloffs/3)*3+2]) ); state->m_paloffs = (state->m_paloffs + 1) % (3*256); }
static WRITE16_HANDLER( bmc_RAMDAC_color_w ) { bmcbowl_state *state = space->machine().driver_data<bmcbowl_state>(); state->m_bmc_colorram[state->m_clr_offset]=data; palette_set_color_rgb(space->machine(),state->m_clr_offset/3,pal6bit(state->m_bmc_colorram[(state->m_clr_offset/3)*3]),pal6bit(state->m_bmc_colorram[(state->m_clr_offset/3)*3+1]),pal6bit(state->m_bmc_colorram[(state->m_clr_offset/3)*3+2])); state->m_clr_offset=(state->m_clr_offset+1)%768; }
/* 'Normal' layers, no line/columnscroll. No per-line effects. Zooming isn't supported just because it's not used and it would be slow */ static void draw_bglayer( running_machine &machine, int layer, bitmap_t *bitmap, const rectangle *cliprect, UINT8 req_pri ) { psikyosh_state *state = machine.driver_data<psikyosh_state>(); gfx_element *gfx; int offs = 0, sx, sy; int scrollx, scrolly, regbank, tilebank, alpha, alphamap, zoom, pri, size, width; assert(!BG_LINE(layer)); gfx = BG_DEPTH_8BPP(layer) ? machine.gfx[1] : machine.gfx[0]; size = BG_LARGE(layer) ? 32 : 16; width = 16 * size; regbank = BG_TYPE(layer); scrollx = (state->m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000001ff) >> 0; scrolly = (state->m_bgram[(regbank * 0x800) / 4 + 0x3f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x03ff0000) >> 16; tilebank = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x000000ff) >> 0; alpha = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00003f00) >> 8; alphamap = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00008000) >> 15; zoom = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0x00ff0000) >> 16; pri = (state->m_bgram[(regbank * 0x800) / 4 + 0x7f0 / 4 + (layer * 0x04) / 4 - 0x4000 / 4] & 0xff000000) >> 24; if(pri != req_pri) return; if (alphamap) /* alpha values are per-pen */ alpha = -1; else alpha = pal6bit(0x3f - alpha); /* 0x3f-0x00 maps to 0x00-0xff */ if(zoom) { popmessage("draw_bglayer() zoom not implemented\nContact MAMEDEV"); } if ((tilebank >= 0x0a) && (tilebank <= 0x1f)) /* 20 banks of 0x800 bytes. filter garbage. */ { for (sy = 0; sy < size; sy++) { for (sx = 0; sx < 32; sx++) { int tileno, colour; tileno = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0x0007ffff); /* seems to take into account spriteram, hence -0x4000 */ colour = (state->m_bgram[(tilebank * 0x800) / 4 + offs - 0x4000 / 4] & 0xff000000) >> 24; drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)), alpha); /* normal */ if (scrollx) drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)), alpha); /* wrap x */ if (scrolly) drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, (16 * sx + scrollx) & 0x1ff, ((16 * sy + scrolly) & (width - 1)) - width, alpha); /* wrap y */ if (scrollx && scrolly) drawgfx_alphatable(bitmap, cliprect, gfx, tileno, colour, 0, 0, ((16 * sx + scrollx) & 0x1ff) - 0x200, ((16 * sy + scrolly) & (width - 1)) - width, alpha); /* wrap xy */ offs++; } } } }
static WRITE8_HANDLER(vram2_w) { if(!(vidctrl&1)) { tilemap_mark_tile_dirty(tilemap1,offset&0x7ff); vram2[offset]=data; } else { palram[offset]=data; if(offset<0x300) { offset&=0xff; palette_set_color_rgb(machine, offset, pal6bit(palram[offset]), pal6bit(palram[offset+0x100]), pal6bit(palram[offset+0x200])); } } }
static WRITE8_HANDLER(vram2_w) { pipeline_state *state = space->machine().driver_data<pipeline_state>(); if(!(state->m_vidctrl&1)) { state->m_tilemap1->mark_tile_dirty(offset&0x7ff); state->m_vram2[offset]=data; } else { state->m_palram[offset]=data; if(offset<0x300) { offset&=0xff; palette_set_color_rgb(space->machine(), offset, pal6bit(state->m_palram[offset]), pal6bit(state->m_palram[offset+0x100]), pal6bit(state->m_palram[offset+0x200])); } } }
static WRITE16_HANDLER( pntnpuzl_palette_w ) { pntnpuzl_state *state = space->machine().driver_data<pntnpuzl_state>(); if (ACCESSING_BITS_8_15) { state->m_indx = data >> 8; state->m_sub = 0; } if (ACCESSING_BITS_0_7) { state->m_rgb[state->m_sub++] = data & 0xff; if (state->m_sub == 3) { palette_set_color_rgb(space->machine(),state->m_indx++,pal6bit(state->m_rgb[0]),pal6bit(state->m_rgb[1]),pal6bit(state->m_rgb[2])); state->m_sub = 0; if (state->m_indx == 256) state->m_indx = 0; } } }
static WRITE16_HANDLER( pntnpuzl_palette_w ) { static int indx,sub,rgb[3]; if (ACCESSING_BITS_8_15) { indx = data >> 8; sub = 0; } if (ACCESSING_BITS_0_7) { rgb[sub++] = data & 0xff; if (sub == 3) { palette_set_color_rgb(space->machine,indx++,pal6bit(rgb[0]),pal6bit(rgb[1]),pal6bit(rgb[2])); sub = 0; if (indx == 256) indx = 0; } } }
INPUT_PORTS_END const pen_t* get_pens(tapatune_state *state) { offs_t i; for (i = 0; i < 0x100; i++) { int r, g, b; r = state->m_paletteram[3 * i + 0]; g = state->m_paletteram[3 * i + 1]; b = state->m_paletteram[3 * i + 2]; r = pal6bit(r); g = pal6bit(g); b = pal6bit(b); state->m_pens[i] = MAKE_RGB(r, g, b); } return state->m_pens; }
static WRITE16_HANDLER( bmc_RAMDAC_color_w ) { colorram[clr_offset]=data; palette_set_color(Machine,clr_offset/3,pal6bit(colorram[(clr_offset/3)*3]),pal6bit(colorram[(clr_offset/3)*3+1]),pal6bit(colorram[(clr_offset/3)*3+2])); clr_offset=(clr_offset+1)%768; }