summaryrefslogtreecommitdiff
path: root/userspace/xterm
diff options
context:
space:
mode:
Diffstat (limited to 'userspace/xterm')
-rw-r--r--userspace/xterm/terminal.c16
-rw-r--r--userspace/xterm/vesa.c21
-rw-r--r--userspace/xterm/vesa.h2
-rw-r--r--userspace/xterm/xterm.c46
4 files changed, 68 insertions, 17 deletions
diff --git a/userspace/xterm/terminal.c b/userspace/xterm/terminal.c
index 4f321dd..ba7986e 100644
--- a/userspace/xterm/terminal.c
+++ b/userspace/xterm/terminal.c
@@ -6,6 +6,8 @@
#include <stdbool.h>
#include <stddef.h>
+#include "vesa.h"
+
#define NPAR_START 1000
#define TERM_WIDTH 80
#define TERM_HEIGHT 24
@@ -290,6 +292,7 @@ static void reset(terminal_tty *tty)
tty->command_l=0;
}
+
terminal_tty terminal_init(term_out *screen,term_in *input)
{
terminal_tty tty;
@@ -326,6 +329,19 @@ terminal_tty terminal_init(term_out *screen,term_in *input)
return tty;
}
+term_out tout;
+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
void terminal_put(terminal_tty *tty, uint8_t c)
diff --git a/userspace/xterm/vesa.c b/userspace/xterm/vesa.c
index d38f3f2..e795cc8 100644
--- a/userspace/xterm/vesa.c
+++ b/userspace/xterm/vesa.c
@@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdio.h>
#include "../newcalls.h"
+#include "vesa.h"
#define VMEM_USER_FRAMEBUFFER 0xfa000000
@@ -134,6 +135,9 @@ void vesa_set_physbase(uint32_t addr)
uint32_t vesa_init()
{
+
+ FILE *f=fopen("/doc/fonts/binfont.bin","r");
+ fread(deffont,10,95,f);
//inf->framebuffer_type
/*
@@ -351,20 +355,3 @@ void vesa_init_doublebuff()
VbeModeInfoBlock->physbase=buffer;
}
*/
-
-int main()
-{
- FILE *f=fopen("/doc/fonts/binfont.bin","r");
- fread(deffont,10,95,f);
-
- vesa_init();
-
- _gui_win();
-
- while(1)
- {
- vesa_console_put_char('X' ,15, 0, 5, 5);
- _gui_rect();
- }
-
-}
diff --git a/userspace/xterm/vesa.h b/userspace/xterm/vesa.h
new file mode 100644
index 0000000..16a52f1
--- /dev/null
+++ b/userspace/xterm/vesa.h
@@ -0,0 +1,2 @@
+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);
diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c
index 10b222c..96389a9 100644
--- a/userspace/xterm/xterm.c
+++ b/userspace/xterm/xterm.c
@@ -1,2 +1,48 @@
#include <stdio.h>
+int main()
+{
+ _gui_win();
+
+ int xterm_in[2];
+ int xterm_out[2];
+
+ _pipe(xterm_in);
+ _pipe(xterm_out);
+
+
+ vesa_init();
+ void *tty=terminal_init_vesa();
+
+ int pid=_fork();
+
+ if(!pid)
+ {
+ _close(xterm_in[1]);
+ _close(xterm_out[0]);
+
+ _dup2(xterm_in[0],0);// stdin
+ _dup2(xterm_out[1],1);// stdout
+ _dup2(xterm_out[1],2);// stderr
+
+ char *argv1[]={"/bin/fsh",0};
+ char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+
+ _execve("/bin/fsh",argv1,env1); // replace process with our foolshell :)
+ }
+
+ _close(xterm_in[0]);
+ _close(xterm_out[1]);
+
+ _dup2(xterm_in[1],1); // compositor writes here.
+
+ while(1)
+ {
+ char buf[1];
+ _read(xterm_out[0],buf,1); // show what foolshell writes to its stdout/stderr
+
+ _gui_rect(); //lock
+ terminal_put(tty,buf[0]);
+ _gui_rect(); //unlock
+ }
+}