census logo
[bootcensus] / src / contty.h
1 /*
2 pcboot - bootable PC demo/game kernel
3 Copyright (C) 2018  John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY, without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef CONTTY_H_
19 #define CONTTY_H_
20
21 enum {
22         CON_CURSOR_LINE,
23         CON_CURSOR_BLOCK
24 };
25
26 enum {
27         BLACK,
28         BLUE,
29         GREEN,
30         CYAN,
31         RED,
32         MAGENTA,
33         BROWN,
34         LTGREY,
35         GREY,
36         LTBLUE,
37         LTGREEN,
38         LTCYAN,
39         LTRED,
40         LTMAGENTA,
41         YELLOW,
42         WHITE
43 };
44 #define BRIGHT          8
45 #define FG_BRIGHT       0x08
46 #define BG_BRIGHT       0x80
47
48 enum {
49         G_DIAMOND       = 0x04,
50         G_CHECKER       = 0xb1,
51         G_LR_CORNER     = 0xd9,
52         G_UR_CORNER     = 0xbf,
53         G_UL_CORNER     = 0xda,
54         G_LL_CORNER     = 0xc0,
55         G_CROSS         = 0xc5,
56         G_HLINE         = 0xc4,
57         G_L_TEE         = 0xc3,
58         G_R_TEE         = 0xb4,
59         G_B_TEE         = 0xc1,
60         G_T_TEE         = 0xc2,
61         G_VLINE         = 0xb3,
62         G_CDOT          = 0xf8,
63
64         G_HDBL          = 0xcd,
65         G_UL_HDBL       = 0xd5,
66         G_UR_HDBL       = 0xb8,
67         G_T_HDBL_TEE = 0xd1
68 };
69
70
71 int con_init(void);
72 void con_scr_enable(void);
73 void con_scr_disable(void);
74 void con_show_cursor(int show);
75 void con_cursor(int x, int y);
76 void con_curattr(int shape, int blink);
77 void con_fgcolor(int c);
78 void con_bgcolor(int c);
79 void con_setattr(unsigned char attr);
80 unsigned char con_getattr(void);
81 void con_clear(void);
82 void con_putchar(int c);
83
84 void con_putchar_scr(int x, int y, int c);
85 int con_printf(int x, int y, const char *fmt, ...);
86
87 #endif  /* CONTTY_H_ */