blob: 2dc7feceb10d0c0d5c01adf7975b9859fe525234 [file] [log] [blame]
Joseph Pranevich791cd6a1998-12-02 19:58:08 +00001/* tty.c */
Joseph Pranevichebc0e5e1999-02-14 11:15:47 +00002/* Copyright 1999 - Joseph Pranevich */
Joseph Pranevich791cd6a1998-12-02 19:58:08 +00003
4/* This is the console driver for TTY-based consoles, i.e. consoles
5 without cursor placement, etc. It's also a pretty decent starting
6 point for other driers.
7*/
8
9/* When creating new drivers, you need to assign all the functions that
10 that driver supports into the driver struct. If it is a supplementary
11 driver, it should make sure to perserve the old values. */
12
13#include <stdio.h>
14#include "console.h"
15#include "config.h"
16#include "wintypes.h" /* FALSE */
17#include "windows.h" /* _lread16() */
18void TTY_Start()
19{
20 /* This should be the root driver so we can ignore anything
21 already in the struct. */
22
23 driver.norefresh = FALSE;
24
25 driver.write = TTY_Write;
26 driver.getKeystroke = TTY_GetKeystroke;
27}
28
29void TTY_Write(char output, int fg, int bg, int attribute)
30{
31 /* We can discard all extended information. */
Joseph Pranevich55768381998-12-09 15:43:03 +000032 fprintf(driver.console_out, "%c", output);
Joseph Pranevich791cd6a1998-12-02 19:58:08 +000033}
34
Ove Kaaven408b0851999-01-31 09:22:58 +000035void TTY_GetKeystroke(char *scan, char *ch)
Joseph Pranevich791cd6a1998-12-02 19:58:08 +000036{
37 /* All we have are character input things, nothing for extended */
38 /* This is just the TTY driver, after all. We'll cope. */
Joseph Pranevich55768381998-12-09 15:43:03 +000039 *ch = fgetc(driver.console_in);
Joseph Pranevich791cd6a1998-12-02 19:58:08 +000040}
41
42