diff options
| author | Michal Idziorek <m.i@gmx.at> | 2015-05-22 03:28:49 +0200 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2015-05-22 03:28:49 +0200 |
| commit | fceb15b1d325a7bb0bcab8993a1057cb991172e8 (patch) | |
| tree | ca95bf9b600d8687f2f6307628db4066e485119a /driver | |
| parent | a6184be79e3918764d5e683796afbd8e8ccba018 (diff) | |
support for fg and bg color escape sequences
Diffstat (limited to 'driver')
| -rw-r--r-- | driver/keyboard.c | 6 | ||||
| -rw-r--r-- | driver/screen.c (renamed from driver/console.c) | 29 | ||||
| -rw-r--r-- | driver/screen.h (renamed from driver/console.h) | 22 |
3 files changed, 32 insertions, 25 deletions
diff --git a/driver/keyboard.c b/driver/keyboard.c index 2323b04..951c0f0 100644 --- a/driver/keyboard.c +++ b/driver/keyboard.c @@ -102,6 +102,7 @@ void keyboard_handle(uint8_t in) uint8_t break_key_enter=0x9c; uint8_t break_key_space=0xb9; uint8_t break_key_backspace=0x8e; + uint8_t break_key_esc=0x81; uint8_t make_key_shift_l=0x2a; uint8_t break_key_shift_l=0xaa; @@ -184,6 +185,11 @@ void keyboard_handle(uint8_t in) ascii=0x08; match=true; } + else if(break_key_esc==in) + { + ascii=0x1b; + match=true; + } else if(break_key_enter==in) { diff --git a/driver/console.c b/driver/screen.c index fcbf6e1..6b47312 100644 --- a/driver/console.c +++ b/driver/screen.c @@ -1,4 +1,4 @@ -#include "console.h" +#include "screen.h" #include "kernel/config.h" //#define FOOLOS_CONSOLE @@ -22,24 +22,23 @@ void update_cursor(uint32_t col,uint32_t row) // helper_funcs -static void print_char_col(int x, int y, char c, char col) +static void print_char_col(int x, int y, char c, char col_fg, char col_bg) { - - #ifdef FOOLOS_CONSOLE - char* video_mem=(char *)SCR_VIDEOMEM+(x+y*SCR_REAL_WIDTH)*2; - video_mem[0]=c; - video_mem[1]=col; - #endif + 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) ; } -// glue func for vt52 terminal -void console_put_char(uint8_t c,uint8_t color, uint32_t x, uint32_t y) +// glue func for terminal +void 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); + print_char_col(x,y,c, color_bg, color_fg); } + // // +/* static void print_char(int x, int y, char c) { print_char_col(x,y,c,SCR_WHITE); @@ -88,6 +87,7 @@ void scr_clear() posx=posy=0; } +*/ /* void scr_put_string_nl(char *str) { @@ -95,7 +95,7 @@ void scr_put_string_nl(char *str) scr_nextline(); } */ - +/* static void scr_nextline() { #ifdef FOOLOS_CONSOLE @@ -130,7 +130,7 @@ static void scr_nextline() } #endif } - +*/ /* void scr_put_hex(uint16_t val) { @@ -160,7 +160,7 @@ void scr_put_hex32(uint32_t val) scr_put_string("]"); } */ - +/* static void scr_put_char(char ch,char col) { @@ -192,3 +192,4 @@ static void scr_backspace() posx--; } +*/ diff --git a/driver/console.h b/driver/screen.h index 819bd8d..bcf55e9 100644 --- a/driver/console.h +++ b/driver/screen.h @@ -1,5 +1,5 @@ -#ifndef CONSOLEINT_H -#define CONSOLEINT_H +#ifndef SCREEN_H +#define SCREEN_H // 80 x 24 ? @@ -21,20 +21,20 @@ #define SCR_GREEN 0x2 #define SCR_CYAN 0x3 #define SCR_RED 0x4 -#define SCR_VIOLET 0x5 +#define SCR_MAGENTA 0x5 #define SCR_BROWN 0x6 -#define SCR_GRAY1 0x7 -#define SCR_GRAY2 0x8 -#define SCR_LBLUE 0x9 -#define SCR_LGREEN 0xa -#define SCR_LCYAN 0xb -#define SCR_LRED 0xc -#define SCR_PINK 0xd +#define SCR_GRAY_LIGHT 0x7 +#define SCR_GRAY_DARK 0x8 +#define SCR_BLUE_LIGHT 0x9 +#define SCR_GREEN_LIGHT 0xa +#define SCR_CYAN_LIGHT 0xb +#define SCR_RED_LIGHT 0xc +#define SCR_MAGENTA_LIGHT 0xd #define SCR_YELLOW 0xe #define SCR_WHITE 0xf //autoscroll void update_cursor(uint32_t col,uint32_t row); -void console_put_char(uint8_t c,uint8_t color, uint32_t x, uint32_t y); +void console_put_char(uint8_t c,uint8_t color_fg, uint8_t color_bg, uint32_t x, uint32_t y); #endif |
