go back...
virtual terminal figure
Fig.1 - Virtual Terminal


User runs vt (virtual terminal)
	- vt process checks if there is one VTTY available via tty driver. If any
	- creates a window via microui. 
	- creates a surface associated with window.
	- runs a vtty_out process 
		(which is in charge of ttyhandle_out() for this VTTY).
	- runs a XINU shell process (its in/out dev is this VTTY).


How virtual terminal manages INPUT from keyboard

(0) user press a key on keyboard. 
	- keyboard driver reads key code from keyboard.

(1) microui process reads raw key code from keyboard driver
	- converts raw key code to key value using some specific kbd layout.
	- puts new key value on event struct of on-focus windows.

(2) virtual terminal process 0 (vt)
	- takes the key value and put it on ttytab[VTTY0] struct.
	- calls to ttyhandle_in().
	- tty driver takes ch from struct and puts it on tyiotail.

(3) XINU shell calls to read(VTTY0, buf, sizeof(buf));
	- runs an specific command if there is one. For example  xsh_help.


How virtual terminal manages OUTPUT to virtual console (display window)

(4) xsh_help do some printf()
	- printf() lib does some putc()/ttyputc()  (4.1).
	- ttyput(c) puts char on tyotail of ttytab[VTTY0] and does
		send(vtty_out_pid, 1); to vtty_out 0 process.

(5) vtty_out 0 process
	- takes char from ttyehead of ttytab[VTTY0].
	- calls to vt100_putc(char).

(6) vt100_putc(char) from vt100 lib
	- draws char on Surface 0.

(7) microui process 
	- puts Surfaces of all windows on a whole display surface buf.
	- calls to write(VGA, buf, sizeof(buf)); via gui.c lib.