devices/console.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include <stdio.h>
#include "../xyw.h"
/* console device */
#define CONSOLE_INPUT 0x0
#define CONSOLE_OUTPUT 0x1
#define CONSOLE_ERROR 0x2
#define CONSOLE_ON_KEYPRESS 0x3
void console_output(xyw_byte *data, xyw_byte addr, xyw_byte *error)
{
(void)error;
switch (addr)
{
case CONSOLE_OUTPUT:
fputc(data[addr], stdout);
fflush(stdout);
break;
case CONSOLE_ERROR:
fputc(data[addr], stderr);
fflush(stderr);
break;
}
}
|