OSDN Git Service

AI003:config.txt, words.txtを追加。
[chnosproject/CHNOSProject.git] / CHNOSProject / chnos / tolset_chn_000 / z_tools / guigui00 / guigui00.h
1 #ifndef __GUIGUI00_H\r
2 #define __GUIGUI00_H\r
3 \r
4 /* gg00lib+ ver.0.8 */\r
5 /* gg00lib9\82ð\83x\81[\83X\82É\82µ\82Ä\82¢\82é */\r
6 \r
7 struct LIB_WORK {\r
8         int data[256 / 4];\r
9 };\r
10 \r
11 struct LIB_WINDOW {\r
12         int data[128 / 4];\r
13 };\r
14 \r
15 struct LIB_TEXTBOX {\r
16         int data[64 / 4];\r
17 };\r
18 \r
19 struct LIB_SIGHNDLREG {\r
20         int ES, DS, FS, GS;\r
21         int EDI, ESI, EBP, ESP;\r
22         int EBX, EDX, ECX, EAX;\r
23         int EIP, CS, EFLAGS;\r
24 };\r
25 \r
26 struct LIB_GRAPHBOX {\r
27         int reserve[64 / 4];\r
28 };\r
29 \r
30 struct LIB_LINES1 {\r
31         int x0, y0, dx, dy, length, color;\r
32 };\r
33 \r
34 struct LIB_LINES0 {\r
35         int x0, y0, x1, y1, dummy, color;\r
36 };\r
37 \r
38 struct LIB_POINTS {\r
39         int x, y, color;\r
40 };\r
41 \r
42 //void lib_execcmd(void *EBX);\r
43 \r
44 extern __inline__ void lib_execcmd(void *EBX)\r
45 {\r
46         __asm__ (" .byte 154 \n\t"\r
47                          " .byte 0   \n\t"\r
48                          " .byte 0   \n\t"\r
49                          " .byte 0   \n\t"\r
50                          " .byte 0   \n\t"\r
51                          " .byte 199 \n\t"\r
52                          " .byte 0   \n\t"\r
53                          : : "b" (EBX) );\r
54 }\r
55 \r
56 void lib_execcmd0(int cmd, ...);\r
57 #if 0\r
58 extern __inline__ void lib_execcmd0(int cmd, ...)\r
59 {\r
60         __asm__ (" movl %%esp,%%ebx \n\t"\r
61                          " .byte 154 \n\t"\r
62                          " .byte 0   \n\t"\r
63                          " .byte 0   \n\t"\r
64                          " .byte 0   \n\t"\r
65                          " .byte 0   \n\t"\r
66                          " .byte 199 \n\t"\r
67                          " .byte 0   \n\t"\r
68                          : : : "%ebx");\r
69 }\r
70 #endif\r
71 \r
72 int lib_execcmd1(int ret, int cmd, ...);\r
73 int lib_execcmd2(int ret, int cmd, ...);\r
74 \r
75 void *malloc(const unsigned int nbytes);\r
76 \r
77 #if 0\r
78         /* \88È\89º\82Ì\8aÖ\90\94\82Í\83}\83N\83\8d\82Å\8eÀ\8c»\82³\82ê\82Ä\82¢\82é(\8d\82\91¬\89»\82Æ\83R\83\93\83p\83N\83g\89»\82Ì\82½\82ß) */\r
79         /* \88ø\90\94\82Ì\8c^\82È\82Ç\82ª\95ª\82©\82è\82â\82·\82¢\82æ\82¤\82É\81A\8aÖ\90\94\8c^\90é\8c¾\82ð\92\90\8eß\82Æ\82µ\82Ä\8ec\82µ\82Ä\82 \82é */\r
80 \r
81 struct LIB_WORK *lib_init(struct LIB_WORK *work);\r
82 void lib_init_nm(struct LIB_WORK *work);\r
83 struct LIB_WORK *lib_init_am(struct LIB_WORK *work);\r
84 void lib_waitsignal(int opt, int signaldw, int nest);\r
85 struct LIB_WINDOW *lib_openwindow(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
86 void lib_openwindow_nm(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
87 void lib_openwindow_am(struct LIB_WINDOW *window, int slot, int x_size, int y_size);\r
88 struct LIB_TEXTBOX *lib_opentextbox(int opt, struct LIB_TEXTBOX *textbox, int backcolor,\r
89         int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset,\r
90         int init_char);\r
91 void lib_opentextbox_nm(int opt, struct LIB_TEXTBOX *textbox, int backcolor, int x_size,\r
92         int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset, int init_char);\r
93 void lib_opentextbox_am(int opt, struct LIB_TEXTBOX *textbox, int backcolor, int x_size,\r
94         int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window, int charset, int init_char);\r
95 void lib_waitsignaltime(int opt, int signaldw, int nest, unsigned int time0, unsigned int time1,\r
96         unsigned int time2);\r
97 int *lib_opensignalbox(int bytes, int *signalbox, int eos, int rewind);\r
98 void lib_opensignalbox_nm(int bytes, int *signalbox, int eos, int rewind);\r
99 int *lib_opensignalbox_am(int bytes, int *signalbox, int eos, int rewind);\r
100 void lib_definesignal0p0(int opt, int default_assign0, int default_assign1, int default_assign2);\r
101 void lib_definesignal1p0(int opt, int default_assign0, int default_assign1,\r
102         struct LIB_WINDOW *default_assign2, int signal);\r
103 void lib_opentimer(int slot);\r
104 void lib_closetimer(int slot);\r
105 void lib_settimertime(int opt, int slot, unsigned int time0, unsigned int time1,\r
106         unsigned int time2);\r
107 void lib_settimer(int opt, int slot);\r
108 void lib_opensoundtrack(int slot);\r
109 void lib_controlfreq(int slot, int freq);\r
110 struct LIB_WINDOW *lib_openwindow1(struct LIB_WINDOW *window, int slot, int x_size, int y_size,\r
111         int flags, int base);\r
112 void lib_openwindow1_nm(struct LIB_WINDOW *window, int slot, int x_size, int y_size, int flags,\r
113         int base);\r
114 void lib_openwindow1_am(struct LIB_WINDOW *window, int slot, int x_size, int y_size, int flags,\r
115         int base);\r
116 void lib_closewindow(int opt, struct LIB_WINDOW *window);\r
117 void lib_controlwindow(int opt, struct LIB_WINDOW *window);\r
118 void lib_close(int opt);\r
119 void lib_loadfontset(int opt, int slot, int len, void *font);\r
120 void lib_loadfontset0(int opt, int slot);\r
121 void lib_makecharset(int opt, int charset, int fontset, int len, int from, int base);\r
122 void lib_drawline(int opt, struct LIB_WINDOW *window, int color, int x0, int y0, int x1, int y1);\r
123 void lib_closetextbox(int opt, struct LIB_TEXTBOX *textbox);\r
124 void lib_mapmodule(int opt, int slot, int attr, int size, void *addr, int ofs);\r
125 void lib_unmapmodule(int opt, int size, void *addr);\r
126 void lib_initmodulehandle(int opt, int slot);\r
127 void lib_putblock1(struct LIB_WINDOW *win, int x, int y, int sx, int sy, int skip, void *p);\r
128 struct LIB_GRAPHBOX *lib_opengraphbox(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
129         int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
130 void lib_opengraphbox_nm(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
131         int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
132 struct LIB_GRAPHBOX *lib_opengraphbox_am(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
133         int x_size, int y_size, int x_pos, int y_pos, struct LIB_WINDOW *window);\r
134 void lib_flushgraphbox(int opt, struct LIB_WINDOW *win, int x, int y, int sx, int sy, int skip,\r
135         void *p);\r
136 void lib_drawline0(int opt, struct LIB_GRAPHBOX *gbox, int color, int x0, int y0, int x1, int y1);\r
137 void lib_drawlines0(int opt, struct LIB_GRAPHBOX *gbox, int x0, int y0, int xsize, int ysize,\r
138         int lines, const struct LIB_LINES1 *ofs);\r
139 void lib_convlines(int opt, int lines, struct LIB_LINES0 *src, struct LIB_LINES1 *dest);\r
140 void lib_initmodulehandle0(int opt, int slot);\r
141 void lib_putblock02001(struct LIB_GRAPHBOX *gbox, void *buf, int vx0, int vy0);\r
142 struct LIB_GRAPHBOX *lib_opengraphbox2(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
143         int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
144         struct LIB_WINDOW *window);\r
145 void lib_opengraphbox2_nm(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
146         int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
147         struct LIB_WINDOW *window);\r
148 struct LIB_GRAPHBOX *lib_opengraphbox2_am(int opt, struct LIB_GRAPHBOX *gbox, int mode, int mode_opt,\r
149         int x_bsize, int y_bsize, int x_vsize, int y_vsize, int x_pos, int y_pos,\r
150         struct LIB_WINDOW *window);\r
151 void lib_putblock03001(struct LIB_GRAPHBOX *gbox, void *buf, int vx0, int vy0, void *tbuf,\r
152         int tbuf_skip, int tcol0);\r
153 void lib_drawpoints0(int opt, struct LIB_GRAPHBOX *gbox, int x0, int y0, int xsize, int ysize,\r
154         int points, const struct LIB_POINTS *ofs);\r
155 void lib_wsjis2gg00jpn0(int len, const char *sjis, int *gg00jpn, int ankbase, int jpnbase);\r
156 void lib_loadfontset1(int opt, int slot, int sig);\r
157 void lib_drawlines1(int opt, struct LIB_WINDOW *win, int x0, int y0, int xsize, int ysize,\r
158         int lines, const struct LIB_LINES1 *ofs);\r
159 void lib_drawpoints1(int opt, struct LIB_WINDOW *win, int x0, int y0, int xsize, int ysize,\r
160         int points, const struct LIB_POINTS *ofs);\r
161 void lib_seuc2gg00(int len, const char *seuc, int *gg00, int ankbase, int rightbase);\r
162 void lib_resizemodule(int opt, int slot, int newsize, int sig);\r
163 void lib_drawpoint0(int opt, struct LIB_GRAPHBOX *gbox, int color, int x, int y);\r
164 const int lib_getrandseed();\r
165 void lib_putstring0(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox,\r
166         int color, int bcolor, int len, const int *str);\r
167 void lib_putstring1(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *tbox,\r
168         int col, int bcol, int base, int len, const int *str);\r
169 \r
170 #endif\r
171 \r
172 void lib_putstring_ASCII(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox, int color,\r
173         int backcolor, const char *str);\r
174 void lib_definesignalhandler(void (*lib_signalhandler)(struct LIB_SIGHNDLREG *));\r
175 int lib_readCSb(int offset);\r
176 int lib_readCSd(int offset);\r
177 int lib_readmodulesize(int slot);\r
178 void lib_initmodulehandle1(int slot, int num, int sig);\r
179 void lib_steppath0(int opt, int slot, const char *name, int sig);\r
180 int lib_decodel2d3(int size, int src_ofs, int src_sel, int dest_ofs, int dest_sel);\r
181 void lib_putstring_SJIS0(int opt, int x_pos, int y_pos, struct LIB_TEXTBOX *textbox,\r
182         int color, int backcolor, const char *str);\r
183 int lib_decodetek0(int size, int src_ofs, int src_sel, int dest_ofs, int dest_sel);\r
184 void lib_settimertime2(int opt, int slot0, int slot1, unsigned int *time);\r
185 \r
186 #define lib_init(work) \\r
187         (struct LIB_WORK *) lib_execcmd2(1 * 4 + 4, 0x0004, \\r
188         (work) ? (void *) (work) : malloc(sizeof (struct LIB_WORK)), 0x0000)\r
189 \r
190 #define lib_init_nm(work) \\r
191         lib_execcmd0(0x0004, (void *) (work), 0x0000)\r
192 \r
193 #define lib_init_am(work) \\r
194         (struct LIB_WORK *) lib_execcmd2(1 * 4 + 4, 0x0004, \\r
195         malloc(sizeof (struct LIB_WORK)), 0x0000)\r
196 \r
197 #define lib_waitsignal(opt, signaldw, nest) \\r
198         lib_execcmd0(0x0018, (int) (opt), (int) (signaldw), (int) (nest), 0x0000)\r
199 \r
200 #define lib_openwindow(window, slot, x_size, y_size) \\r
201         (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
202         (window) ? (void *) (window) : malloc(sizeof (struct LIB_WINDOW)), \\r
203         (int) (slot), (int) (x_size), (int) (y_size), 0x0000)\r
204 \r
205 #define lib_openwindow_nm(window, slot, x_size, y_size) \\r
206         lib_execcmd0(0x0020, (void *) (window), (int) (slot), (int) (x_size), \\r
207         (int) (y_size), 0x0000)\r
208 \r
209 #define lib_openwindow_am(window, slot, x_size, y_size) \\r
210         (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
211         malloc(sizeof (struct LIB_WINDOW)), \\r
212         (int) (slot), (int) (x_size), (int) (y_size), 0x0000)\r
213 \r
214 #define lib_opentextbox(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
215         (struct LIB_TEXTBOX *) lib_execcmd2(2 * 4 + 4, 0x0028, (int) (opt), \\r
216         (textbox) ? (void *) (textbox) : malloc(sizeof (struct LIB_TEXTBOX) + 8 * (x_size) * (y_size)), \\r
217         (int) (backcolor), (int) (x_size), (int) (y_size), (int) (x_pos), \\r
218         (int) (y_pos), (void *) (window), (int) (charset), (int) (init_char), \\r
219         0x0000)\r
220 \r
221 #define lib_opentextbox_nm(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
222         lib_execcmd0(0x0028, (int) (opt), (void *) (textbox), (int) (backcolor), \\r
223         (int) (x_size), (int) (y_size), (int) (x_pos), (int) (y_pos), \\r
224         (void *) (window), (int) (charset), (int) (init_char), 0x0000)\r
225 \r
226 #define lib_opentextbox_am(opt, textbox, backcolor, x_size, y_size, x_pos, y_pos, window, charset, init_char) \\r
227         (struct LIB_TEXTBOX *) lib_execcmd2(2 * 4 + 4, 0x0028, (int) (opt), \\r
228         malloc(sizeof (struct LIB_TEXTBOX) + 8 * (x_size) * (y_size)), \\r
229         (int) (backcolor), (int) (x_size), (int) (y_size), (int) (x_pos), \\r
230         (int) (y_pos), (void *) (window), (int) (charset), (int) (init_char), \\r
231         0x0000)\r
232 \r
233 #define lib_waitsignaltime(opt, signaldw, nest, time0, time1, time2) \\r
234         lib_execcmd0(0x0018, (int) (opt), (int) (signaldw), (int) (nest), \\r
235         (int) (time0), (int) (time1), (int) (time2), 0x0000)\r
236 \r
237 #define lib_opensignalbox(bytes, signalbox, eos, rewind) \\r
238         (int *) lib_execcmd2(2 * 4 + 4, 0x0060, (int) (bytes), \\r
239         (signalbox) ? (void *) (signalbox) : malloc(bytes), (int) (eos), \\r
240         (int) (rewind), 0x0000)\r
241 \r
242 #define lib_opensignalbox_nm(bytes, signalbox, eos, rewind) \\r
243         lib_execcmd0(0x0060, (int) (bytes), (void *) (signalbox), (int) (eos), \\r
244         (int) (rewind), 0x0000)\r
245 \r
246 #define lib_opensignalbox_am(bytes, signalbox, eos, rewind) \\r
247         (int *) lib_execcmd2(2 * 4 + 4, 0x0060, (int) (bytes), \\r
248         malloc(bytes), (int) (eos), (int) (rewind), 0x0000)\r
249 \r
250 #define lib_definesignal0p0(opt, default_assign0, default_assign1, default_assign2) \\r
251         lib_execcmd0(0x0068, (int) (opt), (int) (default_assign0), \\r
252         (int) (default_assign1), (int) (default_assign2), 0, 0, 0x0000)\r
253 \r
254 #define lib_definesignal1p0(opt, default_assign0, default_assign1, default_assign2, signal) \\r
255         lib_execcmd0(0x0068, (int) (opt), (int) (default_assign0), \\r
256         (int) (default_assign1), (int) (default_assign2), 1, (int) (signal), \\r
257         0, 0x0000)\r
258 \r
259 #define lib_opentimer(slot) \\r
260         lib_execcmd0(0x0070, (int) (slot), 0x0000)\r
261 \r
262 #define lib_closetimer(slot) \\r
263         lib_execcmd0(0x0074, (int) (slot), 0x0000)\r
264 \r
265 #define lib_settimertime(opt, slot, time0, time1, time2) \\r
266         lib_execcmd0(0x0078, (int) (opt), (int) (slot), (int) (time0), \\r
267         (int) (time1), (int) (time2), 0x0000)\r
268 \r
269 #define lib_settimer(opt, slot) \\r
270         lib_execcmd0(0x0078, (int) (opt), (int) (slot), 0x0000)\r
271 \r
272 #define lib_opensoundtrack(slot) \\r
273         lib_execcmd0(0x0080, (int) (slot), 0, 0x0000)\r
274 \r
275 #define lib_controlfreq(slot, freq) \\r
276         lib_execcmd0(0x008c, (int) (slot), (int) (freq), 0x0000)\r
277 \r
278 #define lib_openwindow1(window, slot, x_size, y_size, flags, base) \\r
279         (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
280         (window) ? (void *) (window) : malloc(sizeof (struct LIB_WINDOW)), \\r
281         (int) (slot) | 0x01, (int) (x_size), (int) (y_size), \\r
282         0x01 | (int) (flags) << 8, (int) (base), 0x0000)\r
283 \r
284 #define lib_openwindow1_nm(window, slot, x_size, y_size, flags, base) \\r
285         lib_execcmd0(0x0020, (void *) (window), (int) (slot) | 0x01, \\r
286         (int) (x_size), (int) (y_size), 0x01 | (int) (flags) << 8, (int) (base), \\r
287         0x0000)\r
288 \r
289 #define lib_openwindow1_am(window, slot, x_size, y_size, flags, base) \\r
290         (struct LIB_WINDOW *) lib_execcmd2(1 * 4 + 4, 0x0020, \\r
291         malloc(sizeof (struct LIB_WINDOW)), \\r
292         (int) (slot) | 0x01, (int) (x_size), (int) (y_size), \\r
293         0x01 | (int) (flags) << 8, (int) (base), 0x0000)\r
294 \r
295 #define lib_closewindow(opt, window) \\r
296         lib_execcmd0(0x0024, (int) (opt), (void *) (window), 0x0000)\r
297 \r
298 #define lib_controlwindow(opt, window) \\r
299         lib_execcmd0(0x003c, (int) (opt), (void *) (window), 0x0000)\r
300 \r
301 #define lib_close(opt) \\r
302         lib_execcmd0(0x0008, (int) (opt), 0x0000)\r
303 \r
304 #define lib_loadfontset(opt, slot, len, font) \\r
305         lib_execcmd0(0x00e0, (int) (opt), (int) (slot), (int) (len), (int) (font), \\r
306         0x000c, 0x0000)\r
307 \r
308 #define lib_loadfontset0(opt, slot) \\r
309         lib_execcmd0(0x00e0, (int) (opt), (int) (slot), 0x0000)\r
310 \r
311 #define lib_loadfontset1(opt, slot, sig) \\r
312         lib_execcmd0(0x00e0, (int) (opt), (int) (slot), 1, (int) (sig), 0x0000)\r
313 \r
314 #define lib_makecharset(opt, charset, fontset, len, from, base) \\r
315         lib_execcmd0(0x00e8, (int) (opt), (int) (charset), (int) (fontset), \\r
316         (int) (len), (int) (from), (int) (base), 0x0000)\r
317 \r
318 #define lib_drawline(opt, window, color, x0, y0, x1, y1) \\r
319         lib_execcmd0(0x0044, (int) (opt), (void *) (window), (int) (color), \\r
320         (int) (x0), (int) (y0), (int) (x1), (int) (y1), 0x0000)\r
321 \r
322 #define lib_closetextbox(opt, textbox) \\r
323         lib_execcmd0(0x002c, (int) (opt), (int) (textbox), 0x0000)\r
324 \r
325 #define lib_mapmodule(opt, slot, attr, size, addr, ofs) \\r
326         lib_execcmd0(0x00c0, (int) (opt), (int) (slot), (int) (size), \\r
327         (void *) (addr), 0x000c, (int) ((ofs) | (attr)), 0x0000)\r
328 \r
329 #define lib_unmapmodule(opt, size, addr) \\r
330         lib_execcmd0(0x00c4, (int) (opt), (int) (size), (void *) (addr), 0x000c, \\r
331         0x0000)\r
332 \r
333 #define lib_initmodulehandle(opt, slot) \\r
334         lib_execcmd0(0x00a0, (int) (opt), (int) (slot), 0x0000)\r
335 \r
336 #define lib_putblock1(win, x, y, sx, sy, skip, p) \\r
337         lib_execcmd0(0x004c, 1, (void *) (win), (int) (x), (int) (y), (int) (sx), \\r
338         (int) (sy), (int) (skip), (void *) (p), 0x000c, 0x0000)\r
339 \r
340 #define lib_opengraphbox(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
341         (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
342         (graphbox) ? (void *) (graphbox) : malloc(sizeof (struct LIB_GRAPHBOX) + (x_size) * (y_size) * ((mode) & 0xf)), \\r
343         (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
344         (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
345 \r
346 #define lib_opengraphbox_nm(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
347         lib_execcmd0(0x0030, (int) (opt), (void *) (graphbox), \\r
348         (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
349         (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
350 \r
351 #define lib_opengraphbox_am(opt, graphbox, mode, mode_opt, x_size, y_size, x_pos, y_pos, window) \\r
352         (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
353         malloc(sizeof (struct LIB_GRAPHBOX) + (x_size) * (y_size) * ((mode) & 0xf)), \\r
354         (int) (mode), (int) (mode_opt), (int) (x_size), (int) (y_size), \\r
355         (int) (x_pos), (int) (y_pos), (void *) (window), 0x0000)\r
356 \r
357 #define lib_flushgraphbox(opt, win, x, y, sx, sy, skip, p) \\r
358         lib_execcmd0(0x004c, opt, (void *) (win), (int) (x), (int) (y), (int) (sx), \\r
359         (int) (sy), (int) (skip), (void *) (p), 0x000c, 0x0000)\r
360 \r
361 #define lib_drawline0(opt, gbox, color, x0, y0, x1, y1) \\r
362         lib_execcmd0(0x0054, (int) (opt), (void *) (gbox), (int) (color), \\r
363         (int) (x0), (int) (y0), (int) (x1), (int) (y1), 0x0000)\r
364 \r
365 #define lib_drawlines0(opt, gbox, x0, y0, xsize, ysize, lines, ofs) \\r
366         lib_execcmd0(0x0108, (int) (opt), (void *) (gbox), (int) (x0), \\r
367         (int) (y0), (int) (xsize), (int) (ysize), (int) (lines), (void *) (ofs), \\r
368         0x000c, 0x0000)\r
369 \r
370 #define lib_convlines(opt, lines, src, dest) \\r
371         lib_execcmd0(0x010c, (int) (opt), (int) (lines), \\r
372         (struct LIB_LINES0 *) (src), 0x000c, (struct LIB_LINES1 *) (dest), \\r
373         0x000c, 0x0000)\r
374 \r
375 #define lib_initmodulehandle0(opt, slot) \\r
376         lib_execcmd0(0x00a0, (int) (opt), (int) (slot), 0x0000)\r
377 \r
378 #define lib_putblock02001(gbox, buf, vx0, vy0) \\r
379         lib_execcmd0(0x0058, 0x2001, (void *) (gbox), (void *) (buf), \\r
380         (int) (vx0), (int) (vy0), 0x0000)\r
381 \r
382 #define lib_opengraphbox2(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
383         x_vsize, y_vsize, x_pos, y_pos, window) \\r
384         (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
385         (graphbox) ? (void *) (graphbox) : malloc(sizeof (struct LIB_GRAPHBOX) + (x_bsize) * (y_bsize) * ((mode) & 0xf)), \\r
386         (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
387         (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
388         (void *) (window), 0x0000)\r
389 \r
390 #define lib_opengraphbox2_nm(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
391         x_vsize, y_vsize, x_pos, y_pos, window) \\r
392         lib_execcmd0(0x0030, (int) (opt), (void *) (graphbox), \\r
393         (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
394         (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
395         (void *) (window), 0x0000)\r
396 \r
397 #define lib_opengraphbox2_am(opt, graphbox, mode, mode_opt, x_bsize, y_bsize, \\r
398         x_vsize, y_vsize, x_pos, y_pos, window) \\r
399         (struct LIB_GRAPHBOX *) lib_execcmd2(2 * 4 + 4, 0x0030, (int) (opt), \\r
400         malloc(sizeof (struct LIB_GRAPHBOX) + (x_bsize) * (y_bsize) * ((mode) & 0xf)), \\r
401         (int) (mode), (int) (mode_opt), (int) (x_bsize), (int) (y_bsize), \\r
402         (int) (x_vsize), (int) (y_vsize), (int) (x_pos), (int) (y_pos), \\r
403         (void *) (window), 0x0000)\r
404 \r
405 #define lib_putblock03001(gbox, buf, vx0, vy0, tbuf, tbuf_skip, tcol0) \\r
406         lib_execcmd0(0x0058, 0x3001, (void *) (gbox), (void *) (buf), \\r
407         (int) (vx0), (int) (vy0), (void *) (tbuf), (int) (tbuf_skip), \\r
408         (int) (tcol0), 0x0000)\r
409 \r
410 #define lib_drawpoints0(opt, gbox, x0, y0, xsize, ysize, points, ofs) \\r
411         lib_execcmd0(0x005c, (int) (opt), (void *) (gbox), (int) (x0), \\r
412         (int) (y0), (int) (xsize), (int) (ysize), (int) (points), (void *) (ofs), \\r
413         0x000c, 0x0000)\r
414 \r
415 #define lib_wsjis2gg00jpn0(len, sjis, gg00jpn, ankbase, jpnbase) \\r
416         lib_execcmd0(0x00ec, 0x0001, (int) (len), (void *) (sjis), 0x000c, \\r
417         (int *) (gg00jpn), 0x000c, (int) (ankbase), (int) (jpnbase), 0x0000)\r
418 \r
419 #define lib_drawlines1(opt, win, x0, y0, xsize, ysize, lines, ofs) \\r
420         lib_execcmd0(0x0110, (int) (opt), (void *) (win), (int) (x0), \\r
421         (int) (y0), (int) (xsize), (int) (ysize), (int) (lines), (void *) (ofs), \\r
422         0x000c, 0x0000)\r
423 \r
424 #define lib_drawpoints1(opt, win, x0, y0, xsize, ysize, points, ofs) \\r
425         lib_execcmd0(0x0050, (int) (opt), (void *) (win), (int) (x0), \\r
426         (int) (y0), (int) (xsize), (int) (ysize), (int) (points), (void *) (ofs), \\r
427         0x000c, 0x0000)\r
428 \r
429 #define lib_seuc2gg00(len, seuc, gg00, ankbase, rightbase) \\r
430         lib_execcmd0(0x00ec, 0x0002, (int) (len), (void *) (seuc), 0x000c, \\r
431         (int *) (gg00), 0x000c, (int) (ankbase), (int) (rightbase), 0x0000)\r
432 \r
433 #define lib_resizemodule(opt, slot, newsize, sig) \\r
434         lib_execcmd0(0x0120, 0x0000, (int) (slot), (int) (newsize), 1, \\r
435         (int) (sig), 0x0000)\r
436 \r
437 #define lib_drawpoint0(opt, gbox, color, x, y) \\r
438         lib_execcmd0(0x0054, (int) (opt), (void *) (gbox), (int) (color), \\r
439         (int) (x), (int) (y), (int) (x), (int) (y), 0x0000)\r
440 \r
441 #define lib_getrandseed() \\r
442         lib_execcmd2(2 * 4 + 4, 0x0118, (int) 0, (int) 0, (int) 0x0000)\r
443 \r
444 #define lib_putstring0(opt, x_pos, y_pos, textbox, color, bcolor, len, str) \\r
445         lib_execcmd0(0x0040, (int) (opt) | 0x4000, (int) (x_pos),  (int) (y_pos), \\r
446         (void *) (textbox), (int) (color), (int) (bcolor), (int) (len), \\r
447         (void *) (str), (int) 0x000c, 0x0000)\r
448 \r
449 #define lib_putstring1(opt, x_pos, y_pos, tbox, col, bcol, base, len, str) \\r
450         lib_execcmd0(0x0040, (int) (opt) | 0x4000, (int) (x_pos),  (int) (y_pos), \\r
451         (void *) (tbox), (int) (col), (int) (bcol), (int) (base), (int) (len), \\r
452         (void *) (str), (int) 0x000c, 0x0000)\r
453 \r
454 /* <guigui00.h>\89ü\97Ç\8cv\89æ\82Ì\82½\82ß\82Ì\92Ç\8bL */\r
455 \r
456 //void lib_initsignalbox0_256(int rewind);\r
457 //void lib_initsignalbox0_4k(int rewind);\r
458 //void lib_initsignalbox0_64k(int rewind);\r
459 extern int lib_work256[256 / 4];\r
460 extern int lib_sigrwd_256, *lib_sigptr_256, lib_sigbox_256[256 / 4];\r
461 extern int lib_sigrwd_4k,  *lib_sigptr_4k,  lib_sigbox_4k[4096 / 4];\r
462 extern int lib_sigrwd_64k, *lib_sigptr_64k, lib_sigbox_64k[65536 / 4];\r
463 int lib_getsig0w(int *sigbox);\r
464 int lib_getsig0(int *sigbox);\r
465 int lib_getsig1w(int *sigbox);\r
466 int lib_getsig1(int *sigbox);\r
467 \r
468 extern int lib_initsignalbox0_256d[1];\r
469 extern __inline__ void lib_initsignalbox0_256(int rewind)\r
470 {\r
471         __asm__ (" movl $_lib_initsignalbox0_256d,%%ebx\n\t"    \\r
472                          " movl %0,24(%%ebx)                   \n\t"    \\r
473                          " .byte 154                           \n\t"    \\r
474                          " .byte 0                             \n\t"    \\r
475                          " .byte 0                             \n\t"    \\r
476                          " .byte 0                             \n\t"    \\r
477                          " .byte 0                             \n\t"    \\r
478                          " .byte 199                           \n\t"    \\r
479                          " .byte 0                             \n\t"    \\r
480                          : : "r" (rewind) : "%ebx" );\r
481 }\r
482 \r
483 extern int lib_initsignalbox0_4kd[1];\r
484 extern __inline__ void lib_initsignalbox0_4k(int rewind)\r
485 {\r
486         __asm__ (" movl $_lib_initsignalbox0_4kd,%%ebx \n\t"    \\r
487                          " movl %0,24(%%ebx)                   \n\t"    \\r
488                          " .byte 154                           \n\t"    \\r
489                          " .byte 0                             \n\t"    \\r
490                          " .byte 0                             \n\t"    \\r
491                          " .byte 0                             \n\t"    \\r
492                          " .byte 0                             \n\t"    \\r
493                          " .byte 199                           \n\t"    \\r
494                          " .byte 0                             \n\t"    \\r
495                          : : "r" (rewind) : "%ebx" );\r
496 }\r
497 \r
498 extern int lib_initsignalbox0_64kd[1];\r
499 extern __inline__ void lib_initsignalbox0_64k(int rewind)\r
500 {\r
501         __asm__ (" movl $_lib_initsignalbox0_64kd,%%ebx\n\t"    \\r
502                          " movl %0,24(%%ebx)                   \n\t"    \\r
503                          " .byte 154                           \n\t"    \\r
504                          " .byte 0                             \n\t"    \\r
505                          " .byte 0                             \n\t"    \\r
506                          " .byte 0                             \n\t"    \\r
507                          " .byte 0                             \n\t"    \\r
508                          " .byte 199                           \n\t"    \\r
509                          " .byte 0                             \n\t"    \\r
510                          : : "r" (rewind) : "%ebx" );\r
511 }\r
512 \r
513 #if (!defined(LIB_FN_INIT))\r
514 /* function-number */\r
515 #define LIB_FN_INIT                             0x0004  /* non-malloc\8c^ */\r
516 #define LIB_FN_CLOSE                    0x0008\r
517 #define LIB_FN_WAITSIGNAL               0x0018\r
518 #define LIB_FN_WAITSIGNALTIME   0x0018\r
519 #define LIB_FN_OPENWINDOW               0x0020  /* non-malloc\8c^ */\r
520 #define LIB_FN_OPENWINDOW1              0x0020  /* non-malloc\8c^ */\r
521         /* \81ªslot\82Ì\82Æ\82±\82ë\82É1\82ð\91«\82·\81Aflags\82Ì\82Æ\82±\82ë\82Í256\94{\82µ\82Ä\82³\82ç\82É1\82ð\91«\82· */\r
522 #define LIB_FN_CLOSEWINDOW              0x0024\r
523 #define LIB_FN_OPENTEXTBOX              0x0028  /* non-malloc\8c^ */\r
524 #define LIB_FN_CLOSETEXTBOX             0x002c\r
525 #define LIB_FN_OPENGRAPHBOX             0x0030  /* non-malloc\8c^ */\r
526 #define LIB_FN_OPENGRAPHBOX2    0x0030  /* non-malloc\8c^ */\r
527 #define LIB_FN_CONTROLWINDOW    0x003c\r
528 #define LIB_FN_PUTSTRING                0x0040\r
529         /* \81ª\95\81\92Ê\82É\8eg\82¤\82È\82çopt\82É0x4000\82ð\91«\82· */\r
530         /* \81ª\83e\83L\83X\83g\96\84\82ß\8d\9e\82Ý\82ð\82â\82é\82È\82ç0x4000\82Í\91«\82³\82È\82¢ */\r
531 #define LIB_FN_DRAWLINE                 0x0044\r
532 #define LIB_FN_FLUSHGRAPHBOX    0x004c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
533 #define LIB_FN_PUTBLOCK1                0x004c  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä1\82ð\92Ç\89Á\81A\82³\82ç\82É\82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
534 #define LIB_FN_DRAWPOINTS1              0x0050  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
535 #define LIB_FN_DRAWLINE0                0x0054\r
536 #define LIB_FN_DRAWPOINT0               0x0054\r
537         /* \81ªx\82Æy\82Ì\82 \82Æ\82É\81A\82Ü\82½x\82Æy\82ð\92Ç\89Á\81F\8eÀ\82ÍDRAWLINE0\82Å\82²\82Ü\82©\82µ\82Ä\82¢\82é\82½\82ß */\r
538 #define LIB_FN_PUTBLOCK02001    0x0058  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä0x2001\82ð\92Ç\89Á */\r
539 #define LIB_FN_PUTBLOCK03001    0x0058  /* \90æ\93ª\82Éopt\82Æ\82µ\82Ä0x3001\82ð\92Ç\89Á */\r
540 #define LIB_FN_DRAWPOINTS0              0x005c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
541 #define LIB_FN_OPENSIGNALBOX    0x0060  /* non-malloc\8c^ */\r
542 #define LIB_FN_DEFINESIGNAL             0x0068\r
543         /* \81ª0p0\82Ì\8fê\8d\87\82Í\81A\82¨\82µ\82è\82É0\82ð2\82Â\92Ç\89Á */\r
544         /* \81ª1p0\82Ì\8fê\8d\87\82Í\81Asignal\82Ì\91O\82É1\82ð\92Ç\89Á\81Asignal\82Ì\8cã\82ë\82É0\82ð\92Ç\89Á */\r
545 #define LIB_FN_OPENTIMER                0x0070\r
546 #define LIB_FN_CLOSETIMER               0x0074\r
547 #define LIB_FN_SETTIMER                 0x0078\r
548 #define LIB_FN_SETTIMERTIME             0x0078\r
549 #define LIB_FN_OPENSOUNDTRAK    0x0080\r
550 #define LIB_FN_CONTROLFREQ              0x008c\r
551 #define LIB_FN_MAPMODULE                0x00c0  /* addr\82Ì\8cã\82ë\82É0x000c\82ð\92Ç\89Á\81Aofs\82Æattr\82Í\91«\82µ\8eZ\82µ\82Ä\88ê\82Â\82É */\r
552 #define LIB_FN_UNMAPMODULE              0x00c4  /* addr\82Ì\8cã\82ë\82É0x000c\82ð\92Ç\89Á */\r
553 #define LIB_FN_LOADFONTSET              0x00e0  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
554 #define LIB_FN_LOADFONTSET0             0x00e0\r
555 #define LIB_FN_MAKECHARSET              0x00e8\r
556 #define LIB_FN_WSJIS2GG00JPN0   0x00ec\r
557         /* \81ª\90æ\93ª\82Éopt\82Æ\82µ\82Ä1\82ð\92Ç\89Á\81Asjis\82Ægg00jpn\82Ì\82¤\82µ\82ë\82É\82»\82ê\82¼\82ê0x000c\82ð\92Ç\89Á */\r
558 #define LIB_FN_SEUC2GG00                0x00ec\r
559         /* \81ª\90æ\93ª\82Éopt\82Æ\82µ\82Ä2\82ð\92Ç\89Á\81Aseuc\82Ægg00\82Ì\82¤\82µ\82ë\82É\82»\82ê\82¼\82ê0x000c\82ð\92Ç\89Á */\r
560 #define LIB_FN_DRAWLINES0               0x0108  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
561 #define LIB_FN_CONVLINES                0x010c  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
562 #define LIB_FN_DRAWLINES1               0x0110  /* \82¨\82µ\82è\82É0x000c\82ð\92Ç\89Á */\r
563 #define LIB_FN_RESIZEMODULE             0x0120  /* sig\82Ì\91O\82É1\82ð\92Ç\89Á */\r
564 #endif\r
565 \r
566 #define lib_openwintitle(size, window) \\r
567     lib_opentextbox(0x1000, 0, 0, size, 1, 0, 0, window, 0x00c0, 0)\r
568 \r
569 #define lib_settimertime_interval(slot, time0, time1) \\r
570     lib_settimertime(0x12, slot, time0, time1, 0)\r
571 \r
572 #define lib_settimertime_fromnow(slot, time0, time1) \\r
573     lib_settimertime(0x32, slot, time0, time1, 0)\r
574 \r
575 #define lib_wait_interval(time0, time1) \\r
576     lib_waitsignaltime(0x0007, 0, 0, time0, time1, 0)\r
577 \r
578 #define lib_wait_fromnow(time0, time1) \\r
579     lib_waitsignaltime(0x000f, 0, 0, time0, time1, 0)\r
580 \r
581 int lib_imul(signed int a, signed int b, int *h);\r
582 int lib_idiv(signed int a, signed int b, int *r);\r
583 int lib_imuldiv(signed int a, signed int b, signed int c, int *r);\r
584 int lib_imod(signed int a, signed int b, int *q);\r
585 \r
586 #endif\r