summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-14 22:36:16 +0200
committerMiguel <m.i@gmx.at>2018-10-14 22:36:16 +0200
commit2a6690e9fd53a02613796764248006e06ac482d6 (patch)
treeea3063ef3ecd0808e9291faf6c56949d91b1b09e /userspace
parent5aeab1c853e487aa0042d5c32200d623efe908d3 (diff)
ported vim et al
Diffstat (limited to 'userspace')
-rw-r--r--userspace/Makefile5
-rw-r--r--userspace/date.c5
-rw-r--r--userspace/echo.c10
-rw-r--r--userspace/echoapp.c17
-rw-r--r--userspace/files/.vimrc12
-rw-r--r--userspace/fonts/Makefile6
-rw-r--r--userspace/fsh.c2
-rw-r--r--userspace/init.c5
-rw-r--r--userspace/myclear.c7
-rw-r--r--userspace/ncurses/Makefile11
-rw-r--r--userspace/ncurses/foolstart.c149
-rw-r--r--userspace/ncurses/nc.c200
-rw-r--r--userspace/ncurses/ncurs.c70
-rw-r--r--userspace/sysc.c4
-rw-r--r--userspace/xterm/Makefile3
-rw-r--r--userspace/xterm/terminal.c43
-rw-r--r--userspace/xterm/vesa.c20
17 files changed, 308 insertions, 261 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index 4823598..950a8d6 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -46,17 +46,20 @@ ext2.img: $(PROGS)
@sudo chown miguel mnt
@mkdir -p mnt/home/miguel
@cp files/* mnt/home/miguel/
+ @cp files/.vimrc mnt/home/miguel/
@mkdir -p mnt/boot
@mkdir -p mnt/bin
@mkdir -p mnt/doc/fonts
@mkdir -p mnt/sys # mountpoint for sysfs
@mkdir -p mnt/pipes # mountpoint for pipes
@cp $(PROGS) mnt/bin
+ @mkdir -p mnt/usr/share/vim
@cp /home/miguel/git/EXT/vim/src/vim mnt/bin
+ @cp /home/miguel/git/EXT/vim/runtime/syntax mnt/usr/share/vim/syntax -r
@cp fonts/*.bin mnt/doc/fonts
@cp xterm/xterm mnt/bin
@cp cpp/testcpp mnt/bin
- @cp ncurses/foolstart mnt/bin
+ @cp ncurses/nc mnt/bin
# @cp /home/miguel/temp/foolos/usr/bin/* mnt/bin
@cp /home/miguel/temp/foolos/usr/bin/worm mnt/bin
@cp /home/miguel/temp/foolos/usr/bin/xmas mnt/bin
diff --git a/userspace/date.c b/userspace/date.c
index 64b8dfc..b2c497e 100644
--- a/userspace/date.c
+++ b/userspace/date.c
@@ -12,8 +12,3 @@ int main(int argc, char **argv)
printf("%s", ctime(&ltime));
return 0;
}
-
-
-
-
-
diff --git a/userspace/echo.c b/userspace/echo.c
new file mode 100644
index 0000000..9f6b9df
--- /dev/null
+++ b/userspace/echo.c
@@ -0,0 +1,10 @@
+int main(int argc, char **argv)
+{
+ for (int i=1;i<argc;i++)
+ {
+ if(!strcmp("\\n",argv[i]))
+ printf("\n");
+ else
+ printf("%s ",argv[i]);
+ }
+}
diff --git a/userspace/echoapp.c b/userspace/echoapp.c
new file mode 100644
index 0000000..4ff75e6
--- /dev/null
+++ b/userspace/echoapp.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("echo app -- press Q to quit\n");
+
+ while(1)
+ {
+ uint8_t c;
+ _read(0,&c,1);
+ printf("%d",c);
+ fflush(stdout);
+
+ if(c=='q')break;
+ }
+}
+
diff --git a/userspace/files/.vimrc b/userspace/files/.vimrc
new file mode 100644
index 0000000..a86c950
--- /dev/null
+++ b/userspace/files/.vimrc
@@ -0,0 +1,12 @@
+set nocompatible
+set nobackup "no backup files
+set nowritebackup "only in case you don't want a backup file while editing
+set noswapfile "no swap files
+syntax on
+set number
+set colorcolumn=73
+
+" following should be set from terminfo automatically
+set t_me=
+" todo t_ve
+" todo t_vi
diff --git a/userspace/fonts/Makefile b/userspace/fonts/Makefile
index 31dfb20..dad4df7 100644
--- a/userspace/fonts/Makefile
+++ b/userspace/fonts/Makefile
@@ -7,9 +7,7 @@
FONT_SRC=$(wildcard ./*.src)
FONT_BIN=$(patsubst %.src, %.bin, $(FONT_SRC))
-all:
+all: $(FONT_BIN)
clean:
- -rm binfont.bin
- -rm binfont_v2.bin
- -rm tinyfont.bin
+ -rm $(FONT_BIN)
diff --git a/userspace/fsh.c b/userspace/fsh.c
index d74d9d5..85fc5e4 100644
--- a/userspace/fsh.c
+++ b/userspace/fsh.c
@@ -21,7 +21,6 @@
#include <string.h>
#include "interface/fs.h"
-
extern char **environ;
bool process(char *buf);
@@ -58,7 +57,6 @@ void prompt()
int main(int argc, char **argv)
{
-
for(int i=0;i<argc;i++)
{
if(!strcmp(argv[i],"--version"))
diff --git a/userspace/init.c b/userspace/init.c
index 5dfd55d..4c55a12 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -1,4 +1,7 @@
-char *argv1[]={"xterm","/bin/foolstart",0};
+//char *argv1[]={"xterm","/bin/foolstart",0};
+char *argv1[]={"xterm","/bin/fsh",0};
+//char *argv1[]={"xterm","/bin/vim",0};
+//char *argv1[]={"xterm","/bin/nc",0};
char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
int main(int argc, char **argv)
diff --git a/userspace/myclear.c b/userspace/myclear.c
index 1c794b8..54120d5 100644
--- a/userspace/myclear.c
+++ b/userspace/myclear.c
@@ -3,7 +3,10 @@
#include <stdio.h>
int main()
{
- printf("\033c");
- fflush(stdout); // force printing to console
+ printf("x");
+ //printf("\033c");
+ //printf("\033[10;10H");
+// fflush(stdout); // force printing to console
+// tputs("clear",1,putchar);
return 0;
}
diff --git a/userspace/ncurses/Makefile b/userspace/ncurses/Makefile
index 5fa350f..e920dc7 100644
--- a/userspace/ncurses/Makefile
+++ b/userspace/ncurses/Makefile
@@ -1,13 +1,14 @@
CC=i686-foolos-gcc
CFLAGS=
CFLAGS+=-O0
-#CFLAGS+=-gstabs
-CFLAGS+=-g
+CFLAGS+=-gstabs
#LDLIBS=-lncurses -lform -lmenu -lpanel -ltinfo
-LDLIBS=-lncurses -ltinfo
+#DLIBS=-ltinfo_g -lncurses_g
+#LDLIBS=-lncurses -ltinfo
+LDLIBS=-ltinfo_g
-foolstart:
+nc:
clean:
- rm -f *.o ncurs foolstart
+ rm -f *.o nc
diff --git a/userspace/ncurses/foolstart.c b/userspace/ncurses/foolstart.c
deleted file mode 100644
index 0b795aa..0000000
--- a/userspace/ncurses/foolstart.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include <ncurses.h>
-
-// http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/printw.html
-
-#include <stdio.h>
-#include <ncurses.h>
-
-#define WIDTH 50
-#define HEIGHT 20
-
-int startx = 0;
-int starty = 0;
-
-
-/*
- COLOR_BLACK 0
- COLOR_RED 1
- COLOR_GREEN 2
- COLOR_YELLOW 3
- COLOR_BLUE 4
- COLOR_MAGENTA 5
- COLOR_CYAN 6
- COLOR_WHITE 7
- */
-
-char *choices[] = {
- "Choice 1",
- "Choice 2",
- "Choice 3",
- "Choice 4",
- "Exit",
- };
-
-
-int n_choices = sizeof(choices) / sizeof(char *);
-void print_menu(WINDOW *menu_win, int highlight);
-
-int main()
-{ WINDOW *menu_win;
- int highlight = 1;
- int choice = 0;
- int c;
-
- initscr();
- clear();
- noecho();
- cbreak(); /* Line buffering disabled. pass on everything */
-
- startx = (80 - WIDTH) / 2;
- starty = (24 - HEIGHT) / 2;
-
- start_color(); /* Start color */
- init_pair(1, COLOR_BLACK, COLOR_WHITE);
- init_pair(2, COLOR_WHITE, COLOR_BLUE);
-
- menu_win = newwin(HEIGHT, WIDTH, starty, startx);
- wbkgd(menu_win, COLOR_PAIR(2));
-
- keypad(menu_win, TRUE);
-
- /*
- nodelay(menu_win,FALSE);
- notimeout(menu_win,FALSE);
- wtimeout(menu_win,-1);
- */
-
- mvprintw(0, 0, "Use W/S/A/D to go up and down, Press enter to select a choice");
- refresh();
- print_menu(menu_win, highlight);
- while(1)
- {
- choice=0;
- int y=0;
- while(1)
- { c = wgetch(menu_win);
- mvprintw(y++,0, "%3d / '%c'", c, c);
- y%=24;
-
- refresh();
- switch(c)
- { case 'w':
- case KEY_UP:
-
- if(highlight == 1)
- highlight = n_choices;
- else
- --highlight;
- break;
-
- case 's':
- case KEY_DOWN:
-
- if(highlight == n_choices)
- highlight = 1;
- else
- ++highlight;
- break;
-
- case 10:
-
- choice = highlight;
- break;
- }
- print_menu(menu_win, highlight);
- if(choice != 0) /* User did a choice come out of the infinite loop */
- break;
- }
- mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]);
-
- char *argv1[]={"xterm","/bin/fsh",0};
- char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
-
-
- int pid=_fork();
-
- if(pid==0)
- {
- _execve("/bin/xterm",argv1,env1);
- }
-}
-
- clrtoeol();
- refresh();
- endwin();
- return 0;
-}
-
-
-void print_menu(WINDOW *menu_win, int highlight)
-{
- int x, y, i;
-
- x = 2;
- y = 2;
-
- box(menu_win, 0, 0);
-
- for(i = 0; i < n_choices; ++i)
- { if(highlight == i + 1) /* High light the present choice */
- { wattron(menu_win, COLOR_PAIR(1));
- mvwprintw(menu_win, y, x, ">> %40s <<", choices[i]);
- wattroff(menu_win, COLOR_PAIR(1));
- }
- else
- mvwprintw(menu_win, y, x, " %40s ", choices[i]);
- ++y;
- }
- wrefresh(menu_win);
-}
diff --git a/userspace/ncurses/nc.c b/userspace/ncurses/nc.c
new file mode 100644
index 0000000..58be71e
--- /dev/null
+++ b/userspace/ncurses/nc.c
@@ -0,0 +1,200 @@
+// http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/printw.html
+
+#include <stdio.h>
+#include <curses.h>
+#include <term.h>
+
+#define WIDTH 50
+#define HEIGHT 20
+
+int startx = 0;
+int starty = 0;
+
+
+/*
+ COLOR_BLACK 0
+ COLOR_RED 1
+ COLOR_GREEN 2
+ COLOR_YELLOW 3
+ COLOR_BLUE 4
+ COLOR_MAGENTA 5
+ COLOR_CYAN 6
+ COLOR_WHITE 7
+ */
+
+char *choices[] = {
+ "Choice 1",
+ "Choice 2",
+ "Choice 3",
+ "Choice 4",
+ "Exit",
+ };
+
+
+int n_choices = sizeof(choices) / sizeof(char *);
+
+//void print_menu(WINDOW *menu_win, int highlight);
+
+int main()
+{
+ printf("HELLO\n");
+ setupterm(getenv("TERM"), 1, (int *)0);
+ putp(tigetstr("clear"));
+ putchar('X');
+ putp(tparm(tigetstr("cup"),10,10));
+ putchar('X');
+ printf("BYE\n");
+ while(1);
+
+ putp(tigetstr("clear"));
+ putp("XXX");
+ return 0;
+
+ tputs(tparm(tigetstr("cup"),1,5),1,putchar);
+ tputs(tparm(tigetstr("cup"),5,1),1,putchar);
+
+ return 0;
+
+ for(int i=2;i<40;i+=2)
+ {
+// tputs(tparm(tigetstr("cup"),2,i),1,putchar);
+ putchar('X');
+ }
+
+ tputs(tparm(tigetstr("cup"),1,5),1,putchar);
+ putchar('X');
+ fflush(stdout);
+
+
+ endwin();
+
+
+ /*
+ //printf("x");
+ putchar('A');
+ tputs("clear",1,putchar);
+ // putp("buum");
+ putchar('B');
+
+ return 0;
+ putc('a',stdout);
+ putchar('\n');
+ */
+ return 0;
+}
+
+//// int main2()
+//// {
+////
+//// WINDOW *menu_win;
+////
+//// int highlight = 1;
+//// int choice = 0;
+//// int c;
+////
+//// initscr();
+//// clear();
+//// noecho();
+//// cbreak(); /// Line buffering disabled. pass on everything
+////
+//// startx = (80 - WIDTH) / 2;
+//// starty = (24 - HEIGHT) / 2;
+////
+//// start_color();
+//// init_pair(1, COLOR_BLACK, COLOR_WHITE);
+//// init_pair(2, COLOR_WHITE, COLOR_BLUE);
+////
+//// menu_win = newwin(HEIGHT, WIDTH, starty, startx);
+//// wbkgd(menu_win, COLOR_PAIR(2));
+////
+//// keypad(menu_win, TRUE);
+////
+//// /*
+//// nodelay(menu_win,FALSE);
+//// notimeout(menu_win,FALSE);
+//// wtimeout(menu_win,-1);
+//// */
+////
+//// mvprintw(0, 0, "Use W/S/A/D to go up and down, Press enter to select a choice");
+//// refresh();
+//// print_menu(menu_win, highlight);
+//// while(1)
+//// {
+//// choice=0;
+//// int y=0;
+//// while(1)
+//// { c = wgetch(menu_win);
+//// mvprintw(y++,0, "%3d / '%c'", c, c);
+//// y%=24;
+////
+//// refresh();
+//// switch(c)
+//// { case 'w':
+//// case KEY_UP:
+////
+//// if(highlight == 1)
+//// highlight = n_choices;
+//// else
+//// --highlight;
+//// break;
+////
+//// case 's':
+//// case KEY_DOWN:
+////
+//// if(highlight == n_choices)
+//// highlight = 1;
+//// else
+//// ++highlight;
+//// break;
+////
+//// case 10:
+////
+//// choice = highlight;
+//// break;
+//// }
+//// print_menu(menu_win, highlight);
+//// if(choice != 0) /* User did a choice come out of the infinite loop */
+//// break;
+//// }
+//// mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]);
+////
+//// char *argv1[]={"xterm","/bin/fsh",0};
+//// char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+////
+////
+//// int pid=_fork();
+////
+//// if(pid==0)
+//// {
+//// _execve("/bin/xterm",argv1,env1);
+//// }
+//// }
+////
+//// clrtoeol();
+//// refresh();
+//// endwin();
+//// return 0;
+//// }
+////
+////
+//// void print_menu(WINDOW *menu_win, int highlight)
+//// {
+//// int x, y, i;
+////
+//// x = 2;
+//// y = 2;
+////
+//// box(menu_win, 0, 0);
+////
+//// for(i = 0; i < n_choices; ++i)
+//// { if(highlight == i + 1) /* High light the present choice */
+//// { wattron(menu_win, COLOR_PAIR(1));
+//// mvwprintw(menu_win, y, x, ">> %40s <<", choices[i]);
+//// wattroff(menu_win, COLOR_PAIR(1));
+//// }
+//// else
+//// mvwprintw(menu_win, y, x, " %40s ", choices[i]);
+//// ++y;
+//// }
+//// wrefresh(menu_win);
+//// }
diff --git a/userspace/ncurses/ncurs.c b/userspace/ncurses/ncurs.c
deleted file mode 100644
index 88b6e09..0000000
--- a/userspace/ncurses/ncurs.c
+++ /dev/null
@@ -1,70 +0,0 @@
-#include <ncurses.h>
-#include "../newcalls.h"
-
-void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string)
-{
- int length, x, y;
- float temp;
-
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
-
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- mvwprintw(win, y, x, "%s", string);
- refresh();
-}
-
-/*
-int write()
-{
- printf("hi\n");
-}
-*/
-
-int main()
-{
-
- initscr();
-
- //cbreak();
- ////noecho();
-
-if(has_colors() == FALSE)
-
- { endwin();
- printf("Your terminal does not support color\n");
- exit(1);
- }
-
- start_color(); /* Start color */
- init_pair(1, COLOR_RED, COLOR_BLACK);
-
- attron(COLOR_PAIR(1));
- print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ...");
- attroff(COLOR_PAIR(1));
- getch();
- print_in_middle(stdscr, LINES / 2, 0, 0, "Fool Masters");
- getch();
- endwin();
-
- //write();
-
-// initscr(); /* Start curses mode */
-// printw("Hello World !!!"); /* Print Hello World */
-// refresh(); /* Print it on to the real screen */
-// getch(); /* Wait for user input */
- //while(1);
-
-// endwin(); /* End curses mode */
-
-// return 0;
-}
diff --git a/userspace/sysc.c b/userspace/sysc.c
deleted file mode 100644
index f5a6719..0000000
--- a/userspace/sysc.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int main()
-{
- write(1,"dupa\n",5);
-}
diff --git a/userspace/xterm/Makefile b/userspace/xterm/Makefile
index b6bac6e..fdec016 100644
--- a/userspace/xterm/Makefile
+++ b/userspace/xterm/Makefile
@@ -1,6 +1,7 @@
CC=i686-foolos-gcc
-AS=i686-foolos-as
+
+CFLAGS = -ggdb -O0 # best gdb debugging experience
xterm: vesa.o terminal.o
clean:
diff --git a/userspace/xterm/terminal.c b/userspace/xterm/terminal.c
index 60cd8b0..15fbd36 100644
--- a/userspace/xterm/terminal.c
+++ b/userspace/xterm/terminal.c
@@ -1,7 +1,11 @@
// https://en.wikipedia.org/wiki/ANSI_escape_code
// http://en.wikipedia.org/wiki/VT52
// http://vt100.net/docs/vt520-rm/
+// https://invisible-island.net/xterm/terminfo.html
// man 4 console_codes
+//
+
+// AIMING TO BE A vt52?
#include <stdint.h>
#include <stdbool.h>
@@ -49,6 +53,7 @@ typedef enum{
ecma48_blinkoff,
ecma48_reverse_video_off,
+ // fg codes are 3x
ecma48_fg_black =30,
ecma48_fg_red,
ecma48_fg_green,
@@ -56,10 +61,12 @@ typedef enum{
ecma48_fg_blue,
ecma48_fg_magenta,
ecma48_fg_cyan,
- ecma48_fg_white,
+ ecma48_fg_white, // 37
+
ecma48_underscore_on, // set def color
ecma48_underscore_off, // set def color
+ // bg codes are 4x
ecma48_bg_black, //40
ecma48_bg_red,
ecma48_bg_green,
@@ -210,6 +217,7 @@ static void process_graphic_npar(terminal_tty *tty, terminal_settings s)
case ecma48_fg_white:
tty->fg=SCR_WHITE;
break;
+
// bg
case ecma48_bg_black:
@@ -303,6 +311,7 @@ static void process_cup(terminal_tty *tty)
}
tty->npar=0;
+ tty->escaping=0;
}
static void process_graphic_npars(terminal_tty *tty)
@@ -331,10 +340,8 @@ static void process_graphic_npars(terminal_tty *tty)
}
-static void reset(terminal_tty *tty)
+static void clear(terminal_tty *tty)
{
- tty->bg=SCR_BLACK;
- tty->fg=SCR_WHITE;
for(int x=0;x<tty->width;x++)
for(int y=0;y<tty->height;y++)
@@ -360,7 +367,7 @@ terminal_tty terminal_init(term_out *screen,term_in *input)
tty.set_lfnl=true;
// tty.set_lfnl=false;
-
+ // termios!
tty.set_echo=true;
tty.set_echo=false;
@@ -375,12 +382,15 @@ terminal_tty terminal_init(term_out *screen,term_in *input)
tty.x=0;
tty.y=0;
+ tty.bg=SCR_BLACK;
+ tty.fg=SCR_WHITE;
+
tty.width=TERM_WIDTH;
tty.height=TERM_HEIGHT;
tty.reverse_video=false;
- reset(&tty);
+ clear(&tty);
return tty;
}
@@ -390,13 +400,10 @@ terminal_tty tty;
terminal_tty* terminal_init_vesa()
{
-
tout.put_char=vesa_console_put_char;
tout.update_cursor=vesa_update_cursor;
tty=(terminal_init(&tout,NULL));
return &tty;
-
-
}
// send one ASCII character to the terminal
@@ -438,7 +445,7 @@ void terminal_put(terminal_tty *tty, uint8_t c)
}
}
- else if(c==0x0D) // CR
+ else if(c==0x0D) // CR \r
{
tty->x=0;
return;
@@ -448,7 +455,7 @@ void terminal_put(terminal_tty *tty, uint8_t c)
{
for(uint32_t x=tty->x;x<tty->width;x++)
{
- set_char(tty,x,tty->y,' ',tty->fg,tty->bg);
+ // set_char(tty,x,tty->y,' ',tty->fg,tty->bg);
}
tty->y++;
if(tty->set_lfnl)tty->x=0;
@@ -468,7 +475,7 @@ void terminal_put(terminal_tty *tty, uint8_t c)
{
for(uint32_t x=tty->x;x<tty->width;x++)
{
- set_char(tty, x, tty->y, ' ', tty->fg, tty->bg);
+ set_char(tty, x, tty->y, ' ', tty->fg,tty->bg);
}
}
// FOOL-TERM: clear to end of screen
@@ -478,6 +485,7 @@ void terminal_put(terminal_tty *tty, uint8_t c)
{
set_char(tty, x, tty->y, ' ', tty->fg, tty->bg);
}
+
for(uint32_t y=tty->y+1;y<tty->height;y++)
{
for(uint32_t x=0;x<tty->width;x++)
@@ -520,9 +528,13 @@ void terminal_put(terminal_tty *tty, uint8_t c)
///
- if(c=='c'){reset(tty);} // RESET
+ if(c=='c'){clear(tty);} // RESET
- if(c=='D'){tty->y++;} // LINEFEED
+ if(c=='D'){tty->y++;
+
+ tty->fg=SCR_WHITE;
+ tty->bg=SCR_BLACK;
+ } // LINEFEED
if(c=='E'){tty->y++;tty->x=0;} //NEWLINE
//if(c=='H'){} // SET TABSTOP: TODO
@@ -534,7 +546,8 @@ void terminal_put(terminal_tty *tty, uint8_t c)
{
for(uint32_t x=0;x<tty->width;x++)
{
- uint32_t c=' '|tty->fg<<8|tty->bg<<16;
+ //uint32_t c=' '|tty->fg<<8|tty->bg<<16;
+ uint32_t c=' '|tty->fg<<8|SCR_BLACK<<16;
if(y!=0) c=tty->data[index(tty,x,y-1)];
tty->data[index(tty,x,y)] = c;
diff --git a/userspace/xterm/vesa.c b/userspace/xterm/vesa.c
index 7f22a5f..745e7fb 100644
--- a/userspace/xterm/vesa.c
+++ b/userspace/xterm/vesa.c
@@ -29,6 +29,10 @@ static int console_y;
static int console_lines;
static int console_cols;
+static uint8_t termdata[80*24];
+static uint8_t termdata_bg[80*24];
+static uint8_t termdata_fg[80*24];
+
// same colors as in screen.h
static uint32_t cols[] = {
0x0, // black
@@ -52,14 +56,26 @@ static uint32_t cols[] = {
/** update cursor position */
void vesa_update_cursor(uint32_t col,uint32_t row)
{
+ int oldx=console_x;
+ int oldy=console_y;
+
console_x=col;
console_y=row;
+
+
+ vesa_console_put_char(termdata[oldy*80+oldx],termdata_bg[oldy*80+oldx],termdata_fg[oldy*80+oldx],oldx,oldy);
+ vesa_console_put_char(termdata[row*80+col],termdata_bg[row*80+col],termdata_fg[row*80+col],col,row);
}
/** put char */
void vesa_console_put_char(uint8_t c,uint8_t color_bg, uint8_t color_fg, uint32_t x, uint32_t y)
{
- PutFont(c, x,y, cols[color_bg],cols[color_fg]);
+ termdata[y*80+x]=c;
+ termdata_bg[y*80+x]=color_bg;
+ termdata_fg[y*80+x]=color_fg;
+
+ if(x==console_x&&y==console_y)PutFont(c, x,y, cols[color_fg],cols[color_bg]);
+ else PutFont(c, x,y, cols[color_bg],cols[color_fg]);
}
//
@@ -88,7 +104,7 @@ uint32_t vesa_init(char *fontname)
FILE *f;
//if(fontname==NULL)f=fopen("/doc/fonts/binfont.bin","r");
//if(fontname==NULL)f=fopen("/doc/fonts/tinyfont.bin","r");
- if(fontname==NULL)f=fopen("/doc/fonts/binfont_v2.bin","r");
+ if(fontname==NULL)f=fopen("/doc/fonts/envypn7x13.bin","r");
fread(&font_width,1,1,f);
fread(&font_height,1,1,f);