From 98eb242e282650e9c6645dd2e5290e144b105bb4 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sat, 23 May 2015 23:44:44 +0200 Subject: improved params and environment passing and started snake-game :) --- terminal/terminal.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'terminal') diff --git a/terminal/terminal.c b/terminal/terminal.c index 4d3a1a0..7fc6f93 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -9,7 +9,7 @@ #include "driver/screen.h" #define SET_LFNL true -#define SET_BUFF true +#define SET_BUFF false #define SET_ECHO true @@ -262,22 +262,30 @@ terminal_tty terminal_init(term_out *screen,term_in *input) void terminal_kb(terminal_tty *tty, uint8_t c) { - terminal_put(tty,c); - tty->command[tty->command_l]=c; - (tty->command_l)++; + if(SET_ECHO)terminal_put(tty,c); - if(c==0x08) + if(SET_BUFF) { - tty->command_l-=2; - if(tty->command_l<0)tty->command_l=0; + tty->command[tty->command_l]=c; + (tty->command_l)++; + + if(c==0x08) + { + tty->command_l-=2; + if(tty->command_l<0)tty->command_l=0; + } + else if(c=='\n') + { + // write command to ringbuff + for(int i=0;icommand_l;i++) + tty->input->put_char(tty->command[i]); + + tty->command_l=0; + } } - else if(c=='\n') + else { - // write command to ringbuff - for(int i=0;icommand_l;i++) - tty->input->put_char(tty->command[i]); - - tty->command_l=0; + tty->input->put_char(c); } } -- cgit v1.2.3