From 042e25e19b5fc0cec1d47440c26246c886cf39f6 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sun, 17 May 2015 20:40:29 +0200 Subject: started big cleanup! --- video/console.c | 195 -------------------------------------------------------- 1 file changed, 195 deletions(-) delete mode 100644 video/console.c (limited to 'video/console.c') diff --git a/video/console.c b/video/console.c deleted file mode 100644 index b6958c5..0000000 --- a/video/console.c +++ /dev/null @@ -1,195 +0,0 @@ -#include "console.h" -#include "kernel/config.h" - -//#define FOOLOS_CONSOLE - -static int posx=0; -static int posy=0; - -static void scr_nextline(); - -void update_cursor(uint32_t col,uint32_t row) -{ - unsigned short position=(row*80) + col; - - // cursor LOW port to vga INDEX register - x86_outb(0x3D4, 0x0F); - x86_outb(0x3D5, (unsigned char)(position&0xFF)); - // cursor HIGH port to vga INDEX register - x86_outb(0x3D4, 0x0E); - x86_outb(0x3D5, (unsigned char )((position>>8)&0xFF)); - } - - -// helper_funcs -static void print_char_col(int x, int y, char c, char col) -{ - - #ifdef FOOLOS_CONSOLE - char* video_mem=(char *)SCR_VIDEOMEM+(x+y*SCR_REAL_WIDTH)*2; - video_mem[0]=c; - video_mem[1]=col; - #endif - -} - -// glue func for vt52 terminal -void console_put_char(uint8_t c,uint8_t color, uint32_t x, uint32_t y) -{ - - print_char_col(x,y,c, color); -} -// -// -static void print_char(int x, int y, char c) -{ - print_char_col(x,y,c,SCR_WHITE); -} - -static void print_single_num(int i) -{ - if(i<10)print_char_col(posx,posy,'0'+i,SCR_GREEN); - else if(i<16)print_char_col(posx,posy,'A'+i-10,SCR_GREEN); - posx++; - if(posx>=SCR_WIDTH)scr_nextline(); - -} - -static void print_str_col(int x,int y,char *str, char col) -{ - - while(*str!=0) - { - print_char_col(x++,y,*(str++),col); - } - -} - -static void print_str(int x,int y,char *str) -{ - print_str_col(x,y,str,SCR_WHITE); -} - - -// -// -void scr_clear() -{ - int x,y; - - for(x=0;xSCR_HEIGHT-2) - { - for(i=1;i=SCR_WIDTH)scr_nextline(); -#endif - -} - -/* -void scr_put_hex(uint16_t val) -{ - - int i; - - scr_put_string("0x"); - - for(i=0;i<4;i++) - { - print_single_num((val&0xf000)>>12); - val=val << 4; - - } - - -} -*/ - -/* -void scr_put_hex32(uint32_t val) -{ - scr_put_string("["); - scr_put_hex(val>>16); - scr_put_string(","); - scr_put_hex(val&0xffff); - scr_put_string("]"); -} -*/ - -static void scr_put_string(char *str, char col) -{ - while(*str!=0) - { - scr_put_char(*(str++),col); - } -} - -static void scr_backspace() -{ - if(posx==0)return; - print_char_col(posx-1,posy,' ',SCR_LGREEN); - posx--; - -} -- cgit v1.2.3