INPUT_PORTS_END /* Video */ static MC6845_UPDATE_ROW( bw12_update_row ) { bw12_state *state = device->machine().driver_data<bw12_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); int column, bit; for (column = 0; column < x_count; column++) { UINT8 code = state->m_video_ram[((ma + column) & BW12_VIDEORAM_MASK)]; UINT16 addr = code << 4 | (ra & 0x0f); UINT8 data = state->m_char_rom[addr & BW12_CHARROM_MASK]; if (column == cursor_x) { data = 0xff; } for (bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7); bitmap.pix32(y, x) = palette[color]; data <<= 1; } } }
static MC6845_UPDATE_ROW( ec65_update_row ) { ec65_state *state = device->machine().driver_data<ec65_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 chr,gfx,inv; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { inv = (x == cursor_x) ? 0xff : 0; mem = (ma + x) & 0x7ff; chr = state->m_p_videoram[mem]; /* get pattern of pixels for that character scanline */ gfx = state->m_p_chargen[(chr<<4) | (ra & 0x0f)] ^ inv; /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; *p++ = palette[BIT(gfx, 4)]; *p++ = palette[BIT(gfx, 3)]; *p++ = palette[BIT(gfx, 2)]; *p++ = palette[BIT(gfx, 1)]; *p++ = palette[BIT(gfx, 0)]; } }
INPUT_PORTS_END //************************************************************************** // VIDEO //************************************************************************** static MC6845_UPDATE_ROW( trs80m2_update_row ) { trs80m2_state *state = device->machine().driver_data<trs80m2_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); for (int column = 0; column < x_count; column++) { int bit; UINT16 address = (state->m_video_ram[(ma + column) & 0x7ff] << 4) | (ra & 0x0f); UINT8 data = state->m_char_rom[address & 0x7ff]; if (column == cursor_x) { data = 0xff; } for (bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; bitmap.pix32(y, x) = palette[BIT(data, 7)]; data <<= 1; } } }
static MC6845_UPDATE_ROW( hercules_gfx_update_row ) { isa8_hercules_device *herc = downcast<isa8_hercules_device *>(device->owner()); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT32 *p = &bitmap.pix32(y); UINT16 gfx_base = ( ( herc->m_mode_control & 0x80 ) ? 0x8000 : 0x0000 ) | ( ( ra & 0x03 ) << 13 ); int i; if ( y == 0 ) MDA_LOG(1,"hercules_gfx_update_row",("\n")); for ( i = 0; i < x_count; i++ ) { UINT8 data = herc->m_videoram[ gfx_base + ( ( ma + i ) << 1 ) ]; *p = palette[( data & 0x80 ) ? 2 : 0]; p++; *p = palette[( data & 0x40 ) ? 2 : 0]; p++; *p = palette[( data & 0x20 ) ? 2 : 0]; p++; *p = palette[( data & 0x10 ) ? 2 : 0]; p++; *p = palette[( data & 0x08 ) ? 2 : 0]; p++; *p = palette[( data & 0x04 ) ? 2 : 0]; p++; *p = palette[( data & 0x02 ) ? 2 : 0]; p++; *p = palette[( data & 0x01 ) ? 2 : 0]; p++; data = herc->m_videoram[ gfx_base + ( ( ma + i ) << 1 ) + 1 ]; *p = palette[( data & 0x80 ) ? 2 : 0]; p++; *p = palette[( data & 0x40 ) ? 2 : 0]; p++; *p = palette[( data & 0x20 ) ? 2 : 0]; p++; *p = palette[( data & 0x10 ) ? 2 : 0]; p++; *p = palette[( data & 0x08 ) ? 2 : 0]; p++; *p = palette[( data & 0x04 ) ? 2 : 0]; p++; *p = palette[( data & 0x02 ) ? 2 : 0]; p++; *p = palette[( data & 0x01 ) ? 2 : 0]; p++; } }
GFXDECODE_END MC6845_UPDATE_ROW( v6809_update_row ) { v6809_state *state = device->machine().driver_data<v6809_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 chr,gfx; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { mem = (ma + x) & 0x7ff; chr = state->m_p_videoram[mem]; gfx = state->m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; *p++ = palette[BIT(gfx, 4)]; *p++ = palette[BIT(gfx, 3)]; *p++ = palette[BIT(gfx, 2)]; *p++ = palette[BIT(gfx, 1)]; *p++ = palette[BIT(gfx, 0)]; } }
static MC6845_UPDATE_ROW( apricot_update_row ) { apricot_state *state = device->machine().driver_data<apricot_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *ram = state->m_ram->pointer(); int i, x; if (state->m_video_mode) { /* text mode */ for (i = 0; i < x_count; i++) { UINT16 code = state->m_screen_buffer[(ma + i) & 0x7ff]; UINT16 offset = ((code & 0x7ff) << 5) | (ra << 1); UINT16 data = ram[offset + 1] << 8 | ram[offset]; int fill = 0; if (BIT(code, 12) && BIT(data, 14)) fill = 1; /* strike-through? */ if (BIT(code, 13) && BIT(data, 15)) fill = 1; /* underline? */ /* draw 10 pixels of the character */ for (x = 0; x <= 10; x++) { int color = fill ? 1 : BIT(data, x); if (BIT(code, 15)) color = !color; /* reverse? */ bitmap.pix32(y, x + i*10) = palette[color ? 1 + BIT(code, 14) : 0]; } } } else { /* graphics mode */ fatalerror("Graphics mode not implemented!\n"); } }
void comx_clm_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param) { const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); for (int column = 0; column < x_count; column++) { UINT8 code = m_video_ram[((ma + column) & 0x7ff)]; UINT16 addr = (code << 3) | (ra & 0x07); UINT8 data = m_char_rom[addr & 0x7ff]; if (BIT(ra, 3) && column == cursor_x) { data = 0xff; } for (int bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7) ? 7 : 0; bitmap.pix32(y, x) = palette[color]; data <<= 1; } } }
static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text ) { dmv_state *state = device->machine().driver_data<dmv_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 * chargen = state->memregion("maincpu")->base() + 0x1000; for( int x = 0; x < pitch; x++ ) { UINT8 tile = state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff; for( int yi = 0; yi < lr; yi++) { UINT8 tile_data = chargen[(tile*16+yi) & 0x7ff]; if(cursor_on && cursor_addr == addr+x) //TODO tile_data^=0xff; for( int xi = 0; xi < 8; xi++) { int res_x,res_y; int pen = (tile_data >> xi) & 1 ? 1 : 0; res_x = x * 8 + xi; res_y = y * lr + yi; if(!device->machine().primary_screen->visible_area().contains(res_x, res_y)) continue; if(yi >= 16) { pen = 0; } bitmap.pix32(res_y, res_x) = palette[pen]; } } } }
static MC6845_UPDATE_ROW( h19_update_row ) { h19_state *state = device->machine().driver_data<h19_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 chr,gfx; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { UINT8 inv=0; if (x == cursor_x) inv=0xff; mem = (ma + x) & 0x7ff; chr = state->m_p_videoram[mem]; if (chr & 0x80) { inv ^= 0xff; chr &= 0x7f; } /* get pattern of pixels for that character scanline */ gfx = state->m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; *p++ = palette[BIT(gfx, 4)]; *p++ = palette[BIT(gfx, 3)]; *p++ = palette[BIT(gfx, 2)]; *p++ = palette[BIT(gfx, 1)]; *p++ = palette[BIT(gfx, 0)]; } }
static void gfxset_draw_item(running_machine &machine, gfx_element *gfx, int index, bitmap_rgb32 &bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255), MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255) }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height() : gfx->width(); int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width() : gfx->height(); const rgb_t *palette = (machine.total_colors() != 0) ? palette_entry_list_raw(machine.palette) : NULL; UINT32 palette_mask = ~0; int x, y; if (palette != NULL) palette += gfx->colorbase() + color * gfx->granularity(); else { palette = default_palette; palette_mask = 7; } /* loop over rows in the cell */ for (y = 0; y < height; y++) { UINT32 *dest = &bitmap.pix32(dsty + y, dstx); const UINT8 *src = gfx->get_data(index); /* loop over columns in the cell */ for (x = 0; x < width; x++) { int effx = x, effy = y; const UINT8 *s; /* compute effective x,y values after rotation */ if (!(rotate & ORIENTATION_SWAP_XY)) { if (rotate & ORIENTATION_FLIP_X) effx = gfx->width() - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->height() - 1 - effy; } else { int temp; if (rotate & ORIENTATION_FLIP_X) effx = gfx->height() - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->width() - 1 - effy; temp = effx; effx = effy; effy = temp; } /* get a pointer to the start of this source row */ s = src + effy * gfx->rowbytes(); /* extract the pixel */ *dest++ = 0xff000000 | palette[s[effx] & palette_mask]; } } }
static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels ) { compis_state *state = device->machine().driver_data<compis_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 i,gfx = state->m_video_ram[address & 0x1ffff]; for(i=0; i<8; i++) bitmap.pix32(y, x + i) = palette[BIT((gfx >> i), 0)]; }
static MC6845_UPDATE_ROW( mycom_update_row ) { mycom_state *state = device->machine().driver_data<mycom_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 chr,gfx=0,z; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); if (state->m_0a & 0x40) { for (x = 0; x < x_count; x++) // lores pixels { UINT8 dbit=1; if (x == cursor_x) dbit=0; mem = (ma + x) & 0x7ff; chr = state->m_p_videoram[mem]; z = ra / 3; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; z += 4; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; *p++ = palette[BIT( chr, z ) ? dbit: dbit^1]; } } else { for (x = 0; x < x_count; x++) // text { UINT8 inv=0; if (x == cursor_x) inv=0xff; mem = (ma + x) & 0x7ff; if (ra > 7) gfx = inv; // some blank spacing lines else { chr = state->m_p_videoram[mem]; gfx = state->m_p_chargen[(chr<<3) | ra] ^ inv; } /* Display a scanline of a character */ *p++ = palette[BIT(gfx, 7)]; *p++ = palette[BIT(gfx, 6)]; *p++ = palette[BIT(gfx, 5)]; *p++ = palette[BIT(gfx, 4)]; *p++ = palette[BIT(gfx, 3)]; *p++ = palette[BIT(gfx, 2)]; *p++ = palette[BIT(gfx, 1)]; *p++ = palette[BIT(gfx, 0)]; } } }
// draw a char in 80 char line mode void ef9345_device::draw_char_80(UINT8 *c, UINT16 x, UINT16 y) { // verify size limit if (y * 10 >= m_screen->height() || x * 6 >= m_screen->width()) return; const rgb_t *palette = palette_entry_list_raw(m_screen_out.palette()); for(int i = 0; i < 10; i++) for(int j = 0; j < 6; j++) m_screen_out.pix32(y * 10 + i, x * 6 + j) = palette[c[6 * i + j] & 0x07]; }
// defined in machine/victor9kb.c INPUT_PORTS_END //************************************************************************** // DEVICE CONFIGURATION //************************************************************************** //------------------------------------------------- // MC6845_INTERFACE( hd46505s_intf ) //------------------------------------------------- #define CODE_NON_DISPLAY 0x1000 #define CODE_UNDERLINE 0x2000 #define CODE_LOW_INTENSITY 0x4000 #define CODE_REVERSE_VIDEO 0x8000 static MC6845_UPDATE_ROW( victor9k_update_row ) { victor9k_state *state = device->machine().driver_data<victor9k_state>(); address_space &program = state->m_maincpu->space(AS_PROGRAM); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); if (BIT(ma, 13)) { fatalerror("Graphics mode not supported!\n"); } else { UINT16 video_ram_addr = (ma & 0xfff) << 1; for (int sx = 0; sx < x_count; sx++) { UINT16 code = (state->m_video_ram[video_ram_addr + 1] << 8) | state->m_video_ram[video_ram_addr]; UINT32 char_ram_addr = (BIT(ma, 12) << 16) | ((code & 0xff) << 5) | (ra << 1); UINT16 data = program.read_word(char_ram_addr); for (int x = 0; x <= 10; x++) { int color = BIT(data, x); if (sx == cursor_x) color = 1; bitmap.pix32(y, x + sx*10) = palette[color]; } video_ram_addr += 2; video_ram_addr &= 0xfff; } } }
static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels ) { mz6500_state *state = device->machine().driver_data<mz6500_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); int gfx[3]; UINT8 i,pen; gfx[0] = state->m_video_ram[address + 0x00000]; gfx[1] = state->m_video_ram[address + 0x10000]; gfx[2] = state->m_video_ram[address + 0x20000]; for(i=0; i<8; i++) { pen = (BIT(gfx[0], i)) | (BIT(gfx[1], i) << 1) | (BIT(gfx[2], i) << 2); bitmap.pix32(y, x + i) = palette[pen]; } }
static I8275_DISPLAY_PIXELS(sm1800_display_pixels) { int i; sm1800_state *state = device->machine().driver_data<sm1800_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *charmap = state->memregion("chargen")->base(); UINT8 pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff; if (vsp) pixels = 0; if (lten) pixels = 0xff; if (rvv) pixels ^= 0xff; for(i=0;i<8;i++) bitmap.pix32(y, x + i) = palette[(pixels >> (7-i)) & 1 ? (hlgt ? 2 : 1) : 0]; }
void k001604_device::draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect ) { bitmap.fill(0, cliprect); if ((m_reg[0x60 / 4] & 0x40000000) == 0) return; int tile_size = m_roz_size ? 16 : 8; INT32 x = (INT16)((m_reg[0x08] >> 16) & 0xffff); INT32 y = (INT16)((m_reg[0x08] >> 0) & 0xffff); INT32 xx = (INT16)((m_reg[0x09] >> 0) & 0xffff); INT32 xy = (INT16)((m_reg[0x09] >> 16) & 0xffff); INT32 yx = (INT16)((m_reg[0x0a] >> 0) & 0xffff); INT32 yy = (INT16)((m_reg[0x0a] >> 16) & 0xffff); int pivotx = (INT16)((m_reg[0x00] >> 16) & 0xffff); int pivoty = (INT16)((m_reg[0x00] >> 0) & 0xffff); int startx = ((x - pivotx) * 256) * 32; int starty = ((y - pivoty) * 256) * 32; int incxx = (xx) * 32; int incxy = (-xy) * 32; int incyx = (-yx) * 32; int incyy = (yy) * 32; bitmap_ind16& pixmap = m_layer_roz->pixmap(); // extract start/end points int sx = cliprect.min_x; int sy = cliprect.min_y; int ex = cliprect.max_x; int ey = cliprect.max_y; const rgb_t *clut = palette_entry_list_raw(bitmap.palette()); int window_x, window_y, window_xmask, window_ymask; int layer_size = (m_reg[0x1b] >> 9) & 3; if (m_roz_size) window_x = ((m_reg[0x1b] >> 1) & 3) * 512; else
static I8275_DISPLAY_PIXELS( zorba_update_chr ) { int i; zorba_state *state = device->machine().driver_data<zorba_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 gfx = state->m_p_chargen[(linecount & 15) + (charcode << 4)]; if (vsp) gfx = 0; if (lten) gfx = 0xff; if (rvv) gfx ^= 0xff; for(i=0;i<8;i++) bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0]; }
static MC6845_UPDATE_ROW( update_row ) { othello_state *state = device->machine().driver_data<othello_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); int cx, x; UINT32 data_address; UINT32 tmp; const UINT8 *gfx = device->machine().region("gfx")->base(); for(cx = 0; cx < x_count; ++cx) { data_address = ((state->m_videoram[ma + cx] + state->m_tile_bank) << 4) | ra; tmp = gfx[data_address] | (gfx[data_address + 0x2000] << 8) | (gfx[data_address + 0x4000] << 16); for(x = 0; x < TILE_WIDTH; ++x) { bitmap.pix32(y, (cx * TILE_WIDTH + x) ^ 1) = palette[tmp & 0x0f]; tmp >>= 4; } } }
static MC6845_UPDATE_ROW( lynx128k_update_row ) { UINT8 *RAM = device->machine().root_device().memregion("maincpu")->base(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 r,g,b; UINT32 x, *p = &bitmap.pix32(y); for (x = (y << 6); x < x_count + (y << 6); x++) { r = RAM[0x20100+x]; g = RAM[0x28100+x]; b = RAM[0x24100+x]; *p++ = palette[(BIT(r, 7) << 1) | (BIT(g, 7) << 2) | (BIT(b, 7))]; *p++ = palette[(BIT(r, 6) << 1) | (BIT(g, 6) << 2) | (BIT(b, 6))]; *p++ = palette[(BIT(r, 5) << 1) | (BIT(g, 5) << 2) | (BIT(b, 5))]; *p++ = palette[(BIT(r, 4) << 1) | (BIT(g, 4) << 2) | (BIT(b, 4))]; *p++ = palette[(BIT(r, 3) << 1) | (BIT(g, 3) << 2) | (BIT(b, 3))]; *p++ = palette[(BIT(r, 2) << 1) | (BIT(g, 2) << 2) | (BIT(b, 2))]; *p++ = palette[(BIT(r, 1) << 1) | (BIT(g, 1) << 2) | (BIT(b, 1))]; *p++ = palette[(BIT(r, 0) << 1) | (BIT(g, 0) << 2) | (BIT(b, 0))]; } }
static MC6845_UPDATE_ROW( alphatro_update_row ) { alphatro_state *state = device->machine().driver_data<alphatro_state>(); const rgb_t *pens = palette_entry_list_raw(bitmap.palette()); bool palette = BIT(state->ioport("CONFIG")->read(), 5); UINT8 chr,gfx,attr,fg,inv; UINT16 mem,x; UINT32 *p = &bitmap.pix32(y); for (x = 0; x < x_count; x++) { inv = (x == cursor_x) ? 0xff : 0; mem = (ma + x) & 0x7ff; chr = state->m_p_videoram[mem]; attr = state->m_p_videoram[mem | 0x800]; fg = (palette) ? 8 : attr & 7; // amber or RGB if (BIT(attr, 7)) // reverse video for fkey labels { inv ^= 0xff; chr &= 0x7f; } /* get pattern of pixels for that character scanline */ gfx = state->m_p_chargen[(chr<<4) | ra] ^ inv; /* Display a scanline of a character (8 pixels) */ *p++ = pens[BIT(gfx, 7) ? fg : 0]; *p++ = pens[BIT(gfx, 6) ? fg : 0]; *p++ = pens[BIT(gfx, 5) ? fg : 0]; *p++ = pens[BIT(gfx, 4) ? fg : 0]; *p++ = pens[BIT(gfx, 3) ? fg : 0]; *p++ = pens[BIT(gfx, 2) ? fg : 0]; *p++ = pens[BIT(gfx, 1) ? fg : 0]; *p++ = pens[BIT(gfx, 0) ? fg : 0]; } }
static MC6845_UPDATE_ROW( v1050_update_row ) { v1050_state *state = device->machine().driver_data<v1050_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); int column, bit; for (column = 0; column < x_count; column++) { UINT16 address = (((ra & 0x03) + 1) << 13) | ((ma & 0x1fff) + column); UINT8 data = state->m_video_ram[address & V1050_VIDEORAM_MASK]; UINT8 attr = (state->m_attr & 0xfc) | (state->m_attr_ram[address] & 0x03); for (bit = 0; bit < 8; bit++) { int x = (column * 8) + bit; int color = BIT(data, 7); /* blinking */ if ((attr & V1050_ATTR_BLINKING) && !(attr & V1050_ATTR_BLINK)) color = 0; /* reverse video */ color ^= BIT(attr, 4); /* bright */ if (color && (!(attr & V1050_ATTR_BOLD) ^ (attr & V1050_ATTR_BRIGHT))) color = 2; /* display blank */ if (attr & V1050_ATTR_BLANK) color = 0; bitmap.pix32(y, x) = palette[color]; data <<= 1; } } }
static void palette_handler(running_machine &machine, render_container *container, ui_gfx_state *state) { int total = state->palette.which ? colortable_palette_get_size(machine.colortable) : machine.total_colors(); const char *title = state->palette.which ? "COLORTABLE" : "PALETTE"; const rgb_t *raw_color = palette_entry_list_raw(machine.palette); render_font *ui_font = ui_get_font(machine); float cellwidth, cellheight; float chwidth, chheight; float titlewidth; float x0, y0; render_bounds cellboxbounds; render_bounds boxbounds; int x, y, skip; /* add a half character padding for the box */ chheight = ui_get_line_height(machine); chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.y0 = 0.0f + 0.5f * chheight; boxbounds.y1 = 1.0f - 0.5f * chheight; /* the character cell box bounds starts a half character in from the box */ cellboxbounds = boxbounds; cellboxbounds.x0 += 0.5f * chwidth; cellboxbounds.x1 -= 0.5f * chwidth; cellboxbounds.y0 += 0.5f * chheight; cellboxbounds.y1 -= 0.5f * chheight; /* add space on the left for 5 characters of text, plus a half character of padding */ cellboxbounds.x0 += 5.5f * chwidth; /* add space on the top for a title, a half line of padding, a header, and another half line */ cellboxbounds.y0 += 3.0f * chheight; /* figure out the title and expand the outer box to fit */ titlewidth = ui_font->string_width(chheight, machine.render().ui_aspect(), title); x0 = 0.0f; if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); /* go ahead and draw the outer box now */ ui_draw_outlined_box(container, boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); /* draw the title */ x0 = 0.5f - 0.5f * titlewidth; y0 = boxbounds.y0 + 0.5f * chheight; for (x = 0; title[x] != 0; x++) { container->add_char(x0, y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]); x0 += ui_font->char_width(chheight, machine.render().ui_aspect(), title[x]); } /* compute the cell size */ cellwidth = (cellboxbounds.x1 - cellboxbounds.x0) / (float)state->palette.count; cellheight = (cellboxbounds.y1 - cellboxbounds.y0) / (float)state->palette.count; /* draw the top column headers */ skip = (int)(chwidth / cellwidth); for (x = 0; x < state->palette.count; x += 1 + skip) { x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth; y0 = boxbounds.y0 + 2.0f * chheight; container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]); /* if we're skipping, draw a point between the character and the box to indicate which */ /* one it's referring to */ if (skip != 0) container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } /* draw the side column headers */ skip = (int)(chheight / cellheight); for (y = 0; y < state->palette.count; y += 1 + skip) /* only display if there is data to show */ if (state->palette.offset + y * state->palette.count < total) { char buffer[10]; /* if we're skipping, draw a point between the character and the box to indicate which */ /* one it's referring to */ x0 = boxbounds.x0 + 5.5f * chwidth; y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight; if (skip != 0) container->add_point(0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); /* draw the row header */ sprintf(buffer, "%5X", state->palette.offset + y * state->palette.count); for (x = 4; x >= 0; x--) { x0 -= ui_font->char_width(chheight, machine.render().ui_aspect(), buffer[x]); container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine.render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]); } } /* now add the rectangles for the colors */ for (y = 0; y < state->palette.count; y++) for (x = 0; x < state->palette.count; x++) { int index = state->palette.offset + y * state->palette.count + x; if (index < total) { pen_t pen = state->palette.which ? colortable_palette_get_color(machine.colortable, index) : raw_color[index]; container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight, cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight, 0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } } /* handle keys */ palette_handle_keys(machine, state); }
static MC6845_UPDATE_ROW( abc802_update_row ) { /* PAL16R4 equation: IF (VCC) *OS = FC + RF / RC *RG: = HS / *RG + *ATE / *RG + ATD / *RG + LL / *RG + AT1 / *RG + AT0 / ATE + *ATD + *LL + *AT1 + *AT0 *RI: = *RI + *INV / *RI + LL / *INV + *LL *RF: = HS / *RF + *ATE / *RF + ATD / *RF + LL / *RF + AT1 / *RF + AT0 / ATE + *ATD + *LL + *AT1 + AT0 *RC: = HS / *RC + *ATE / *RC + *ATD / *RC + LL / *RC + *ATI / *RC + AT0 / ATE + *LL + *AT1 + *AT0 IF (VCC) *O0 = *CUR + *AT0 / *CUR + ATE *O1 = *CUR + *AT1 / *CUR + ATE + = AND / = OR * = Inverted ATD Attribute data ATE Attribute enable AT0,AT1 Attribute address CUR Cursor FC FLSH clock HS Horizontal sync INV Inverted signal input LL Load when Low OEL Output Enable when Low RC Row clear RF Row flash RG Row graphic RI Row inverted */ abc802_state *state = device->machine().driver_data<abc802_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); int rf = 0, rc = 0, rg = 0; // prevent wraparound if (y >= 240) return; y += VERTICAL_PORCH_HACK; for (int column = 0; column < x_count; column++) { UINT8 code = state->m_char_ram[(ma + column) & 0x7ff]; UINT16 address = code << 4; UINT8 ra_latch = ra; UINT8 data; int ri = (code & ABC802_INV) ? 1 : 0; if (column == cursor_x) { ra_latch = 0x0f; } if ((state->m_flshclk && rf) || rc) { ra_latch = 0x0e; } if (rg) { address |= 0x800; } data = state->m_char_rom[(address + ra_latch) & 0xfff]; if (data & ABC802_ATE) { int attr = data & 0x03; int value = (data & ABC802_ATD) ? 1 : 0; switch (attr) { case 0x00: // Row Graphic rg = value; break; case 0x01: // Row Flash rf = value; break; case 0x02: // Row Clear rc = value; break; case 0x03: // undefined break; } } else { data <<= 2; if (state->m_80_40_mux) { for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) { int x = HORIZONTAL_PORCH_HACK + ((column + 3) * ABC800_CHAR_WIDTH) + bit; int color = BIT(data, 7) ^ ri; bitmap.pix32(y, x) = palette[color]; data <<= 1; } } else { for (int bit = 0; bit < ABC800_CHAR_WIDTH; bit++) { int x = HORIZONTAL_PORCH_HACK + ((column + 3) * ABC800_CHAR_WIDTH) + (bit << 1); int color = BIT(data, 7) ^ ri; bitmap.pix32(y, x) = palette[color]; bitmap.pix32(y, x + 1) = palette[color]; data <<= 1; } column++; } } } }
static MC6845_UPDATE_ROW( vid_update_row ) { mbc55x_state *mstate = device->machine().driver_data<mbc55x_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *ram = &mstate->m_ram->pointer()[0]; UINT8 *red = &mstate->m_video_mem[RED_PLANE_OFFSET]; UINT8 *blue = &mstate->m_video_mem[BLUE_PLANE_OFFSET]; UINT8 *green; int offset; UINT8 rpx,gpx,bpx; UINT8 rb,gb,bb; int x_pos; int pixelno; UINT8 bitno; UINT8 shifts; UINT8 colour; switch(mstate->m_vram_page) { case 4 : green=&ram[0x08000]; break; case 5 : green=&ram[0x1C000]; break; case 6 : green=&ram[0x2C000]; break; case 7 : green=&ram[0x3C000]; break; default : green=&ram[0x0C000]; } if(DEBUG_SET(DEBUG_LINES)) logerror("MC6845_UPDATE_ROW: ma=%d, ra=%d, y=%d, x_count=%d\n",ma,ra,y,x_count); offset=((ma*4) + ra) % COLOUR_PLANE_SIZE; if(DEBUG_SET(DEBUG_LINES)) logerror("offset=%05X\n",offset); for(x_pos=0; x_pos<x_count; x_pos++) { UINT16 mem = (offset+(x_pos*4)) % COLOUR_PLANE_SIZE; rpx=red[mem]; gpx=green[mem]; bpx=blue[mem]; bitno=0x80; shifts=7; for(pixelno=0; pixelno<8; pixelno++) { rb=(rpx & bitno) >> shifts; gb=(gpx & bitno) >> shifts; bb=(bpx & bitno) >> shifts; colour=(rb<<2) | (gb<<1) | (bb<<0); bitmap.pix32(y, (x_pos*8)+pixelno)=palette[colour]; //logerror("set pixel (%d,%d)=%d\n",y, ((x_pos*8)+pixelno),colour); bitno=bitno>>1; shifts--; } } }
static void gfxset_draw_item(running_machine *machine, const gfx_element *gfx, int index, bitmap_t *bitmap, int dstx, int dsty, int color, int rotate) { static const pen_t default_palette[] = { MAKE_RGB(0,0,0), MAKE_RGB(0,0,255), MAKE_RGB(0,255,0), MAKE_RGB(0,255,255), MAKE_RGB(255,0,0), MAKE_RGB(255,0,255), MAKE_RGB(255,255,0), MAKE_RGB(255,255,255) }; int width = (rotate & ORIENTATION_SWAP_XY) ? gfx->height : gfx->width; int height = (rotate & ORIENTATION_SWAP_XY) ? gfx->width : gfx->height; const rgb_t *palette = (machine->config->total_colors != 0) ? palette_entry_list_raw(machine->palette) : NULL; UINT32 rowpixels = bitmap->rowpixels; UINT32 palette_mask = ~0; int x, y; if (palette != NULL) palette += gfx->color_base + color * gfx->color_granularity; else { palette = default_palette; palette_mask = 7; } /* loop over rows in the cell */ for (y = 0; y < height; y++) { UINT32 *dest = (UINT32 *)bitmap->base + (dsty + y) * rowpixels + dstx; const UINT8 *src = gfx_element_get_data(gfx, index); /* loop over columns in the cell */ for (x = 0; x < width; x++) { int effx = x, effy = y; rgb_t pixel; const UINT8 *s; /* compute effective x,y values after rotation */ if (!(rotate & ORIENTATION_SWAP_XY)) { if (rotate & ORIENTATION_FLIP_X) effx = gfx->width - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->height - 1 - effy; } else { int temp; if (rotate & ORIENTATION_FLIP_X) effx = gfx->height - 1 - effx; if (rotate & ORIENTATION_FLIP_Y) effy = gfx->width - 1 - effy; temp = effx; effx = effy; effy = temp; } /* get a pointer to the start of this source row */ s = src + effy * gfx->line_modulo; /* extract the pixel */ if (gfx->flags & GFX_ELEMENT_PACKED) pixel = (s[effx/2] >> ((effx & 1) * 4)) & 0xf; else pixel = s[effx]; *dest++ = 0xff000000 | palette[pixel & palette_mask]; } }
static MC6845_UPDATE_ROW( dgnbeta_update_row ) { dgn_beta_state *state = device->machine().driver_data<dgn_beta_state>(); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT8 *videoram = state->m_videoram; UINT32 *p = &bitmap.pix32(y); int i; if(IsTextMode) { UINT8 *chr_gen = state->memregion("gfx1")->base(); for ( i = 0; i < x_count; i++ ) { UINT32 offset = ( ( ma + i ) | ((state->m_GCtrl & GCtrlAddrLines)<<8)) << 1; UINT8 chr = videoram[ offset ]; UINT8 attr = videoram[ offset +1 ]; /* Extract non-colour attributes, in character set 1, undeline is used */ /* We will extract the colours below, when we have decoded inverse */ /* to indicate a double height character */ int UnderLine=(attr & 0x40) >> 6; // Underline active int FlashChar=(attr & 0x80) >> 7; // Flashing char // underline is active for character set 0, on character row 9 int ULActive=(UnderLine && (ra==9) && ~SWChar); /* Invert forground and background if flashing char and flash acive */ int Invert=(FlashChar & state->m_FlashBit); /* Underline inverts flash */ if (ULActive) Invert=~Invert; /* Cursor on also inverts */ if (i == cursor_x) Invert=~Invert; UINT16 fg = 0; UINT16 bg = 0; /* Invert colours if invert is true */ if(!Invert) { fg = (attr & 0x38) >> 3; bg = (attr & 0x07); } else { bg = (attr & 0x38) >> 3; fg = (attr & 0x07); } UINT8 data = chr_gen[ chr * 16 + ra ]; *p = palette[( data & 0x80 ) ? fg : bg]; p++; *p = palette[( data & 0x80 ) ? fg : bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg]; p++; *p = palette[( data & 0x20 ) ? fg : bg]; p++; *p = palette[( data & 0x20 ) ? fg : bg]; p++; *p = palette[( data & 0x10 ) ? fg : bg]; p++; *p = palette[( data & 0x10 ) ? fg : bg]; p++; *p = palette[( data & 0x08 ) ? fg : bg]; p++; *p = palette[( data & 0x08 ) ? fg : bg]; p++; *p = palette[( data & 0x04 ) ? fg : bg]; p++; *p = palette[( data & 0x04 ) ? fg : bg]; p++; *p = palette[( data & 0x02 ) ? fg : bg]; p++; *p = palette[( data & 0x02 ) ? fg : bg]; p++; *p = palette[( data & 0x01 ) ? fg : bg]; p++; *p = palette[( data & 0x01 ) ? fg : bg]; p++; }
static MC6845_UPDATE_ROW( mda_text_blink_update_row ) { isa8_mda_device *mda = downcast<isa8_mda_device *>(device->owner()); const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); UINT32 *p = &bitmap.pix32(y); UINT16 chr_base = ( ra & 0x08 ) ? 0x800 | ( ra & 0x07 ) : ra; int i; if ( y == 0 ) MDA_LOG(1,"mda_text_blink_update_row",("\n")); for ( i = 0; i < x_count; i++ ) { UINT16 offset = ( ( ma + i ) << 1 ) & 0x0FFF; UINT8 chr = mda->m_videoram[ offset ]; UINT8 attr = mda->m_videoram[ offset + 1 ]; UINT8 data = mda->m_chr_gen[ chr_base + chr * 8 ]; UINT8 fg = ( attr & 0x08 ) ? 3 : 2; UINT8 bg = 0; if ( ( attr & ~0x88 ) == 0 ) { data = 0x00; } switch( attr ) { case 0x70: case 0xF0: bg = 2; fg = 0; break; case 0x78: case 0xF8: bg = 2; fg = 1; break; } if ( ( attr & 0x07 ) == 0x01 ) { data = 0xFF; } if ( i == cursor_x ) { if ( mda->m_framecnt & 0x08 ) { data = 0xFF; } } else { if ( ( attr & 0x80 ) && ( mda->m_framecnt & 0x10 ) ) { data = 0x00; } } *p = palette[( data & 0x80 ) ? fg : bg]; p++; *p = palette[( data & 0x40 ) ? fg : bg]; p++; *p = palette[( data & 0x20 ) ? fg : bg]; p++; *p = palette[( data & 0x10 ) ? fg : bg]; p++; *p = palette[( data & 0x08 ) ? fg : bg]; p++; *p = palette[( data & 0x04 ) ? fg : bg]; p++; *p = palette[( data & 0x02 ) ? fg : bg]; p++; *p = palette[( data & 0x01 ) ? fg : bg]; p++; if ( ( chr & 0xE0 ) == 0xC0 ) { *p = palette[( data & 0x01 ) ? fg : bg]; p++; } else { *p = palette[bg]; p++; } } }