ajusting i/o

This commit is contained in:
Thiago Auler 2017-11-21 15:06:40 -02:00 committed by GitHub
parent 7003d3f63b
commit dd4a315e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,12 +8,15 @@ void io_init()
noecho(); noecho();
cbreak(); cbreak();
nodelay(stdscr, TRUE); nodelay(stdscr, TRUE);
keyboard_control = 0x00;
} }
void input() void input()
{ {
int ch = getch(); int ch = getch();
if (ch != ERR) if (ch == '\n') { ch = '\r'; }
if (ch == '\r' || (ch >= '0' && ch <= '9'))
{ {
keyboard_buffer = ch | 0x80; keyboard_buffer = ch | 0x80;
keyboard_control = 0xFF; keyboard_control = 0xFF;
@ -27,9 +30,10 @@ void output()
{ {
// outputs the buffer character // outputs the buffer character
display_buffer = display_buffer & 0x7F; display_buffer = display_buffer & 0x7F;
if (display_buffer == '\r')
{
display_buffer = '\n';
}
addch(display_buffer); addch(display_buffer);
//refresh();
} }
//refresh();
} }