forked from mfld-fr/emu86
-
Notifications
You must be signed in to change notification settings - Fork 0
/
con-char.c
85 lines (61 loc) · 1.22 KB
/
con-char.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//-------------------------------------------------------------------------------
// EMU86 - Console to character backend mapping
//-------------------------------------------------------------------------------
#include "emu-con.h" // generic console
#include "emu-char.h" // generic character backend
int con_put_char (byte_t c, byte_t a)
{
return char_send (c);
}
static byte_t col_prev = 0;
int con_pos_set (byte_t row, byte_t col)
{
// Detect new line as return to first column
if (col == 0 && col_prev != 0)
{
char_send (10); // LF
}
col_prev = col;
return 0;
}
int con_pos_get (byte_t *row, byte_t *col)
{
*row = *col = 0;
return 0;
}
int con_scroll (int dn, byte_t n, byte_t at, byte_t r, byte_t c, byte_t r2, byte_t c2)
{
return 0;
}
int con_proc ()
{
int err;
while (1)
{
err = char_poll ();
if (err <= 0) break;
byte_t c = 0;
err = char_recv (&c);
if (!err) con_put_key ((word_t) c);
break;
}
return err;
}
void con_raw ()
{
char_raw ();
}
void con_normal ()
{
char_normal ();
}
int con_init ()
{
con_init_key ();
return char_init ();
}
void con_term ()
{
char_term ();
}
//-------------------------------------------------------------------------------