36static int console_width, console_height,
43static unsigned char *console_fb = 0LL;
45static int cursor_x, cursor_y, max_x, max_y, offset_x, offset_y;
57static inline void console_pset32(
int x,
int y,
int color)
59#define fbint ((uint32_t*)console_fb)
60#define base (((y >> 5)*32*console_width + ((x >> 5)<<10) \
61 + (x&3) + ((y&1)<<2) + (((x&31)>>2)<<3) + (((y&31)>>1)<<6)) ^ ((y&8)<<2))
67inline void console_pset(
int x,
int y,
unsigned char r,
unsigned char g,
unsigned char b) {
68 console_pset32(x, y, (b<<24) + (g<<16) + (r<<8));
73static void console_draw_char(
const int x,
const int y,
const unsigned char c) {
74#define font_pixel(ch, x, y) ((fontdata_8x16[ch*16+y]>>(7-x))&1)
76 for (ly=0; ly < 16; ly++)
77 for (lx=0; lx < 8; lx++) {
83 unsigned int *fb = (
unsigned int*)console_fb;
84 int count = console_width * console_height;
88 memdcbst(console_fb, console_size*4);
96 memset(sp,
' ', max_x);
101static void console_scroll32(
const unsigned int lines) {
103 bs = console_width*32*4;
105 for (l=lines; l*32 < console_height; l++) {
106 memcpy(console_fb + bs*(l-lines),
117 memdcbst(console_fb, console_size*4);
123 while (cursor_x*8 < console_width) {
124 console_draw_char(cursor_x*8, cursor_y*16,
' ');
132 if (cursor_y >= max_y) {
144 }
else if (
c ==
'\n') {
147 console_draw_char(cursor_x*8 + offset_x, cursor_y*16 + offset_y,
c);
149 if (cursor_x >= max_x)
152 memdcbst(console_fb, console_size*4);
155static void console_stdout_hook(
const char *buf,
int len)
161extern void (*
stdout_hook)(
const char *buf,
int len);
166 console_fb = (
unsigned char*)(
long)(ai->
base | 0x80000000);
168 console_width = ((ai->
width+31)>>5)<<5;
169 console_height = ((ai->
height+31)>>5)<<5;
170 console_size = console_width*console_height;
172 offset_x = offset_y = 0;
175 offset_x = (ai->
width/28);
176 offset_y = (ai->
height/28);
179 cursor_x = cursor_y = 0;
180 max_x = (ai->
width - offset_x * 2) / 8;
181 max_y = (ai->
height - offset_y * 2) / 16;
187 printf(
" * Xenos FB with %dx%d (%dx%d) at %p initialized.\n",
void(* stdout_hook)(const char *buf, int len)
void console_set_colors(unsigned int background, unsigned int foreground)
void console_get_dimensions(unsigned int *width, unsigned int *height)
#define font_pixel(ch, x, y)
uint32_t console_color[2]
void console_putch(const char c)
void console_pset(int x, int y, unsigned char r, unsigned char g, unsigned char b)
void memdcbst(void *addr, int len)
unsigned int __mf_uintptr_t __attribute__((__mode__(__pointer__)))
struct detailed_data_wpindex color