blob: 002f67fe4d8e650d0deb65997a895cb140b8837e (
plain)
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
|
/*
* crt.h:
*
* Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
* All rights reserved.
*
*/
/*
* $Id$
*/
/*
* $Log$
* Revision 1.3 2008/02/06 11:30:37 james
* *** empty log message ***
*
* Revision 1.2 2008/02/04 20:23:55 james
* *** empty log message ***
*
* Revision 1.1 2008/02/03 23:31:25 james
* *** empty log message ***
*
*/
#ifndef __CRT_H__
#define __CRT_H__
#define CRT_ROWS 25
#define CRT_COLS 80
#define CRT_CELS (CRT_ROWS*CRT_COLS)
#define CRT_ADDR(r,c) (((r)*CRT_COLS)+(c))
#define CRT_ADDR_POS(p) ((((p)->y)*CRT_COLS)+((p)->x))
#define CRT_ATTR_NORMAL 0x0
#define CRT_ATTR_UNDERLINE 0x1
#define CRT_ATTR_REVERSE 0x2
#define CRT_ATTR_BLINK 0x4
#define CRT_ATTR_BOLD 0x8
typedef struct
{
uint8_t chr;
uint8_t attr;
} CRT_CA;
typedef struct
{
int x;
int y;
} CRT_Pos;
typedef struct
{
CRT_CA screen[CRT_CELS];
CRT_Pos pos;
int hide_cursor;
} CRT;
static inline
crt_ca_cmp (CRT_CA a, CRT_CA b)
{
return memcmp (&a, &b, sizeof (a));
}
#endif /* __CRT_H__ */
|