⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btext.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 3 页
字号:
	{		unsigned long *ptr = base;		for(j=width; j; --j)			*(ptr++) = 0;		base += (dispDeviceRowBytes >> 3);	}}#ifndef NO_SCROLLstatic void scrollscreen(void){	unsigned long *src     	= (unsigned long *)calc_base(0,16);	unsigned long *dst     	= (unsigned long *)calc_base(0,0);	unsigned long width    	= ((dispDeviceRect[2] - dispDeviceRect[0]) *				   (dispDeviceDepth >> 3)) >> 3;	int i,j;	for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++)	{		unsigned long *src_ptr = src;		unsigned long *dst_ptr = dst;		for(j=width; j; --j)			*(dst_ptr++) = *(src_ptr++);		src += (dispDeviceRowBytes >> 3);		dst += (dispDeviceRowBytes >> 3);	}	for (i=0; i<16; i++)	{		unsigned long *dst_ptr = dst;		for(j=width; j; --j)			*(dst_ptr++) = 0;		dst += (dispDeviceRowBytes >> 3);	}}#endif /* ndef NO_SCROLL */void btext_drawchar(char c){	int cline = 0;#ifdef NO_SCROLL	int x;#endif	if (!boot_text_mapped)		return;	switch (c) {	case '\b':		if (g_loc_X > 0)			--g_loc_X;		break;	case '\t':		g_loc_X = (g_loc_X & -8) + 8;		break;	case '\r':		g_loc_X = 0;		break;	case '\n':		g_loc_X = 0;		g_loc_Y++;		cline = 1;		break;	default:		draw_byte(c, g_loc_X++, g_loc_Y);	}	if (g_loc_X >= g_max_loc_X) {		g_loc_X = 0;		g_loc_Y++;		cline = 1;	}#ifndef NO_SCROLL	while (g_loc_Y >= g_max_loc_Y) {		scrollscreen();		g_loc_Y--;	}#else	/* wrap around from bottom to top of screen so we don't	   waste time scrolling each line.  -- paulus. */	if (g_loc_Y >= g_max_loc_Y)		g_loc_Y = 0;	if (cline) {		for (x = 0; x < g_max_loc_X; ++x)			draw_byte(' ', x, g_loc_Y);	}#endif}void btext_drawstring(const char *c){	if (!boot_text_mapped)		return;	while (*c)		btext_drawchar(*c++);}void btext_drawhex(unsigned long v){	char *hex_table = "0123456789abcdef";	if (!boot_text_mapped)		return;#ifdef CONFIG_PPC64	btext_drawchar(hex_table[(v >> 60) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 56) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 52) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 48) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 44) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 40) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 36) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 32) & 0x0000000FUL]);#endif	btext_drawchar(hex_table[(v >> 28) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 24) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 20) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 16) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >> 12) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >>  8) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >>  4) & 0x0000000FUL]);	btext_drawchar(hex_table[(v >>  0) & 0x0000000FUL]);	btext_drawchar(' ');}static void draw_byte(unsigned char c, long locX, long locY){	unsigned char *base	= calc_base(locX << 3, locY << 4);	unsigned char *font	= &vga_font[((unsigned int)c) * 16];	int rb			= dispDeviceRowBytes;	switch(dispDeviceDepth) {	case 24:	case 32:		draw_byte_32(font, (unsigned int *)base, rb);		break;	case 15:	case 16:		draw_byte_16(font, (unsigned int *)base, rb);		break;	case 8:		draw_byte_8(font, (unsigned int *)base, rb);		break;	}}static unsigned int expand_bits_8[16] = {	0x00000000,	0x000000ff,	0x0000ff00,	0x0000ffff,	0x00ff0000,	0x00ff00ff,	0x00ffff00,	0x00ffffff,	0xff000000,	0xff0000ff,	0xff00ff00,	0xff00ffff,	0xffff0000,	0xffff00ff,	0xffffff00,	0xffffffff};static unsigned int expand_bits_16[4] = {	0x00000000,	0x0000ffff,	0xffff0000,	0xffffffff};static void draw_byte_32(unsigned char *font, unsigned int *base, int rb){	int l, bits;	int fg = 0xFFFFFFFFUL;	int bg = 0x00000000UL;	for (l = 0; l < 16; ++l)	{		bits = *font++;		base[0] = (-(bits >> 7) & fg) ^ bg;		base[1] = (-((bits >> 6) & 1) & fg) ^ bg;		base[2] = (-((bits >> 5) & 1) & fg) ^ bg;		base[3] = (-((bits >> 4) & 1) & fg) ^ bg;		base[4] = (-((bits >> 3) & 1) & fg) ^ bg;		base[5] = (-((bits >> 2) & 1) & fg) ^ bg;		base[6] = (-((bits >> 1) & 1) & fg) ^ bg;		base[7] = (-(bits & 1) & fg) ^ bg;		base = (unsigned int *) ((char *)base + rb);	}}static void draw_byte_16(unsigned char *font, unsigned int *base, int rb){	int l, bits;	int fg = 0xFFFFFFFFUL;	int bg = 0x00000000UL;	unsigned int *eb = (int *)expand_bits_16;	for (l = 0; l < 16; ++l)	{		bits = *font++;		base[0] = (eb[bits >> 6] & fg) ^ bg;		base[1] = (eb[(bits >> 4) & 3] & fg) ^ bg;		base[2] = (eb[(bits >> 2) & 3] & fg) ^ bg;		base[3] = (eb[bits & 3] & fg) ^ bg;		base = (unsigned int *) ((char *)base + rb);	}}static void draw_byte_8(unsigned char *font, unsigned int *base, int rb){	int l, bits;	int fg = 0x0F0F0F0FUL;	int bg = 0x00000000UL;	unsigned int *eb = (int *)expand_bits_8;	for (l = 0; l < 16; ++l)	{		bits = *font++;		base[0] = (eb[bits >> 4] & fg) ^ bg;		base[1] = (eb[bits & 0xf] & fg) ^ bg;		base = (unsigned int *) ((char *)base + rb);	}}static unsigned char vga_font[cmapsz] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd,0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xff,0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe,0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd,0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x1e, 0x0e,0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30,0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x63,0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18,0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8,0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0e,0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xdb,0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6,0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c,0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0,0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c,0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18,0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c,0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c,0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18,0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x6c,0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30,0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x18,0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e,0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -