aboutsummaryrefslogtreecommitdiff
path: root/arch/casiowin/fxlib/include/dispbios.h
blob: 75e4ed07d055a2bec4f402b56e2aa0bd83888993 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/* ****************************************************************************
 * fxlib's display definitions.
 * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 * ************************************************************************* */
#include <fxlib/cdefs.h>
__BEGIN_NAMESPACE_FXLIB

/* VRAM size */
#define IM_VRAM_WIDTH  128  /* width in pixels */
#define IM_VRAM_HEIGHT 64   /* height in pixels */
#define IM_VRAM_SIZE   1024 /* size in bytes (1bpp) */

/* characters */
#define IM_CHARACTERS_MAX_LINE 21 /* number of characters per line */
#define IM_BYTES_MAX_LINE (IM_CHARACTERS_MAX_LINE * 2)

/* to save and restore displays */
#define SAVEDISP_PAGE1 1 /* first page (?) */
#define SAVEDISP_PAGE2 5 /* second page (?) */
#define SAVEDISP_PAGE3 6 /* third page (?) */

/* related to mini font? */
#define MINI_OVER  0x10
#define MINI_OR    0x11
#define MINI_REV   0x12
#define MINI_REVOR 0x13

/* DD size */
#define IM_BIOS_DD_WIDTH  IM_VRAM_WIDTH
#define IM_BIOS_DD_HEIGHT IM_VRAM_HEIGHT
/* ************************************************************************* */
/*  Write kind                                                               */
/* ************************************************************************* */
/* This is how to draw the pixels of a line, for example. */

enum _WRITEKIND {
	_WRITEKIND_OVER = 0x01,
	_WRITEKIND_OR   = 0x02,
	_WRITEKIND_AND  = 0x03,
	_WRITEKIND_XOR  = 0x04
};

typedef enum _WRITEKIND WRITEKIND;
#define IMB_WRITEKIND_OVER _WRITEKIND_OVER
#define IMB_WRITEKIND_OR   _WRITEKIND_OR
#define IMB_WRITEKIND_AND  _WRITEKIND_AND
#define IMB_WRITEKIND_XOR  _WRITEKIND_XOR
/* ************************************************************************* */
/*  Write modify                                                             */
/* ************************************************************************* */
/* TODO: describe this. */

enum _WRITEMODIFY {
	_WRITEMODIFY_NORMAL  = 0x01,
	_WRITEMODIFY_REVERSE = 0x02,
	_WRITEMODIFY_MESH    = 0x03
};

typedef enum _WRITEMODIFY WRITEMODIFY;
#define IMB_WRITEMODIFY_NORMAL  _WRITEMODIFY_NORMAL
#define IMB_WRITEMODIFY_REVERSE _WRITEMODIFY_REVERSE
#define IMB_WRITEMODIFY_REVERCE _WRITEMODIFY_REVERSE /* compatibility */
#define IMB_WRITEMODIFY_MESH    _WRITEMODIFY_MESH
/* ************************************************************************* */
/*  Area kind                                                                */
/* ************************************************************************* */
/* TODO: describe this. */

enum _AREAKIND {
	_AREAKIND_OVER    = 0x01,
	_AREAKIND_MESH    = 0x02,
	_AREAKIND_CLR     = 0x03,
	_AREAKIND_REVERSE = 0x04
};

typedef enum _AREAKIND AREAKIND;
#define IMB_AREAKIND_OVER    _AREAKIND_OVER
#define IMB_AREAKIND_MESH    _AREAKIND_MESH
#define IMB_AREAKIND_CLR     _AREAKIND_CLR
#define IMB_AREAKIND_REVERSE _AREAKIND_REVERSE
#define IMB_AREAKIND_REVERCE _AREAKIND_REVERSE /* compatibility */
/* ************************************************************************* */
/*  Effect window                                                            */
/* ************************************************************************* */
/* TODO: describe this. */

enum _EFFECTWIN {
	_EFFECTWIN_OK = 0x01,
	_EFFECTWIN_NG = 0x02
};

typedef enum _EFFECTWIN EFFECTWIN;
#define IMB_EFFECTWIN_OK _EFFECTWIN_OK
#define IMB_EFFECTWIN_NG _EFFECTWIN_NG
/* ************************************************************************* */
/*  Display box                                                              */
/* ************************************************************************* */
/* TODO: describe this. */

#define tag_DISPBOX _DISPBOX /* compatibility */
struct _DISPBOX {
	int left;
	int top;
	int right;
	int bottom;
};

typedef struct _DISPBOX DISPBOX;
typedef struct _DISPBOX dispbox_t;
#define dp_left   left
#define dp_top    top
#define dp_right  right
#define dp_bottom bottom
/* ************************************************************************* */
/*  Graph data                                                               */
/* ************************************************************************* */
/* TODO: describe this. */

#define tag_GRAPHDATA _GRAPHDATA /* compatibility */
struct _GRAPHDATA {
	int            width;
	int            height;
	unsigned char *pBitmap;
};

typedef struct _GRAPHDATA GRAPHDATA;
typedef struct _GRAPHDATA graphdata_t;
#define gd_width  width
#define gd_height height
#define gd_bitmap pBitmap
/* ************************************************************************* */
/*  Rectangle                                                                */
/* ************************************************************************* */
/* TODO: describe this. */

#define tag_RECTANGLE _RECTANGLE /* compatibility */
struct _RECTANGLE {
	DISPBOX   LineArea;
	AREAKIND  AreaKind;
	EFFECTWIN EffectWin;
};

typedef struct _RECTANGLE RECTANGLE;
typedef struct _RECTANGLE rectangle_t;
#define rc_linearea  LineArea
#define rc_areakind  AreaKind
#define rc_effectwin EffectWin
/* ************************************************************************* */
/*  Display graph                                                            */
/* ************************************************************************* */
/* TODO: describe this. */

#define tag_DISPGRAPH _DISPGRAPH /* compatibility */
struct _DISPGRAPH {
	int         x;
	int         y;
	GRAPHDATA   GraphData;
	WRITEMODIFY WriteModify;
	WRITEKIND   WriteKind;
};

typedef struct _DISPGRAPH DISPGRAPH;
typedef struct _DISPGRAPH dispgraph_t;
#define dg_x           x
#define dg_y           y
#define dg_graphdata   GraphData
#define dg_writemodify WriteModify
#define dg_writekind   WriteKind
/* ************************************************************************* */
/*  Shape                                                                    */
/* ************************************************************************* */
#if __USE_FXLIB_UNOFFICIAL
/* Main structure.
 * The `sh_f` structure contains the shape information.
 * - `sh_f[0]` is always 2 (?);
 * - `sh_f[1]` is the type of the shape;
 * - `sh_f[2]` and `sh_f[3]` control the draw mode (set, clear, invert).
 *
 * The shape type can be the following:
 * `shape_dot`:        dot at (x1, y1);
 * `shape_line_solid`: solid line from (x1, y1) to (x2, y2);
 * `shape_line_dash1`: dashed line (starting with `sh_onbits`)
 *                     from (x1, y1) to (x2, y2);
 * `shape_line_dash0`: dashed line (starting with `sh_offbits`)
 *                     from (x1, y1) to (x2, y2);
 * `shape_box`:        box from (x1, y1) to (x2, y2);
 * `shape_circle`:     circle at (x1, y1) with radius x2. */

# define shape_dot        1
# define shape_line_solid 2
# define shape_line_dash1 3
# define shape_line_dash0 4
# define shape_box        5
# define shape_circle     6

/* The draw mode uses the following values for `sh_f[2]` and `sh_f[3]`:
 * - [1, 1] set;
 * - [1, 4] invert;
 * - [2, 1] clear;
 * - [3, 1] invert (normal bit disabling);
 * - [3, 2] set (normal bit disabling);
 * - [3, 3] clear (normal bit disabling);
 * - [3, 4] invert (reverse bit disabling). */

# define tag_SHAPE _SHAPE
struct _SHAPE {
	/* coordinates */
	unsigned int sh_x1, sh_y1;
	unsigned int sh_x2, sh_y2;

	/* shape information */
	unsigned char sh_f[4];

	/* control the pattern of the dashed line types 3 and 4 */
	unsigned int sh_onbits, sh_offbits;
};

typedef struct _SHAPE SHAPE;
typedef struct _SHAPE shape_t;
#endif

__END_NAMESPACE_FXLIB