summaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-17 19:43:59 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-17 19:43:59 +0200
commitd98828d08eb1f6c1394f38a1df69c73fef0cfefa (patch)
tree31df37430733c906b235b88c2cfa14d835af4bec /video
parent29ea3208b004f15dafa48ae29a75ba7f0c093a74 (diff)
working on vt52 and some cleanup
Diffstat (limited to 'video')
-rw-r--r--video/console.c41
-rw-r--r--video/console.h13
2 files changed, 31 insertions, 23 deletions
diff --git a/video/console.c b/video/console.c
index c1b9c5c..b6958c5 100644
--- a/video/console.c
+++ b/video/console.c
@@ -6,16 +6,23 @@
static int posx=0;
static int posy=0;
+static void scr_nextline();
-// glue func for vt52 terminal
-void console_put_char(uint8_t c,uint8_t color, uint32_t x, uint32_t y)
+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));
+ }
- print_char_col(x,y,c, color);
-}
// helper_funcs
-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)
{
#ifdef FOOLOS_CONSOLE
@@ -26,12 +33,20 @@ void print_char_col(int x, int y, char c, char col)
}
-void print_char(int x, int y, char c)
+// 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);
}
-void print_single_num(int i)
+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);
@@ -40,7 +55,7 @@ void print_single_num(int i)
}
-void print_str_col(int x,int y,char *str, char col)
+static void print_str_col(int x,int y,char *str, char col)
{
while(*str!=0)
@@ -50,7 +65,7 @@ void print_str_col(int x,int y,char *str, char col)
}
-void print_str(int x,int y,char *str)
+static void print_str(int x,int y,char *str)
{
print_str_col(x,y,str,SCR_WHITE);
}
@@ -82,7 +97,7 @@ void scr_put_string_nl(char *str)
}
*/
-void scr_nextline()
+static void scr_nextline()
{
#ifdef FOOLOS_CONSOLE
int i,x;
@@ -117,7 +132,7 @@ void scr_nextline()
#endif
}
-void scr_put_char(char ch,char col)
+static void scr_put_char(char ch,char col)
{
if(ch=='\n')scr_nextline();
@@ -163,7 +178,7 @@ void scr_put_hex32(uint32_t val)
}
*/
-void scr_put_string(char *str, char col)
+static void scr_put_string(char *str, char col)
{
while(*str!=0)
{
@@ -171,7 +186,7 @@ void scr_put_string(char *str, char col)
}
}
-void scr_backspace()
+static void scr_backspace()
{
if(posx==0)return;
print_char_col(posx-1,posy,' ',SCR_LGREEN);
diff --git a/video/console.h b/video/console.h
index a89e0f5..819bd8d 100644
--- a/video/console.h
+++ b/video/console.h
@@ -1,8 +1,7 @@
#ifndef CONSOLEINT_H
#define CONSOLEINT_H
-// 80 x 24
-// TODO: implement VT100
+// 80 x 24 ?
#include <stdint.h>
@@ -35,13 +34,7 @@
#define SCR_WHITE 0xf
//autoscroll
-void scr_clear();
-
-
-void scr_nextline();
-void scr_backspace();
-void scr_put_char(char ch,char col);
-void scr_put_string(char *str, char col);
-
+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);
#endif