1 /*
\83O
\83\89\83t
\83B
\83b
\83N
\8f\88\97\9d\8aÖ
\8cW */
5 void init_palette(void)
7 static unsigned char table_rgb[16 * 3] = {
8 0x00, 0x00, 0x00, /* 0:
\8d\95 */
9 0xff, 0x00, 0x00, /* 1:
\96¾
\82é
\82¢
\90Ô */
10 0x00, 0xff, 0x00, /* 2:
\96¾
\82é
\82¢
\97Î */
11 0xff, 0xff, 0x00, /* 3:
\96¾
\82é
\82¢
\89©
\90F */
12 0x00, 0x00, 0xff, /* 4:
\96¾
\82é
\82¢
\90Â */
13 0xff, 0x00, 0xff, /* 5:
\96¾
\82é
\82¢
\8e\87 */
14 0x00, 0xff, 0xff, /* 6:
\96¾
\82é
\82¢
\90\85\90F */
15 0xff, 0xff, 0xff, /* 7:
\94\92 */
16 0xc6, 0xc6, 0xc6, /* 8:
\96¾
\82é
\82¢
\8aD
\90F */
17 0x84, 0x00, 0x00, /* 9:
\88Ã
\82¢
\90Ô */
18 0x00, 0x84, 0x00, /* 10:
\88Ã
\82¢
\97Î */
19 0x84, 0x84, 0x00, /* 11:
\88Ã
\82¢
\89©
\90F */
20 0x00, 0x00, 0x84, /* 12:
\88Ã
\82¢
\90Â */
21 0x84, 0x00, 0x84, /* 13:
\88Ã
\82¢
\8e\87 */
22 0x00, 0x84, 0x84, /* 14:
\88Ã
\82¢
\90\85\90F */
23 0x84, 0x84, 0x84 /* 15:
\88Ã
\82¢
\8aD
\90F */
25 unsigned char table2[216 * 3];
27 set_palette(0, 15, table_rgb);
28 for (b = 0; b < 6; b++) {
29 for (g = 0; g < 6; g++) {
30 for (r = 0; r < 6; r++) {
31 table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
32 table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
33 table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
37 set_palette(16, 231, table2);
41 void set_palette(int start, int end, unsigned char *rgb)
44 eflags = io_load_eflags(); /*
\8a\84\82è
\8d\9e\82Ý
\8b\96\89Â
\83t
\83\89\83O
\82Ì
\92l
\82ð
\8bL
\98^
\82·
\82é */
45 io_cli(); /*
\8b\96\89Â
\83t
\83\89\83O
\82ð0
\82É
\82µ
\82Ä
\8a\84\82è
\8d\9e\82Ý
\8bÖ
\8e~
\82É
\82·
\82é */
46 io_out8(0x03c8, start);
47 for (i = start; i <= end; i++) {
48 io_out8(0x03c9, rgb[0] / 4);
49 io_out8(0x03c9, rgb[1] / 4);
50 io_out8(0x03c9, rgb[2] / 4);
53 io_store_eflags(eflags); /*
\8a\84\82è
\8d\9e\82Ý
\8b\96\89Â
\83t
\83\89\83O
\82ð
\8c³
\82É
\96ß
\82· */
57 void boxfill8(unsigned char *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1)
60 for (y = y0; y <= y1; y++) {
61 for (x = x0; x <= x1; x++)
62 vram[y * xsize + x] = c;
67 void init_screen8(char *vram, int x, int y)
69 boxfill8(vram, x, COL8_008484, 0, 0, x - 1, y - 29);
70 boxfill8(vram, x, COL8_C6C6C6, 0, y - 28, x - 1, y - 28);
71 boxfill8(vram, x, COL8_FFFFFF, 0, y - 27, x - 1, y - 27);
72 boxfill8(vram, x, COL8_C6C6C6, 0, y - 26, x - 1, y - 1);
74 boxfill8(vram, x, COL8_FFFFFF, 3, y - 24, 59, y - 24);
75 boxfill8(vram, x, COL8_FFFFFF, 2, y - 24, 2, y - 4);
76 boxfill8(vram, x, COL8_848484, 3, y - 4, 59, y - 4);
77 boxfill8(vram, x, COL8_848484, 59, y - 23, 59, y - 5);
78 boxfill8(vram, x, COL8_000000, 2, y - 3, 59, y - 3);
79 boxfill8(vram, x, COL8_000000, 60, y - 24, 60, y - 3);
81 boxfill8(vram, x, COL8_848484, x - 47, y - 24, x - 4, y - 24);
82 boxfill8(vram, x, COL8_848484, x - 47, y - 23, x - 47, y - 4);
83 boxfill8(vram, x, COL8_FFFFFF, x - 47, y - 3, x - 4, y - 3);
84 boxfill8(vram, x, COL8_FFFFFF, x - 3, y - 24, x - 3, y - 3);
88 void putfont8(char *vram, int xsize, int x, int y, char c, char *font)
91 char *p, d /* data */;
92 for (i = 0; i < 16; i++) {
93 p = vram + (y + i) * xsize + x;
95 if ((d & 0x80) != 0) { p[0] = c; }
96 if ((d & 0x40) != 0) { p[1] = c; }
97 if ((d & 0x20) != 0) { p[2] = c; }
98 if ((d & 0x10) != 0) { p[3] = c; }
99 if ((d & 0x08) != 0) { p[4] = c; }
100 if ((d & 0x04) != 0) { p[5] = c; }
101 if ((d & 0x02) != 0) { p[6] = c; }
102 if ((d & 0x01) != 0) { p[7] = c; }
107 void putfonts8_asc(char *vram, int xsize, int x, int y, char c, unsigned char *s)
109 extern char hankaku[4096];
110 struct TASK *task = task_now();
111 char *nihongo = (char *) *((int *) 0x0fe8), *font;
114 if (task->langmode == 0) {
115 for (; *s != 0x00; s++) {
116 putfont8(vram, xsize, x, y, c, hankaku + *s * 16);
120 if (task->langmode == 1) {
121 for (; *s != 0x00; s++) {
122 if (task->langbyte1 == 0) {
123 if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) {
124 task->langbyte1 = *s;
126 putfont8(vram, xsize, x, y, c, nihongo + *s * 16);
129 if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) {
130 k = (task->langbyte1 - 0x81) * 2;
132 k = (task->langbyte1 - 0xe0) * 2 + 62;
134 if (0x40 <= *s && *s <= 0x7e) {
136 } else if (0x80 <= *s && *s <= 0x9e) {
143 font = nihongo + 256 * 16 + (k * 94 + t) * 32;
144 putfont8(vram, xsize, x - 8, y, c, font ); /*
\8d¶
\94¼
\95ª */
145 putfont8(vram, xsize, x , y, c, font + 16); /*
\89E
\94¼
\95ª */
150 if (task->langmode == 2) {
151 for (; *s != 0x00; s++) {
152 if (task->langbyte1 == 0) {
153 if (0x81 <= *s && *s <= 0xfe) {
154 task->langbyte1 = *s;
156 putfont8(vram, xsize, x, y, c, nihongo + *s * 16);
159 k = task->langbyte1 - 0xa1;
162 font = nihongo + 256 * 16 + (k * 94 + t) * 32;
163 putfont8(vram, xsize, x - 8, y, c, font ); /*
\8d¶
\94¼
\95ª */
164 putfont8(vram, xsize, x , y, c, font + 16); /*
\89E
\94¼
\95ª */
172 void init_mouse_cursor8(char *mouse, char bc)
173 /*
\83}
\83E
\83X
\83J
\81[
\83\
\83\8b\82ð
\8f\80\94õ
\81i16x16
\81j */
175 static char cursor[16][16] = {
195 for (y = 0; y < 16; y++) {
196 for (x = 0; x < 16; x++) {
197 if (cursor[y][x] == '*') {
198 mouse[y * 16 + x] = COL8_000000;
200 if (cursor[y][x] == 'O') {
201 mouse[y * 16 + x] = COL8_FFFFFF;
203 if (cursor[y][x] == '.') {
204 mouse[y * 16 + x] = bc;
211 void putblock8_8(char *vram, int vxsize, int pxsize,
212 int pysize, int px0, int py0, char *buf, int bxsize)
215 for (y = 0; y < pysize; y++) {
216 for (x = 0; x < pxsize; x++) {
217 vram[(py0 + y) * vxsize + (px0 + x)] = buf[y * bxsize + x];