> For 1) How does the context (i.e. that I am in a text program) get > established? Is there a context line at the start of the application? > Is it through main(argc, argv) or some such, depending on the > programming language of the application? How does it know to move one > line down on the screen i.e. is there a system call, a special > function ? man termios will teach you more than you ever want to know.