From e4febc5aac3006c3ef025b5f708ec51fdac63b94 Mon Sep 17 00:00:00 2001 From: Miguel Date: Mon, 20 Aug 2018 03:18:04 +0200 Subject: vesa works beuatifullyy --- driver/mouse.c | 6 ++-- driver/vesa.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- driver/vesa.h | 3 ++ 3 files changed, 94 insertions(+), 11 deletions(-) (limited to 'driver') diff --git a/driver/mouse.c b/driver/mouse.c index 23619a4..f585b99 100644 --- a/driver/mouse.c +++ b/driver/mouse.c @@ -128,10 +128,10 @@ void mouse_log() if(mouse_x>800)mouse_x=800; if(mouse_y>600)mouse_y=600; - log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d / %d / %02x ",mouse_x, mouse_y,mouse_byte[2]); + //log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d / %d / %02x ",mouse_x, mouse_y,mouse_byte[2]); if (mouse_byte[0] & 1)vesa_put_rect(mouse_x,600-mouse_y,10,10,0x00ffff); - else vesa_put_rect(mouse_x,600-mouse_y,10,10,0x0000ff); - //PutFont('X', mouse_x,600-mouse_y, 0xffffff); + //else vesa_put_rect(mouse_x,600-mouse_y,10,10,0x0000ff); + PutFont('X', mouse_x,600-mouse_y, 0xff0000); } diff --git a/driver/vesa.c b/driver/vesa.c index 9b0dd55..b8c03ec 100644 --- a/driver/vesa.c +++ b/driver/vesa.c @@ -25,6 +25,60 @@ static uint8_t* physbase; void PutConsoleNL(); void PutPixel(int x,int y, int color); +//static char buf[80][24]; + +void vesa_update_cursor(uint32_t col,uint32_t row) +{ + console_x=col; + console_y=row; +} + +// helper_funcs +static void vesa_print_char_col(int x, int y, char c, char col_fg, char col_bg) +{ + // uint16_t attrib = (col_bg << 4) | (col_fg & 0x0F); + // uint16_t* video_mem=(uint16_t *)SCR_VIDEOMEM+(x+y*SCR_REAL_WIDTH); + // *video_mem=c | (attrib << 8) ; +} + +// same colors as in screen.h +static uint32_t cols[] = { + 0x0, // black + 0x0066cc, //blue + 0x009900, //green + 0x33ffff, //cyan + 0xff3333, //red + 0xcc00cc, //magenta + 0x994c00, //brown + 0xa0a0a0, //light gray + 0x404040, //dark gray + 0x3399ff, //light blue + 0x99ff33, //light green + 0x99ffff, //cyan light + 0xff9999, //red light + 0xff99ff, //magenta light + 0xffff00, //yellow + 0xffffff, //white +}; + +// glue func for terminal +void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y) +{ +// print_char_col(x,y,c, color_bg, color_fg); + //PutFont(c, console_x*10,console_y*12, cols[color_fg],cols[color_bg]); + + //PutFont(c, x*10,y*12, cols[color_bg],cols[color_fg]); + PutFont(c, x*9,y*11, cols[color_bg],cols[color_fg]); + +// buf[console_x][console_y]=c; + +// console_x++; + +// #ifdef FOOLOS_CONSOLE_AUTOBREAK +// if(console_x>=console_cols)PutConsoleNL(); +// #endif +} + void vesa_switch_buffers() { for(int i=0;i<800*600*2;i++)physbase[i]=buffer[i]; @@ -79,6 +133,10 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) int col_width=10; console_lines=mode->Yres/line_height; console_cols=mode->Xres/col_width; + + //TODO dynamic (but need to sync with terminal!) + console_cols=80; + console_lines=24; // vesa info log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"vbe version: 0x%x / video mode ptr: 0x%x 0x%x", @@ -127,7 +185,7 @@ void PutPixel(int x,int y, int color) } -void PutFont(char c, int x,int y, int color) +void PutFont(char c, int x,int y, int color_fg,int color_bg) { int fnt=0x126-0x20; @@ -136,6 +194,15 @@ void PutFont(char c, int x,int y, int color) int posx, posy, sizex=8, sizey=10; + for(posx=x;posx=console_lines-5)console_y=0; + if(console_y +void vesa_update_cursor(uint32_t col,uint32_t row); +void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y); + typedef struct foolfont_struct { uint8_t line[10]; //every single fool font consists of 10 lines a 8 bit -- cgit v1.2.3