• R/O
  • SSH
  • HTTPS

haribote: Commit


Commit MetaInfo

Revision181 (tree)
Time2007-08-04 13:34:56
Authorbayside

Log Message

Initial Import

Change Summary

Incremental Difference

--- haribote/trunk/bayos_exp/keyboard.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/keyboard.cpp (revision 181)
@@ -0,0 +1,44 @@
1+/* キーボード関係 */
2+
3+#include "bootpack.h"
4+
5+Queue *keyfifo;
6+int keydata0;
7+
8+void inthandler21(int *esp)
9+{
10+ int data;
11+ io_out8(PIC0_OCW2, 0x61); /* IRQ-01受付完了をPICに通知 */
12+ data = io_in8(PORT_KEYDAT);
13+ Queue::push(keyfifo, data + keydata0);
14+ return;
15+}
16+
17+#define PORT_KEYSTA 0x0064
18+#define KEYSTA_SEND_NOTREADY 0x02
19+#define KEYCMD_WRITE_MODE 0x60
20+#define KBC_MODE 0x47
21+
22+void Keyboard::sendready(void)
23+{
24+ /* キーボードコントローラがデータ送信可能になるのを待つ */
25+ for (;;) {
26+ if ((io_in8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {
27+ break;
28+ }
29+ }
30+ return;
31+}
32+
33+void Keyboard::init(Queue *fifo, int data0)
34+{
35+ /* 書き込み先のFIFOバッファを記憶 */
36+ keyfifo = fifo;
37+ keydata0 = data0;
38+ /* キーボードコントローラの初期化 */
39+ Keyboard::sendready();
40+ io_out8(PORT_KEYCMD, KEYCMD_WRITE_MODE);
41+ Keyboard::sendready();
42+ io_out8(PORT_KEYDAT, KBC_MODE);
43+ return;
44+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/make.bat (nonexistent)
+++ haribote/trunk/bayos_exp/make.bat (revision 181)
@@ -0,0 +1 @@
1+..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
\ No newline at end of file
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/console.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/console.cpp (revision 181)
@@ -0,0 +1,709 @@
1+/* コンソール関係 */
2+
3+#include "bootpack.h"
4+#include <stdio.h>
5+#include <string.h>
6+
7+extern unsigned short table_8_565[256];
8+
9+void console_task(Sheet *sheet, int memtotal)
10+{
11+ Task *task = Task::now();
12+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
13+ int i, *fat = (int *) MemoryManager::allocate_4k(memman, 4 * 2880);
14+ Console cons;
15+ FileHandle fhandle[8];
16+ char cmdline[30];
17+ unsigned char *nihongo = (unsigned char *) *((int *) 0x0fe8);
18+
19+ cons.sht = sheet;
20+ cons.cur_x = 8;
21+ cons.cur_y = 28;
22+ cons.cur_c = -1;
23+ task->cons = &cons;
24+ task->cmdline = cmdline;
25+
26+ if (cons.sht != 0) {
27+ cons.timer = Timer::allocate();
28+ Timer::init(cons.timer, &task->fifo, 1);
29+ Timer::set_time(cons.timer, 50);
30+ }
31+ File::read_fat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200));
32+ for (i = 0; i < 8; i++) {
33+ fhandle[i].buf = 0; /* 未使用マーク */
34+ }
35+ task->fhandle = fhandle;
36+ task->fat = fat;
37+ if (nihongo[4096] != 0xff) { /* 日本語フォントファイルを読み込めたか? */
38+ task->langmode = 1;
39+ } else {
40+ task->langmode = 0;
41+ }
42+ task->langbyte1 = 0;
43+
44+ /* プロンプト表示 */
45+ Console::put_char(&cons, '>', 1);
46+
47+ for (;;) {
48+ io_cli();
49+ if (Queue::status(&task->fifo) == 0) {
50+ Task::sleep(task);
51+ io_sti();
52+ } else {
53+ i = Queue::pop(&task->fifo);
54+ io_sti();
55+ if (i <= 1 && cons.sht != 0) { /* カーソル用タイマ */
56+ if (i != 0) {
57+ Timer::init(cons.timer, &task->fifo, 0); /* 次は0を */
58+ if (cons.cur_c >= 0) {
59+ cons.cur_c = COL8_FFFFFF;
60+ }
61+ } else {
62+ Timer::init(cons.timer, &task->fifo, 1); /* 次は1を */
63+ if (cons.cur_c >= 0) {
64+ cons.cur_c = COL8_000000;
65+ }
66+ }
67+ Timer::set_time(cons.timer, 50);
68+ }
69+ if (i == 2) { /* カーソルON */
70+ cons.cur_c = COL8_FFFFFF;
71+ }
72+ if (i == 3) { /* カーソルOFF */
73+ if (cons.sht != 0) {
74+ Graphics::fill_rect(cons.sht->buf, cons.sht->bxsize, COL8_000000,
75+ cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
76+ }
77+ cons.cur_c = -1;
78+ }
79+ if (i == 4) { /* コンソールの「×」ボタンクリック */
80+ Console::command_exit(&cons, fat);
81+ }
82+ if (256 <= i && i <= 511) { /* キーボードデータ(タスクA経由) */
83+ if (i == 8 + 256) {
84+ /* バックスペース */
85+ if (cons.cur_x > 16) {
86+ /* カーソルをスペースで消してから、カーソルを1つ戻す */
87+ Console::put_char(&cons, ' ', 0);
88+ cons.cur_x -= 8;
89+ }
90+ } else if (i == 10 + 256) {
91+ /* Enter */
92+ /* カーソルをスペースで消してから改行する */
93+ Console::put_char(&cons, ' ', 0);
94+ cmdline[cons.cur_x / 8 - 2] = 0;
95+ Console::new_line(&cons);
96+ Console::run_command(cmdline, &cons, fat, memtotal); /* コマンド実行 */
97+ if (cons.sht == 0) {
98+ Console::command_exit(&cons, fat);
99+ }
100+ /* プロンプト表示 */
101+ Console::put_char(&cons, '>', 1);
102+ } else {
103+ /* 一般文字 */
104+ if (cons.cur_x < 240) {
105+ /* 一文字表示してから、カーソルを1つ進める */
106+ cmdline[cons.cur_x / 8 - 2] = i - 256;
107+ Console::put_char(&cons, i - 256, 1);
108+ }
109+ }
110+ }
111+ /* カーソル再表示 */
112+ if (cons.sht != 0) {
113+ if (cons.cur_c >= 0) {
114+ Graphics::fill_rect(cons.sht->buf, cons.sht->bxsize, cons.cur_c,
115+ cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
116+ }
117+ Sheet::refresh(cons.sht, cons.cur_x, cons.cur_y, cons.cur_x + 8, cons.cur_y + 16);
118+ }
119+ }
120+ }
121+}
122+
123+void Console::put_char(Console *cons, int chr, char move)
124+{
125+ char s[2];
126+ s[0] = chr;
127+ s[1] = 0;
128+ if (s[0] == 0x09) { /* タブ */
129+ for (;;) {
130+ if (cons->sht != 0) {
131+ Window::putfonts_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, " ", 1);
132+ }
133+ cons->cur_x += 8;
134+ if (cons->cur_x == 8 + 240) {
135+ Console::new_line(cons);
136+ }
137+ if (((cons->cur_x - 8) & 0x1f) == 0) {
138+ break; /* 32で割り切れたらbreak */
139+ }
140+ }
141+ } else if (s[0] == 0x0a) { /* 改行 */
142+ Console::new_line(cons);
143+ } else if (s[0] == 0x0d) { /* 復帰 */
144+ /* とりあえずなにもしない */
145+ } else { /* 普通の文字 */
146+ if (cons->sht != 0) {
147+ Window::putfonts_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1);
148+ }
149+ if (move != 0) {
150+ /* moveが0のときはカーソルを進めない */
151+ cons->cur_x += 8;
152+ if (cons->cur_x == 8 + 240) {
153+ Console::new_line(cons);
154+ }
155+ }
156+ }
157+ return;
158+}
159+
160+void Console::new_line(Console *cons)
161+{
162+ int x, y;
163+ Sheet *sheet = cons->sht;
164+ Task *task = Task::now();
165+ if (cons->cur_y < 28 + 112) {
166+ cons->cur_y += 16; /* 次の行へ */
167+ } else {
168+ /* スクロール */
169+ if (sheet != 0) {
170+ for (y = 28; y < 28 + 112; y++) {
171+ for (x = 8; x < 8 + 240; x++) {
172+ sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize];
173+ }
174+ }
175+ for (y = 28 + 112; y < 28 + 128; y++) {
176+ for (x = 8; x < 8 + 240; x++) {
177+ sheet->buf[x + y * sheet->bxsize] = COL8_000000;
178+ }
179+ }
180+ Sheet::refresh(sheet, 8, 28, 8 + 240, 28 + 128);
181+ }
182+ }
183+ cons->cur_x = 8;
184+ if (task->langmode == 1 && task->langbyte1 != 0) {
185+ cons->cur_x = 16;
186+ }
187+ return;
188+}
189+
190+void Console::put_str0(Console *cons, char *s)
191+{
192+ for (; *s != 0; s++) {
193+ Console::put_char(cons, *s, 1);
194+ }
195+ return;
196+}
197+
198+void Console::put_str1(Console *cons, char *s, int l)
199+{
200+ int i;
201+ for (i = 0; i < l; i++) {
202+ Console::put_char(cons, s[i], 1);
203+ }
204+ return;
205+}
206+
207+void Console::run_command(char *cmdline, Console *cons, int *fat, int memtotal)
208+{
209+ if (strcmp(cmdline, "mem") == 0 && cons->sht != 0) {
210+ Console::command_mem(cons, memtotal);
211+ } else if (strcmp(cmdline, "cls") == 0 && cons->sht != 0) {
212+ Console::command_cls(cons);
213+ } else if (strcmp(cmdline, "dir") == 0 && cons->sht != 0) {
214+ Console::command_dir(cons);
215+ } else if (strcmp(cmdline, "exit") == 0) {
216+ Console::command_exit(cons, fat);
217+ } else if (strncmp(cmdline, "start ", 6) == 0) {
218+ Console::command_start(cons, cmdline, memtotal);
219+ } else if (strncmp(cmdline, "ncst ", 5) == 0) {
220+ Console::command_ncst(cons, cmdline, memtotal);
221+ } else if (strncmp(cmdline, "langmode ", 9) == 0) {
222+ Console::command_langmode(cons, cmdline);
223+ } else if (cmdline[0] != 0) {
224+ if (Console::command_app(cons, fat, cmdline) == 0) {
225+ /* コマンドではなく、アプリでもなく、さらに空行でもない */
226+ Console::put_str0(cons, "Bad command.\n\n");
227+ }
228+ }
229+ return;
230+}
231+
232+void Console::command_mem(Console *cons, int memtotal)
233+{
234+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
235+ char s[60];
236+ sprintf(s, "total %dMB\nfree %dKB\n\n", memtotal / (1024 * 1024), MemoryManager::total(memman) / 1024);
237+ Console::put_str0(cons, s);
238+ return;
239+}
240+
241+void Console::command_cls(Console *cons)
242+{
243+ int x, y;
244+ Sheet *sheet = cons->sht;
245+ for (y = 28; y < 28 + 128; y++) {
246+ for (x = 8; x < 8 + 240; x++) {
247+ sheet->buf[x + y * sheet->bxsize] = COL8_000000;
248+ }
249+ }
250+ Sheet::refresh(sheet, 8, 28, 8 + 240, 28 + 128);
251+ cons->cur_y = 28;
252+ return;
253+}
254+
255+void Console::command_dir(Console *cons)
256+{
257+ FileInfo *finfo = (FileInfo *) (ADR_DISKIMG + 0x002600);
258+ int i, j;
259+ char s[30];
260+ for (i = 0; i < 224; i++) {
261+ if (finfo[i].name[0] == 0x00) {
262+ break;
263+ }
264+ if (finfo[i].name[0] != 0xe5) {
265+ if ((finfo[i].type & 0x18) == 0) {
266+ sprintf(s, "filename.ext %7d\n", finfo[i].size);
267+ for (j = 0; j < 8; j++) {
268+ s[j] = finfo[i].name[j];
269+ }
270+ s[ 9] = finfo[i].ext[0];
271+ s[10] = finfo[i].ext[1];
272+ s[11] = finfo[i].ext[2];
273+ Console::put_str0(cons, s);
274+ }
275+ }
276+ }
277+ Console::new_line(cons);
278+ return;
279+}
280+
281+void Console::command_exit(Console *cons, int *fat)
282+{
283+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
284+ Task *task = Task::now();
285+ SheetManager *shtctl = (SheetManager *) *((int *) 0x0fe4);
286+ Queue *fifo = (Queue *) *((int *) 0x0fec);
287+ if (cons->sht != 0) {
288+ Timer::cancel(cons->timer);
289+ }
290+ MemoryManager::deallocate_4k(memman, (int) fat, 4 * 2880);
291+ io_cli();
292+ if (cons->sht != 0) {
293+ Queue::push(fifo, cons->sht - shtctl->sheets0 + 768); /* 768〜1023 */
294+ } else {
295+ Queue::push(fifo, task - taskctl->tasks0 + 1024); /* 1024〜2023 */
296+ }
297+ io_sti();
298+ for (;;) {
299+ Task::sleep(task);
300+ }
301+}
302+
303+void Console::command_start(Console *cons, char *cmdline, int memtotal)
304+{
305+ SheetManager *shtctl = (SheetManager *) *((int *) 0x0fe4);
306+ Sheet *sht = open_console(shtctl, memtotal);
307+ Queue *fifo = &sht->task->fifo;
308+ int i;
309+ Sheet::slide(sht, 32, 4);
310+ Sheet::up_down(sht, shtctl->top);
311+ /* コマンドラインに入力された文字列を、一文字ずつ新しいコンソールに入力 */
312+ for (i = 6; cmdline[i] != 0; i++) {
313+ Queue::push(fifo, cmdline[i] + 256);
314+ }
315+ Queue::push(fifo, 10 + 256); /* Enter */
316+ Console::new_line(cons);
317+ return;
318+}
319+
320+void Console::command_ncst(Console *cons, char *cmdline, int memtotal)
321+{
322+ Task *task = open_constask(0, memtotal);
323+ Queue *fifo = &task->fifo;
324+ int i;
325+ /* コマンドラインに入力された文字列を、一文字ずつ新しいコンソールに入力 */
326+ for (i = 5; cmdline[i] != 0; i++) {
327+ Queue::push(fifo, cmdline[i] + 256);
328+ }
329+ Queue::push(fifo, 10 + 256); /* Enter */
330+ Console::new_line(cons);
331+ return;
332+}
333+
334+void Console::command_langmode(Console *cons, char *cmdline)
335+{
336+ Task *task = Task::now();
337+ unsigned char mode = cmdline[9] - '0';
338+ if (mode <= 2) {
339+ task->langmode = mode;
340+ } else {
341+ Console::put_str0(cons, "mode number error.\n");
342+ }
343+ Console::new_line(cons);
344+ return;
345+}
346+
347+int Console::command_app(Console *cons, int *fat, char *cmdline)
348+{
349+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
350+ FileInfo *finfo;
351+ char name[13], *q;
352+ unsigned char *p;
353+ Task *task = Task::now();
354+ int i, segsiz, datsiz, esp, dathrb, appsiz;
355+ SheetManager *shtctl;
356+ Sheet *sht;
357+
358+ /* コマンドラインからファイル名を生成 */
359+ for (i = 0; i < 8; i++) {
360+ if (cmdline[i] <= ' ') {
361+ break;
362+ }
363+ name[i] = cmdline[i];
364+ }
365+ name[i] = 0; /* とりあえずファイル名の後ろを0にする */
366+
367+ /* ファイルを探す */
368+ finfo = File::search(name, (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
369+ if (finfo == 0) {
370+ /* 見つからなかったので後ろに".HRB"をつけてもう一度探してみる */
371+ name[i ] = '.';
372+ name[i + 1] = 'H';
373+ name[i + 2] = 'R';
374+ name[i + 3] = 'B';
375+ name[i + 4] = 0;
376+ finfo = File::search(name, (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
377+ }
378+
379+ if (finfo != 0) {
380+ /* ファイルが見つかった場合 */
381+ appsiz = finfo->size;
382+ p = File::load_file2(finfo->clustno, &appsiz, fat);
383+ if (appsiz >= 36 && strncmp((char *) p + 4, "Hari", 4) == 0 && *p == 0x00) {
384+ segsiz = *((int *) (p + 0x0000));
385+ esp = *((int *) (p + 0x000c));
386+ datsiz = *((int *) (p + 0x0010));
387+ dathrb = *((int *) (p + 0x0014));
388+ q = (char *) MemoryManager::allocate_4k(memman, segsiz);
389+ task->ds_base = (int) q;
390+ SegmentDescriptor::set(task->ldt + 0, appsiz - 1, (int) p, AR_CODE32_ER + 0x60);
391+ SegmentDescriptor::set(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
392+ for (i = 0; i < datsiz; i++) {
393+ q[esp + i] = p[dathrb + i];
394+ }
395+ start_app(0x1b, 0 * 8 + 4, esp, 1 * 8 + 4, &(task->tss.esp0));
396+ shtctl = (SheetManager *) *((int *) 0x0fe4);
397+ for (i = 0; i < MAX_SHEETS; i++) {
398+ sht = &(shtctl->sheets0[i]);
399+ if ((sht->flags & 0x11) == 0x11 && sht->task == task) {
400+ /* アプリが開きっぱなしにした下じきを発見 */
401+ Sheet::deallocate(sht); /* 閉じる */
402+ }
403+ }
404+ for (i = 0; i < 8; i++) { /* クローズしてないファイルをクローズ */
405+ if (task->fhandle[i].buf != 0) {
406+ MemoryManager::deallocate(memman, (int) task->fhandle[i].buf, task->fhandle[i].size);
407+ task->fhandle[i].buf = 0;
408+ }
409+ }
410+ Timer::cancel_all(&task->fifo);
411+ MemoryManager::deallocate_4k(memman, (int) q, segsiz);
412+ task->langbyte1 = 0;
413+ } else {
414+ Console::put_str0(cons, ".hrb file format error.\n");
415+ }
416+ MemoryManager::deallocate_4k(memman, (int) p, appsiz);
417+ Console::new_line(cons);
418+ return 1;
419+ }
420+ /* ファイルが見つからなかった場合 */
421+ return 0;
422+}
423+
424+int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax)
425+{
426+ Task *task = Task::now();
427+ int ds_base = task->ds_base;
428+ Console *cons = task->cons;
429+ SheetManager *shtctl = (SheetManager *) *((int *) 0x0fe4);
430+ Sheet *sht;
431+ Queue *sys_fifo = (Queue *) *((int *) 0x0fec);
432+ int *reg = &eax + 1; /* eaxの次の番地 */
433+ /* 保存のためのPUSHADを強引に書き換える */
434+ /* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */
435+ /* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */
436+ int i;
437+ FileInfo *finfo;
438+ FileHandle *fh;
439+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
440+
441+ if (edx == 1) {
442+ Console::put_char(cons, eax & 0xff, 1);
443+ } else if (edx == 2) {
444+ Console::put_str0(cons, (char *) ebx + ds_base);
445+ } else if (edx == 3) {
446+ Console::put_str1(cons, (char *) ebx + ds_base, ecx);
447+ } else if (edx == 4) {
448+ return &(task->tss.esp0);
449+ } else if (edx == 5) {
450+ sht = Sheet::allocate(shtctl);
451+ sht->task = task;
452+ sht->flags |= 0x10;
453+ Sheet::set_buffer(sht, (unsigned short *) (ebx + ds_base), esi, edi, eax);
454+ Window::make_window((unsigned short *) (ebx + ds_base), esi, edi, (char *) ecx + ds_base, 0);
455+ Sheet::slide(sht, ((shtctl->xsize - esi) / 2) & ~3, (shtctl->ysize - edi) / 2);
456+ Sheet::up_down(sht, shtctl->top); /* 今のマウスと同じ高さになるように指定: マウスはこの上になる */
457+ reg[7] = (int) sht;
458+ } else if (edx == 6) {
459+ sht = (Sheet *) (ebx & 0xfffffffe);
460+ Graphics::draw_string(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base);
461+ if ((ebx & 1) == 0) {
462+ Sheet::refresh(sht, esi, edi, esi + ecx * 8, edi + 16);
463+ }
464+ } else if (edx == 7) {
465+ sht = (Sheet *) (ebx & 0xfffffffe);
466+ Graphics::fill_rect(sht->buf, sht->bxsize, ebp, eax, ecx, esi, edi);
467+ if ((ebx & 1) == 0) {
468+ Sheet::refresh(sht, eax, ecx, esi + 1, edi + 1);
469+ }
470+ } else if (edx == 8) {
471+ MemoryManager::init((MemoryManager *) (ebx + ds_base));
472+ ecx &= 0xfffffff0; /* 16バイト単位に */
473+ MemoryManager::deallocate((MemoryManager *) (ebx + ds_base), eax, ecx);
474+ } else if (edx == 9) {
475+ ecx = (ecx + 0x0f) & 0xfffffff0; /* 16バイト単位に切り上げ */
476+ reg[7] = MemoryManager::allocate((MemoryManager *) (ebx + ds_base), ecx);
477+ } else if (edx == 10) {
478+ ecx = (ecx + 0x0f) & 0xfffffff0; /* 16バイト単位に切り上げ */
479+ MemoryManager::deallocate((MemoryManager *) (ebx + ds_base), eax, ecx);
480+ } else if (edx == 11) {
481+ sht = (Sheet *) (ebx & 0xfffffffe);
482+ sht->buf[sht->bxsize * edi + esi] = table_8_565[eax];
483+ if ((ebx & 1) == 0) {
484+ Sheet::refresh(sht, esi, edi, esi + 1, edi + 1);
485+ }
486+ } else if (edx == 12) {
487+ sht = (Sheet *) ebx;
488+ Sheet::refresh(sht, eax, ecx, esi, edi);
489+ } else if (edx == 13) {
490+ sht = (Sheet *) (ebx & 0xfffffffe);
491+ Console::hrb_api_linewin(sht, eax, ecx, esi, edi, table_8_565[ebp]);
492+ if ((ebx & 1) == 0) {
493+ if (eax > esi) {
494+ i = eax;
495+ eax = esi;
496+ esi = i;
497+ }
498+ if (ecx > edi) {
499+ i = ecx;
500+ ecx = edi;
501+ edi = i;
502+ }
503+ Sheet::refresh(sht, eax, ecx, esi + 1, edi + 1);
504+ }
505+ } else if (edx == 14) {
506+ Sheet::deallocate((Sheet *) ebx);
507+ } else if (edx == 15) {
508+ for (;;) {
509+ io_cli();
510+ if (Queue::status(&task->fifo) == 0) {
511+ if (eax != 0) {
512+ Task::sleep(task); /* FIFOが空なので寝て待つ */
513+ } else {
514+ io_sti();
515+ reg[7] = -1;
516+ return 0;
517+ }
518+ }
519+ i = Queue::pop(&task->fifo);
520+ io_sti();
521+ if (i <= 1 && cons->sht != 0) { /* カーソル用タイマ */
522+ /* アプリ実行中はカーソルが出ないので、いつも次は表示用の1を注文しておく */
523+ Timer::init(cons->timer, &task->fifo, 1); /* 次は1を */
524+ Timer::set_time(cons->timer, 50);
525+ }
526+ if (i == 2) { /* カーソルON */
527+ cons->cur_c = COL8_FFFFFF;
528+ }
529+ if (i == 3) { /* カーソルOFF */
530+ cons->cur_c = -1;
531+ }
532+ if (i == 4) { /* コンソールだけを閉じる */
533+ Timer::cancel(cons->timer);
534+ io_cli();
535+ Queue::push(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /* 2024〜2279 */
536+ cons->sht = 0;
537+ io_sti();
538+ }
539+ if (i >= 256) { /* キーボードデータ(タスクA経由)など */
540+ reg[7] = i - 256;
541+ return 0;
542+ }
543+ }
544+ } else if (edx == 16) {
545+ reg[7] = (int) Timer::allocate();
546+ ((Timer *) reg[7])->flags2 = 1; /* 自動キャンセル有効 */
547+ } else if (edx == 17) {
548+ Timer::init((Timer *) ebx, &task->fifo, eax + 256);
549+ } else if (edx == 18) {
550+ Timer::set_time((Timer *) ebx, eax);
551+ } else if (edx == 19) {
552+ Timer::deallocate((Timer *) ebx);
553+ } else if (edx == 20) {
554+ if (eax == 0) {
555+ i = io_in8(0x61);
556+ io_out8(0x61, i & 0x0d);
557+ } else {
558+ i = 1193180000 / eax;
559+ io_out8(0x43, 0xb6);
560+ io_out8(0x42, i & 0xff);
561+ io_out8(0x42, i >> 8);
562+ i = io_in8(0x61);
563+ io_out8(0x61, (i | 0x03) & 0x0f);
564+ }
565+ } else if (edx == 21) {
566+ for (i = 0; i < 8; i++) {
567+ if (task->fhandle[i].buf == 0) {
568+ break;
569+ }
570+ }
571+ fh = &task->fhandle[i];
572+ reg[7] = 0;
573+ if (i < 8) {
574+ finfo = File::search((char *) ebx + ds_base,
575+ (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
576+ if (finfo != 0) {
577+ reg[7] = (int) fh;
578+ fh->size = finfo->size;
579+ fh->pos = 0;
580+ fh->buf = File::load_file2(finfo->clustno, &fh->size, task->fat);
581+ }
582+ }
583+ } else if (edx == 22) {
584+ fh = (FileHandle *) eax;
585+ MemoryManager::deallocate(memman, (int) fh->buf, fh->size);
586+ fh->buf = 0;
587+ } else if (edx == 23) {
588+ fh = (FileHandle *) eax;
589+ if (ecx == 0) {
590+ fh->pos = ebx;
591+ } else if (ecx == 1) {
592+ fh->pos += ebx;
593+ } else if (ecx == 2) {
594+ fh->pos = fh->size + ebx;
595+ }
596+ if (fh->pos < 0) {
597+ fh->pos = 0;
598+ }
599+ if (fh->pos > fh->size) {
600+ fh->pos = fh->size;
601+ }
602+ } else if (edx == 24) {
603+ fh = (FileHandle *) eax;
604+ if (ecx == 0) {
605+ reg[7] = fh->size;
606+ } else if (ecx == 1) {
607+ reg[7] = fh->pos;
608+ } else if (ecx == 2) {
609+ reg[7] = fh->pos - fh->size;
610+ }
611+ } else if (edx == 25) {
612+ fh = (FileHandle *) eax;
613+ for (i = 0; i < ecx; i++) {
614+ if (fh->pos == fh->size) {
615+ break;
616+ }
617+ *((char *) ebx + ds_base + i) = fh->buf[fh->pos];
618+ fh->pos++;
619+ }
620+ reg[7] = i;
621+ } else if (edx == 26) {
622+ i = 0;
623+ for (;;) {
624+ *((char *) ebx + ds_base + i) = task->cmdline[i];
625+ if (task->cmdline[i] == 0) {
626+ break;
627+ }
628+ if (i >= ecx) {
629+ break;
630+ }
631+ i++;
632+ }
633+ reg[7] = i;
634+ } else if (edx == 27) {
635+ reg[7] = task->langmode;
636+ }
637+ return 0;
638+}
639+
640+int *inthandler0c(int *esp)
641+{
642+ Task *task = Task::now();
643+ Console *cons = task->cons;
644+ char s[30];
645+ Console::put_str0(cons, "\nINT 0C :\n Stack Exception.\n");
646+ sprintf(s, "EIP = %08X\n", esp[11]);
647+ Console::put_str0(cons, s);
648+ return &(task->tss.esp0); /* 異常終了させる */
649+}
650+
651+int *inthandler0d(int *esp)
652+{
653+ Task *task = Task::now();
654+ Console *cons = task->cons;
655+ char s[30];
656+ Console::put_str0(cons, "\nINT 0D :\n General Protected Exception.\n");
657+ sprintf(s, "EIP = %08X\n", esp[11]);
658+ Console::put_str0(cons, s);
659+ return &(task->tss.esp0); /* 異常終了させる */
660+}
661+
662+void Console::hrb_api_linewin(Sheet *sht, int x0, int y0, int x1, int y1, int col)
663+{
664+ int i, x, y, len, dx, dy;
665+
666+ dx = x1 - x0;
667+ dy = y1 - y0;
668+ x = x0 << 10;
669+ y = y0 << 10;
670+ if (dx < 0) {
671+ dx = - dx;
672+ }
673+ if (dy < 0) {
674+ dy = - dy;
675+ }
676+ if (dx >= dy) {
677+ len = dx + 1;
678+ if (x0 > x1) {
679+ dx = -1024;
680+ } else {
681+ dx = 1024;
682+ }
683+ if (y0 <= y1) {
684+ dy = ((y1 - y0 + 1) << 10) / len;
685+ } else {
686+ dy = ((y1 - y0 - 1) << 10) / len;
687+ }
688+ } else {
689+ len = dy + 1;
690+ if (y0 > y1) {
691+ dy = -1024;
692+ } else {
693+ dy = 1024;
694+ }
695+ if (x0 <= x1) {
696+ dx = ((x1 - x0 + 1) << 10) / len;
697+ } else {
698+ dx = ((x1 - x0 - 1) << 10) / len;
699+ }
700+ }
701+
702+ for (i = 0; i < len; i++) {
703+ sht->buf[(y >> 10) * sht->bxsize + (x >> 10)] = col;
704+ x += dx;
705+ y += dy;
706+ }
707+
708+ return;
709+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/bootpack.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/bootpack.cpp (revision 181)
@@ -0,0 +1,421 @@
1+/* bootpackのメイン */
2+
3+#include "bootpack.h"
4+#include <stdio.h>
5+
6+#define KEYCMD_LED 0xed
7+
8+void keywin_off(Sheet *key_win);
9+void keywin_on(Sheet *key_win);
10+void close_console(Sheet *sht);
11+void close_constask(Task *task);
12+
13+void HariMain(void)
14+{
15+ SystemInfo *sysinfo = SystemInfo::get_instance();
16+ SheetManager *shtctl;
17+ char s[40];
18+ Queue fifo, keycmd;
19+ int fifobuf[128], keycmd_buf[32];
20+ int mx, my, i, new_mx = -1, new_my = 0, new_wx = 0x7fffffff, new_wy = 0;
21+ unsigned int memtotal;
22+ Mouse mdec;
23+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
24+ unsigned short *buf_back, buf_mouse[256];
25+ Sheet *sht_back, *sht_mouse;
26+ Task *task_a, *task;
27+ static char keytable0[0x80] = {
28+ 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0x08, 0,
29+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0x0a, 0, 'A', 'S',
30+ 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0, 0, ']', 'Z', 'X', 'C', 'V',
31+ 'B', 'N', 'M', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0,
32+ 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1',
33+ '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
34+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35+ 0, 0, 0, 0x5c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x5c, 0, 0
36+ };
37+ static char keytable1[0x80] = {
38+ 0, 0, '!', 0x22, '#', '$', '%', '&', 0x27, '(', ')', '~', '=', '~', 0x08, 0,
39+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', 0x0a, 0, 'A', 'S',
40+ 'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0, 0, '}', 'Z', 'X', 'C', 'V',
41+ 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0,
42+ 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1',
43+ '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45+ 0, 0, 0, '_', 0, 0, 0, 0, 0, 0, 0, 0, 0, '|', 0, 0
46+ };
47+ int key_shift = 0, key_leds = (sysinfo->leds >> 4) & 7, keycmd_wait = -1;
48+ int j, x, y, mmx = -1, mmy = -1, mmx2 = 0;
49+ Sheet *sht = 0, *key_win, *sht2;
50+ int *fat;
51+ unsigned char *nihongo;
52+ FileInfo *finfo;
53+ extern char hankaku[4096];
54+
55+ Descriptor::init();
56+ PIC::init();
57+ io_sti(); /* IDT/PICの初期化が終わったのでCPUの割り込み禁止を解除 */
58+ Queue::init(&fifo, 128, fifobuf, 0);
59+ *((int *) 0x0fec) = (int) &fifo;
60+ PIT::init();
61+ Keyboard::init(&fifo, 256);
62+ Mouse::init(&fifo, 512, &mdec);
63+ io_out8(PIC0_IMR, 0xf8); /* PITとPIC1とキーボードを許可(11111000) */
64+ io_out8(PIC1_IMR, 0xef); /* マウスを許可(11101111) */
65+ Queue::init(&keycmd, 32, keycmd_buf, 0);
66+
67+ memtotal = MemoryManager::test(0x00400000, 0xbfffffff);
68+ MemoryManager::init(memman);
69+ MemoryManager::deallocate(memman, 0x00001000, 0x0009e000); /* 0x00001000 - 0x0009efff */
70+ MemoryManager::deallocate(memman, 0x00400000, memtotal - 0x00400000);
71+
72+ TimerManager::init();
73+ Palette::init();
74+ shtctl = SheetManager::init(memman, sysinfo->vram, sysinfo->scrnx, sysinfo->scrny);
75+ task_a = Task::init(memman);
76+ fifo.task = task_a;
77+ Task::run(task_a, 1, 2);
78+ *((int *) 0x0fe4) = (int) shtctl;
79+ task_a->langmode = 0;
80+
81+ /* fat */
82+ fat = (int *) MemoryManager::allocate_4k(memman, 4 * 2880);
83+ File::read_fat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200));
84+
85+ /* sht_back */
86+ sht_back = Sheet::allocate(shtctl);
87+ buf_back = (unsigned short *) MemoryManager::allocate_4k(memman, sysinfo->scrnx * sysinfo->scrny * 2);
88+ Sheet::set_buffer(sht_back, buf_back, sysinfo->scrnx, sysinfo->scrny, -1); /* 透明色なし */
89+ Graphics::init(fat, buf_back, sysinfo->scrnx, sysinfo->scrny);
90+
91+ /* sht_cons */
92+ key_win = open_console(shtctl, memtotal);
93+
94+ /* sht_mouse */
95+ sht_mouse = Sheet::allocate(shtctl);
96+ Sheet::set_buffer(sht_mouse, buf_mouse, 16, 16, 99);
97+ MouseCursor::init(buf_mouse, 99);
98+ mx = (sysinfo->scrnx - 16) / 2; /* 画面中央になるように座標計算 */
99+ my = (sysinfo->scrny - 28 - 16) / 2;
100+
101+ Sheet::slide(sht_back, 0, 0);
102+ Sheet::slide(key_win, 32, 4);
103+ Sheet::slide(sht_mouse, mx, my);
104+ Sheet::up_down(sht_back, 0);
105+ Sheet::up_down(key_win, 1);
106+ Sheet::up_down(sht_mouse, 2);
107+ keywin_on(key_win);
108+
109+ /* 最初にキーボード状態との食い違いがないように、設定しておくことにする */
110+ Queue::push(&keycmd, KEYCMD_LED);
111+ Queue::push(&keycmd, key_leds);
112+
113+ /* nihongo.fntの読み込み */
114+ finfo = File::search("nihongo.fnt", (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
115+ if (finfo != 0) {
116+ i = finfo->size;
117+ nihongo = File::load_file2(finfo->clustno, &i, fat);
118+ } else {
119+ nihongo = (unsigned char *) MemoryManager::allocate_4k(memman, 16 * 256 + 32 * 94 * 47);
120+ for (i = 0; i < 16 * 256; i++) {
121+ nihongo[i] = hankaku[i]; /* フォントがなかったので半角部分をコピー */
122+ }
123+ for (i = 16 * 256; i < 16 * 256 + 32 * 94 * 47; i++) {
124+ nihongo[i] = 0xff; /* フォントがなかったので全角部分を0xffで埋め尽くす */
125+ }
126+ }
127+ *((int *) 0x0fe8) = (int) nihongo;
128+ MemoryManager::deallocate_4k(memman, (int) fat, 4 * 2880);
129+
130+ for (;;) {
131+ if (Queue::status(&keycmd) > 0 && keycmd_wait < 0) {
132+ /* キーボードコントローラに送るデータがあれば、送る */
133+ keycmd_wait = Queue::pop(&keycmd);
134+ Keyboard::sendready();
135+ io_out8(PORT_KEYDAT, keycmd_wait);
136+ }
137+ io_cli();
138+ if (Queue::status(&fifo) == 0) {
139+ /* FIFOがからっぽになったので、保留している描画があれば実行する */
140+ if (new_mx >= 0) {
141+ io_sti();
142+ Sheet::slide(sht_mouse, new_mx, new_my);
143+ new_mx = -1;
144+ } else if (new_wx != 0x7fffffff) {
145+ io_sti();
146+ Sheet::slide(sht, new_wx, new_wy);
147+ new_wx = 0x7fffffff;
148+ } else {
149+ Task::sleep(task_a);
150+ io_sti();
151+ }
152+ } else {
153+ i = Queue::pop(&fifo);
154+ io_sti();
155+ if (key_win != 0 && key_win->flags == 0) { /* ウィンドウが閉じられた */
156+ if (shtctl->top == 1) { /* もうマウスと背景しかない */
157+ key_win = 0;
158+ } else {
159+ key_win = shtctl->sheets[shtctl->top - 1];
160+ keywin_on(key_win);
161+ }
162+ }
163+ if (256 <= i && i <= 511) { /* キーボードデータ */
164+ if (i < 0x80 + 256) { /* キーコードを文字コードに変換 */
165+ if (key_shift == 0) {
166+ s[0] = keytable0[i - 256];
167+ } else {
168+ s[0] = keytable1[i - 256];
169+ }
170+ } else {
171+ s[0] = 0;
172+ }
173+ if ('A' <= s[0] && s[0] <= 'Z') { /* 入力文字がアルファベット */
174+ if (((key_leds & 4) == 0 && key_shift == 0) ||
175+ ((key_leds & 4) != 0 && key_shift != 0)) {
176+ s[0] += 0x20; /* 大文字を小文字に変換 */
177+ }
178+ }
179+ if (s[0] != 0 && key_win != 0) { /* 通常文字、バックスペース、Enter */
180+ Queue::push(&key_win->task->fifo, s[0] + 256);
181+ }
182+ if (i == 256 + 0x0f && key_win != 0) { /* Tab */
183+ keywin_off(key_win);
184+ j = key_win->height - 1;
185+ if (j == 0) {
186+ j = shtctl->top - 1;
187+ }
188+ key_win = shtctl->sheets[j];
189+ keywin_on(key_win);
190+ }
191+ if (i == 256 + 0x2a) { /* 左シフト ON */
192+ key_shift |= 1;
193+ }
194+ if (i == 256 + 0x36) { /* 右シフト ON */
195+ key_shift |= 2;
196+ }
197+ if (i == 256 + 0xaa) { /* 左シフト OFF */
198+ key_shift &= ~1;
199+ }
200+ if (i == 256 + 0xb6) { /* 右シフト OFF */
201+ key_shift &= ~2;
202+ }
203+ if (i == 256 + 0x3a) { /* CapsLock */
204+ key_leds ^= 4;
205+ Queue::push(&keycmd, KEYCMD_LED);
206+ Queue::push(&keycmd, key_leds);
207+ }
208+ if (i == 256 + 0x45) { /* NumLock */
209+ key_leds ^= 2;
210+ Queue::push(&keycmd, KEYCMD_LED);
211+ Queue::push(&keycmd, key_leds);
212+ }
213+ if (i == 256 + 0x46) { /* ScrollLock */
214+ key_leds ^= 1;
215+ Queue::push(&keycmd, KEYCMD_LED);
216+ Queue::push(&keycmd, key_leds);
217+ }
218+ if (i == 256 + 0x3b && key_shift != 0 && key_win != 0) { /* Shift+F1 */
219+ task = key_win->task;
220+ if (task != 0 && task->tss.ss0 != 0) {
221+ Console::put_str0(task->cons, "\nBreak(key) :\n");
222+ io_cli(); /* 強制終了処理中にタスクが変わると困るから */
223+ task->tss.eax = (int) &(task->tss.esp0);
224+ task->tss.eip = (int) asm_end_app;
225+ io_sti();
226+ Task::run(task, -1, 0); /* 終了処理を確実にやらせるために、寝ていたら起こす */
227+ }
228+ }
229+ if (i == 256 + 0x3c && key_shift != 0) { /* Shift+F2 */
230+ /* 新しく作ったコンソールを入力選択状態にする(そのほうが親切だよね?) */
231+ if (key_win != 0) {
232+ keywin_off(key_win);
233+ }
234+ key_win = open_console(shtctl, memtotal);
235+ Sheet::slide(key_win, 32, 4);
236+ Sheet::up_down(key_win, shtctl->top);
237+ keywin_on(key_win);
238+ }
239+ if (i == 256 + 0x57) { /* F11 */
240+ Sheet::up_down(shtctl->sheets[1], shtctl->top - 1);
241+ }
242+ if (i == 256 + 0xfa) { /* キーボードがデータを無事に受け取った */
243+ keycmd_wait = -1;
244+ }
245+ if (i == 256 + 0xfe) { /* キーボードがデータを無事に受け取れなかった */
246+ Keyboard::sendready();
247+ io_out8(PORT_KEYDAT, keycmd_wait);
248+ }
249+ } else if (512 <= i && i <= 767) { /* マウスデータ */
250+ if (Mouse::decode(&mdec, i - 512) != 0) {
251+ /* マウスカーソルの移動 */
252+ mx += mdec.x;
253+ my += mdec.y;
254+ if (mx < 0) {
255+ mx = 0;
256+ }
257+ if (my < 0) {
258+ my = 0;
259+ }
260+ if (mx > sysinfo->scrnx - 1) {
261+ mx = sysinfo->scrnx - 1;
262+ }
263+ if (my > sysinfo->scrny - 1) {
264+ my = sysinfo->scrny - 1;
265+ }
266+ new_mx = mx;
267+ new_my = my;
268+ if ((mdec.btn & 0x01) != 0) {
269+ /* 左ボタンを押している */
270+ if (mmx < 0) {
271+ /* 通常モードの場合 */
272+ /* 上の下じきから順番にマウスが指している下じきを探す */
273+ for (j = shtctl->top - 1; j > 0; j--) {
274+ sht = shtctl->sheets[j];
275+ x = mx - sht->vx0;
276+ y = my - sht->vy0;
277+ if (0 <= x && x < sht->bxsize && 0 <= y && y < sht->bysize) {
278+ if (sht->buf[y * sht->bxsize + x] != sht->col_inv) {
279+ Sheet::up_down(sht, shtctl->top - 1);
280+ if (sht != key_win) {
281+ keywin_off(key_win);
282+ key_win = sht;
283+ keywin_on(key_win);
284+ }
285+ if (3 <= x && x < sht->bxsize - 3 && 3 <= y && y < 21) {
286+ mmx = mx; /* ウィンドウ移動モードへ */
287+ mmy = my;
288+ mmx2 = sht->vx0;
289+ new_wy = sht->vy0;
290+ }
291+ if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <= y && y < 19) {
292+ /* 「×」ボタンクリック */
293+ if ((sht->flags & 0x10) != 0) { /* アプリが作ったウィンドウか? */
294+ task = sht->task;
295+ Console::put_str0(task->cons, "\nBreak(mouse) :\n");
296+ io_cli(); /* 強制終了処理中にタスクが変わると困るから */
297+ task->tss.eax = (int) &(task->tss.esp0);
298+ task->tss.eip = (int) asm_end_app;
299+ io_sti();
300+ Task::run(task, -1, 0);
301+ } else { /* コンソール */
302+ task = sht->task;
303+ Sheet::up_down(sht, -1); /* とりあえず非表示にしておく */
304+ keywin_off(key_win);
305+ key_win = shtctl->sheets[shtctl->top - 1];
306+ keywin_on(key_win);
307+ io_cli();
308+ Queue::push(&task->fifo, 4);
309+ io_sti();
310+ }
311+ }
312+ break;
313+ }
314+ }
315+ }
316+ } else {
317+ /* ウィンドウ移動モードの場合 */
318+ x = mx - mmx; /* マウスの移動量を計算 */
319+ y = my - mmy;
320+ new_wx = (mmx2 + x + 2) & ~3;
321+ new_wy = new_wy + y;
322+ mmy = my; /* 移動後の座標に更新 */
323+ }
324+ } else {
325+ /* 左ボタンを押していない */
326+ mmx = -1; /* 通常モードへ */
327+ if (new_wx != 0x7fffffff) {
328+ Sheet::slide(sht, new_wx, new_wy); /* 一度確定させる */
329+ new_wx = 0x7fffffff;
330+ }
331+ }
332+ }
333+ } else if (768 <= i && i <= 1023) { /* コンソール終了処理 */
334+ close_console(shtctl->sheets0 + (i - 768));
335+ } else if (1024 <= i && i <= 2023) {
336+ close_constask(taskctl->tasks0 + (i - 1024));
337+ } else if (2024 <= i && i <= 2279) { /* コンソールだけを閉じる */
338+ sht2 = shtctl->sheets0 + (i - 2024);
339+ MemoryManager::deallocate_4k(memman, (int) sht2->buf, 256 * 165);
340+ Sheet::deallocate(sht2);
341+ }
342+ }
343+ }
344+}
345+
346+void keywin_off(Sheet *key_win)
347+{
348+ Window::change_wtitle(key_win, 0);
349+ if ((key_win->flags & 0x20) != 0) {
350+ Queue::push(&key_win->task->fifo, 3); /* コンソールのカーソルOFF */
351+ }
352+ return;
353+}
354+
355+void keywin_on(Sheet *key_win)
356+{
357+ Window::change_wtitle(key_win, 1);
358+ if ((key_win->flags & 0x20) != 0) {
359+ Queue::push(&key_win->task->fifo, 2); /* コンソールのカーソルON */
360+ }
361+ return;
362+}
363+
364+Task *open_constask(Sheet *sht, unsigned int memtotal)
365+{
366+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
367+ Task *task = Task::allocate();
368+ int *cons_fifo = (int *) MemoryManager::allocate_4k(memman, 128 * 4);
369+ task->cons_stack = MemoryManager::allocate_4k(memman, 64 * 1024);
370+ task->tss.esp = task->cons_stack + 64 * 1024 - 12;
371+ task->tss.eip = (int) &console_task;
372+ task->tss.es = 1 * 8;
373+ task->tss.cs = 2 * 8;
374+ task->tss.ss = 1 * 8;
375+ task->tss.ds = 1 * 8;
376+ task->tss.fs = 1 * 8;
377+ task->tss.gs = 1 * 8;
378+ *((int *) (task->tss.esp + 4)) = (int) sht;
379+ *((int *) (task->tss.esp + 8)) = memtotal;
380+ Task::run(task, 2, 2); /* level=2, priority=2 */
381+ Queue::init(&task->fifo, 128, cons_fifo, task);
382+ return task;
383+}
384+
385+Sheet *open_console(SheetManager *shtctl, unsigned int memtotal)
386+{
387+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
388+ Sheet *sht = Sheet::allocate(shtctl);
389+ unsigned short *buf = (unsigned short *) MemoryManager::allocate_4k(memman, 256 * 165 * 2);
390+ Sheet::set_buffer(sht, buf, 256, 165, -1); /* 透明色なし */
391+ Window::make_window(buf, 256, 165, "console", 0);
392+ Window::make_textbox(sht, 8, 28, 240, 128, COL8_000000);
393+ sht->task = open_constask(sht, memtotal);
394+ sht->flags |= 0x20; /* カーソルあり */
395+ return sht;
396+}
397+
398+void close_constask(Task *task)
399+{
400+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
401+ Task::sleep(task);
402+ MemoryManager::deallocate_4k(memman, task->cons_stack, 64 * 1024);
403+ MemoryManager::deallocate_4k(memman, (int) task->fifo.buf, 128 * 4);
404+ io_cli();
405+ task->flags = 0; /* task_free(task); の代わり */
406+ if (taskctl->task_fpu == task) {
407+ taskctl->task_fpu = 0;
408+ }
409+ io_sti();
410+ return;
411+}
412+
413+void close_console(Sheet *sht)
414+{
415+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
416+ Task *task = sht->task;
417+ MemoryManager::deallocate_4k(memman, (int) sht->buf, 256 * 165);
418+ Sheet::deallocate(sht);
419+ close_constask(task);
420+ return;
421+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/bootpack.h (nonexistent)
+++ haribote/trunk/bayos_exp/bootpack.h (revision 181)
@@ -0,0 +1,490 @@
1+#if (defined(__cplusplus))
2+extern "C" {
3+#endif
4+
5+/* asmhead.nas */
6+
7+#define ADR_SYSTEMINFO 0x00000ff0
8+#define ADR_DISKIMG 0x00100000
9+
10+/* naskfunc.nas */
11+
12+void io_hlt(void);
13+void io_cli(void);
14+void io_sti(void);
15+void io_stihlt(void);
16+int io_in8(int port);
17+void io_out8(int port, int data);
18+int io_load_eflags(void);
19+void io_store_eflags(int eflags);
20+void load_gdtr(int limit, int addr);
21+void load_idtr(int limit, int addr);
22+int load_cr0(void);
23+void store_cr0(int cr0);
24+void load_tr(int tr);
25+void clts(void);
26+void fnsave(int *addr);
27+void frstor(int *addr);
28+void asm_inthandler07(void);
29+void asm_inthandler0c(void);
30+void asm_inthandler0d(void);
31+void asm_inthandler20(void);
32+void asm_inthandler21(void);
33+void asm_inthandler27(void);
34+void asm_inthandler2c(void);
35+unsigned int memtest_sub(unsigned int start, unsigned int end);
36+void farjmp(int eip, int cs);
37+void farcall(int eip, int cs);
38+void asm_hrb_api(void);
39+void start_app(int eip, int cs, int esp, int ds, int *tss_esp0);
40+void asm_end_app(void);
41+
42+/* fifo.c */
43+
44+/* graphic.c */
45+
46+#define COL8_000000 0
47+#define COL8_FF0000 1
48+#define COL8_00FF00 2
49+#define COL8_FFFF00 3
50+#define COL8_0000FF 4
51+#define COL8_FF00FF 5
52+#define COL8_00FFFF 6
53+#define COL8_FFFFFF 7
54+#define COL8_C6C6C6 8
55+#define COL8_840000 9
56+#define COL8_008400 10
57+#define COL8_848400 11
58+#define COL8_000084 12
59+#define COL8_840084 13
60+#define COL8_008484 14
61+#define COL8_848484 15
62+
63+/* dsctbl.c */
64+
65+#define ADR_IDT 0x0026f800
66+#define LIMIT_IDT 0x000007ff
67+#define ADR_GDT 0x00270000
68+#define LIMIT_GDT 0x0000ffff
69+#define ADR_BOTPAK 0x00280000
70+#define LIMIT_BOTPAK 0x0007ffff
71+#define AR_DATA32_RW 0x4092
72+#define AR_CODE32_ER 0x409a
73+#define AR_LDT 0x0082
74+#define AR_TSS32 0x0089
75+#define AR_INTGATE32 0x008e
76+
77+/* int.c */
78+
79+void inthandler27(int *esp);
80+
81+#define PIC0_ICW1 0x0020
82+#define PIC0_OCW2 0x0020
83+#define PIC0_IMR 0x0021
84+#define PIC0_ICW2 0x0021
85+#define PIC0_ICW3 0x0021
86+#define PIC0_ICW4 0x0021
87+#define PIC1_ICW1 0x00a0
88+#define PIC1_OCW2 0x00a0
89+#define PIC1_IMR 0x00a1
90+#define PIC1_ICW2 0x00a1
91+#define PIC1_ICW3 0x00a1
92+#define PIC1_ICW4 0x00a1
93+
94+/* keyboard.c */
95+
96+void inthandler21(int *esp);
97+
98+#define PORT_KEYDAT 0x0060
99+#define PORT_KEYCMD 0x0064
100+
101+/* mouse.c */
102+
103+void inthandler2c(int *esp);
104+
105+/* memory.c */
106+
107+#define MEMMAN_FREES 4090 /* これで約32KB */
108+#define MEMMAN_ADDR 0x003c0000
109+
110+/* sheet.c */
111+
112+#define MAX_SHEETS 256
113+
114+/* timer.c */
115+
116+#define MAX_TIMER 500
117+
118+void inthandler20(int *esp);
119+
120+/* mtask.c */
121+
122+#define MAX_TASKS 1000 /* 最大タスク数 */
123+#define TASK_GDT0 3 /* TSSをGDTの何番から割り当てるのか */
124+#define MAX_TASKS_LV 100
125+#define MAX_TASKLEVELS 10
126+
127+int *inthandler07(int *esp);
128+
129+/* window.c */
130+
131+/* console.c */
132+
133+int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax);
134+int *inthandler0d(int *esp);
135+int *inthandler0c(int *esp);
136+
137+/* file.c */
138+
139+/* tek.c */
140+
141+int tek_getsize(unsigned char *p);
142+int tek_decomp(unsigned char *p, unsigned char *q, int size);
143+
144+/* jpeg.c */
145+
146+struct DLL_STRPICENV { /* 64KB */
147+ int work[64 * 1024 / 4];
148+};
149+struct RGB {
150+ unsigned char b, g, r, t;
151+};
152+int info_JPEG(struct DLL_STRPICENV *env, int *info, int size, unsigned char *fp);
153+int decode0_JPEG(struct DLL_STRPICENV *env, int size, unsigned char *fp, int b_type, unsigned char *buf, int skip);
154+
155+/* bootpack.c */
156+
157+void HariMain(void);
158+
159+#if (defined(__cplusplus))
160+}
161+#endif
162+
163+/* asmhead.nas */
164+
165+class SystemInfo { /* 0x0ff0-0x0fff */
166+public:
167+ char cyls; /* ブートセクタはどこまでディスクを読んだのか */
168+ char leds; /* ブート時のキーボードのLEDの状態 */
169+ char vmode; /* ビデオモード 何ビットカラーか */
170+ char reserve;
171+ short scrnx, scrny; /* 画面解像度 */
172+ unsigned char *vram;
173+
174+public:
175+ static SystemInfo *get_instance(void) {
176+ SystemInfo *sysinfo = (SystemInfo *) ADR_SYSTEMINFO;
177+ return sysinfo;
178+ }
179+};
180+
181+/* fifo.cpp */
182+
183+class Task;
184+class Queue {
185+public:
186+ int *buf;
187+ int p, q, size, free, flags;
188+ Task *task;
189+
190+public:
191+ static void init(Queue *fifo, int size, int *buf, Task *task);
192+ static int push(Queue *fifo, int data);
193+ static int pop(Queue *fifo);
194+ static int status(Queue *fifo);
195+};
196+
197+/* graphic.cpp */
198+
199+class Palette {
200+public:
201+ static void init(void);
202+ static void set(int start, int end, unsigned char *rgb);
203+};
204+
205+class Graphics {
206+public:
207+ static void init(int *fat, unsigned short *vram, int x, int y);
208+ static void fill_rect(unsigned short *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1);
209+ static void draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s);
210+private:
211+ static void draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font);
212+};
213+
214+/* dsctbl.cpp */
215+
216+class Descriptor {
217+public:
218+ static void init(void);
219+};
220+
221+class SegmentDescriptor {
222+public:
223+ short limit_low, base_low;
224+ char base_mid, access_right;
225+ char limit_high, base_high;
226+
227+public:
228+ static void set(SegmentDescriptor *sd, unsigned int limit, int base, int ar);
229+};
230+
231+class GateDescriptor {
232+public:
233+ short offset_low, selector;
234+ char dw_count, access_right;
235+ short offset_high;
236+
237+public:
238+ static void set(GateDescriptor *gd, int offset, int selector, int ar);
239+};
240+
241+/* int.cpp */
242+
243+class PIC {
244+public:
245+ static void init(void);
246+};
247+
248+/* keyboard.cpp */
249+
250+class Keyboard {
251+public:
252+ static void init(Queue *fifo, int data0);
253+ static void sendready(void);
254+};
255+
256+/* mouse.cpp */
257+
258+class MouseCursor {
259+public:
260+ static void init(unsigned short *mouse, char bc);
261+};
262+
263+class Mouse {
264+public:
265+ unsigned char buf[4], phase;
266+ int x, y, btn, scroll, scrollmode;
267+
268+public:
269+ static void init(Queue *fifo, int data0, Mouse *mdec);
270+ static int decode(Mouse *mdec, unsigned char dat);
271+};
272+
273+/* memory.cpp */
274+
275+class FreeInfo {
276+public:
277+ unsigned int addr, size;
278+};
279+
280+class MemoryManager {
281+public:
282+ int frees, maxfrees, lostsize, losts;
283+ FreeInfo freeinfo[MEMMAN_FREES];
284+
285+public:
286+ static unsigned int test(unsigned int start, unsigned int end);
287+ static void init(MemoryManager *man);
288+ static unsigned int total(MemoryManager *man);
289+ static unsigned int allocate(MemoryManager *man, unsigned int size);
290+ static int deallocate(MemoryManager *man, unsigned int addr, unsigned int size);
291+ static unsigned int allocate_4k(MemoryManager *man, unsigned int size);
292+ static int deallocate_4k(MemoryManager *man, unsigned int addr, unsigned int size);
293+};
294+
295+/* file.cpp */
296+
297+class FileHandle {
298+public:
299+ unsigned char *buf;
300+ int size;
301+ int pos;
302+};
303+
304+class FileInfo {
305+public:
306+ unsigned char name[8], ext[3], type;
307+ char reserve[10];
308+ unsigned short time, date, clustno;
309+ unsigned int size;
310+};
311+
312+class File {
313+public:
314+ static void read_fat(int *fat, unsigned char *img);
315+ static FileInfo *search(char *name, FileInfo *finfo, int max);
316+ static unsigned char *load_file2(int clustno, int *psize, int *fat);
317+private:
318+ static void load_file(int clustno, int size, unsigned char *buf, int *fat, unsigned char *img);
319+};
320+
321+/* sheet.cpp */
322+
323+class SheetManager;
324+class Sheet {
325+public:
326+ unsigned short *buf;
327+ int bxsize, bysize, vx0, vy0, col_inv, height, flags;
328+ SheetManager *ctl;
329+ Task *task;
330+
331+public:
332+ static Sheet *allocate(SheetManager *ctl);
333+ static void set_buffer(Sheet *sht, unsigned short *buf, int xsize, int ysize, int col_inv);
334+ static void up_down(Sheet *sht, int height);
335+ static void refresh(Sheet *sht, int bx0, int by0, int bx1, int by1);
336+ static void slide(Sheet *sht, int vx0, int vy0);
337+ static void deallocate(Sheet *sht);
338+private:
339+ static void refresh_map(SheetManager *ctl, int vx0, int vy0, int vx1, int vy1, int h0);
340+ static void refresh_sub(SheetManager *ctl, int vx0, int vy0, int vx1, int vy1, int h0, int h1);
341+};
342+
343+class SheetManager {
344+public:
345+ unsigned char *vram, *map;
346+ int xsize, ysize, top;
347+ Sheet *sheets[MAX_SHEETS];
348+ Sheet sheets0[MAX_SHEETS];
349+
350+public:
351+ static SheetManager *init(MemoryManager *memman, unsigned char *vram, int xsize, int ysize);
352+};
353+
354+/* timer.cpp */
355+
356+class PIT {
357+public:
358+ static void init(void);
359+};
360+
361+class Timer {
362+public:
363+ Timer *next;
364+ unsigned int timeout;
365+ char flags, flags2;
366+ Queue *fifo;
367+ int data;
368+
369+public:
370+ static Timer *allocate(void);
371+ static void deallocate(Timer *timer);
372+ static void init(Timer *timer, Queue *fifo, int data);
373+ static void set_time(Timer *timer, unsigned int timeout);
374+ static int cancel(Timer *timer);
375+ static void cancel_all(Queue *fifo);
376+};
377+
378+class TimerManager {
379+public:
380+ unsigned int count, next;
381+ Timer *t0;
382+ Timer *timers0;
383+
384+public:
385+ static void init(void);
386+};
387+
388+extern TimerManager timerctl;
389+
390+/* mtask.cpp */
391+
392+class TSS32 {
393+public:
394+ int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3;
395+ int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi;
396+ int es, cs, ss, ds, fs, gs;
397+ int ldtr, iomap;
398+};
399+
400+class Console;
401+class Task {
402+public:
403+ int sel, flags; /* selはGDTの番号のこと */
404+ int level, priority;
405+ Queue fifo;
406+ TSS32 tss;
407+ int fpu[108 / 4];
408+ SegmentDescriptor ldt[2];
409+ Console *cons;
410+ int ds_base, cons_stack;
411+ FileHandle *fhandle;
412+ int *fat;
413+ char *cmdline;
414+ unsigned char langmode, langbyte1;
415+
416+public:
417+ static Task *now(void);
418+ static Task *init(MemoryManager *memman);
419+ static Task *allocate(void);
420+ static void run(Task *task, int level, int priority);
421+ static void switcher(void);
422+ static void sleep(Task *task);
423+private:
424+ static void add(Task *task);
425+ static void remove(Task *task);
426+ static void switch_sub(void);
427+};
428+
429+class TaskLevel {
430+public:
431+ int running; /* 動作しているタスクの数 */
432+ int now; /* 現在動作しているタスクがどれだか分かるようにするための変数 */
433+ Task *tasks[MAX_TASKS_LV];
434+};
435+
436+struct TaskManager {
437+public:
438+ int now_lv; /* 現在動作中のレベル */
439+ Task *task_fpu;
440+ char lv_change; /* 次回タスクスイッチのときに、レベルも変えたほうがいいかどうか */
441+ TaskLevel level[MAX_TASKLEVELS];
442+ Task tasks0[MAX_TASKS];
443+};
444+
445+extern TaskManager *taskctl;
446+extern Timer *task_timer;
447+
448+/* window.c */
449+
450+class Window {
451+public:
452+ static void make_window(unsigned short *buf, int xsize, int ysize, char *title, char act);
453+ static void putfonts_asc_sht(Sheet *sht, int x, int y, int c, int b, char *s, int l);
454+ static void make_textbox(Sheet *sht, int x0, int y0, int sx, int sy, int c);
455+ static void make_wtitle(unsigned short *buf, int xsize, char *title, char act);
456+ static void change_wtitle(Sheet *sht, char act);
457+};
458+
459+/* console.c */
460+
461+class Console {
462+public:
463+ Sheet *sht;
464+ int cur_x, cur_y, cur_c;
465+ Timer *timer;
466+
467+public:
468+ static void put_char(Console *cons, int chr, char move);
469+ static void new_line(Console *cons);
470+ static void put_str0(Console *cons, char *s);
471+ static void put_str1(Console *cons, char *s, int l);
472+ static void run_command(char *cmdline, Console *cons, int *fat, int memtotal);
473+ static void command_mem(Console *cons, int memtotal);
474+ static void command_cls(Console *cons);
475+ static void command_dir(Console *cons);
476+ static void command_exit(Console *cons, int *fat);
477+ static void command_start(Console *cons, char *cmdline, int memtotal);
478+ static void command_ncst(Console *cons, char *cmdline, int memtotal);
479+ static void command_langmode(Console *cons, char *cmdline);
480+ static int command_app(Console *cons, int *fat, char *cmdline);
481+ static void hrb_api_linewin(Sheet *sht, int x0, int y0, int x1, int y1, int col);
482+};
483+
484+void console_task(Sheet *sheet, int memtotal);
485+
486+/* bootpack.cpp */
487+
488+Task *open_constask(Sheet *sht, unsigned int memtotal);
489+Sheet *open_console(SheetManager *shtctl, unsigned int memtotal);
490+
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/!cons_9x.bat (nonexistent)
+++ haribote/trunk/bayos_exp/!cons_9x.bat (revision 181)
@@ -0,0 +1 @@
1+command
\ No newline at end of file
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/window.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/window.cpp (revision 181)
@@ -0,0 +1,127 @@
1+/* ウィンドウ関係 */
2+
3+#include "bootpack.h"
4+
5+extern unsigned short table_8_565[256];
6+
7+void Window::make_window(unsigned short *buf, int xsize, int ysize, char *title, char act)
8+{
9+ Graphics::fill_rect(buf, xsize, COL8_C6C6C6, 0, 0, xsize - 1, 0 );
10+ Graphics::fill_rect(buf, xsize, COL8_FFFFFF, 1, 1, xsize - 2, 1 );
11+ Graphics::fill_rect(buf, xsize, COL8_C6C6C6, 0, 0, 0, ysize - 1);
12+ Graphics::fill_rect(buf, xsize, COL8_FFFFFF, 1, 1, 1, ysize - 2);
13+ Graphics::fill_rect(buf, xsize, COL8_848484, xsize - 2, 1, xsize - 2, ysize - 2);
14+ Graphics::fill_rect(buf, xsize, COL8_000000, xsize - 1, 0, xsize - 1, ysize - 1);
15+ Graphics::fill_rect(buf, xsize, COL8_C6C6C6, 2, 2, xsize - 3, ysize - 3);
16+ Graphics::fill_rect(buf, xsize, COL8_848484, 1, ysize - 2, xsize - 2, ysize - 2);
17+ Graphics::fill_rect(buf, xsize, COL8_000000, 0, ysize - 1, xsize - 1, ysize - 1);
18+ Window::make_wtitle(buf, xsize, title, act);
19+ return;
20+}
21+
22+void Window::make_wtitle(unsigned short *buf, int xsize, char *title, char act)
23+{
24+ static char* closebtn[14]/*[16]*/ = {
25+ "OOOOOOOOOOOOOOO@",
26+ "OQQQQQQQQQQQQQ$@",
27+ "OQQQQQQQQQQQQQ$@",
28+ "OQQQ@@QQQQ@@QQ$@",
29+ "OQQQQ@@QQ@@QQQ$@",
30+ "OQQQQQ@@@@QQQQ$@",
31+ "OQQQQQQ@@QQQQQ$@",
32+ "OQQQQQ@@@@QQQQ$@",
33+ "OQQQQ@@QQ@@QQQ$@",
34+ "OQQQ@@QQQQ@@QQ$@",
35+ "OQQQQQQQQQQQQQ$@",
36+ "OQQQQQQQQQQQQQ$@",
37+ "O$$$$$$$$$$$$$$@",
38+ "@@@@@@@@@@@@@@@@"
39+ };
40+ int x, y;
41+ char c, tc, tbc;
42+ if (act != 0) {
43+ tc = COL8_FFFFFF;
44+ tbc = COL8_000084;
45+ } else {
46+ tc = COL8_C6C6C6;
47+ tbc = COL8_848484;
48+ }
49+ Graphics::fill_rect(buf, xsize, tbc, 3, 3, xsize - 4, 20);
50+ Graphics::draw_string(buf, xsize, 24, 4, tc, title);
51+ for (y = 0; y < 14; y++) {
52+ for (x = 0; x < 16; x++) {
53+ c = closebtn[y][x];
54+ if (c == '@') {
55+ c = COL8_000000;
56+ } else if (c == '$') {
57+ c = COL8_848484;
58+ } else if (c == 'Q') {
59+ c = COL8_C6C6C6;
60+ } else {
61+ c = COL8_FFFFFF;
62+ }
63+ buf[(5 + y) * xsize + (xsize - 21 + x)] = table_8_565[c & 0xff];
64+ }
65+ }
66+ return;
67+}
68+
69+void Window::putfonts_asc_sht(Sheet *sht, int x, int y, int c, int b, char *s, int l)
70+{
71+ Task *task = Task::now();
72+ Graphics::fill_rect(sht->buf, sht->bxsize, b, x, y, x + l * 8 - 1, y + 15);
73+ if (task->langmode != 0 && task->langbyte1 != 0) {
74+ Graphics::draw_string(sht->buf, sht->bxsize, x, y, c, s);
75+ Sheet::refresh(sht, x - 8, y, x + l * 8, y + 16);
76+ } else {
77+ Graphics::draw_string(sht->buf, sht->bxsize, x, y, c, s);
78+ Sheet::refresh(sht, x, y, x + l * 8, y + 16);
79+ }
80+ return;
81+}
82+
83+void Window::make_textbox(Sheet *sht, int x0, int y0, int sx, int sy, int c)
84+{
85+ int x1 = x0 + sx, y1 = y0 + sy;
86+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_848484, x0 - 2, y0 - 3, x1 + 1, y0 - 3);
87+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_848484, x0 - 3, y0 - 3, x0 - 3, y1 + 1);
88+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_FFFFFF, x0 - 3, y1 + 2, x1 + 1, y1 + 2);
89+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_FFFFFF, x1 + 2, y0 - 3, x1 + 2, y1 + 2);
90+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_000000, x0 - 1, y0 - 2, x1 + 0, y0 - 2);
91+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_000000, x0 - 2, y0 - 2, x0 - 2, y1 + 0);
92+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_C6C6C6, x0 - 2, y1 + 1, x1 + 0, y1 + 1);
93+ Graphics::fill_rect(sht->buf, sht->bxsize, COL8_C6C6C6, x1 + 1, y0 - 2, x1 + 1, y1 + 1);
94+ Graphics::fill_rect(sht->buf, sht->bxsize, c, x0 - 1, y0 - 1, x1 + 0, y1 + 0);
95+ return;
96+}
97+
98+void Window::change_wtitle(Sheet *sht, char act)
99+{
100+ int x, y, xsize = sht->bxsize;
101+ unsigned char tc_new, tbc_new, tc_old, tbc_old;
102+ unsigned short c565, *buf = sht->buf;
103+ if (act != 0) {
104+ tc_new = COL8_FFFFFF;
105+ tbc_new = COL8_000084;
106+ tc_old = COL8_C6C6C6;
107+ tbc_old = COL8_848484;
108+ } else {
109+ tc_new = COL8_C6C6C6;
110+ tbc_new = COL8_848484;
111+ tc_old = COL8_FFFFFF;
112+ tbc_old = COL8_000084;
113+ }
114+ for (y = 3; y <= 20; y++) {
115+ for (x = 3; x <= xsize - 4; x++) {
116+ c565 = buf[y * xsize + x];
117+ if (c565 == table_8_565[tc_old] && x <= xsize - 22) {
118+ c565 = table_8_565[tc_new];
119+ } else if (c565 == table_8_565[tbc_old]) {
120+ c565 = table_8_565[tbc_new];
121+ }
122+ buf[y * xsize + x] = c565;
123+ }
124+ }
125+ Sheet::refresh(sht, 3, 3, xsize, 21);
126+ return;
127+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/memory.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/memory.cpp (revision 181)
@@ -0,0 +1,160 @@
1+/* メモリ関係 */
2+
3+#include "bootpack.h"
4+
5+#define EFLAGS_AC_BIT 0x00040000
6+#define CR0_CACHE_DISABLE 0x60000000
7+
8+unsigned int MemoryManager::test(unsigned int start, unsigned int end)
9+{
10+ char flg486 = 0;
11+ unsigned int eflg, cr0, i;
12+
13+ /* 386か、486以降なのかの確認 */
14+ eflg = io_load_eflags();
15+ eflg |= EFLAGS_AC_BIT; /* AC-bit = 1 */
16+ io_store_eflags(eflg);
17+ eflg = io_load_eflags();
18+ if ((eflg & EFLAGS_AC_BIT) != 0) { /* 386ではAC=1にしても自動で0に戻ってしまう */
19+ flg486 = 1;
20+ }
21+ eflg &= ~EFLAGS_AC_BIT; /* AC-bit = 0 */
22+ io_store_eflags(eflg);
23+
24+ if (flg486 != 0) {
25+ cr0 = load_cr0();
26+ cr0 |= CR0_CACHE_DISABLE; /* キャッシュ禁止 */
27+ store_cr0(cr0);
28+ }
29+
30+ i = memtest_sub(start, end);
31+
32+ if (flg486 != 0) {
33+ cr0 = load_cr0();
34+ cr0 &= ~CR0_CACHE_DISABLE; /* キャッシュ許可 */
35+ store_cr0(cr0);
36+ }
37+
38+ return i;
39+}
40+
41+void MemoryManager::init(MemoryManager *man)
42+{
43+ man->frees = 0; /* あき情報の個数 */
44+ man->maxfrees = 0; /* 状況観察用:freesの最大値 */
45+ man->lostsize = 0; /* 解放に失敗した合計サイズ */
46+ man->losts = 0; /* 解放に失敗した回数 */
47+ return;
48+}
49+
50+unsigned int MemoryManager::total(MemoryManager *man)
51+/* あきサイズの合計を報告 */
52+{
53+ unsigned int i, t = 0;
54+ for (i = 0; i < man->frees; i++) {
55+ t += man->freeinfo[i].size;
56+ }
57+ return t;
58+}
59+
60+unsigned int MemoryManager::allocate(MemoryManager *man, unsigned int size)
61+/* 確保 */
62+{
63+ unsigned int i, a;
64+ for (i = 0; i < man->frees; i++) {
65+ if (man->freeinfo[i].size >= size) {
66+ /* 十分な広さのあきを発見 */
67+ a = man->freeinfo[i].addr;
68+ man->freeinfo[i].addr += size;
69+ man->freeinfo[i].size -= size;
70+ if (man->freeinfo[i].size == 0) {
71+ /* freeinfo[i]がなくなったので前へつめる */
72+ man->frees--;
73+ for (; i < man->frees; i++) {
74+ man->freeinfo[i] = man->freeinfo[i + 1]; /* 構造体の代入 */
75+ }
76+ }
77+ return a;
78+ }
79+ }
80+ return 0; /* あきがない */
81+}
82+
83+int MemoryManager::deallocate(MemoryManager *man, unsigned int addr, unsigned int size)
84+/* 解放 */
85+{
86+ int i, j;
87+ /* まとめやすさを考えると、freeinfo[]がaddr順に並んでいるほうがいい */
88+ /* だからまず、どこに入れるべきかを決める */
89+ for (i = 0; i < man->frees; i++) {
90+ if (man->freeinfo[i].addr > addr) {
91+ break;
92+ }
93+ }
94+ /* freeinfo[i - 1].addr < addr < freeinfo[i].addr */
95+ if (i > 0) {
96+ /* 前がある */
97+ if (man->freeinfo[i - 1].addr + man->freeinfo[i - 1].size == addr) {
98+ /* 前のあき領域にまとめられる */
99+ man->freeinfo[i - 1].size += size;
100+ if (i < man->frees) {
101+ /* 後ろもある */
102+ if (addr + size == man->freeinfo[i].addr) {
103+ /* なんと後ろともまとめられる */
104+ man->freeinfo[i - 1].size += man->freeinfo[i].size;
105+ /* man->freeinfo[i]の削除 */
106+ /* freeinfo[i]がなくなったので前へつめる */
107+ man->frees--;
108+ for (; i < man->frees; i++) {
109+ man->freeinfo[i] = man->freeinfo[i + 1]; /* 構造体の代入 */
110+ }
111+ }
112+ }
113+ return 0; /* 成功終了 */
114+ }
115+ }
116+ /* 前とはまとめられなかった */
117+ if (i < man->frees) {
118+ /* 後ろがある */
119+ if (addr + size == man->freeinfo[i].addr) {
120+ /* 後ろとはまとめられる */
121+ man->freeinfo[i].addr = addr;
122+ man->freeinfo[i].size += size;
123+ return 0; /* 成功終了 */
124+ }
125+ }
126+ /* 前にも後ろにもまとめられない */
127+ if (man->frees < MEMMAN_FREES) {
128+ /* freeinfo[i]より後ろを、後ろへずらして、すきまを作る */
129+ for (j = man->frees; j > i; j--) {
130+ man->freeinfo[j] = man->freeinfo[j - 1];
131+ }
132+ man->frees++;
133+ if (man->maxfrees < man->frees) {
134+ man->maxfrees = man->frees; /* 最大値を更新 */
135+ }
136+ man->freeinfo[i].addr = addr;
137+ man->freeinfo[i].size = size;
138+ return 0; /* 成功終了 */
139+ }
140+ /* 後ろにずらせなかった */
141+ man->losts++;
142+ man->lostsize += size;
143+ return -1; /* 失敗終了 */
144+}
145+
146+unsigned int MemoryManager::allocate_4k(MemoryManager *man, unsigned int size)
147+{
148+ unsigned int a;
149+ size = (size + 0xfff) & 0xfffff000;
150+ a = MemoryManager::allocate(man, size);
151+ return a;
152+}
153+
154+int MemoryManager::deallocate_4k(MemoryManager *man, unsigned int addr, unsigned int size)
155+{
156+ int i;
157+ size = (size + 0xfff) & 0xfffff000;
158+ i = MemoryManager::deallocate(man, addr, size);
159+ return i;
160+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/sheet.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/sheet.cpp (revision 181)
@@ -0,0 +1,314 @@
1+/* マウスやウィンドウの重ね合わせ処理 */
2+
3+#include "bootpack.h"
4+
5+#define SHEET_USE 1
6+
7+extern unsigned short table_8_565[256];
8+
9+SheetManager *SheetManager::init(MemoryManager *memman, unsigned char *vram, int xsize, int ysize)
10+{
11+ SheetManager *ctl;
12+ int i;
13+ ctl = (SheetManager *) MemoryManager::allocate_4k(memman, sizeof (SheetManager));
14+ if (ctl == 0) {
15+ goto err;
16+ }
17+ ctl->map = (unsigned char *) MemoryManager::allocate_4k(memman, xsize * ysize);
18+ if (ctl->map == 0) {
19+ MemoryManager::deallocate_4k(memman, (int) ctl, sizeof (SheetManager));
20+ goto err;
21+ }
22+ ctl->vram = vram;
23+ ctl->xsize = xsize;
24+ ctl->ysize = ysize;
25+ ctl->top = -1; /* シートは一枚もない */
26+ for (i = 0; i < MAX_SHEETS; i++) {
27+ ctl->sheets0[i].flags = 0; /* 未使用マーク */
28+ ctl->sheets0[i].ctl = ctl; /* 所属を記録 */
29+ }
30+err:
31+ return ctl;
32+}
33+
34+Sheet *Sheet::allocate(SheetManager *ctl)
35+{
36+ Sheet *sht;
37+ int i;
38+ for (i = 0; i < MAX_SHEETS; i++) {
39+ if (ctl->sheets0[i].flags == 0) {
40+ sht = &ctl->sheets0[i];
41+ sht->flags = SHEET_USE; /* 使用中マーク */
42+ sht->height = -1; /* 非表示中 */
43+ sht->task = 0; /* 自動で閉じる機能を使わない */
44+ return sht;
45+ }
46+ }
47+ return 0; /* 全てのシートが使用中だった */
48+}
49+
50+void Sheet::set_buffer(Sheet *sht, unsigned short *buf, int xsize, int ysize, int col_inv)
51+{
52+ sht->buf = buf;
53+ sht->bxsize = xsize;
54+ sht->bysize = ysize;
55+ if (col_inv != -1) {
56+ sht->col_inv = table_8_565[col_inv];
57+ } else {
58+ sht->col_inv = -1;
59+ }
60+ return;
61+}
62+
63+void Sheet::refresh_map(SheetManager *ctl, int vx0, int vy0, int vx1, int vy1, int h0)
64+{
65+ int h, bx, by, vx, vy, bx0, by0, bx1, by1, sid4, *p;
66+ unsigned short *buf;
67+ unsigned char sid, *map = ctl->map;
68+ Sheet *sht;
69+ if (vx0 < 0) { vx0 = 0; }
70+ if (vy0 < 0) { vy0 = 0; }
71+ if (vx1 > ctl->xsize) { vx1 = ctl->xsize; }
72+ if (vy1 > ctl->ysize) { vy1 = ctl->ysize; }
73+ for (h = h0; h <= ctl->top; h++) {
74+ sht = ctl->sheets[h];
75+ sid = sht - ctl->sheets0; /* 番地を引き算してそれを下じき番号として利用 */
76+ buf = sht->buf;
77+ bx0 = vx0 - sht->vx0;
78+ by0 = vy0 - sht->vy0;
79+ bx1 = vx1 - sht->vx0;
80+ by1 = vy1 - sht->vy0;
81+ if (bx0 < 0) { bx0 = 0; }
82+ if (by0 < 0) { by0 = 0; }
83+ if (bx1 > sht->bxsize) { bx1 = sht->bxsize; }
84+ if (by1 > sht->bysize) { by1 = sht->bysize; }
85+ if (sht->col_inv == -1) {
86+ if ((sht->vx0 & 3) == 0 && (bx0 & 3) == 0 && (bx1 & 3) == 0) {
87+ /* 透明色なし専用の高速版(4バイト型) */
88+ bx1 = (bx1 - bx0) / 4; /* MOV回数 */
89+ sid4 = sid | sid << 8 | sid << 16 | sid << 24;
90+ for (by = by0; by < by1; by++) {
91+ vy = sht->vy0 + by;
92+ vx = sht->vx0 + bx0;
93+ p = (int *) &map[vy * ctl->xsize + vx];
94+ for (bx = 0; bx < bx1; bx++) {
95+ p[bx] = sid4;
96+ }
97+ }
98+ } else {
99+ /* 透明色なし専用の高速版(1バイト型) */
100+ for (by = by0; by < by1; by++) {
101+ vy = sht->vy0 + by;
102+ for (bx = bx0; bx < bx1; bx++) {
103+ vx = sht->vx0 + bx;
104+ map[vy * ctl->xsize + vx] = sid;
105+ }
106+ }
107+ }
108+ } else {
109+ /* 透明色ありの一般版 */
110+ for (by = by0; by < by1; by++) {
111+ vy = sht->vy0 + by;
112+ for (bx = bx0; bx < bx1; bx++) {
113+ vx = sht->vx0 + bx;
114+ if (buf[by * sht->bxsize + bx] != sht->col_inv) {
115+ map[vy * ctl->xsize + vx] = sid;
116+ }
117+ }
118+ }
119+ }
120+ }
121+ return;
122+}
123+
124+void Sheet::refresh_sub(SheetManager *ctl, int vx0, int vy0, int vx1, int vy1, int h0, int h1)
125+{
126+ SystemInfo *sysinfo = SystemInfo::get_instance();
127+ int h, bx, by, vx, vy, bx0, by0, bx1, by1, bx2, sid4, i, i1, *p, *q, *r;
128+ unsigned char *vram = ctl->vram, *map = ctl->map, sid;
129+ unsigned short *buf, sid2, *o;
130+ Sheet *sht;
131+ /* refresh範囲が画面外にはみ出していたら補正 */
132+ if (vx0 < 0) { vx0 = 0; }
133+ if (vy0 < 0) { vy0 = 0; }
134+ if (vx1 > ctl->xsize) { vx1 = ctl->xsize; }
135+ if (vy1 > ctl->ysize) { vy1 = ctl->ysize; }
136+ for (h = h0; h <= h1; h++) {
137+ sht = ctl->sheets[h];
138+ buf = sht->buf;
139+ sid = sht - ctl->sheets0;
140+ /* vx0〜vy1を使って、bx0〜by1を逆算する */
141+ bx0 = vx0 - sht->vx0;
142+ by0 = vy0 - sht->vy0;
143+ bx1 = vx1 - sht->vx0;
144+ by1 = vy1 - sht->vy0;
145+ if (bx0 < 0) { bx0 = 0; }
146+ if (by0 < 0) { by0 = 0; }
147+ if (bx1 > sht->bxsize) { bx1 = sht->bxsize; }
148+ if (by1 > sht->bysize) { by1 = sht->bysize; }
149+ if (sysinfo->vmode == 8) {
150+ /* 8ビットカラー */
151+ /* 1バイト型 */
152+ for (by = by0; by < by1; by++) {
153+ vy = sht->vy0 + by;
154+ for (bx = bx0; bx < bx1; bx++) {
155+ vx = sht->vx0 + bx;
156+ if (map[vy * ctl->xsize + vx] == sid) {
157+ vram[vy * ctl->xsize + vx] = buf[by * sht->bxsize + bx];
158+ }
159+ }
160+ }
161+ } else {
162+ /* 16ビットカラー */
163+ if ((sht->vx0 & 2) == 0) {
164+ /* 4バイト型 */
165+ i = (bx0 + 1) / 2; /* bx0を2で割ったもの(端数切り上げ) */
166+ i1 = bx1 / 2; /* bx1を2で割ったもの(端数切り捨て) */
167+ i1 = i1 - i;
168+ sid2 = sid | sid << 8;
169+ for (by = by0; by < by1; by++) {
170+ vy = sht->vy0 + by;
171+ for (bx = bx0; bx < bx1 && (bx & 1) != 0; bx++) { /* 前の端数を1バイトずつ */
172+ vx = sht->vx0 + bx;
173+ if (map[vy * ctl->xsize + vx] == sid) {
174+ *(unsigned short *) &vram[(vy * ctl->xsize + vx) * 2] =
175+ buf[by * sht->bxsize + bx];
176+ }
177+ }
178+ vx = sht->vx0 + bx;
179+ o = (unsigned short *) &map[vy * ctl->xsize + vx];
180+ q = (int *) &vram[(vy * ctl->xsize + vx) * 2];
181+ r = (int *) &buf[by * sht->bxsize + bx];
182+ for (i = 0; i < i1; i++) { /* 2の倍数部分 */
183+ if (o[i] == sid2) {
184+ q[i] = r[i];
185+ } else {
186+ bx2 = bx + i * 2;
187+ vx = sht->vx0 + bx2;
188+ if (map[vy * ctl->xsize + vx + 0] == sid) {
189+ *(unsigned short *) &vram[(vy * ctl->xsize + vx + 0) * 2] =
190+ buf[by * sht->bxsize + bx2 + 0];
191+ }
192+ if (map[vy * ctl->xsize + vx + 1] == sid) {
193+ *(unsigned short *) &vram[(vy * ctl->xsize + vx + 1) * 2] =
194+ buf[by * sht->bxsize + bx2 + 1];
195+ }
196+ }
197+ }
198+ for (bx += i1 * 2; bx < bx1; bx++) { /* 後の端数を1バイトずつ */
199+ vx = sht->vx0 + bx;
200+ if (map[vy * ctl->xsize + vx] == sid) {
201+ *(unsigned short *) &vram[(vy * ctl->xsize + vx) * 2] =
202+ buf[by * sht->bxsize + bx];
203+ }
204+ }
205+ }
206+ } else {
207+ /* 2バイト型 */
208+ for (by = by0; by < by1; by++) {
209+ vy = sht->vy0 + by;
210+ for (bx = bx0; bx < bx1; bx++) {
211+ vx = sht->vx0 + bx;
212+ if (map[vy * ctl->xsize + vx] == sid) {
213+ *(unsigned short *) &vram[(vy * ctl->xsize + vx) * 2] =
214+ buf[by * sht->bxsize + bx];
215+ }
216+ }
217+ }
218+ }
219+ }
220+ }
221+ return;
222+}
223+
224+void Sheet::up_down(Sheet *sht, int height)
225+{
226+ SheetManager *ctl = sht->ctl;
227+ int h, old = sht->height; /* 設定前の高さを記憶する */
228+
229+ /* 指定が低すぎや高すぎだったら、修正する */
230+ if (height > ctl->top + 1) {
231+ height = ctl->top + 1;
232+ }
233+ if (height < -1) {
234+ height = -1;
235+ }
236+ sht->height = height; /* 高さを設定 */
237+
238+ /* 以下は主にsheets[]の並べ替え */
239+ if (old > height) { /* 以前よりも低くなる */
240+ if (height >= 0) {
241+ /* 間のものを引き上げる */
242+ for (h = old; h > height; h--) {
243+ ctl->sheets[h] = ctl->sheets[h - 1];
244+ ctl->sheets[h]->height = h;
245+ }
246+ ctl->sheets[height] = sht;
247+ Sheet::refresh_map(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1);
248+ Sheet::refresh_sub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height + 1, old);
249+ } else { /* 非表示化 */
250+ if (ctl->top > old) {
251+ /* 上になっているものをおろす */
252+ for (h = old; h < ctl->top; h++) {
253+ ctl->sheets[h] = ctl->sheets[h + 1];
254+ ctl->sheets[h]->height = h;
255+ }
256+ }
257+ ctl->top--; /* 表示中の下じきが一つ減るので、一番上の高さが減る */
258+ Sheet::refresh_map(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0);
259+ Sheet::refresh_sub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, 0, old - 1);
260+ }
261+ } else if (old < height) { /* 以前よりも高くなる */
262+ if (old >= 0) {
263+ /* 間のものを押し下げる */
264+ for (h = old; h < height; h++) {
265+ ctl->sheets[h] = ctl->sheets[h + 1];
266+ ctl->sheets[h]->height = h;
267+ }
268+ ctl->sheets[height] = sht;
269+ } else { /* 非表示状態から表示状態へ */
270+ /* 上になるものを持ち上げる */
271+ for (h = ctl->top; h >= height; h--) {
272+ ctl->sheets[h + 1] = ctl->sheets[h];
273+ ctl->sheets[h + 1]->height = h + 1;
274+ }
275+ ctl->sheets[height] = sht;
276+ ctl->top++; /* 表示中の下じきが一つ増えるので、一番上の高さが増える */
277+ }
278+ Sheet::refresh_map(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height);
279+ Sheet::refresh_sub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize, height, height);
280+ }
281+ return;
282+}
283+
284+void Sheet::refresh(Sheet *sht, int bx0, int by0, int bx1, int by1)
285+{
286+ if (sht->height >= 0) { /* もしも表示中なら、新しい下じきの情報に沿って画面を描き直す */
287+ Sheet::refresh_sub(sht->ctl, sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1, sht->height, sht->height);
288+ }
289+ return;
290+}
291+
292+void Sheet::slide(Sheet *sht, int vx0, int vy0)
293+{
294+ SheetManager *ctl = sht->ctl;
295+ int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
296+ sht->vx0 = vx0;
297+ sht->vy0 = vy0;
298+ if (sht->height >= 0) { /* もしも表示中なら、新しい下じきの情報に沿って画面を描き直す */
299+ Sheet::refresh_map(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0);
300+ Sheet::refresh_map(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height);
301+ Sheet::refresh_sub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize, 0, sht->height - 1);
302+ Sheet::refresh_sub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize, sht->height, sht->height);
303+ }
304+ return;
305+}
306+
307+void Sheet::deallocate(Sheet *sht)
308+{
309+ if (sht->height >= 0) {
310+ Sheet::up_down(sht, -1); /* 表示中ならまず非表示にする */
311+ }
312+ sht->flags = 0; /* 未使用マーク */
313+ return;
314+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/dsctbl.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/dsctbl.cpp (revision 181)
@@ -0,0 +1,61 @@
1+/* GDTやIDTなどの、 descriptor table 関係 */
2+
3+#include "bootpack.h"
4+
5+void Descriptor::init(void)
6+{
7+ SegmentDescriptor *gdt = (SegmentDescriptor *) ADR_GDT;
8+ GateDescriptor *idt = (GateDescriptor *) ADR_IDT;
9+ int i;
10+
11+ /* GDTの初期化 */
12+ for (i = 0; i <= LIMIT_GDT / 8; i++) {
13+ SegmentDescriptor::set(gdt + i, 0, 0, 0);
14+ }
15+ SegmentDescriptor::set(gdt + 1, 0xffffffff, 0x00000000, AR_DATA32_RW);
16+ SegmentDescriptor::set(gdt + 2, LIMIT_BOTPAK, ADR_BOTPAK, AR_CODE32_ER);
17+ load_gdtr(LIMIT_GDT, ADR_GDT);
18+
19+ /* IDTの初期化 */
20+ for (i = 0; i <= LIMIT_IDT / 8; i++) {
21+ GateDescriptor::set(idt + i, 0, 0, 0);
22+ }
23+ load_idtr(LIMIT_IDT, ADR_IDT);
24+
25+ /* IDTの設定 */
26+ GateDescriptor::set(idt + 0x07, (int) asm_inthandler07, 2 * 8, AR_INTGATE32);
27+ GateDescriptor::set(idt + 0x0c, (int) asm_inthandler0c, 2 * 8, AR_INTGATE32);
28+ GateDescriptor::set(idt + 0x0d, (int) asm_inthandler0d, 2 * 8, AR_INTGATE32);
29+ GateDescriptor::set(idt + 0x20, (int) asm_inthandler20, 2 * 8, AR_INTGATE32);
30+ GateDescriptor::set(idt + 0x21, (int) asm_inthandler21, 2 * 8, AR_INTGATE32);
31+ GateDescriptor::set(idt + 0x27, (int) asm_inthandler27, 2 * 8, AR_INTGATE32);
32+ GateDescriptor::set(idt + 0x2c, (int) asm_inthandler2c, 2 * 8, AR_INTGATE32);
33+ GateDescriptor::set(idt + 0x40, (int) asm_hrb_api, 2 * 8, AR_INTGATE32 + 0x60);
34+
35+ return;
36+}
37+
38+void SegmentDescriptor::set(SegmentDescriptor *sd, unsigned int limit, int base, int ar)
39+{
40+ if (limit > 0xfffff) {
41+ ar |= 0x8000; /* G_bit = 1 */
42+ limit /= 0x1000;
43+ }
44+ sd->limit_low = limit & 0xffff;
45+ sd->base_low = base & 0xffff;
46+ sd->base_mid = (base >> 16) & 0xff;
47+ sd->access_right = ar & 0xff;
48+ sd->limit_high = ((limit >> 16) & 0x0f) | ((ar >> 8) & 0xf0);
49+ sd->base_high = (base >> 24) & 0xff;
50+ return;
51+}
52+
53+void GateDescriptor::set(GateDescriptor *gd, int offset, int selector, int ar)
54+{
55+ gd->offset_low = offset & 0xffff;
56+ gd->selector = selector;
57+ gd->dw_count = (ar >> 8) & 0xff;
58+ gd->access_right = ar & 0xff;
59+ gd->offset_high = (offset >> 16) & 0xffff;
60+ return;
61+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/graphic.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/graphic.cpp (revision 181)
@@ -0,0 +1,236 @@
1+/* グラフィック処理関係 */
2+
3+#include "bootpack.h"
4+
5+unsigned short table_8_565[256];
6+
7+void Palette::init(void)
8+{
9+ SystemInfo *sysinfo = SystemInfo::get_instance();
10+ static unsigned char table_rgb[16 * 3] = {
11+ 0x00, 0x00, 0x00, /* 0:黒 */
12+ 0xff, 0x00, 0x00, /* 1:明るい赤 */
13+ 0x00, 0xff, 0x00, /* 2:明るい緑 */
14+ 0xff, 0xff, 0x00, /* 3:明るい黄色 */
15+ 0x00, 0x00, 0xff, /* 4:明るい青 */
16+ 0xff, 0x00, 0xff, /* 5:明るい紫 */
17+ 0x00, 0xff, 0xff, /* 6:明るい水色 */
18+ 0xff, 0xff, 0xff, /* 7:白 */
19+ 0xc6, 0xc6, 0xc6, /* 8:明るい灰色 */
20+ 0x84, 0x00, 0x00, /* 9:暗い赤 */
21+ 0x00, 0x84, 0x00, /* 10:暗い緑 */
22+ 0x84, 0x84, 0x00, /* 11:暗い黄色 */
23+ 0x00, 0x00, 0x84, /* 12:暗い青 */
24+ 0x84, 0x00, 0x84, /* 13:暗い紫 */
25+ 0x00, 0x84, 0x84, /* 14:暗い水色 */
26+ 0x84, 0x84, 0x84 /* 15:暗い灰色 */
27+ };
28+ int i, r, g, b;
29+ if (sysinfo->vmode == 8) {
30+ for (i = 0; i < 16; i++) {
31+ table_8_565[i] = i;
32+ }
33+ Palette::set(0, 15, table_rgb);
34+ unsigned char table2[216 * 3];
35+ for (b = 0; b < 6; b++) {
36+ for (g = 0; g < 6; g++) {
37+ for (r = 0; r < 6; r++) {
38+ table2[(r + g * 6 + b * 36) * 3 + 0] = r * 51;
39+ table2[(r + g * 6 + b * 36) * 3 + 1] = g * 51;
40+ table2[(r + g * 6 + b * 36) * 3 + 2] = b * 51;
41+ table_8_565[r + g * 6 + b * 36 + 16] = r + g * 6 + b * 36 + 16;
42+ }
43+ }
44+ }
45+ Palette::set(16, 231, table2);
46+ } else {
47+ for (i = 0; i < 16; i++) {
48+ r = table_rgb[i * 3 + 0];
49+ g = table_rgb[i * 3 + 1];
50+ b = table_rgb[i * 3 + 2];
51+ table_8_565[i] = (unsigned short) (((r << 8) & 0xf800) |
52+ ((g << 3) & 0x07e0) | (b >> 3));
53+ }
54+ for (b = 0; b < 6; b++) {
55+ for (g = 0; g < 6; g++) {
56+ for (r = 0; r < 6; r++) {
57+ table_8_565[r + g * 6 + b * 36 + 16] =
58+ (unsigned short) ((((r * 51) << 8) & 0xf800) |
59+ (((g * 51) << 3) & 0x07e0) | ((b * 51) >> 3));
60+ }
61+ }
62+ }
63+ }
64+ return;
65+}
66+
67+void Palette::set(int start, int end, unsigned char *rgb)
68+{
69+ int i, eflags;
70+ eflags = io_load_eflags(); /* 割り込み許可フラグの値を記録する */
71+ io_cli(); /* 許可フラグを0にして割り込み禁止にする */
72+ io_out8(0x03c8, start);
73+ for (i = start; i <= end; i++) {
74+ io_out8(0x03c9, rgb[0] / 4);
75+ io_out8(0x03c9, rgb[1] / 4);
76+ io_out8(0x03c9, rgb[2] / 4);
77+ rgb += 3;
78+ }
79+ io_store_eflags(eflags); /* 割り込み許可フラグを元に戻す */
80+ return;
81+}
82+
83+void Graphics::fill_rect(unsigned short *vram, int xsize, unsigned char c, int x0, int y0, int x1, int y1)
84+{
85+ int x, y;
86+ for (y = y0; y <= y1; y++) {
87+ for (x = x0; x <= x1; x++)
88+ vram[y * xsize + x] = table_8_565[c & 0xff];
89+ }
90+ return;
91+}
92+
93+void Graphics::init(int *fat, unsigned short *vram, int x, int y)
94+{
95+ /* hrbwall.jpgの読み込み */
96+ SystemInfo *sysinfo = SystemInfo::get_instance();
97+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
98+ unsigned char *filebuf, r, g, b;
99+ struct DLL_STRPICENV env;
100+ struct RGB *picbuf;
101+ int info[4], fsize, xx, yy;
102+ FileInfo *finfo = File::search("hrbwall.jpg", (FileInfo *) (ADR_DISKIMG + 0x002600), 224);
103+
104+ if (sysinfo->vmode == 16 && finfo != 0) {
105+ fsize = finfo->size;
106+ filebuf = (unsigned char *) MemoryManager::allocate_4k(memman, fsize);
107+ filebuf = File::load_file2(finfo->clustno, &fsize, fat);
108+ info_JPEG(&env, info, fsize, filebuf);
109+ picbuf = (struct RGB *) MemoryManager::allocate_4k(memman, info[2] * info[3] * sizeof(struct RGB));
110+ decode0_JPEG(&env, fsize, filebuf, 4, (unsigned char *) picbuf, 0);
111+ for (yy = 0; yy < info[3]; yy++) {
112+ for (xx = 0; xx < info[2]; xx++) {
113+ r = picbuf[yy * info[2] + xx].r;
114+ g = picbuf[yy * info[2] + xx].g;
115+ b = picbuf[yy * info[2] + xx].b;
116+ vram[yy * x + xx] = (unsigned short)(((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | (b >> 3));
117+ }
118+ }
119+ } else {
120+ Graphics::fill_rect(vram, x, COL8_008484, 0, 0, x - 1, y - 29);
121+ }
122+
123+ Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 28, x - 1, y - 28);
124+ Graphics::fill_rect(vram, x, COL8_FFFFFF, 0, y - 27, x - 1, y - 27);
125+ Graphics::fill_rect(vram, x, COL8_C6C6C6, 0, y - 26, x - 1, y - 1);
126+
127+ Graphics::fill_rect(vram, x, COL8_FFFFFF, 3, y - 24, 59, y - 24);
128+ Graphics::fill_rect(vram, x, COL8_FFFFFF, 2, y - 24, 2, y - 4);
129+ Graphics::fill_rect(vram, x, COL8_848484, 3, y - 4, 59, y - 4);
130+ Graphics::fill_rect(vram, x, COL8_848484, 59, y - 23, 59, y - 5);
131+ Graphics::fill_rect(vram, x, COL8_000000, 2, y - 3, 59, y - 3);
132+ Graphics::fill_rect(vram, x, COL8_000000, 60, y - 24, 60, y - 3);
133+
134+ Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 24, x - 4, y - 24);
135+ Graphics::fill_rect(vram, x, COL8_848484, x - 47, y - 23, x - 47, y - 4);
136+ Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 47, y - 3, x - 4, y - 3);
137+ Graphics::fill_rect(vram, x, COL8_FFFFFF, x - 3, y - 24, x - 3, y - 3);
138+ return;
139+}
140+
141+void Graphics::draw_char(unsigned short *vram, int xsize, int x, int y, char c, char *font)
142+{
143+ int i;
144+ char d /* data */;
145+ unsigned short *p;
146+ for (i = 0; i < 16; i++) {
147+ p = vram + (y + i) * xsize + x;
148+ d = font[i];
149+ if ((d & 0x80) != 0) { p[0] = table_8_565[c & 0xff]; }
150+ if ((d & 0x40) != 0) { p[1] = table_8_565[c & 0xff]; }
151+ if ((d & 0x20) != 0) { p[2] = table_8_565[c & 0xff]; }
152+ if ((d & 0x10) != 0) { p[3] = table_8_565[c & 0xff]; }
153+ if ((d & 0x08) != 0) { p[4] = table_8_565[c & 0xff]; }
154+ if ((d & 0x04) != 0) { p[5] = table_8_565[c & 0xff]; }
155+ if ((d & 0x02) != 0) { p[6] = table_8_565[c & 0xff]; }
156+ if ((d & 0x01) != 0) { p[7] = table_8_565[c & 0xff]; }
157+ }
158+ return;
159+}
160+
161+void Graphics::draw_string(unsigned short *vram, int xsize, int x, int y, char c, char *s)
162+{
163+ extern char hankaku[4096];
164+ Task *task = Task::now();
165+ char *nihongo = (char *) *((int *) 0x0fe8), *font;
166+ int k, t;
167+
168+ if (task->langmode == 0) {
169+ for (; *s != 0x00; s++) {
170+ Graphics::draw_char(vram, xsize, x, y, c, hankaku + *s * 16);
171+ x += 8;
172+ }
173+ }
174+ if (task->langmode == 1) {
175+ for (; *s != 0x00; s++) {
176+ if (task->langbyte1 == 0) {
177+ if ((0x81 <= *s && *s <= 0x9f) || (0xe0 <= *s && *s <= 0xfc)) {
178+ task->langbyte1 = *s;
179+ } else {
180+ Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
181+ }
182+ } else {
183+ if (0x81 <= task->langbyte1 && task->langbyte1 <= 0x9f) {
184+ k = (task->langbyte1 - 0x81) * 2;
185+ } else {
186+ k = (task->langbyte1 - 0xe0) * 2 + 62;
187+ }
188+ if (0x40 <= *s && *s <= 0x7e) {
189+ t = *s - 0x40;
190+ } else if (0x80 <= *s && *s <= 0x9e) {
191+ t = *s - 0x80 + 63;
192+ } else {
193+ t = *s - 0x9f;
194+ k++;
195+ }
196+ task->langbyte1 = 0;
197+ font = nihongo + 256 * 16 + (k * 94 + t) * 32;
198+ Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
199+ Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
200+ }
201+ x += 8;
202+ }
203+ }
204+ if (task->langmode == 2) {
205+ for (; *s != 0x00; s++) {
206+ if (task->langbyte1 == 0) {
207+ if (0x81 <= *s && *s <= 0xfe) {
208+ task->langbyte1 = *s;
209+ } else {
210+ Graphics::draw_char(vram, xsize, x, y, c, nihongo + *s * 16);
211+ }
212+ } else {
213+ k = task->langbyte1 - 0xa1;
214+ t = *s - 0xa1;
215+ task->langbyte1 = 0;
216+ font = nihongo + 256 * 16 + (k * 94 + t) * 32;
217+ Graphics::draw_char(vram, xsize, x - 8, y, c, font ); /* 左半分 */
218+ Graphics::draw_char(vram, xsize, x , y, c, font + 16); /* 右半分 */
219+ }
220+ x += 8;
221+ }
222+ }
223+ return;
224+}
225+
226+//void putblock8_8(unsigned short *vram, int vxsize, int pxsize,
227+// int pysize, int px0, int py0, unsigned short *buf, int bxsize)
228+//{
229+// int x, y;
230+// for (y = 0; y < pysize; y++) {
231+// for (x = 0; x < pxsize; x++) {
232+// vram[(py0 + y) * vxsize + (px0 + x)] = table_8_565[buf[y * bxsize + x]];
233+// }
234+// }
235+// return;
236+//}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/hankaku.txt (nonexistent)
+++ haribote/trunk/bayos_exp/hankaku.txt (revision 181)
@@ -0,0 +1,4609 @@
1+OSASKの半角フォントを流用
2+
3+char 0x00
4+........
5+........
6+........
7+........
8+........
9+........
10+........
11+........
12+........
13+........
14+........
15+........
16+........
17+........
18+........
19+........
20+
21+char 0x01
22+........
23+........
24+..***...
25+.*...*..
26+*.....*.
27+*.*.*.*.
28+*.*.*.*.
29+*.....*.
30+*.....*.
31+*.*.*.*.
32+*..*..*.
33+.*...*..
34+..***...
35+........
36+........
37+........
38+
39+char 0x02
40+........
41+........
42+..***...
43+.*****..
44+*******.
45+**.*.**.
46+**.*.**.
47+*******.
48+*******.
49+**.*.**.
50+***.***.
51+.*****..
52+..***...
53+........
54+........
55+........
56+
57+char 0x03
58+........
59+........
60+........
61+........
62+.**.**..
63+*******.
64+*******.
65+*******.
66+.*****..
67+..***...
68+...*....
69+........
70+........
71+........
72+........
73+........
74+
75+char 0x04
76+........
77+........
78+........
79+........
80+...*....
81+..***...
82+.*****..
83+*******.
84+.*****..
85+..***...
86+...*....
87+........
88+........
89+........
90+........
91+........
92+
93+char 0x05
94+........
95+........
96+........
97+........
98+...*....
99+..***...
100+.*.*.*..
101+*******.
102+.*.*.*..
103+...*....
104+..***...
105+........
106+........
107+........
108+........
109+........
110+
111+char 0x06
112+........
113+........
114+........
115+........
116+...*....
117+..***...
118+.*****..
119+*******.
120+**.*.**.
121+...*....
122+..***...
123+........
124+........
125+........
126+........
127+........
128+
129+char 0x07
130+........
131+........
132+........
133+........
134+........
135+........
136+...**...
137+..****..
138+..****..
139+...**...
140+........
141+........
142+........
143+........
144+........
145+........
146+
147+char 0x08
148+********
149+********
150+********
151+********
152+********
153+********
154+***..***
155+**....**
156+**....**
157+***..***
158+********
159+********
160+********
161+********
162+********
163+********
164+
165+char 0x09
166+........
167+........
168+........
169+........
170+........
171+..****..
172+.**..**.
173+.*....*.
174+.*....*.
175+.**..**.
176+..****..
177+........
178+........
179+........
180+........
181+........
182+
183+char 0x0a
184+********
185+********
186+********
187+********
188+********
189+**....**
190+*..**..*
191+*.****.*
192+*.****.*
193+*..**..*
194+**....**
195+********
196+********
197+********
198+********
199+********
200+
201+char 0x0b
202+........
203+...*....
204+..***...
205+.*.*.*..
206+*..*..*.
207+...*....
208+...*....
209+..***...
210+.*...*..
211+*.....*.
212+*.....*.
213+*.....*.
214+.*...*..
215+..***...
216+........
217+........
218+
219+char 0x0c
220+........
221+..***...
222+.*...*..
223+*.....*.
224+*.....*.
225+*.....*.
226+.*...*..
227+..***...
228+...*....
229+...*....
230+*******.
231+...*....
232+...*....
233+...*....
234+........
235+........
236+
237+char 0x0d
238+........
239+........
240+....**..
241+....***.
242+....*.**
243+....*.**
244+....*.*.
245+....*...
246+....*...
247+...**...
248+.****...
249+*****...
250+.***....
251+........
252+........
253+........
254+
255+char 0x0e
256+........
257+........
258+...*****
259+...*****
260+...*...*
261+...*...*
262+...*...*
263+...*...*
264+...*...*
265+...*...*
266+.***.***
267+********
268+.**..**.
269+........
270+........
271+........
272+
273+char 0x0f
274+........
275+........
276+........
277+........
278+...*....
279+.*.*.*..
280+..***...
281+..*.*...
282+..***...
283+.*.*.*..
284+...*....
285+........
286+........
287+........
288+........
289+........
290+
291+char 0x10
292+........
293+*.......
294+**......
295+***.....
296+****....
297+*****...
298+******..
299+*******.
300+******..
301+*****...
302+****....
303+***.....
304+**......
305+*.......
306+........
307+........
308+
309+char 0x11
310+........
311+......*.
312+.....**.
313+....***.
314+...****.
315+..*****.
316+.******.
317+*******.
318+.******.
319+..*****.
320+...****.
321+....***.
322+.....**.
323+......*.
324+........
325+........
326+
327+char 0x12
328+........
329+........
330+...*....
331+..***...
332+.*.*.*..
333+*..*..*.
334+...*....
335+...*....
336+...*....
337+*..*..*.
338+.*.*.*..
339+..***...
340+...*....
341+........
342+........
343+........
344+
345+char 0x13
346+........
347+........
348+.*...*..
349+.*...*..
350+.*...*..
351+.*...*..
352+.*...*..
353+.*...*..
354+.*...*..
355+.*...*..
356+........
357+........
358+.*...*..
359+.*...*..
360+........
361+........
362+
363+char 0x14
364+........
365+..*****.
366+.*..*.*.
367+*...*.*.
368+*...*.*.
369+*...*.*.
370+*...*.*.
371+.*..*.*.
372+..***.*.
373+....*.*.
374+....*.*.
375+....*.*.
376+....*.*.
377+....*.*.
378+........
379+........
380+
381+char 0x15
382+.*****..
383+*.....*.
384+.*......
385+..*.....
386+..***...
387+.*...*..
388+*.....*.
389+*.....*.
390+*.....*.
391+.*...*..
392+..***...
393+....*...
394+.....*..
395+*.....*.
396+.*****..
397+........
398+
399+char 0x16
400+........
401+........
402+........
403+........
404+........
405+........
406+........
407+........
408+........
409+........
410+........
411+*******.
412+*******.
413+*******.
414+........
415+........
416+
417+char 0x17
418+........
419+........
420+...*....
421+..***...
422+.*.*.*..
423+*..*..*.
424+...*....
425+...*....
426+...*....
427+*..*..*.
428+.*.*.*..
429+..***...
430+...*....
431+.*****..
432+........
433+........
434+
435+char 0x18
436+........
437+...*....
438+..***...
439+.*.*.*..
440+*..*..*.
441+...*....
442+...*....
443+...*....
444+...*....
445+...*....
446+...*....
447+...*....
448+...*....
449+...*....
450+........
451+........
452+
453+char 0x19
454+........
455+...*....
456+...*....
457+...*....
458+...*....
459+...*....
460+...*....
461+...*....
462+...*....
463+...*....
464+*..*..*.
465+.*.*.*..
466+..***...
467+...*....
468+........
469+........
470+
471+char 0x1a
472+........
473+........
474+........
475+........
476+...*....
477+....*...
478+.....*..
479+*******.
480+.....*..
481+....*...
482+...*....
483+........
484+........
485+........
486+........
487+........
488+
489+char 0x1b
490+........
491+........
492+........
493+........
494+...*....
495+..*.....
496+.*......
497+*******.
498+.*......
499+..*.....
500+...*....
501+........
502+........
503+........
504+........
505+........
506+
507+char 0x1c
508+........
509+........
510+........
511+........
512+........
513+........
514+........
515+........
516+........
517+........
518+........
519+*.......
520+*.......
521+*******.
522+........
523+........
524+
525+char 0x1d
526+........
527+........
528+........
529+........
530+........
531+..*.*...
532+.*...*..
533+*******.
534+.*...*..
535+..*.*...
536+........
537+........
538+........
539+........
540+........
541+........
542+
543+char 0x1e
544+........
545+........
546+........
547+........
548+...*....
549+...*....
550+..***...
551+..***...
552+.*****..
553+.*****..
554+*******.
555+*******.
556+........
557+........
558+........
559+........
560+
561+char 0x1f
562+........
563+........
564+........
565+........
566+*******.
567+*******.
568+.*****..
569+.*****..
570+..***...
571+..***...
572+...*....
573+...*....
574+........
575+........
576+........
577+........
578+
579+char 0x20
580+........
581+........
582+........
583+........
584+........
585+........
586+........
587+........
588+........
589+........
590+........
591+........
592+........
593+........
594+........
595+........
596+
597+char 0x21
598+........
599+...*....
600+...*....
601+...*....
602+...*....
603+...*....
604+...*....
605+...*....
606+...*....
607+...*....
608+........
609+........
610+...*....
611+...*....
612+........
613+........
614+
615+char 0x22
616+..*.*...
617+..*.*...
618+..*.*...
619+........
620+........
621+........
622+........
623+........
624+........
625+........
626+........
627+........
628+........
629+........
630+........
631+........
632+
633+char 0x23
634+........
635+.*...*..
636+.*...*..
637+.*...*..
638+*******.
639+.*...*..
640+.*...*..
641+.*...*..
642+.*...*..
643+.*...*..
644+*******.
645+.*...*..
646+.*...*..
647+.*...*..
648+........
649+........
650+
651+char 0x24
652+...*....
653+..***.*.
654+.*.*.**.
655+*..*..*.
656+*..*..*.
657+*..*....
658+.*.*....
659+..***...
660+...*.*..
661+...*..*.
662+*..*..*.
663+*..*..*.
664+**.*.*..
665+*.***...
666+...*....
667+...*....
668+
669+char 0x25
670+.**...*.
671+*..*..*.
672+*..*.*..
673+*..*.*..
674+.**.*...
675+....*...
676+...*....
677+...*....
678+..*.....
679+..*.**..
680+.*.*..*.
681+.*.*..*.
682+*..*..*.
683+*...**..
684+........
685+........
686+
687+char 0x26
688+........
689+.***....
690+*...*...
691+*...*...
692+*...*...
693+*..*....
694+.**.....
695+.*...***
696+*.*...*.
697+*..*..*.
698+*...*.*.
699+*....*..
700+.*...**.
701+..***..*
702+........
703+........
704+
705+char 0x27
706+.....*..
707+....*...
708+...*....
709+........
710+........
711+........
712+........
713+........
714+........
715+........
716+........
717+........
718+........
719+........
720+........
721+........
722+
723+char 0x28
724+......*.
725+.....*..
726+....*...
727+....*...
728+...*....
729+...*....
730+...*....
731+...*....
732+...*....
733+...*....
734+...*....
735+....*...
736+....*...
737+.....*..
738+......*.
739+........
740+
741+char 0x29
742+*.......
743+.*......
744+..*.....
745+..*.....
746+...*....
747+...*....
748+...*....
749+...*....
750+...*....
751+...*....
752+...*....
753+..*.....
754+..*.....
755+.*......
756+*.......
757+........
758+
759+char 0x2a
760+........
761+........
762+........
763+........
764+........
765+...*....
766+*..*..*.
767+.*.*.*..
768+..***...
769+.*.*.*..
770+*..*..*.
771+...*....
772+........
773+........
774+........
775+........
776+
777+char 0x2b
778+........
779+........
780+........
781+........
782+........
783+...*....
784+...*....
785+...*....
786+*******.
787+...*....
788+...*....
789+...*....
790+........
791+........
792+........
793+........
794+
795+char 0x2c
796+........
797+........
798+........
799+........
800+........
801+........
802+........
803+........
804+........
805+........
806+........
807+...**...
808+...**...
809+....*...
810+....*...
811+...*....
812+
813+char 0x2d
814+........
815+........
816+........
817+........
818+........
819+........
820+........
821+........
822+*******.
823+........
824+........
825+........
826+........
827+........
828+........
829+........
830+
831+char 0x2e
832+........
833+........
834+........
835+........
836+........
837+........
838+........
839+........
840+........
841+........
842+........
843+........
844+...**...
845+...**...
846+........
847+........
848+
849+char 0x2f
850+......*.
851+......*.
852+.....*..
853+.....*..
854+....*...
855+....*...
856+....*...
857+...*....
858+...*....
859+..*.....
860+..*.....
861+.*......
862+.*......
863+.*......
864+*.......
865+*.......
866+
867+char 0x30
868+........
869+...**...
870+..*..*..
871+..*..*..
872+.*....*.
873+.*....*.
874+.*....*.
875+.*....*.
876+.*....*.
877+.*....*.
878+.*....*.
879+..*..*..
880+..*..*..
881+...**...
882+........
883+........
884+
885+char 0x31
886+........
887+....*...
888+...**...
889+..*.*...
890+....*...
891+....*...
892+....*...
893+....*...
894+....*...
895+....*...
896+....*...
897+....*...
898+....*...
899+..*****.
900+........
901+........
902+
903+char 0x32
904+........
905+...**...
906+..*..*..
907+.*....*.
908+.*....*.
909+......*.
910+.....*..
911+....*...
912+...*....
913+..*.....
914+..*.....
915+.*......
916+.*......
917+.******.
918+........
919+........
920+
921+char 0x33
922+........
923+...**...
924+..*..*..
925+.*....*.
926+......*.
927+......*.
928+.....*..
929+...**...
930+.....*..
931+......*.
932+......*.
933+.*....*.
934+..*..*..
935+...**...
936+........
937+........
938+
939+char 0x34
940+........
941+....**..
942+....**..
943+....**..
944+...*.*..
945+...*.*..
946+...*.*..
947+..*..*..
948+..*..*..
949+.*...*..
950+.******.
951+.....*..
952+.....*..
953+...****.
954+........
955+........
956+
957+char 0x35
958+........
959+.*****..
960+.*......
961+.*......
962+.*......
963+.*.**...
964+.**..*..
965+......*.
966+......*.
967+......*.
968+......*.
969+.*....*.
970+..*..*..
971+...**...
972+........
973+........
974+
975+char 0x36
976+........
977+...**...
978+..*..*..
979+.*....*.
980+.*......
981+.*.**...
982+.**..*..
983+.*....*.
984+.*....*.
985+.*....*.
986+.*....*.
987+.*....*.
988+..*..*..
989+...**...
990+........
991+........
992+
993+char 0x37
994+........
995+.******.
996+.*....*.
997+.*....*.
998+.....*..
999+.....*..
1000+....*...
1001+....*...
1002+....*...
1003+...*....
1004+...*....
1005+...*....
1006+...*....
1007+..***...
1008+........
1009+........
1010+
1011+char 0x38
1012+........
1013+...**...
1014+..*..*..
1015+.*....*.
1016+.*....*.
1017+.*....*.
1018+..*..*..
1019+...**...
1020+..*..*..
1021+.*....*.
1022+.*....*.
1023+.*....*.
1024+..*..*..
1025+...**...
1026+........
1027+........
1028+
1029+char 0x39
1030+........
1031+...**...
1032+..*..*..
1033+.*....*.
1034+.*....*.
1035+.*....*.
1036+.*....*.
1037+.*....*.
1038+..*..**.
1039+...**.*.
1040+......*.
1041+.*....*.
1042+..*..*..
1043+...**...
1044+........
1045+........
1046+
1047+char 0x3a
1048+........
1049+........
1050+........
1051+........
1052+........
1053+...**...
1054+...**...
1055+........
1056+........
1057+........
1058+........
1059+........
1060+...**...
1061+...**...
1062+........
1063+........
1064+
1065+char 0x3b
1066+........
1067+........
1068+........
1069+........
1070+........
1071+...**...
1072+...**...
1073+........
1074+........
1075+........
1076+........
1077+...**...
1078+...**...
1079+....*...
1080+....*...
1081+...*....
1082+
1083+char 0x3c
1084+........
1085+......*.
1086+.....*..
1087+....*...
1088+...*....
1089+..*.....
1090+.*......
1091+*.......
1092+*.......
1093+.*......
1094+..*.....
1095+...*....
1096+....*...
1097+.....*..
1098+......*.
1099+........
1100+
1101+char 0x3d
1102+........
1103+........
1104+........
1105+........
1106+........
1107+........
1108+*******.
1109+........
1110+........
1111+*******.
1112+........
1113+........
1114+........
1115+........
1116+........
1117+........
1118+
1119+char 0x3e
1120+........
1121+*.......
1122+.*......
1123+..*.....
1124+...*....
1125+....*...
1126+.....*..
1127+......*.
1128+......*.
1129+.....*..
1130+....*...
1131+...*....
1132+..*.....
1133+.*......
1134+*.......
1135+........
1136+
1137+char 0x3f
1138+........
1139+..***...
1140+.*...*..
1141+*.....*.
1142+*.....*.
1143+*.....*.
1144+.....*..
1145+....*...
1146+...*....
1147+...*....
1148+........
1149+........
1150+...**...
1151+...**...
1152+........
1153+........
1154+
1155+char 0x40
1156+........
1157+..***...
1158+.*...*..
1159+*.....*.
1160+*..**.*.
1161+*.*.*.*.
1162+*.*.*.*.
1163+*.*.*.*.
1164+*.*.*.*.
1165+*.*.*.*.
1166+*..***..
1167+*.......
1168+.*...**.
1169+..***...
1170+........
1171+........
1172+
1173+char 0x41
1174+........
1175+...**...
1176+...**...
1177+...**...
1178+...**...
1179+..*..*..
1180+..*..*..
1181+..*..*..
1182+..*..*..
1183+.******.
1184+.*....*.
1185+.*....*.
1186+.*....*.
1187+***..***
1188+........
1189+........
1190+
1191+char 0x42
1192+........
1193+****....
1194+.*..*...
1195+.*...*..
1196+.*...*..
1197+.*...*..
1198+.*..*...
1199+.****...
1200+.*...*..
1201+.*....*.
1202+.*....*.
1203+.*....*.
1204+.*...*..
1205+*****...
1206+........
1207+........
1208+
1209+char 0x43
1210+........
1211+..***.*.
1212+.*...**.
1213+.*....*.
1214+*.....*.
1215+*.......
1216+*.......
1217+*.......
1218+*.......
1219+*.......
1220+*.....*.
1221+.*....*.
1222+.*...*..
1223+..***...
1224+........
1225+........
1226+
1227+char 0x44
1228+........
1229+*****...
1230+.*...*..
1231+.*...*..
1232+.*....*.
1233+.*....*.
1234+.*....*.
1235+.*....*.
1236+.*....*.
1237+.*....*.
1238+.*....*.
1239+.*...*..
1240+.*...*..
1241+*****...
1242+........
1243+........
1244+
1245+char 0x45
1246+........
1247+*******.
1248+.*....*.
1249+.*....*.
1250+.*......
1251+.*......
1252+.*...*..
1253+.*****..
1254+.*...*..
1255+.*......
1256+.*......
1257+.*....*.
1258+.*....*.
1259+*******.
1260+........
1261+........
1262+
1263+char 0x46
1264+........
1265+*******.
1266+.*....*.
1267+.*....*.
1268+.*......
1269+.*......
1270+.*...*..
1271+.*****..
1272+.*...*..
1273+.*...*..
1274+.*......
1275+.*......
1276+.*......
1277+****....
1278+........
1279+........
1280+
1281+char 0x47
1282+........
1283+..***.*.
1284+.*...**.
1285+.*....*.
1286+*.....*.
1287+*.......
1288+*.......
1289+*..****.
1290+*.....*.
1291+*.....*.
1292+*.....*.
1293+.*....*.
1294+.*...**.
1295+..***...
1296+........
1297+........
1298+
1299+char 0x48
1300+........
1301+***..***
1302+.*....*.
1303+.*....*.
1304+.*....*.
1305+.*....*.
1306+.*....*.
1307+.******.
1308+.*....*.
1309+.*....*.
1310+.*....*.
1311+.*....*.
1312+.*....*.
1313+***..***
1314+........
1315+........
1316+
1317+char 0x49
1318+........
1319+.*****..
1320+...*....
1321+...*....
1322+...*....
1323+...*....
1324+...*....
1325+...*....
1326+...*....
1327+...*....
1328+...*....
1329+...*....
1330+...*....
1331+.*****..
1332+........
1333+........
1334+
1335+char 0x4a
1336+........
1337+...*****
1338+.....*..
1339+.....*..
1340+.....*..
1341+.....*..
1342+.....*..
1343+.....*..
1344+.....*..
1345+.....*..
1346+.....*..
1347+.....*..
1348+*....*..
1349+.*..*...
1350+..**....
1351+........
1352+
1353+char 0x4b
1354+........
1355+***..***
1356+.*....*.
1357+.*...*..
1358+.*..*...
1359+.*.*....
1360+.*.*....
1361+.**.....
1362+.*.*....
1363+.*.*....
1364+.*..*...
1365+.*...*..
1366+.*....*.
1367+***..***
1368+........
1369+........
1370+
1371+char 0x4c
1372+........
1373+****....
1374+.*......
1375+.*......
1376+.*......
1377+.*......
1378+.*......
1379+.*......
1380+.*......
1381+.*......
1382+.*......
1383+.*....*.
1384+.*....*.
1385+*******.
1386+........
1387+........
1388+
1389+char 0x4d
1390+........
1391+**....**
1392+.*....*.
1393+.**..**.
1394+.**..**.
1395+.**..**.
1396+.*.**.*.
1397+.*.**.*.
1398+.*.**.*.
1399+.*....*.
1400+.*....*.
1401+.*....*.
1402+.*....*.
1403+***..***
1404+........
1405+........
1406+
1407+char 0x4e
1408+........
1409+**...***
1410+.*....*.
1411+.**...*.
1412+.**...*.
1413+.*.*..*.
1414+.*.*..*.
1415+.*.*..*.
1416+.*..*.*.
1417+.*..*.*.
1418+.*..*.*.
1419+.*...**.
1420+.*...**.
1421+***...*.
1422+........
1423+........
1424+
1425+char 0x4f
1426+........
1427+..***...
1428+.*...*..
1429+*.....*.
1430+*.....*.
1431+*.....*.
1432+*.....*.
1433+*.....*.
1434+*.....*.
1435+*.....*.
1436+*.....*.
1437+*.....*.
1438+.*...*..
1439+..***...
1440+........
1441+........
1442+
1443+char 0x50
1444+........
1445+*****...
1446+.*...*..
1447+.*....*.
1448+.*....*.
1449+.*....*.
1450+.*...*..
1451+.****...
1452+.*......
1453+.*......
1454+.*......
1455+.*......
1456+.*......
1457+****....
1458+........
1459+........
1460+
1461+char 0x51
1462+........
1463+..***...
1464+.*...*..
1465+*.....*.
1466+*.....*.
1467+*.....*.
1468+*.....*.
1469+*.....*.
1470+*.....*.
1471+*.....*.
1472+*..*..*.
1473+*...*.*.
1474+.*...*..
1475+..***.*.
1476+........
1477+........
1478+
1479+char 0x52
1480+........
1481+******..
1482+.*....*.
1483+.*....*.
1484+.*....*.
1485+.*....*.
1486+.*****..
1487+.*...*..
1488+.*....*.
1489+.*....*.
1490+.*....*.
1491+.*....*.
1492+.*....*.
1493+***..***
1494+........
1495+........
1496+
1497+char 0x53
1498+........
1499+..***.*.
1500+.*...**.
1501+*.....*.
1502+*.....*.
1503+*.......
1504+.*......
1505+..***...
1506+.....*..
1507+......*.
1508+*.....*.
1509+*.....*.
1510+**...*..
1511+*.***...
1512+........
1513+........
1514+
1515+char 0x54
1516+........
1517+*******.
1518+*..*..*.
1519+*..*..*.
1520+...*....
1521+...*....
1522+...*....
1523+...*....
1524+...*....
1525+...*....
1526+...*....
1527+...*....
1528+...*....
1529+.*****..
1530+........
1531+........
1532+
1533+char 0x55
1534+........
1535+***..***
1536+.*....*.
1537+.*....*.
1538+.*....*.
1539+.*....*.
1540+.*....*.
1541+.*....*.
1542+.*....*.
1543+.*....*.
1544+.*....*.
1545+.*....*.
1546+..*..*..
1547+..****..
1548+........
1549+........
1550+
1551+char 0x56
1552+........
1553+***..***
1554+.*....*.
1555+.*....*.
1556+.*....*.
1557+.*....*.
1558+..*..*..
1559+..*..*..
1560+..*..*..
1561+..*..*..
1562+...**...
1563+...**...
1564+...**...
1565+...**...
1566+........
1567+........
1568+
1569+char 0x57
1570+........
1571+***..***
1572+.*....*.
1573+.*....*.
1574+.*....*.
1575+.*.**.*.
1576+.*.**.*.
1577+.*.**.*.
1578+.*.**.*.
1579+..*..*..
1580+..*..*..
1581+..*..*..
1582+..*..*..
1583+..*..*..
1584+........
1585+........
1586+
1587+char 0x58
1588+........
1589+***..***
1590+.*....*.
1591+.*....*.
1592+..*..*..
1593+..*..*..
1594+..*..*..
1595+...**...
1596+..*..*..
1597+..*..*..
1598+..*..*..
1599+.*....*.
1600+.*....*.
1601+***..***
1602+........
1603+........
1604+
1605+char 0x59
1606+........
1607+***.***.
1608+.*...*..
1609+.*...*..
1610+.*...*..
1611+..*.*...
1612+..*.*...
1613+..*.*...
1614+...*....
1615+...*....
1616+...*....
1617+...*....
1618+...*....
1619+.*****..
1620+........
1621+........
1622+
1623+char 0x5a
1624+........
1625+*******.
1626+*....*..
1627+*....*..
1628+....*...
1629+....*...
1630+...*....
1631+...*....
1632+..*.....
1633+..*.....
1634+.*......
1635+.*....*.
1636+*.....*.
1637+*******.
1638+........
1639+........
1640+
1641+char 0x5b
1642+........
1643+..*****.
1644+..*.....
1645+..*.....
1646+..*.....
1647+..*.....
1648+..*.....
1649+..*.....
1650+..*.....
1651+..*.....
1652+..*.....
1653+..*.....
1654+..*.....
1655+..*.....
1656+..*****.
1657+........
1658+
1659+char 0x5c
1660+*.......
1661+*.......
1662+.*......
1663+.*......
1664+..*.....
1665+..*.....
1666+..*.....
1667+...*....
1668+...*....
1669+....*...
1670+....*...
1671+.....*..
1672+.....*..
1673+.....*..
1674+......*.
1675+......*.
1676+
1677+char 0x5d
1678+........
1679+.*****..
1680+.....*..
1681+.....*..
1682+.....*..
1683+.....*..
1684+.....*..
1685+.....*..
1686+.....*..
1687+.....*..
1688+.....*..
1689+.....*..
1690+.....*..
1691+.....*..
1692+.*****..
1693+........
1694+
1695+char 0x5e
1696+........
1697+...*....
1698+..*.*...
1699+.*...*..
1700+*.....*.
1701+........
1702+........
1703+........
1704+........
1705+........
1706+........
1707+........
1708+........
1709+........
1710+........
1711+........
1712+
1713+char 0x5f
1714+........
1715+........
1716+........
1717+........
1718+........
1719+........
1720+........
1721+........
1722+........
1723+........
1724+........
1725+........
1726+........
1727+........
1728+*******.
1729+........
1730+
1731+char 0x60
1732+...*....
1733+....*...
1734+.....*..
1735+........
1736+........
1737+........
1738+........
1739+........
1740+........
1741+........
1742+........
1743+........
1744+........
1745+........
1746+........
1747+........
1748+
1749+char 0x61
1750+........
1751+........
1752+........
1753+........
1754+........
1755+.***....
1756+....*...
1757+.....*..
1758+..****..
1759+.*...*..
1760+*....*..
1761+*....*..
1762+*...**..
1763+.***.**.
1764+........
1765+........
1766+
1767+char 0x62
1768+**......
1769+.*......
1770+.*......
1771+.*......
1772+.*......
1773+.*.**...
1774+.**..*..
1775+.*....*.
1776+.*....*.
1777+.*....*.
1778+.*....*.
1779+.*....*.
1780+.**..*..
1781+.*.**...
1782+........
1783+........
1784+
1785+char 0x63
1786+........
1787+........
1788+........
1789+........
1790+........
1791+..**....
1792+.*..**..
1793+*....*..
1794+*....*..
1795+*.......
1796+*.......
1797+*.....*.
1798+.*...*..
1799+..***...
1800+........
1801+........
1802+
1803+char 0x64
1804+....**..
1805+.....*..
1806+.....*..
1807+.....*..
1808+.....*..
1809+..**.*..
1810+.*..**..
1811+*....*..
1812+*....*..
1813+*....*..
1814+*....*..
1815+*....*..
1816+.*..**..
1817+..**.**.
1818+........
1819+........
1820+
1821+char 0x65
1822+........
1823+........
1824+........
1825+........
1826+........
1827+..***...
1828+.*...*..
1829+*.....*.
1830+*.....*.
1831+******..
1832+*.......
1833+*.....*.
1834+.*....*.
1835+..****..
1836+........
1837+........
1838+
1839+char 0x66
1840+....***.
1841+...*....
1842+...*....
1843+...*....
1844+...*....
1845+.*****..
1846+...*....
1847+...*....
1848+...*....
1849+...*....
1850+...*....
1851+...*....
1852+...*....
1853+.*****..
1854+........
1855+........
1856+
1857+char 0x67
1858+........
1859+........
1860+........
1861+........
1862+........
1863+..**.**.
1864+.*..**..
1865+*....*..
1866+*....*..
1867+*....*..
1868+*....*..
1869+.*..**..
1870+..**.*..
1871+.....*..
1872+.....*..
1873+.****...
1874+
1875+char 0x68
1876+**......
1877+.*......
1878+.*......
1879+.*......
1880+.*......
1881+.*.**...
1882+.**..*..
1883+.*....*.
1884+.*....*.
1885+.*....*.
1886+.*....*.
1887+.*....*.
1888+.*....*.
1889+***...**
1890+........
1891+........
1892+
1893+char 0x69
1894+........
1895+...*....
1896+...*....
1897+........
1898+........
1899+..**....
1900+...*....
1901+...*....
1902+...*....
1903+...*....
1904+...*....
1905+...*....
1906+...*....
1907+..***...
1908+........
1909+........
1910+
1911+char 0x6a
1912+........
1913+.....*..
1914+.....*..
1915+........
1916+........
1917+....**..
1918+.....*..
1919+.....*..
1920+.....*..
1921+.....*..
1922+.....*..
1923+.....*..
1924+.....*..
1925+....*...
1926+....*...
1927+..**....
1928+
1929+char 0x6b
1930+**......
1931+.*......
1932+.*......
1933+.*......
1934+.*......
1935+.*..***.
1936+.*...*..
1937+.*..*...
1938+.*.*....
1939+.**.....
1940+.*.*....
1941+.*..*...
1942+.*...*..
1943+***..**.
1944+........
1945+........
1946+
1947+char 0x6c
1948+..**....
1949+...*....
1950+...*....
1951+...*....
1952+...*....
1953+...*....
1954+...*....
1955+...*....
1956+...*....
1957+...*....
1958+...*....
1959+...*....
1960+...*....
1961+..***...
1962+........
1963+........
1964+
1965+char 0x6d
1966+........
1967+........
1968+........
1969+........
1970+........
1971+****.**.
1972+.*..*..*
1973+.*..*..*
1974+.*..*..*
1975+.*..*..*
1976+.*..*..*
1977+.*..*..*
1978+.*..*..*
1979+**.**.**
1980+........
1981+........
1982+
1983+char 0x6e
1984+........
1985+........
1986+........
1987+........
1988+........
1989+**.**...
1990+.**..*..
1991+.*....*.
1992+.*....*.
1993+.*....*.
1994+.*....*.
1995+.*....*.
1996+.*....*.
1997+***...**
1998+........
1999+........
2000+
2001+char 0x6f
2002+........
2003+........
2004+........
2005+........
2006+........
2007+..***...
2008+.*...*..
2009+*.....*.
2010+*.....*.
2011+*.....*.
2012+*.....*.
2013+*.....*.
2014+.*...*..
2015+..***...
2016+........
2017+........
2018+
2019+char 0x70
2020+........
2021+........
2022+........
2023+........
2024+........
2025+**.**...
2026+.**..*..
2027+.*....*.
2028+.*....*.
2029+.*....*.
2030+.*....*.
2031+.*....*.
2032+.**..*..
2033+.*.**...
2034+.*......
2035+***.....
2036+
2037+char 0x71
2038+........
2039+........
2040+........
2041+........
2042+........
2043+..**.*..
2044+.*..**..
2045+*....*..
2046+*....*..
2047+*....*..
2048+*....*..
2049+*....*..
2050+.*..**..
2051+..**.*..
2052+.....*..
2053+....***.
2054+
2055+char 0x72
2056+........
2057+........
2058+........
2059+........
2060+........
2061+**.***..
2062+.**...*.
2063+.*....*.
2064+.*......
2065+.*......
2066+.*......
2067+.*......
2068+.*......
2069+***.....
2070+........
2071+........
2072+
2073+char 0x73
2074+........
2075+........
2076+........
2077+........
2078+........
2079+.****.*.
2080+*....**.
2081+*.....*.
2082+**......
2083+..***...
2084+.....**.
2085+*.....*.
2086+**....*.
2087+*.****..
2088+........
2089+........
2090+
2091+char 0x74
2092+........
2093+........
2094+...*....
2095+...*....
2096+...*....
2097+.*****..
2098+...*....
2099+...*....
2100+...*....
2101+...*....
2102+...*....
2103+...*....
2104+...*....
2105+....***.
2106+........
2107+........
2108+
2109+char 0x75
2110+........
2111+........
2112+........
2113+........
2114+........
2115+**...**.
2116+.*....*.
2117+.*....*.
2118+.*....*.
2119+.*....*.
2120+.*....*.
2121+.*....*.
2122+.*...**.
2123+..***.**
2124+........
2125+........
2126+
2127+char 0x76
2128+........
2129+........
2130+........
2131+........
2132+........
2133+***..***
2134+.*....*.
2135+.*....*.
2136+.*....*.
2137+..*..*..
2138+..*..*..
2139+..*..*..
2140+...**...
2141+...**...
2142+........
2143+........
2144+
2145+char 0x77
2146+........
2147+........
2148+........
2149+........
2150+........
2151+***..***
2152+.*....*.
2153+.*....*.
2154+.*.**.*.
2155+.*.**.*.
2156+.*.**.*.
2157+..*..*..
2158+..*..*..
2159+..*..*..
2160+........
2161+........
2162+
2163+char 0x78
2164+........
2165+........
2166+........
2167+........
2168+........
2169+**...**.
2170+.*...*..
2171+..*.*...
2172+..*.*...
2173+...*....
2174+..*.*...
2175+..*.*...
2176+.*...*..
2177+**...**.
2178+........
2179+........
2180+
2181+char 0x79
2182+........
2183+........
2184+........
2185+........
2186+........
2187+***..***
2188+.*....*.
2189+.*....*.
2190+..*..*..
2191+..*..*..
2192+..*..*..
2193+...**...
2194+...**...
2195+...*....
2196+...*....
2197+.**.....
2198+
2199+char 0x7a
2200+........
2201+........
2202+........
2203+........
2204+........
2205+*******.
2206+*.....*.
2207+*....*..
2208+....*...
2209+...*....
2210+..*.....
2211+.*....*.
2212+*.....*.
2213+*******.
2214+........
2215+........
2216+
2217+char 0x7b
2218+........
2219+.....**.
2220+....*...
2221+...*....
2222+...*....
2223+...*....
2224+...*....
2225+.**.....
2226+...*....
2227+...*....
2228+...*....
2229+...*....
2230+....*...
2231+.....**.
2232+........
2233+........
2234+
2235+char 0x7c
2236+...*....
2237+...*....
2238+...*....
2239+...*....
2240+...*....
2241+...*....
2242+...*....
2243+...*....
2244+...*....
2245+...*....
2246+...*....
2247+...*....
2248+...*....
2249+...*....
2250+...*....
2251+...*....
2252+
2253+char 0x7d
2254+........
2255+.**.....
2256+...*....
2257+....*...
2258+....*...
2259+....*...
2260+....*...
2261+.....**.
2262+....*...
2263+....*...
2264+....*...
2265+....*...
2266+...*....
2267+.**.....
2268+........
2269+........
2270+
2271+char 0x7e
2272+........
2273+.***..*.
2274+*...**..
2275+........
2276+........
2277+........
2278+........
2279+........
2280+........
2281+........
2282+........
2283+........
2284+........
2285+........
2286+........
2287+........
2288+
2289+char 0x7f
2290+........
2291+........
2292+........
2293+........
2294+...*....
2295+..*.*...
2296+.*...*..
2297+*.....*.
2298+*******.
2299+*.....*.
2300+*******.
2301+........
2302+........
2303+........
2304+........
2305+........
2306+
2307+char 0x80
2308+........
2309+..***...
2310+.*...*..
2311+*.....*.
2312+*.......
2313+*.......
2314+*.......
2315+*.......
2316+*.......
2317+*.......
2318+*.......
2319+*.....*.
2320+.*...*..
2321+..***...
2322+...*....
2323+..*.....
2324+
2325+char 0x81
2326+........
2327+........
2328+..*..*..
2329+..*..*..
2330+........
2331+*.....*.
2332+*.....*.
2333+*.....*.
2334+*.....*.
2335+*.....*.
2336+*.....*.
2337+*.....*.
2338+.*....*.
2339+..*****.
2340+........
2341+........
2342+
2343+char 0x82
2344+....**..
2345+....*...
2346+...*....
2347+........
2348+........
2349+..***...
2350+.*...*..
2351+*.....*.
2352+*.....*.
2353+*******.
2354+*.......
2355+*.....*.
2356+.*...*..
2357+..***...
2358+........
2359+........
2360+
2361+char 0x83
2362+........
2363+...*....
2364+..*.*...
2365+.*...*..
2366+........
2367+.****...
2368+.....*..
2369+.....*..
2370+..****..
2371+.*...*..
2372+*....*..
2373+*....*..
2374+.*...*..
2375+..*****.
2376+........
2377+........
2378+
2379+char 0x84
2380+........
2381+........
2382+..*..*..
2383+..*..*..
2384+........
2385+.****...
2386+.....*..
2387+.....*..
2388+..****..
2389+.*...*..
2390+*....*..
2391+*....*..
2392+.*...*..
2393+..*****.
2394+........
2395+........
2396+
2397+char 0x85
2398+...*....
2399+....*...
2400+.....*..
2401+........
2402+........
2403+.****...
2404+.....*..
2405+.....*..
2406+..****..
2407+.*...*..
2408+*....*..
2409+*....*..
2410+.*...*..
2411+..*****.
2412+........
2413+........
2414+
2415+char 0x86
2416+........
2417+...**...
2418+..*..*..
2419+...**...
2420+........
2421+.****...
2422+.....*..
2423+.....*..
2424+..****..
2425+.*...*..
2426+*....*..
2427+*....*..
2428+.*...*..
2429+..*****.
2430+........
2431+........
2432+
2433+char 0x87
2434+........
2435+........
2436+........
2437+........
2438+........
2439+..****..
2440+.*....*.
2441+*.......
2442+*.......
2443+*.......
2444+*.......
2445+*.......
2446+.*....*.
2447+..****..
2448+....*...
2449+...*....
2450+
2451+char 0x88
2452+........
2453+...*....
2454+..*.*...
2455+.*...*..
2456+........
2457+..***...
2458+.*...*..
2459+*.....*.
2460+*.....*.
2461+*******.
2462+*.......
2463+*.....*.
2464+.*...*..
2465+..***...
2466+........
2467+........
2468+
2469+char 0x89
2470+........
2471+........
2472+..*..*..
2473+..*..*..
2474+........
2475+..***...
2476+.*...*..
2477+*.....*.
2478+*.....*.
2479+*******.
2480+*.......
2481+*.....*.
2482+.*...*..
2483+..***...
2484+........
2485+........
2486+
2487+char 0x8a
2488+...*....
2489+....*...
2490+.....*..
2491+........
2492+........
2493+..***...
2494+.*...*..
2495+*.....*.
2496+*.....*.
2497+*******.
2498+*.......
2499+*.....*.
2500+.*...*..
2501+..***...
2502+........
2503+........
2504+
2505+char 0x8b
2506+........
2507+........
2508+..*..*..
2509+..*..*..
2510+........
2511+...*....
2512+...*....
2513+...*....
2514+...*....
2515+...*....
2516+...*....
2517+...*....
2518+...*....
2519+...*....
2520+........
2521+........
2522+
2523+char 0x8c
2524+........
2525+...*....
2526+..*.*...
2527+.*...*..
2528+........
2529+...*....
2530+...*....
2531+...*....
2532+...*....
2533+...*....
2534+...*....
2535+...*....
2536+...*....
2537+...*....
2538+........
2539+........
2540+
2541+char 0x8d
2542+...*....
2543+....*...
2544+.....*..
2545+........
2546+........
2547+...*....
2548+...*....
2549+...*....
2550+...*....
2551+...*....
2552+...*....
2553+...*....
2554+...*....
2555+...*....
2556+........
2557+........
2558+
2559+char 0x8e
2560+..*..*..
2561+..*..*..
2562+........
2563+..***...
2564+.*...*..
2565+*.....*.
2566+*.....*.
2567+*.....*.
2568+*.....*.
2569+*******.
2570+*.....*.
2571+*.....*.
2572+*.....*.
2573+*.....*.
2574+........
2575+........
2576+
2577+char 0x8f
2578+........
2579+..***...
2580+.*...*..
2581+..***...
2582+.*...*..
2583+*.....*.
2584+*.....*.
2585+*.....*.
2586+*.....*.
2587+*******.
2588+*.....*.
2589+*.....*.
2590+*.....*.
2591+*.....*.
2592+........
2593+........
2594+
2595+char 0x90
2596+....**..
2597+....*...
2598+...*....
2599+*******.
2600+*.......
2601+*.......
2602+*.......
2603+*.......
2604+*****...
2605+*.......
2606+*.......
2607+*.......
2608+*.......
2609+*******.
2610+........
2611+........
2612+
2613+char 0x91
2614+........
2615+........
2616+........
2617+........
2618+........
2619+.**.....
2620+...***..
2621+...*..*.
2622+.***..*.
2623+*..****.
2624+*..*....
2625+*..*....
2626+*..*..*.
2627+.**.**..
2628+........
2629+........
2630+
2631+char 0x92
2632+....**..
2633+...*....
2634+..*.....
2635+..*.*...
2636+..*.*...
2637+..*.*...
2638+*******.
2639+..*.*...
2640+..*.*...
2641+..*.*...
2642+..*.*...
2643+..*.*...
2644+..*.*...
2645+..*.*...
2646+........
2647+........
2648+
2649+char 0x93
2650+........
2651+...*....
2652+..*.*...
2653+.*...*..
2654+........
2655+..***...
2656+.*...*..
2657+*.....*.
2658+*.....*.
2659+*.....*.
2660+*.....*.
2661+*.....*.
2662+.*...*..
2663+..***...
2664+........
2665+........
2666+
2667+char 0x94
2668+........
2669+........
2670+..*..*..
2671+..*..*..
2672+........
2673+..***...
2674+.*...*..
2675+*.....*.
2676+*.....*.
2677+*.....*.
2678+*.....*.
2679+*.....*.
2680+.*...*..
2681+..***...
2682+........
2683+........
2684+
2685+char 0x95
2686+...*....
2687+....*...
2688+.....*..
2689+........
2690+........
2691+..***...
2692+.*...*..
2693+*.....*.
2694+*.....*.
2695+*.....*.
2696+*.....*.
2697+*.....*.
2698+.*...*..
2699+..***...
2700+........
2701+........
2702+
2703+char 0x96
2704+........
2705+...*....
2706+..*.*...
2707+.*...*..
2708+........
2709+*.....*.
2710+*.....*.
2711+*.....*.
2712+*.....*.
2713+*.....*.
2714+*.....*.
2715+*.....*.
2716+.*....*.
2717+..*****.
2718+........
2719+........
2720+
2721+char 0x97
2722+...*....
2723+....*...
2724+.....*..
2725+........
2726+........
2727+*.....*.
2728+*.....*.
2729+*.....*.
2730+*.....*.
2731+*.....*.
2732+*.....*.
2733+*.....*.
2734+.*....*.
2735+..*****.
2736+........
2737+........
2738+
2739+char 0x98
2740+........
2741+........
2742+..*..*..
2743+..*..*..
2744+........
2745+*.....*.
2746+*.....*.
2747+.*...*..
2748+.*...*..
2749+..*.*...
2750+..*.*...
2751+...*....
2752+...*....
2753+..*.....
2754+..*.....
2755+.*......
2756+
2757+char 0x99
2758+..*..*..
2759+..*..*..
2760+........
2761+..***...
2762+.*...*..
2763+*.....*.
2764+*.....*.
2765+*.....*.
2766+*.....*.
2767+*.....*.
2768+*.....*.
2769+*.....*.
2770+.*...*..
2771+..***...
2772+........
2773+........
2774+
2775+char 0x9a
2776+..*..*..
2777+..*..*..
2778+........
2779+*.....*.
2780+*.....*.
2781+*.....*.
2782+*.....*.
2783+*.....*.
2784+*.....*.
2785+*.....*.
2786+*.....*.
2787+*.....*.
2788+.*...*..
2789+..***...
2790+........
2791+........
2792+
2793+char 0x9b
2794+........
2795+..*.*...
2796+..*.*...
2797+..*.*...
2798+..****..
2799+.**.*.*.
2800+*.*.*...
2801+*.*.*...
2802+*.*.*...
2803+*.*.*...
2804+*.*.*...
2805+.**.*.*.
2806+..****..
2807+..*.*...
2808+..*.*...
2809+..*.*...
2810+
2811+char 0x9c
2812+........
2813+....**..
2814+...*..*.
2815+..*.....
2816+..*.....
2817+..*.....
2818+******..
2819+..*.....
2820+..*.....
2821+..*.....
2822+.**.....
2823+*.*.....
2824+*.**..*.
2825+.*..**..
2826+........
2827+........
2828+
2829+char 0x9d
2830+........
2831+*.....*.
2832+*.....*.
2833+.*...*..
2834+..*.*...
2835+...*....
2836+*******.
2837+...*....
2838+...*....
2839+*******.
2840+...*....
2841+...*....
2842+...*....
2843+...*....
2844+........
2845+........
2846+
2847+char 0x9e
2848+........
2849+***.....
2850+*..*....
2851+*...*...
2852+*...*...
2853+*...*...
2854+*..*.*..
2855+***..*..
2856+*..*****
2857+*....*..
2858+*....*..
2859+*....*..
2860+*....*..
2861+*....*..
2862+........
2863+........
2864+
2865+char 0x9f
2866+........
2867+....**..
2868+...*..*.
2869+...*....
2870+...*....
2871+...*....
2872+*******.
2873+...*....
2874+...*....
2875+...*....
2876+...*....
2877+...*....
2878+*..*....
2879+.**.....
2880+........
2881+........
2882+
2883+char 0xa0
2884+....**..
2885+....*...
2886+...*....
2887+........
2888+........
2889+.****...
2890+.....*..
2891+.....*..
2892+..****..
2893+.*...*..
2894+*....*..
2895+*....*..
2896+.*...*..
2897+..*****.
2898+........
2899+........
2900+
2901+char 0xa1
2902+....**..
2903+....*...
2904+...*....
2905+........
2906+........
2907+...*....
2908+...*....
2909+...*....
2910+...*....
2911+...*....
2912+...*....
2913+...*....
2914+...*....
2915+...*....
2916+........
2917+........
2918+
2919+char 0xa2
2920+....**..
2921+....*...
2922+...*....
2923+........
2924+........
2925+..***...
2926+.*...*..
2927+*.....*.
2928+*.....*.
2929+*.....*.
2930+*.....*.
2931+*.....*.
2932+.*...*..
2933+..***...
2934+........
2935+........
2936+
2937+char 0xa3
2938+....**..
2939+....*...
2940+...*....
2941+........
2942+........
2943+*.....*.
2944+*.....*.
2945+*.....*.
2946+*.....*.
2947+*.....*.
2948+*.....*.
2949+*.....*.
2950+.*....*.
2951+..*****.
2952+........
2953+........
2954+
2955+char 0xa4
2956+........
2957+...*..*.
2958+..*.*.*.
2959+..*..*..
2960+........
2961+*****...
2962+*....*..
2963+*.....*.
2964+*.....*.
2965+*.....*.
2966+*.....*.
2967+*.....*.
2968+*.....*.
2969+*.....*.
2970+........
2971+........
2972+
2973+char 0xa5
2974+...*..*.
2975+..*.*.*.
2976+..*..*..
2977+........
2978+*.....*.
2979+**....*.
2980+**....*.
2981+*.*...*.
2982+*..*..*.
2983+*..*..*.
2984+*...*.*.
2985+*....**.
2986+*....**.
2987+*.....*.
2988+........
2989+........
2990+
2991+char 0xa6
2992+........
2993+........
2994+........
2995+.****...
2996+.....*..
2997+.....*..
2998+..****..
2999+.*...*..
3000+*....*..
3001+*....*..
3002+.*...*..
3003+..*****.
3004+........
3005+*******.
3006+........
3007+........
3008+
3009+char 0xa7
3010+........
3011+........
3012+........
3013+..***...
3014+.*...*..
3015+*.....*.
3016+*.....*.
3017+*.....*.
3018+*.....*.
3019+*.....*.
3020+.*...*..
3021+..***...
3022+........
3023+*******.
3024+........
3025+........
3026+
3027+char 0xa8
3028+........
3029+...*....
3030+...*....
3031+........
3032+........
3033+...*....
3034+...*....
3035+..*.....
3036+.*...*..
3037+*.....*.
3038+*.....*.
3039+*.....*.
3040+.*...*..
3041+..***...
3042+........
3043+........
3044+
3045+char 0xa9
3046+........
3047+........
3048+........
3049+........
3050+........
3051+........
3052+........
3053+........
3054+........
3055+........
3056+*******.
3057+*.......
3058+*.......
3059+*.......
3060+........
3061+........
3062+
3063+char 0xaa
3064+........
3065+........
3066+........
3067+........
3068+........
3069+........
3070+........
3071+........
3072+........
3073+........
3074+*******.
3075+......*.
3076+......*.
3077+......*.
3078+........
3079+........
3080+
3081+char 0xab
3082+........
3083+...*....
3084+..**....
3085+...*....
3086+...*....
3087+...*....
3088+........
3089+*******.
3090+........
3091+.****...
3092+.....*..
3093+..***...
3094+.*......
3095+.*****..
3096+........
3097+........
3098+
3099+char 0xac
3100+........
3101+...*....
3102+..**....
3103+...*....
3104+...*....
3105+...*....
3106+........
3107+*******.
3108+........
3109+...**...
3110+..*.*...
3111+.*..*...
3112+.*****..
3113+....*...
3114+........
3115+........
3116+
3117+char 0xad
3118+........
3119+...*....
3120+...*....
3121+........
3122+........
3123+...*....
3124+...*....
3125+...*....
3126+...*....
3127+...*....
3128+...*....
3129+...*....
3130+...*....
3131+...*....
3132+........
3133+........
3134+
3135+char 0xae
3136+........
3137+........
3138+........
3139+........
3140+...*..*.
3141+..*..*..
3142+.*..*...
3143+*..*....
3144+*..*....
3145+.*..*...
3146+..*..*..
3147+...*..*.
3148+........
3149+........
3150+........
3151+........
3152+
3153+char 0xaf
3154+........
3155+........
3156+........
3157+........
3158+*..*....
3159+.*..*...
3160+..*..*..
3161+...*..*.
3162+...*..*.
3163+..*..*..
3164+.*..*...
3165+*..*....
3166+........
3167+........
3168+........
3169+........
3170+
3171+char 0xb0
3172+...*...*
3173+.*...*..
3174+...*...*
3175+.*...*..
3176+...*...*
3177+.*...*..
3178+...*...*
3179+.*...*..
3180+...*...*
3181+.*...*..
3182+...*...*
3183+.*...*..
3184+...*...*
3185+.*...*..
3186+...*...*
3187+.*...*..
3188+
3189+char 0xb1
3190+.*.*.*.*
3191+*.*.*.*.
3192+.*.*.*.*
3193+*.*.*.*.
3194+.*.*.*.*
3195+*.*.*.*.
3196+.*.*.*.*
3197+*.*.*.*.
3198+.*.*.*.*
3199+*.*.*.*.
3200+.*.*.*.*
3201+*.*.*.*.
3202+.*.*.*.*
3203+*.*.*.*.
3204+.*.*.*.*
3205+*.*.*.*.
3206+
3207+char 0xb2
3208+.***.***
3209+**.***.*
3210+.***.***
3211+**.***.*
3212+.***.***
3213+**.***.*
3214+.***.***
3215+**.***.*
3216+.***.***
3217+**.***.*
3218+.***.***
3219+**.***.*
3220+.***.***
3221+**.***.*
3222+.***.***
3223+**.***.*
3224+
3225+char 0xb3
3226+...*....
3227+...*....
3228+...*....
3229+...*....
3230+...*....
3231+...*....
3232+...*....
3233+...*....
3234+...*....
3235+...*....
3236+...*....
3237+...*....
3238+...*....
3239+...*....
3240+...*....
3241+...*....
3242+
3243+char 0xb4
3244+...*....
3245+...*....
3246+...*....
3247+...*....
3248+...*....
3249+...*....
3250+...*....
3251+****....
3252+...*....
3253+...*....
3254+...*....
3255+...*....
3256+...*....
3257+...*....
3258+...*....
3259+...*....
3260+
3261+char 0xb5
3262+...*....
3263+...*....
3264+...*....
3265+...*....
3266+...*....
3267+...*....
3268+...*....
3269+****....
3270+...*....
3271+****....
3272+...*....
3273+...*....
3274+...*....
3275+...*....
3276+...*....
3277+...*....
3278+
3279+char 0xb6
3280+...*.*..
3281+...*.*..
3282+...*.*..
3283+...*.*..
3284+...*.*..
3285+...*.*..
3286+...*.*..
3287+****.*..
3288+...*.*..
3289+...*.*..
3290+...*.*..
3291+...*.*..
3292+...*.*..
3293+...*.*..
3294+...*.*..
3295+...*.*..
3296+
3297+char 0xb7
3298+........
3299+........
3300+........
3301+........
3302+........
3303+........
3304+........
3305+******..
3306+...*.*..
3307+...*.*..
3308+...*.*..
3309+...*.*..
3310+...*.*..
3311+...*.*..
3312+...*.*..
3313+...*.*..
3314+
3315+char 0xb8
3316+........
3317+........
3318+........
3319+........
3320+........
3321+........
3322+........
3323+****....
3324+...*....
3325+****....
3326+...*....
3327+...*....
3328+...*....
3329+...*....
3330+...*....
3331+...*....
3332+
3333+char 0xb9
3334+...*.*..
3335+...*.*..
3336+...*.*..
3337+...*.*..
3338+...*.*..
3339+...*.*..
3340+...*.*..
3341+****.*..
3342+.....*..
3343+****.*..
3344+...*.*..
3345+...*.*..
3346+...*.*..
3347+...*.*..
3348+...*.*..
3349+...*.*..
3350+
3351+char 0xba
3352+...*.*..
3353+...*.*..
3354+...*.*..
3355+...*.*..
3356+...*.*..
3357+...*.*..
3358+...*.*..
3359+...*.*..
3360+...*.*..
3361+...*.*..
3362+...*.*..
3363+...*.*..
3364+...*.*..
3365+...*.*..
3366+...*.*..
3367+...*.*..
3368+
3369+char 0xbb
3370+........
3371+........
3372+........
3373+........
3374+........
3375+........
3376+........
3377+******..
3378+.....*..
3379+****.*..
3380+...*.*..
3381+...*.*..
3382+...*.*..
3383+...*.*..
3384+...*.*..
3385+...*.*..
3386+
3387+char 0xbc
3388+...*.*..
3389+...*.*..
3390+...*.*..
3391+...*.*..
3392+...*.*..
3393+...*.*..
3394+...*.*..
3395+****.*..
3396+.....*..
3397+******..
3398+........
3399+........
3400+........
3401+........
3402+........
3403+........
3404+
3405+char 0xbd
3406+...*.*..
3407+...*.*..
3408+...*.*..
3409+...*.*..
3410+...*.*..
3411+...*.*..
3412+...*.*..
3413+******..
3414+........
3415+........
3416+........
3417+........
3418+........
3419+........
3420+........
3421+........
3422+
3423+char 0xbe
3424+...*....
3425+...*....
3426+...*....
3427+...*....
3428+...*....
3429+...*....
3430+...*....
3431+****....
3432+...*....
3433+****....
3434+........
3435+........
3436+........
3437+........
3438+........
3439+........
3440+
3441+char 0xbf
3442+........
3443+........
3444+........
3445+........
3446+........
3447+........
3448+........
3449+****....
3450+...*....
3451+...*....
3452+...*....
3453+...*....
3454+...*....
3455+...*....
3456+...*....
3457+...*....
3458+
3459+char 0xc0
3460+...*....
3461+...*....
3462+...*....
3463+...*....
3464+...*....
3465+...*....
3466+...*....
3467+...*****
3468+........
3469+........
3470+........
3471+........
3472+........
3473+........
3474+........
3475+........
3476+
3477+char 0xc1
3478+...*....
3479+...*....
3480+...*....
3481+...*....
3482+...*....
3483+...*....
3484+...*....
3485+********
3486+........
3487+........
3488+........
3489+........
3490+........
3491+........
3492+........
3493+........
3494+
3495+char 0xc2
3496+........
3497+........
3498+........
3499+........
3500+........
3501+........
3502+........
3503+********
3504+...*....
3505+...*....
3506+...*....
3507+...*....
3508+...*....
3509+...*....
3510+...*....
3511+...*....
3512+
3513+char 0xc3
3514+...*....
3515+...*....
3516+...*....
3517+...*....
3518+...*....
3519+...*....
3520+...*....
3521+...*****
3522+...*....
3523+...*....
3524+...*....
3525+...*....
3526+...*....
3527+...*....
3528+...*....
3529+...*....
3530+
3531+char 0xc4
3532+........
3533+........
3534+........
3535+........
3536+........
3537+........
3538+........
3539+********
3540+........
3541+........
3542+........
3543+........
3544+........
3545+........
3546+........
3547+........
3548+
3549+char 0xc5
3550+...*....
3551+...*....
3552+...*....
3553+...*....
3554+...*....
3555+...*....
3556+...*....
3557+********
3558+...*....
3559+...*....
3560+...*....
3561+...*....
3562+...*....
3563+...*....
3564+...*....
3565+...*....
3566+
3567+char 0xc6
3568+...*....
3569+...*....
3570+...*....
3571+...*....
3572+...*....
3573+...*....
3574+...*....
3575+...*****
3576+...*....
3577+...*****
3578+...*....
3579+...*....
3580+...*....
3581+...*....
3582+...*....
3583+...*....
3584+
3585+char 0xc7
3586+...*.*..
3587+...*.*..
3588+...*.*..
3589+...*.*..
3590+...*.*..
3591+...*.*..
3592+...*.*..
3593+...*.***
3594+...*.*..
3595+...*.*..
3596+...*.*..
3597+...*.*..
3598+...*.*..
3599+...*.*..
3600+...*.*..
3601+...*.*..
3602+
3603+char 0xc8
3604+...*.*..
3605+...*.*..
3606+...*.*..
3607+...*.*..
3608+...*.*..
3609+...*.*..
3610+...*.*..
3611+...*.***
3612+...*....
3613+...*****
3614+........
3615+........
3616+........
3617+........
3618+........
3619+........
3620+
3621+char 0xc9
3622+........
3623+........
3624+........
3625+........
3626+........
3627+........
3628+........
3629+...*****
3630+...*....
3631+...*.***
3632+...*.*..
3633+...*.*..
3634+...*.*..
3635+...*.*..
3636+...*.*..
3637+...*.*..
3638+
3639+char 0xca
3640+...*.*..
3641+...*.*..
3642+...*.*..
3643+...*.*..
3644+...*.*..
3645+...*.*..
3646+...*.*..
3647+****.***
3648+........
3649+********
3650+........
3651+........
3652+........
3653+........
3654+........
3655+........
3656+
3657+char 0xcb
3658+........
3659+........
3660+........
3661+........
3662+........
3663+........
3664+........
3665+********
3666+........
3667+****.***
3668+...*.*..
3669+...*.*..
3670+...*.*..
3671+...*.*..
3672+...*.*..
3673+...*.*..
3674+
3675+char 0xcc
3676+...*.*..
3677+...*.*..
3678+...*.*..
3679+...*.*..
3680+...*.*..
3681+...*.*..
3682+...*.*..
3683+...*.***
3684+...*....
3685+...*.***
3686+...*.*..
3687+...*.*..
3688+...*.*..
3689+...*.*..
3690+...*.*..
3691+...*.*..
3692+
3693+char 0xcd
3694+........
3695+........
3696+........
3697+........
3698+........
3699+........
3700+........
3701+********
3702+........
3703+********
3704+........
3705+........
3706+........
3707+........
3708+........
3709+........
3710+
3711+char 0xce
3712+...*.*..
3713+...*.*..
3714+...*.*..
3715+...*.*..
3716+...*.*..
3717+...*.*..
3718+...*.*..
3719+****.***
3720+........
3721+****.***
3722+...*.*..
3723+...*.*..
3724+...*.*..
3725+...*.*..
3726+...*.*..
3727+...*.*..
3728+
3729+char 0xcf
3730+...*....
3731+...*....
3732+...*....
3733+...*....
3734+...*....
3735+...*....
3736+...*....
3737+********
3738+........
3739+********
3740+........
3741+........
3742+........
3743+........
3744+........
3745+........
3746+
3747+char 0xd0
3748+...*.*..
3749+...*.*..
3750+...*.*..
3751+...*.*..
3752+...*.*..
3753+...*.*..
3754+...*.*..
3755+********
3756+........
3757+........
3758+........
3759+........
3760+........
3761+........
3762+........
3763+........
3764+
3765+char 0xd1
3766+........
3767+........
3768+........
3769+........
3770+........
3771+........
3772+........
3773+********
3774+........
3775+********
3776+...*....
3777+...*....
3778+...*....
3779+...*....
3780+...*....
3781+...*....
3782+
3783+char 0xd2
3784+........
3785+........
3786+........
3787+........
3788+........
3789+........
3790+........
3791+********
3792+...*.*..
3793+...*.*..
3794+...*.*..
3795+...*.*..
3796+...*.*..
3797+...*.*..
3798+...*.*..
3799+...*.*..
3800+
3801+char 0xd3
3802+...*.*..
3803+...*.*..
3804+...*.*..
3805+...*.*..
3806+...*.*..
3807+...*.*..
3808+...*.*..
3809+...*****
3810+........
3811+........
3812+........
3813+........
3814+........
3815+........
3816+........
3817+........
3818+
3819+char 0xd4
3820+...*....
3821+...*....
3822+...*....
3823+...*....
3824+...*....
3825+...*....
3826+...*....
3827+...*****
3828+...*....
3829+...*****
3830+........
3831+........
3832+........
3833+........
3834+........
3835+........
3836+
3837+char 0xd5
3838+........
3839+........
3840+........
3841+........
3842+........
3843+........
3844+........
3845+...*****
3846+...*....
3847+...*****
3848+...*....
3849+...*....
3850+...*....
3851+...*....
3852+...*....
3853+...*....
3854+
3855+char 0xd6
3856+........
3857+........
3858+........
3859+........
3860+........
3861+........
3862+........
3863+...*****
3864+...*.*..
3865+...*.*..
3866+...*.*..
3867+...*.*..
3868+...*.*..
3869+...*.*..
3870+...*.*..
3871+...*.*..
3872+
3873+char 0xd7
3874+...*.*..
3875+...*.*..
3876+...*.*..
3877+...*.*..
3878+...*.*..
3879+...*.*..
3880+...*.*..
3881+****.***
3882+...*.*..
3883+...*.*..
3884+...*.*..
3885+...*.*..
3886+...*.*..
3887+...*.*..
3888+...*.*..
3889+...*.*..
3890+
3891+char 0xd8
3892+...*....
3893+...*....
3894+...*....
3895+...*....
3896+...*....
3897+...*....
3898+...*....
3899+********
3900+...*....
3901+********
3902+...*....
3903+...*....
3904+...*....
3905+...*....
3906+...*....
3907+...*....
3908+
3909+char 0xd9
3910+...*....
3911+...*....
3912+...*....
3913+...*....
3914+...*....
3915+...*....
3916+...*....
3917+****....
3918+........
3919+........
3920+........
3921+........
3922+........
3923+........
3924+........
3925+........
3926+
3927+char 0xda
3928+........
3929+........
3930+........
3931+........
3932+........
3933+........
3934+........
3935+...*****
3936+...*....
3937+...*....
3938+...*....
3939+...*....
3940+...*....
3941+...*....
3942+...*....
3943+...*....
3944+
3945+char 0xdb
3946+********
3947+********
3948+********
3949+********
3950+********
3951+********
3952+********
3953+********
3954+********
3955+********
3956+********
3957+********
3958+********
3959+********
3960+********
3961+********
3962+
3963+char 0xdc
3964+........
3965+........
3966+........
3967+........
3968+........
3969+........
3970+........
3971+........
3972+********
3973+********
3974+********
3975+********
3976+********
3977+********
3978+********
3979+********
3980+
3981+char 0xdd
3982+****....
3983+****....
3984+****....
3985+****....
3986+****....
3987+****....
3988+****....
3989+****....
3990+****....
3991+****....
3992+****....
3993+****....
3994+****....
3995+****....
3996+****....
3997+****....
3998+
3999+char 0xde
4000+....****
4001+....****
4002+....****
4003+....****
4004+....****
4005+....****
4006+....****
4007+....****
4008+....****
4009+....****
4010+....****
4011+....****
4012+....****
4013+....****
4014+....****
4015+....****
4016+
4017+char 0xdf
4018+********
4019+********
4020+********
4021+********
4022+********
4023+********
4024+********
4025+********
4026+........
4027+........
4028+........
4029+........
4030+........
4031+........
4032+........
4033+........
4034+
4035+char 0xe0
4036+........
4037+........
4038+........
4039+........
4040+........
4041+........
4042+........
4043+........
4044+........
4045+........
4046+........
4047+........
4048+........
4049+........
4050+........
4051+........
4052+
4053+char 0xe1
4054+........
4055+........
4056+........
4057+........
4058+........
4059+........
4060+........
4061+........
4062+........
4063+........
4064+........
4065+........
4066+........
4067+........
4068+........
4069+........
4070+
4071+char 0xe2
4072+........
4073+........
4074+........
4075+........
4076+........
4077+........
4078+........
4079+........
4080+........
4081+........
4082+........
4083+........
4084+........
4085+........
4086+........
4087+........
4088+
4089+char 0xe3
4090+........
4091+........
4092+........
4093+........
4094+........
4095+........
4096+........
4097+........
4098+........
4099+........
4100+........
4101+........
4102+........
4103+........
4104+........
4105+........
4106+
4107+char 0xe4
4108+........
4109+........
4110+........
4111+........
4112+........
4113+........
4114+........
4115+........
4116+........
4117+........
4118+........
4119+........
4120+........
4121+........
4122+........
4123+........
4124+
4125+char 0xe5
4126+........
4127+........
4128+........
4129+........
4130+........
4131+........
4132+........
4133+........
4134+........
4135+........
4136+........
4137+........
4138+........
4139+........
4140+........
4141+........
4142+
4143+char 0xe6
4144+........
4145+........
4146+........
4147+........
4148+........
4149+........
4150+........
4151+........
4152+........
4153+........
4154+........
4155+........
4156+........
4157+........
4158+........
4159+........
4160+
4161+char 0xe7
4162+........
4163+........
4164+........
4165+........
4166+........
4167+........
4168+........
4169+........
4170+........
4171+........
4172+........
4173+........
4174+........
4175+........
4176+........
4177+........
4178+
4179+char 0xe8
4180+........
4181+........
4182+........
4183+........
4184+........
4185+........
4186+........
4187+........
4188+........
4189+........
4190+........
4191+........
4192+........
4193+........
4194+........
4195+........
4196+
4197+char 0xe9
4198+........
4199+........
4200+........
4201+........
4202+........
4203+........
4204+........
4205+........
4206+........
4207+........
4208+........
4209+........
4210+........
4211+........
4212+........
4213+........
4214+
4215+char 0xea
4216+........
4217+........
4218+........
4219+........
4220+........
4221+........
4222+........
4223+........
4224+........
4225+........
4226+........
4227+........
4228+........
4229+........
4230+........
4231+........
4232+
4233+char 0xeb
4234+........
4235+........
4236+........
4237+........
4238+........
4239+........
4240+........
4241+........
4242+........
4243+........
4244+........
4245+........
4246+........
4247+........
4248+........
4249+........
4250+
4251+char 0xec
4252+........
4253+........
4254+........
4255+........
4256+........
4257+........
4258+........
4259+........
4260+........
4261+........
4262+........
4263+........
4264+........
4265+........
4266+........
4267+........
4268+
4269+char 0xed
4270+........
4271+........
4272+........
4273+........
4274+........
4275+........
4276+........
4277+........
4278+........
4279+........
4280+........
4281+........
4282+........
4283+........
4284+........
4285+........
4286+
4287+char 0xee
4288+........
4289+........
4290+........
4291+........
4292+........
4293+........
4294+........
4295+........
4296+........
4297+........
4298+........
4299+........
4300+........
4301+........
4302+........
4303+........
4304+
4305+char 0xef
4306+........
4307+........
4308+........
4309+........
4310+........
4311+........
4312+........
4313+........
4314+........
4315+........
4316+........
4317+........
4318+........
4319+........
4320+........
4321+........
4322+
4323+char 0xf0
4324+........
4325+........
4326+........
4327+........
4328+........
4329+........
4330+........
4331+........
4332+........
4333+........
4334+........
4335+........
4336+........
4337+........
4338+........
4339+........
4340+
4341+char 0xf1
4342+........
4343+........
4344+........
4345+........
4346+........
4347+........
4348+........
4349+........
4350+........
4351+........
4352+........
4353+........
4354+........
4355+........
4356+........
4357+........
4358+
4359+char 0xf2
4360+........
4361+........
4362+........
4363+........
4364+........
4365+........
4366+........
4367+........
4368+........
4369+........
4370+........
4371+........
4372+........
4373+........
4374+........
4375+........
4376+
4377+char 0xf3
4378+........
4379+........
4380+........
4381+........
4382+........
4383+........
4384+........
4385+........
4386+........
4387+........
4388+........
4389+........
4390+........
4391+........
4392+........
4393+........
4394+
4395+char 0xf4
4396+........
4397+........
4398+........
4399+........
4400+........
4401+........
4402+........
4403+........
4404+........
4405+........
4406+........
4407+........
4408+........
4409+........
4410+........
4411+........
4412+
4413+char 0xf5
4414+........
4415+........
4416+........
4417+........
4418+........
4419+........
4420+........
4421+........
4422+........
4423+........
4424+........
4425+........
4426+........
4427+........
4428+........
4429+........
4430+
4431+char 0xf6
4432+........
4433+........
4434+........
4435+........
4436+........
4437+........
4438+........
4439+........
4440+........
4441+........
4442+........
4443+........
4444+........
4445+........
4446+........
4447+........
4448+
4449+char 0xf7
4450+........
4451+........
4452+........
4453+........
4454+........
4455+........
4456+........
4457+........
4458+........
4459+........
4460+........
4461+........
4462+........
4463+........
4464+........
4465+........
4466+
4467+char 0xf8
4468+........
4469+........
4470+........
4471+........
4472+........
4473+........
4474+........
4475+........
4476+........
4477+........
4478+........
4479+........
4480+........
4481+........
4482+........
4483+........
4484+
4485+char 0xf9
4486+........
4487+........
4488+........
4489+........
4490+........
4491+........
4492+........
4493+........
4494+........
4495+........
4496+........
4497+........
4498+........
4499+........
4500+........
4501+........
4502+
4503+char 0xfa
4504+........
4505+........
4506+........
4507+........
4508+........
4509+........
4510+........
4511+........
4512+........
4513+........
4514+........
4515+........
4516+........
4517+........
4518+........
4519+........
4520+
4521+char 0xfb
4522+........
4523+........
4524+........
4525+........
4526+........
4527+........
4528+........
4529+........
4530+........
4531+........
4532+........
4533+........
4534+........
4535+........
4536+........
4537+........
4538+
4539+char 0xfc
4540+........
4541+........
4542+........
4543+........
4544+........
4545+........
4546+........
4547+........
4548+........
4549+........
4550+........
4551+........
4552+........
4553+........
4554+........
4555+........
4556+
4557+char 0xfd
4558+........
4559+........
4560+........
4561+........
4562+........
4563+........
4564+........
4565+........
4566+........
4567+........
4568+........
4569+........
4570+........
4571+........
4572+........
4573+........
4574+
4575+char 0xfe
4576+........
4577+........
4578+........
4579+........
4580+........
4581+........
4582+........
4583+........
4584+........
4585+........
4586+........
4587+........
4588+........
4589+........
4590+........
4591+........
4592+
4593+char 0xff
4594+........
4595+........
4596+........
4597+........
4598+........
4599+........
4600+........
4601+........
4602+........
4603+........
4604+........
4605+........
4606+........
4607+........
4608+........
4609+........
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/file.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/file.cpp (revision 181)
@@ -0,0 +1,93 @@
1+/* ファイル関係 */
2+
3+#include "bootpack.h"
4+
5+void File::read_fat(int *fat, unsigned char *img)
6+/* ディスクイメージ内のFATの圧縮をとく */
7+{
8+ int i, j = 0;
9+ for (i = 0; i < 2880; i += 2) {
10+ fat[i + 0] = (img[j + 0] | img[j + 1] << 8) & 0xfff;
11+ fat[i + 1] = (img[j + 1] >> 4 | img[j + 2] << 4) & 0xfff;
12+ j += 3;
13+ }
14+ return;
15+}
16+
17+void File::load_file(int clustno, int size, unsigned char *buf, int *fat, unsigned char *img)
18+{
19+ int i;
20+ for (;;) {
21+ if (size <= 512) {
22+ for (i = 0; i < size; i++) {
23+ buf[i] = img[clustno * 512 + i];
24+ }
25+ break;
26+ }
27+ for (i = 0; i < 512; i++) {
28+ buf[i] = img[clustno * 512 + i];
29+ }
30+ size -= 512;
31+ buf += 512;
32+ clustno = fat[clustno];
33+ }
34+ return;
35+}
36+
37+FileInfo *File::search(char *name, FileInfo *finfo, int max)
38+{
39+ int i, j;
40+ char s[12];
41+ for (j = 0; j < 11; j++) {
42+ s[j] = ' ';
43+ }
44+ j = 0;
45+ for (i = 0; j < 11 && name[i] != 0; i++) {
46+ if (name[i] == '.') {
47+ j = 8;
48+ } else {
49+ s[j] = name[i];
50+ if ('a' <= s[j] && s[j] <= 'z') {
51+ /* 小文字は大文字に直す */
52+ s[j] -= 0x20;
53+ }
54+ j++;
55+ }
56+ }
57+ for (i = 0; i < max; ) {
58+ if (finfo->name[0] == 0x00) {
59+ break;
60+ }
61+ if ((finfo[i].type & 0x18) == 0) {
62+ for (j = 0; j < 11; j++) {
63+ if (finfo[i].name[j] != s[j]) {
64+ goto next;
65+ }
66+ }
67+ return finfo + i; /* ファイルが見つかった */
68+ }
69+next:
70+ i++;
71+ }
72+ return 0; /* 見つからなかった */
73+}
74+
75+unsigned char *File::load_file2(int clustno, int *psize, int *fat)
76+{
77+ int size = *psize, size2;
78+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
79+ unsigned char *buf, *buf2;
80+ buf = (unsigned char *) MemoryManager::allocate_4k(memman, size);
81+ File::load_file(clustno, size, buf, fat, (unsigned char *) (ADR_DISKIMG + 0x003e00));
82+ if (size >= 17) {
83+ size2 = tek_getsize(buf);
84+ if (size2 > 0) { /* tek圧縮がかかっていた */
85+ buf2 = (unsigned char *) MemoryManager::allocate_4k(memman, size2);
86+ tek_decomp(buf, buf2, size2);
87+ MemoryManager::deallocate_4k(memman, (int) buf, size);
88+ buf = buf2;
89+ *psize = size2;
90+ }
91+ }
92+ return buf;
93+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/mtask.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/mtask.cpp (revision 181)
@@ -0,0 +1,227 @@
1+/* マルチタスク関係 */
2+
3+#include "bootpack.h"
4+
5+TaskManager *taskctl;
6+Timer *task_timer;
7+
8+Task *Task::now(void)
9+{
10+ TaskLevel *tl = &taskctl->level[taskctl->now_lv];
11+ return tl->tasks[tl->now];
12+}
13+
14+void Task::add(Task *task)
15+{
16+ TaskLevel *tl = &taskctl->level[task->level];
17+ tl->tasks[tl->running] = task;
18+ tl->running++;
19+ task->flags = 2; /* 動作中 */
20+ return;
21+}
22+
23+void Task::remove(Task *task)
24+{
25+ int i;
26+ TaskLevel *tl = &taskctl->level[task->level];
27+
28+ /* taskがどこにいるかを探す */
29+ for (i = 0; i < tl->running; i++) {
30+ if (tl->tasks[i] == task) {
31+ /* ここにいた */
32+ break;
33+ }
34+ }
35+
36+ tl->running--;
37+ if (i < tl->now) {
38+ tl->now--; /* ずれるので、これもあわせておく */
39+ }
40+ if (tl->now >= tl->running) {
41+ /* nowがおかしな値になっていたら、修正する */
42+ tl->now = 0;
43+ }
44+ task->flags = 1; /* スリープ中 */
45+
46+ /* ずらし */
47+ for (; i < tl->running; i++) {
48+ tl->tasks[i] = tl->tasks[i + 1];
49+ }
50+
51+ return;
52+}
53+
54+void Task::switch_sub(void)
55+{
56+ int i;
57+ /* 一番上のレベルを探す */
58+ for (i = 0; i < MAX_TASKLEVELS; i++) {
59+ if (taskctl->level[i].running > 0) {
60+ break; /* 見つかった */
61+ }
62+ }
63+ taskctl->now_lv = i;
64+ taskctl->lv_change = 0;
65+ return;
66+}
67+
68+void task_idle(void)
69+{
70+ for (;;) {
71+ io_hlt();
72+ }
73+}
74+
75+Task *Task::init(MemoryManager *memman)
76+{
77+ int i;
78+ Task *task, *idle;
79+ SegmentDescriptor *gdt = (SegmentDescriptor *) ADR_GDT;
80+
81+ taskctl = (TaskManager *) MemoryManager::allocate_4k(memman, sizeof (TaskManager));
82+ for (i = 0; i < MAX_TASKS; i++) {
83+ taskctl->tasks0[i].flags = 0;
84+ taskctl->tasks0[i].sel = (TASK_GDT0 + i) * 8;
85+ taskctl->tasks0[i].tss.ldtr = (TASK_GDT0 + MAX_TASKS + i) * 8;
86+ SegmentDescriptor::set(gdt + TASK_GDT0 + i, 103, (int) &taskctl->tasks0[i].tss, AR_TSS32);
87+ SegmentDescriptor::set(gdt + TASK_GDT0 + MAX_TASKS + i, 15, (int) taskctl->tasks0[i].ldt, AR_LDT);
88+ }
89+ for (i = 0; i < MAX_TASKLEVELS; i++) {
90+ taskctl->level[i].running = 0;
91+ taskctl->level[i].now = 0;
92+ }
93+
94+ task = Task::allocate();
95+ task->flags = 2; /* 動作中マーク */
96+ task->priority = 2; /* 0.02秒 */
97+ task->level = 0; /* 最高レベル */
98+ Task::add(task);
99+ Task::switch_sub(); /* レベル設定 */
100+ load_tr(task->sel);
101+ task_timer = Timer::allocate();
102+ Timer::set_time(task_timer, task->priority);
103+
104+ idle = Task::allocate();
105+ idle->tss.esp = MemoryManager::allocate_4k(memman, 64 * 1024) + 64 * 1024;
106+ idle->tss.eip = (int) &task_idle;
107+ idle->tss.es = 1 * 8;
108+ idle->tss.cs = 2 * 8;
109+ idle->tss.ss = 1 * 8;
110+ idle->tss.ds = 1 * 8;
111+ idle->tss.fs = 1 * 8;
112+ idle->tss.gs = 1 * 8;
113+ Task::run(idle, MAX_TASKLEVELS - 1, 1);
114+
115+ taskctl->task_fpu = 0;
116+
117+ return task;
118+}
119+
120+Task *Task::allocate(void)
121+{
122+ int i;
123+ Task *task;
124+ for (i = 0; i < MAX_TASKS; i++) {
125+ if (taskctl->tasks0[i].flags == 0) {
126+ task = &taskctl->tasks0[i];
127+ task->flags = 1; /* 使用中マーク */
128+ task->tss.eflags = 0x00000202; /* IF = 1; */
129+ task->tss.eax = 0; /* とりあえず0にしておくことにする */
130+ task->tss.ecx = 0;
131+ task->tss.edx = 0;
132+ task->tss.ebx = 0;
133+ task->tss.ebp = 0;
134+ task->tss.esi = 0;
135+ task->tss.edi = 0;
136+ task->tss.es = 0;
137+ task->tss.ds = 0;
138+ task->tss.fs = 0;
139+ task->tss.gs = 0;
140+ task->tss.iomap = 0x40000000;
141+ task->tss.ss0 = 0;
142+ task->fpu[0] = 0x037f; /* CW(control word) */
143+ task->fpu[1] = 0x0000; /* SW(status word) */
144+ task->fpu[2] = 0xffff; /* TW(tag word) */
145+ for (i = 3; i < 108 / 4; i++) {
146+ task->fpu[i] = 0;
147+ }
148+ return task;
149+ }
150+ }
151+ return 0; /* もう全部使用中 */
152+}
153+
154+void Task::run(Task *task, int level, int priority)
155+{
156+ if (level < 0) {
157+ level = task->level; /* レベルを変更しない */
158+ }
159+ if (priority > 0) {
160+ task->priority = priority;
161+ }
162+
163+ if (task->flags == 2 && task->level != level) { /* 動作中のレベルの変更 */
164+ Task::remove(task); /* これを実行するとflagsは1になるので下のifも実行される */
165+ }
166+ if (task->flags != 2) {
167+ /* スリープから起こされる場合 */
168+ task->level = level;
169+ Task::add(task);
170+ }
171+
172+ taskctl->lv_change = 1; /* 次回タスクスイッチのときにレベルを見直す */
173+ return;
174+}
175+
176+void Task::sleep(Task *task)
177+{
178+ Task *now_task;
179+ if (task->flags == 2) {
180+ /* 動作中だったら */
181+ now_task = Task::now();
182+ Task::remove(task); /* これを実行するとflagsは1になる */
183+ if (task == now_task) {
184+ /* 自分自身のスリープだったので、タスクスイッチが必要 */
185+ Task::switch_sub();
186+ now_task = Task::now(); /* 設定後での、「現在のタスク」を教えてもらう */
187+ farjmp(0, now_task->sel);
188+ }
189+ }
190+ return;
191+}
192+
193+void Task::switcher(void)
194+{
195+ TaskLevel *tl = &taskctl->level[taskctl->now_lv];
196+ Task *new_task, *now_task = tl->tasks[tl->now];
197+ tl->now++;
198+ if (tl->now == tl->running) {
199+ tl->now = 0;
200+ }
201+ if (taskctl->lv_change != 0) {
202+ Task::switch_sub();
203+ tl = &taskctl->level[taskctl->now_lv];
204+ }
205+ new_task = tl->tasks[tl->now];
206+ Timer::set_time(task_timer, new_task->priority);
207+ if (new_task != now_task) {
208+ farjmp(0, new_task->sel);
209+ }
210+ return;
211+}
212+
213+int *inthandler07(int *esp)
214+{
215+ Task *now = Task::now();
216+ io_cli();
217+ clts();
218+ if (taskctl->task_fpu != now) {
219+ if (taskctl->task_fpu != 0) {
220+ fnsave(taskctl->task_fpu->fpu);
221+ }
222+ frstor(now->fpu);
223+ taskctl->task_fpu = now;
224+ }
225+ io_sti();
226+ return 0;
227+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/timer.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/timer.cpp (revision 181)
@@ -0,0 +1,177 @@
1+/* タイマ関係 */
2+
3+#include "bootpack.h"
4+
5+#define PIT_CTRL 0x0043
6+#define PIT_CNT0 0x0040
7+
8+TimerManager timerctl;
9+
10+#define TIMER_FLAGS_ALLOC 1 /* 確保した状態 */
11+#define TIMER_FLAGS_USING 2 /* タイマ作動中 */
12+
13+void PIT::init(void)
14+{
15+ io_out8(PIT_CTRL, 0x34);
16+ io_out8(PIT_CNT0, 0x9c);
17+ io_out8(PIT_CNT0, 0x2e);
18+ timerctl.count = 0;
19+ timerctl.next = 0xffffffff; /* 番兵しかいないので番兵の時刻 */
20+ return;
21+}
22+
23+void TimerManager::init(void)
24+{
25+ MemoryManager *memman = (MemoryManager *) MEMMAN_ADDR;
26+ int i;
27+ Timer *t;
28+ timerctl.timers0 = (Timer *) MemoryManager::allocate_4k(memman, MAX_TIMER * sizeof(Timer));
29+ for (i = 0; i < MAX_TIMER; i++) {
30+ timerctl.timers0[i].flags = 0; /* 未使用 */
31+ }
32+ t = Timer::allocate(); /* 一つもらってくる */
33+ t->timeout = 0xffffffff;
34+ t->flags = TIMER_FLAGS_USING;
35+ t->next = 0; /* 一番うしろ */
36+ timerctl.t0 = t; /* 今は番兵しかいないので先頭でもある */
37+ return;
38+}
39+
40+Timer *Timer::allocate(void)
41+{
42+ int i;
43+ for (i = 0; i < MAX_TIMER; i++) {
44+ if (timerctl.timers0[i].flags == 0) {
45+ timerctl.timers0[i].flags = TIMER_FLAGS_ALLOC;
46+ timerctl.timers0[i].flags2 = 0;
47+ return &timerctl.timers0[i];
48+ }
49+ }
50+ return 0; /* 見つからなかった */
51+}
52+
53+void Timer::deallocate(Timer *timer)
54+{
55+ Timer::cancel(timer); /* 念のため取り消し */
56+ timer->flags = 0; /* 未使用 */
57+ return;
58+}
59+
60+void Timer::init(Timer *timer, Queue *fifo, int data)
61+{
62+ timer->fifo = fifo;
63+ timer->data = data;
64+ return;
65+}
66+
67+void Timer::set_time(Timer *timer, unsigned int timeout)
68+{
69+ int e;
70+ Timer *t, *s;
71+ timer->timeout = timeout + timerctl.count;
72+ timer->flags = TIMER_FLAGS_USING;
73+ e = io_load_eflags();
74+ io_cli();
75+ t = timerctl.t0;
76+ if (timer->timeout <= t->timeout) {
77+ /* 先頭に入れる場合 */
78+ timerctl.t0 = timer;
79+ timer->next = t; /* 次はt */
80+ timerctl.next = timer->timeout;
81+ io_store_eflags(e);
82+ return;
83+ }
84+ /* どこに入れればいいかを探す */
85+ for (;;) {
86+ s = t;
87+ t = t->next;
88+ if (timer->timeout <= t->timeout) {
89+ /* sとtの間に入れる場合 */
90+ s->next = timer; /* sの次はtimer */
91+ timer->next = t; /* timerの次はt */
92+ io_store_eflags(e);
93+ return;
94+ }
95+ }
96+}
97+
98+void inthandler20(int *esp)
99+{
100+ Timer *timer;
101+ char ts = 0;
102+ io_out8(PIC0_OCW2, 0x60); /* IRQ-00受付完了をPICに通知 */
103+ timerctl.count++;
104+ if (timerctl.next > timerctl.count) {
105+ return;
106+ }
107+ timer = timerctl.t0; /* とりあえず先頭の番地をtimerに代入 */
108+ for (;;) {
109+ /* timersのタイマは全て動作中のものなので、flagsを確認しない */
110+ if (timer->timeout > timerctl.count) {
111+ break;
112+ }
113+ /* タイムアウト */
114+ timer->flags = TIMER_FLAGS_ALLOC;
115+ if (timer != task_timer) {
116+ Queue::push(timer->fifo, timer->data);
117+ } else {
118+ ts = 1; /* task_timerがタイムアウトした */
119+ }
120+ timer = timer->next; /* 次のタイマの番地をtimerに代入 */
121+ }
122+ timerctl.t0 = timer;
123+ timerctl.next = timer->timeout;
124+ if (ts != 0) {
125+ Task::switcher();
126+ }
127+ return;
128+}
129+
130+int Timer::cancel(Timer *timer)
131+{
132+ int e;
133+ Timer *t;
134+ e = io_load_eflags();
135+ io_cli(); /* 設定中にタイマの状態が変化しないようにするため */
136+ if (timer->flags == TIMER_FLAGS_USING) { /* 取り消し処理は必要か? */
137+ if (timer == timerctl.t0) {
138+ /* 先頭だった場合の取り消し処理 */
139+ t = timer->next;
140+ timerctl.t0 = t;
141+ timerctl.next = t->timeout;
142+ } else {
143+ /* 先頭以外の場合の取り消し処理 */
144+ /* timerの一つ前を探す */
145+ t = timerctl.t0;
146+ for (;;) {
147+ if (t->next == timer) {
148+ break;
149+ }
150+ t = t->next;
151+ }
152+ t->next = timer->next; /* 「timerの直前」の次が、「timerの次」を指すようにする */
153+ }
154+ timer->flags = TIMER_FLAGS_ALLOC;
155+ io_store_eflags(e);
156+ return 1; /* キャンセル処理成功 */
157+ }
158+ io_store_eflags(e);
159+ return 0; /* キャンセル処理は不要だった */
160+}
161+
162+void Timer::cancel_all(Queue *fifo)
163+{
164+ int e, i;
165+ Timer *t;
166+ e = io_load_eflags();
167+ io_cli(); /* 設定中にタイマの状態が変化しないようにするため */
168+ for (i = 0; i < MAX_TIMER; i++) {
169+ t = &timerctl.timers0[i];
170+ if (t->flags != 0 && t->flags2 != 0 && t->fifo == fifo) {
171+ Timer::cancel(t);
172+ Timer::deallocate(t);
173+ }
174+ }
175+ io_store_eflags(e);
176+ return;
177+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/fifo.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/fifo.cpp (revision 181)
@@ -0,0 +1,63 @@
1+/* FIFOライブラリ */
2+
3+#include "bootpack.h"
4+
5+#define FLAGS_OVERRUN 0x0001
6+
7+void Queue::init(Queue *fifo, int size, int *buf, Task *task)
8+/* FIFOバッファの初期化 */
9+{
10+ fifo->size = size;
11+ fifo->buf = buf;
12+ fifo->free = size; /* 空き */
13+ fifo->flags = 0;
14+ fifo->p = 0; /* 書き込み位置 */
15+ fifo->q = 0; /* 読み込み位置 */
16+ fifo->task = task; /* データが入ったときに起こすタスク */
17+ return;
18+}
19+
20+int Queue::push(Queue *fifo, int data)
21+/* FIFOへデータを送り込んで蓄える */
22+{
23+ if (fifo->free == 0) {
24+ /* 空きがなくてあふれた */
25+ fifo->flags |= FLAGS_OVERRUN;
26+ return -1;
27+ }
28+ fifo->buf[fifo->p] = data;
29+ fifo->p++;
30+ if (fifo->p == fifo->size) {
31+ fifo->p = 0;
32+ }
33+ fifo->free--;
34+ if (fifo->task != 0) {
35+ if (fifo->task->flags != 2) { /* タスクが寝ていたら */
36+ Task::run(fifo->task, -1, 0); /* 起こしてあげる */
37+ }
38+ }
39+ return 0;
40+}
41+
42+int Queue::pop(Queue *fifo)
43+/* FIFOからデータを一つとってくる */
44+{
45+ int data;
46+ if (fifo->free == fifo->size) {
47+ /* バッファが空っぽのときは、とりあえず-1が返される */
48+ return -1;
49+ }
50+ data = fifo->buf[fifo->q];
51+ fifo->q++;
52+ if (fifo->q == fifo->size) {
53+ fifo->q = 0;
54+ }
55+ fifo->free++;
56+ return data;
57+}
58+
59+int Queue::status(Queue *fifo)
60+/* どのくらいデータが溜まっているかを報告する */
61+{
62+ return fifo->size - fifo->free;
63+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/tek.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/tek.cpp (revision 181)
@@ -0,0 +1,653 @@
1+#include "bootpack.h"
2+#include <setjmp.h>
3+#include <string.h>
4+#define NULL 0
5+
6+typedef unsigned char UCHAR;
7+typedef unsigned int UINT32;
8+typedef UINT32 tek_TPRB;
9+
10+static int tek_decode1(int siz, UCHAR *p, UCHAR *q);
11+static int tek_decode2(int siz, UCHAR *p, UCHAR *q);
12+static int tek_decode5(int siz, UCHAR *p, UCHAR *q);
13+
14+static unsigned int tek_getnum_s7s(UCHAR **pp)
15+/* これは必ずbig-endian */
16+/* 下駄がないので中身をいじりやすい */
17+{
18+ unsigned int s = 0;
19+ UCHAR *p = *pp;
20+ do {
21+ s = s << 7 | *p++;
22+ } while ((s & 1) == 0);
23+ s >>= 1;
24+ *pp = p;
25+ return s;
26+}
27+
28+int tek_getsize(unsigned char *p)
29+{
30+ static char header[15] = {
31+ 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x53, 0x41, 0x53, 0x4b, 0x43, 0x4d, 0x50
32+ };
33+ int size = -1;
34+ if (memcmp((char *) p + 1, header, 15) == 0 && (*p == 0x83 || *p == 0x85 || *p == 0x89)) {
35+ p += 16;
36+ size = tek_getnum_s7s(&p);
37+ }
38+ return size;
39+}
40+
41+int tek_decomp(unsigned char *p, unsigned char *q, int size)
42+{
43+ int err = -1;
44+ if (*p == 0x83) {
45+ err = tek_decode1(size, p, q);
46+ } else if (*p == 0x85) {
47+ err = tek_decode2(size, p, q);
48+ } else if (*p == 0x89) {
49+ err = tek_decode5(size, p, q);
50+ }
51+ if (err != 0) {
52+ return -1; /* 失敗 */
53+ }
54+ return 0; /* 成功 */
55+}
56+
57+static int tek_lzrestore_stk1(int srcsiz, UCHAR *src, int outsiz, UCHAR *q)
58+{
59+ int by, lz, cp, ds;
60+ UCHAR *q1 = q + outsiz, *s7ptr = src, *q0 = q;
61+ do {
62+ if ((by = (lz = *s7ptr++) & 0x0f) == 0)
63+ by = tek_getnum_s7s(&s7ptr);
64+ if ((lz >>= 4) == 0)
65+ lz = tek_getnum_s7s(&s7ptr);
66+ do {
67+ *q++ = *s7ptr++;
68+ } while (--by);
69+ if (q >= q1)
70+ break;
71+ do {
72+ ds = (cp = *s7ptr++) & 0x0f;
73+ if ((ds & 1) == 0) {
74+ do {
75+ ds = ds << 7 | *s7ptr++;
76+ } while ((ds & 1) == 0);
77+ }
78+ ds = ~(ds >> 1);
79+ if ((cp >>= 4) == 0) {
80+ do {
81+ cp = cp << 7 | *s7ptr++;
82+ } while ((cp & 1) == 0);
83+ cp >>= 1;
84+ } /* 0がこないことをあてにする */
85+ cp++;
86+ if (q + ds < q0)
87+ goto err;
88+ if (q + cp > q1)
89+ cp = q1 - q;
90+ do {
91+ *q = *(q + ds);
92+ q++;
93+ } while (--cp);
94+ } while (--lz);
95+ } while (q < q1);
96+ return 0;
97+err:
98+ return 1;
99+}
100+
101+static int tek_decode1(int siz, UCHAR *p, UCHAR *q)
102+{
103+ int dsiz, hed, bsiz;
104+ UCHAR *p1 = p + siz;
105+ p += 16;
106+ if ((dsiz = tek_getnum_s7s(&p)) > 0) {
107+ hed = tek_getnum_s7s(&p);
108+ bsiz = 1 << (((hed >> 1) & 0x0f) + 8);
109+ if (dsiz > bsiz || (hed & 0x21) != 0x01)
110+ return 1;
111+ if (hed & 0x40)
112+ tek_getnum_s7s(&p); /* オプション情報へのポインタを読み飛ばす */
113+ if (tek_getnum_s7s(&p) != 0)
114+ return 1; /* 補助バッファ使用 */
115+ return tek_lzrestore_stk1(p1 - p, p, dsiz, q);
116+ }
117+ return 0;
118+}
119+
120+static unsigned int tek_getnum_s7(UCHAR **pp)
121+/* これは必ずbig-endian */
122+{
123+ unsigned int s = 0, b = 0, a = 1;
124+ UCHAR *p = *pp;
125+ for (;;) {
126+ s = s << 7 | *p++;
127+ if (s & 1)
128+ break;
129+ a <<= 7;
130+ b += a;
131+ }
132+ s >>= 1;
133+ *pp = p;
134+ return s + b;
135+}
136+
137+static int tek_lzrestore_stk2(int srcsiz, UCHAR *src, int outsiz, UCHAR *q)
138+{
139+ int cp, ds, repdis[4], i, j;
140+ UCHAR *q1 = q + outsiz, *s7ptr = src, *q0 = q, bylz, cbylz;
141+ for (j = 0; j < 4; j++)
142+ repdis[j] = -1 - j;
143+ bylz = cbylz = 0;
144+ if (outsiz) {
145+ if (tek_getnum_s7s(&s7ptr))
146+ return 1;
147+ do {
148+ /* byフェーズ */
149+ j = 0;
150+ do {
151+ j++;
152+ if (j >= 17) {
153+ j += tek_getnum_s7s(&s7ptr);
154+ break;
155+ }
156+ if (cbylz == 0) {
157+ cbylz = 8;
158+ bylz = *s7ptr++;
159+ }
160+ cbylz--;
161+ i = bylz & 1;
162+ bylz >>= 1;
163+ } while (i == 0);
164+ do {
165+ *q++ = *s7ptr++;
166+ } while (--j);
167+ if (q >= q1)
168+ break;
169+
170+ /* lzフェーズ */
171+ j = 0;
172+ do {
173+ j++;
174+ if (j >= 17) {
175+ j += tek_getnum_s7s(&s7ptr);
176+ break;
177+ }
178+ if (cbylz == 0) {
179+ cbylz = 8;
180+ bylz = *s7ptr++;
181+ }
182+ cbylz--;
183+ i = bylz & 1;
184+ bylz >>= 1;
185+ } while (i == 0);
186+ do {
187+ i = *s7ptr++;
188+ cp = i >> 4;
189+ i &= 0x0f;
190+ if ((i & 1) == 0)
191+ i |= (tek_getnum_s7(&s7ptr) + 1) << 4;
192+ i >>= 1;
193+ ds = ~(i - 6);
194+ if (i < 4)
195+ ds = repdis[i];
196+ if (i == 4)
197+ ds = repdis[0] - tek_getnum_s7(&s7ptr) - 1;
198+ if (i == 5)
199+ ds = repdis[0] + tek_getnum_s7(&s7ptr) + 1;
200+ if (cp == 0)
201+ cp = tek_getnum_s7(&s7ptr) + 16;
202+ cp++;
203+ if (i > 0) {
204+ if (i > 1) {
205+ if (i > 2)
206+ repdis[3] = repdis[2];
207+ repdis[2] = repdis[1];
208+ }
209+ repdis[1] = repdis[0];
210+ repdis[0] = ds;
211+ }
212+ if (q + ds < q0)
213+ goto err;
214+ if (q + cp > q1)
215+ cp = q1 - q;
216+ do {
217+ *q = *(q + ds);
218+ q++;
219+ } while (--cp);
220+ } while (--j);
221+ } while (q < q1);
222+ }
223+ return 0;
224+err:
225+ return 1;
226+}
227+
228+static int tek_decode2(int siz, UCHAR *p, UCHAR *q)
229+{
230+ UCHAR *p1 = p + siz;
231+ int dsiz, hed, bsiz, st = 0;
232+ p += 16;
233+ if ((dsiz = tek_getnum_s7s(&p)) > 0) {
234+ hed = tek_getnum_s7s(&p);
235+ bsiz = 1 << (((hed >> 1) & 0x0f) + 8);
236+ if (dsiz > bsiz || (hed & 0x21) != 0x01)
237+ return 1;
238+ if (hed & 0x40)
239+ tek_getnum_s7s(&p); /* オプション情報へのポインタを読み飛ばす */
240+ st = tek_lzrestore_stk2(p1 - p, p, dsiz, q);
241+ }
242+ return st;
243+}
244+
245+static int tek_decmain5(int *work, UCHAR *src, int osiz, UCHAR *q, int lc, int pb, int lp, int flags);
246+
247+static int tek_lzrestore_tek5(int srcsiz, UCHAR *src, int outsiz, UCHAR *outbuf)
248+{
249+ int wrksiz, lc, lp, pb, flags, *work = NULL, prop0, fl;
250+
251+ if ((fl = (prop0 = *src) & 0x0f) == 0x01) /* 0001 */
252+ flags |= -1;
253+ else if (fl == 0x05)
254+ flags = -2;
255+ else if (fl == 0x09)
256+ flags &= 0;
257+ else
258+ return 1;
259+ src++;
260+ prop0 >>= 4;
261+ if (prop0 == 0)
262+ prop0 = *src++;
263+ else {
264+ static UCHAR prop0_table[] = { 0x5d, 0x00 }, prop1_table[] = { 0x00 };
265+ if (flags == -1) {
266+ if (prop0 >= 3)
267+ return 1;
268+ prop0 = prop0_table[prop0 - 1];
269+ } else {
270+ if (prop0 >= 2)
271+ return 1;
272+ prop0 = prop1_table[prop0 - 1];
273+ }
274+ }
275+ lp = prop0 / (9 * 5);
276+ prop0 %= 9 * 5;
277+ pb = prop0 / 9;
278+ lc = prop0 % 9;
279+ if (flags == 0) /* tek5:z2 */
280+ flags = *src++;
281+ if (flags == -1) { /* stk5 */
282+ wrksiz = lp;
283+ lp = pb;
284+ pb = wrksiz;
285+ }
286+ wrksiz = 0x180 * sizeof (UINT32) + (0x840 + (0x300 << (lc + lp))) * sizeof (tek_TPRB); /* 最低15KB, lc+lp=3なら、36KB */
287+ work = (int *) MemoryManager::allocate_4k((MemoryManager *) MEMMAN_ADDR, wrksiz);
288+ if (work == NULL)
289+ return -1;
290+ flags = tek_decmain5(work, src, outsiz, outbuf, lc, pb, lp, flags);
291+ MemoryManager::deallocate_4k((MemoryManager *) MEMMAN_ADDR, (int) work, wrksiz);
292+ return flags;
293+}
294+
295+struct tek_STR_BITMODEL {
296+ UCHAR t, m, s, dmy;
297+ UINT32 prb0, prb1, tmsk, ntm, lt, lt0, dmy4;
298+};
299+
300+struct tek_STR_PRB {
301+ struct tek_STR_PRB_PB {
302+ struct tek_STR_PRB_PBST {
303+ tek_TPRB mch, rep0l1;
304+ } st[12];
305+ tek_TPRB lenlow[2][8], lenmid[2][8];
306+ } pb[16];
307+ struct tek_STR_PRB_ST {
308+ tek_TPRB rep, repg0, repg1, repg2;
309+ } st[12];
310+ tek_TPRB lensel[2][2], lenhigh[2][256], pslot[4][64], algn[64];
311+ tek_TPRB spdis[2][2+4+8+16+32], lenext[2+4+8+16+32];
312+ tek_TPRB repg3, fchgprm[2 * 32], tbmt[16], tbmm[16], fchglt;
313+ tek_TPRB lit[1];
314+};
315+
316+struct tek_STR_RNGDEC {
317+ UCHAR *p;
318+ UINT32 range, code, rmsk;
319+ jmp_buf errjmp;
320+ struct tek_STR_BITMODEL bm[32], *ptbm[16];
321+ struct tek_STR_PRB probs;
322+};
323+
324+static void tek_setbm5(struct tek_STR_BITMODEL *bm, int t, int m)
325+{
326+ bm->t = t;
327+ bm->m = m;
328+ bm->prb1 = -1 << (m + t);
329+ bm->prb0 = ~bm->prb1;
330+ bm->prb1 |= 1 << t;
331+ bm->tmsk = (-1 << t) & 0xffff;
332+ bm->prb0 &= bm->tmsk;
333+ bm->prb1 &= bm->tmsk;
334+ bm->ntm = ~bm->tmsk;
335+ return;
336+}
337+
338+static int tek_rdget0(struct tek_STR_RNGDEC *rd, int n, int i)
339+{
340+ do {
341+ while (rd->range < (UINT32) (1 << 24)) {
342+ rd->range <<= 8;
343+ rd->code = rd->code << 8 | *rd->p++;
344+ }
345+ rd->range >>= 1;
346+ i += i;
347+ if (rd->code >= rd->range) {
348+ rd->code -= rd->range;
349+ i |= 1;
350+ }
351+ } while (--n);
352+ return ~i;
353+}
354+
355+static int tek_rdget1(struct tek_STR_RNGDEC *rd, tek_TPRB *prob0, int n, int j, struct tek_STR_BITMODEL *bm)
356+{
357+ UINT32 p, i, *prob, nm = n >> 4;
358+ n &= 0x0f;
359+ prob0 -= j;
360+ do {
361+ p = *(prob = prob0 + j);
362+ if (bm->lt > 0) {
363+ if (--bm->lt == 0) {
364+ /* 寿命切れ */
365+ if (tek_rdget1(rd, &rd->probs.fchglt, 0x71, 0, &rd->bm[3]) == 0) {
366+ /* 寿命変更はまだサポートしてない */
367+err:
368+ longjmp(rd->errjmp, 1);
369+ }
370+ i = bm - rd->bm;
371+ if ((bm->s = tek_rdget1(rd, &rd->probs.fchgprm[i * 2 + bm->s], 0x71, 0, &rd->bm[1])) == 0) {
372+ i = tek_rdget1(rd, rd->probs.tbmt, 0x74, 1, &rd->bm[2]) & 15;
373+ if (i == 15)
374+ goto err;
375+ tek_setbm5(bm, i, ((tek_rdget1(rd, rd->probs.tbmm, 0x74, 1, &rd->bm[2]) - 1) & 15) + 1);
376+ }
377+ bm->lt = bm->lt0;
378+ }
379+ if (p < bm->prb0) {
380+ p = bm->prb0;
381+ goto fixprob;
382+ }
383+ if (p > bm->prb1) {
384+ p = bm->prb1;
385+ goto fixprob;
386+ }
387+ if (p & bm->ntm) {
388+ p &= bm->tmsk;
389+ fixprob:
390+ *prob = p;
391+ }
392+ }
393+
394+ while (rd->range < (UINT32) (1 << 24)) {
395+ rd->range <<= 8;
396+ rd->code = rd->code << 8 | *rd->p++;
397+ }
398+ j += j;
399+ i = ((unsigned long long) (rd->range & rd->rmsk) * p) >> 16;
400+ if (rd->code < i) {
401+ j |= 1;
402+ rd->range = i;
403+ *prob += ((0x10000 - p) >> bm->m) & bm->tmsk;
404+ } else {
405+ rd->range -= i;
406+ rd->code -= i;
407+ *prob -= (p >> bm->m) & bm->tmsk;
408+ }
409+ --n;
410+ if ((n & nm) == 0)
411+ bm++;
412+ } while (n);
413+ return j;
414+}
415+
416+static UINT32 tek_revbit(UINT32 data, int len)
417+{
418+ UINT32 rev = 0;
419+ do {
420+ rev += rev + (data & 1);
421+ data >>= 1;
422+ } while (--len);
423+ return rev;
424+}
425+
426+static int tek_getlen5(struct tek_STR_RNGDEC *rd, int m, int s_pos, int stk)
427+{
428+ int i;
429+ if (tek_rdget1(rd, &rd->probs.lensel[m][0], 0x71, 0, rd->ptbm[3]) ^ stk) /* low */
430+ i = tek_rdget1(rd, rd->probs.pb[s_pos].lenlow[m], 0x73, 1, rd->ptbm[4]) & 7;
431+ else if (tek_rdget1(rd, &rd->probs.lensel[m][1], 0x71, 0, rd->ptbm[3]) ^ stk) /* mid */
432+ i = tek_rdget1(rd, rd->probs.pb[s_pos].lenmid[m], 0x73, 1, rd->ptbm[5]);
433+ else {
434+ /* high */
435+ i = tek_rdget1(rd, rd->probs.lenhigh[m], 0x78, 1, rd->ptbm[6]) - (256 + 256 - 8);
436+ if (i > 0) {
437+ if (i < 6 && stk == 0)
438+ i = tek_rdget1(rd, &rd->probs.lenext[(1 << i) - 2], i | 0x70, 1, rd->ptbm[7]) - 1;
439+ else
440+ i = tek_rdget0(rd, i, ~1) - 1;
441+ i = tek_rdget0(rd, i, ~1) - 1;
442+ }
443+ i += 256 - 8 + 16;
444+ }
445+ return i;
446+}
447+
448+static int tek_decmain5(int *work, UCHAR *src, int osiz, UCHAR *q, int lc, int pb, int lp, int flags)
449+{
450+ static int state_table[] = { 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5 };
451+ int i, j, k, pmch, rep[4], s, pos, m_pos = (1 << pb) - 1, m_lp = (1 << lp) - 1;
452+ int stk = (flags == -1), lcr = 8 - lc, s_pos, lit0cntmsk = 0x78;
453+ UINT32 *lit1;
454+ struct tek_STR_RNGDEC *rd = (struct tek_STR_RNGDEC *) work;
455+ struct tek_STR_PRB *prb = &rd->probs;
456+
457+ rd->p = &src[4];
458+ rd->range |= -1;
459+ rd->code = src[0] << 24 | src[1] << 16 | src[2] << 8 | src[3];
460+ for (i = 0; i < 4; i++)
461+ rep[i] = ~i;
462+ if (setjmp(rd->errjmp))
463+ goto err;
464+ for (i = sizeof (struct tek_STR_PRB) / sizeof (tek_TPRB) + (0x300 << (lc + lp)) - 2; i >= 0; i--)
465+ ((tek_TPRB *) prb)[i] = 1 << 15;
466+ for (i = 0; i < 32; i++) {
467+ rd->bm[i].lt = (i >= 4); /* 0..3は寿命なし */
468+ rd->bm[i].lt0 = (i < 24) ? 16 * 1024 : 8 * 1024;
469+ rd->bm[i].s &= 0;
470+ rd->bm[i].t = rd->bm[i].m = 5;
471+ }
472+ lit1 = prb->lit + ((256 << (lc + lp)) - 2);
473+ if (stk) {
474+ rd->rmsk = -1 << 11;
475+ for (i = 0; i < 32; i++)
476+ rd->bm[i].lt = 0; /* 全て寿命なし */
477+ for (i = 0; i < 14; i++)
478+ rd->ptbm[i] = &rd->bm[0];
479+ } else {
480+ UCHAR pt[14];
481+ static UCHAR pt1[14] = {
482+ 8, 8, 8, 8, 8, 8, 8, 8,
483+ 8, 8, 18, 18, 18, 8
484+ };
485+ static UCHAR pt2[14] = {
486+ 8, 8, 10, 11, 12, 12, 14, 15,
487+ 16, 16, 18, 18, 20, 21
488+ };
489+ /*
490+ 0- 7:mch, mch, lit1, lensel, lenlow, lenmid, lenhigh, lenext
491+ 8-15:pslot, pslot, sdis, sdis, align, rep-repg2
492+ */
493+ rd->rmsk |= -1;
494+ rd->bm[1].t = 5; rd->bm[1].m = 3; /* for fchgprm */
495+ rd->bm[2].t = 9; rd->bm[2].m = 2; /* for tbmt, tbmm */
496+ if (flags & 0x40) { /* lt-flag */
497+ rd->bm[3].t = 0; rd->bm[3].m = 1;
498+ prb->fchglt = 0xffff;
499+ }
500+ rd->bm[22].t = 0; rd->bm[22].m = 1;
501+ prb->repg3 = 0xffff;
502+ if (flags == -2) { /* z1 */
503+ rd->bm[22].lt = 0; /* repg3のltを0に */
504+ for (i = 0; i < 14; i++)
505+ pt[i] = pt1[i];
506+ } else {
507+ for (i = 0; i < 14; i++)
508+ pt[i] = pt2[i];
509+ lit0cntmsk = (7 >> (flags & 3)) << 4 | 8;
510+ pt[ 1] = 8 + ((flags & 0x04) != 0); /* mch */
511+ pt[ 5] = 12 + ((flags & 0x08) != 0); /* llm */
512+ pt[ 9] = 16 + ((flags & 0x10) != 0); /* pst */
513+ pt[11] = 18 + ((flags & 0x20) != 0); /* sds */
514+ }
515+ for (i = 0; i < 14; i++)
516+ rd->ptbm[i] = &rd->bm[pt[i]];
517+ }
518+ for (i = 0; i < 32; i++)
519+ tek_setbm5(&rd->bm[i], rd->bm[i].t, rd->bm[i].m);
520+
521+ if ((tek_rdget1(rd, &prb->pb[0].st[0].mch, 0x71, 0, rd->ptbm[0]) ^ stk) == 0)
522+ goto err;
523+ *q++ = tek_rdget1(rd, prb->lit, lit0cntmsk, 1, &rd->bm[24]) & 0xff;
524+ pmch &= 0; s &= 0; pos = 1;
525+ while (pos < osiz) {
526+ s_pos = pos & m_pos;
527+ if (tek_rdget1(rd, &prb->pb[s_pos].st[s].mch, 0x71, 0, rd->ptbm[s > 0]) ^ stk) { /* 非lz */
528+ i = (q[-1] >> lcr | (pos & m_lp) << lc) << 8;
529+ s = state_table[s];
530+ if (pmch == 0)
531+ *q = tek_rdget1(rd, &prb->lit[i], lit0cntmsk, 1, &rd->bm[24]) & 0xff;
532+ else {
533+ struct tek_STR_BITMODEL *bm = &rd->bm[24];
534+ j = 1; /* lit1は最初から2を減じてある */
535+ k = 8;
536+ pmch = q[rep[0]];
537+ do {
538+ j += j + tek_rdget1(rd, &lit1[(i + j) << 1 | pmch >> 7], 0x71, 0, rd->ptbm[2]);
539+ k--;
540+ if ((k & (lit0cntmsk >> 4)) == 0)
541+ bm++;
542+ if ((((pmch >> 7) ^ j) & 1) != 0 && k != 0) {
543+ j = tek_rdget1(rd, &prb->lit[i + j - 1], k | (lit0cntmsk & 0x70), j, bm);
544+ break;
545+ }
546+ pmch <<= 1;
547+ } while (k);
548+ *q = j & 0xff;
549+ pmch &= 0;
550+ }
551+ pos++;
552+ q++;
553+ } else { /* lz */
554+ pmch |= 1;
555+ if (tek_rdget1(rd, &prb->st[s].rep, 0x71, 0, rd->ptbm[13]) ^ stk) { /* len/dis */
556+ rep[3] = rep[2];
557+ rep[2] = rep[1];
558+ rep[1] = rep[0];
559+ j = i = tek_getlen5(rd, 0, s_pos, stk);
560+ s = s < 7 ? 7 : 10;
561+ if (j >= 4)
562+ j = 3;
563+ rep[0] = j = tek_rdget1(rd, prb->pslot[j], 0x76, 1, rd->ptbm[8 + (j == 3)]) & 0x3f;
564+ if (j >= 4) {
565+ k = (j >> 1) - 1; /* k = [1, 30] */
566+ rep[0] = (2 | (j & 1)) << k;
567+ if (j < 14) /* k < 6 */
568+ rep[0] |= tek_revbit(tek_rdget1(rd, &prb->spdis[j & 1][(1 << k) - 2], k | 0x70, 1, rd->ptbm[10 + (k >= 4)]), k);
569+ else {
570+ if (stk == 0) {
571+ if (k -= 6)
572+ rep[0] |= tek_rdget0(rd, k, ~0) << 6;
573+ rep[0] |= tek_revbit(tek_rdget1(rd, prb->algn, 0x76, 1, rd->ptbm[12]), 6);
574+ } else {
575+ rep[0] |= tek_rdget0(rd, k - 4, ~0) << 4;
576+ rep[0] |= tek_revbit(tek_rdget1(rd, prb->algn, 0x74, 1, rd->ptbm[12]), 4);
577+ }
578+ }
579+ }
580+ rep[0] = ~rep[0];
581+ } else { /* repeat-dis */
582+ if (tek_rdget1(rd, &prb->st[s].repg0, 0x71, 0, rd->ptbm[13]) ^ stk) { /* rep0 */
583+ i |= -1;
584+ if (tek_rdget1(rd, &prb->pb[s_pos].st[s].rep0l1, 0x71, 0, rd->ptbm[13]) == 0) {
585+ s = s < 7 ? 9 : 11;
586+ goto skip;
587+ }
588+ } else {
589+ if (tek_rdget1(rd, &prb->st[s].repg1, 0x71, 0, rd->ptbm[13]) ^ stk) /* rep1 */
590+ i = rep[1];
591+ else {
592+ if (tek_rdget1(rd, &prb->st[s].repg2, 0x71, 0, rd->ptbm[13]) ^ stk) /* rep2 */
593+ i = rep[2];
594+ else {
595+ if (stk == 0) {
596+ if (tek_rdget1(rd, &prb->repg3, 0x71, 0, &rd->bm[22]) == 0)
597+ goto err;
598+ }
599+ i = rep[3]; /* rep3 */
600+ rep[3] = rep[2];
601+ }
602+ rep[2] = rep[1];
603+ }
604+ rep[1] = rep[0];
605+ rep[0] = i;
606+ }
607+ i = tek_getlen5(rd, 1, s_pos, stk);
608+ s = s < 7 ? 8 : 11;
609+ }
610+skip:
611+ i += 2;
612+ if (pos + rep[0] < 0)
613+ goto err;
614+ if (pos + i > osiz)
615+ i = osiz - pos;
616+ pos += i;
617+ do {
618+ *q = q[rep[0]];
619+ q++;
620+ } while (--i);
621+ }
622+ }
623+ return 0;
624+err:
625+ return 1;
626+}
627+
628+static int tek_decode5(int siz, UCHAR *p, UCHAR *q)
629+{
630+ UCHAR *p1 = p + siz;
631+ int dsiz, hed, bsiz, st = 0;
632+ p += 16;
633+ if ((dsiz = tek_getnum_s7s(&p)) > 0) {
634+ hed = tek_getnum_s7s(&p);
635+ if ((hed & 1) == 0)
636+ st = tek_lzrestore_tek5(p1 - p + 1, p - 1, dsiz, q);
637+ else {
638+ bsiz = 1 << (((hed >> 1) & 0x0f) + 8);
639+ if (hed & 0x20)
640+ return 1;
641+ if (bsiz == 256)
642+ st = tek_lzrestore_tek5(p1 - p, p, dsiz, q);
643+ else {
644+ if (dsiz > bsiz)
645+ return 1;
646+ if (hed & 0x40)
647+ tek_getnum_s7s(&p); /* オプション情報へのポインタを読み飛ばす */
648+ st = tek_lzrestore_tek5(p1 - p, p, dsiz, q);
649+ }
650+ }
651+ }
652+ return st;
653+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/jpeg.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/jpeg.cpp (revision 181)
@@ -0,0 +1,725 @@
1+/*
2+ * JPEG decoding engine for DCT-baseline
3+ *
4+ * copyrights 2003 by nikq | nikq::club.
5+ *
6+ * history::
7+ * 2003/04/28 | added OSASK-GUI ( by H.Kawai )
8+ * 2003/05/12 | optimized DCT ( 20-bits fixed point, etc...) -> line 407-464 ( by I.Tak. )
9+ * 2003/09/27 | PICTURE0.BIN(DLL)用に改造 ( by くーみん )
10+ * 2003/09/28 | 各種バグフィクス&多少の最適化 ( by H.Kawai )
11+ *
12+ */
13+
14+#include "bootpack.h"
15+
16+typedef unsigned char UCHAR;
17+
18+//struct DLL_STRPICENV { int work[16384]; };
19+
20+typedef struct
21+{
22+ int elem; //要素数
23+ unsigned short code[256];
24+ unsigned char size[256];
25+ unsigned char value[256];
26+}HUFF;
27+
28+typedef struct
29+{
30+ // SOF
31+ int width;
32+ int height;
33+
34+ // MCU
35+ int mcu_width;
36+ int mcu_height;
37+
38+ int max_h,max_v;
39+ int compo_count;
40+ int compo_id[3];
41+ int compo_sample[3];
42+ int compo_h[3];
43+ int compo_v[3];
44+ int compo_qt[3];
45+
46+ // SOS
47+ int scan_count;
48+ int scan_id[3];
49+ int scan_ac[3];
50+ int scan_dc[3];
51+ int scan_h[3]; // サンプリング要素数
52+ int scan_v[3]; // サンプリング要素数
53+ int scan_qt[3]; // 量子化テーブルインデクス
54+
55+ // DRI
56+ int interval;
57+
58+ int mcu_buf[32*32*4]; //バッファ
59+ int *mcu_yuv[4];
60+ int mcu_preDC[3];
61+
62+ // DQT
63+ int dqt[3][64];
64+ int n_dqt;
65+
66+ // DHT
67+ HUFF huff[2][3];
68+
69+ // FILE i/o
70+ unsigned char *fp, *fp1;
71+ unsigned long bit_buff;
72+ int bit_remain;
73+ int width_buf;
74+
75+ int base_img[64][64]; // 基底画像 ( [横周波数uπ][縦周波数vπ][横位相(M/8)][縦位相(N/8)]
76+
77+ int dummy[64];
78+}JPEG;
79+
80+/* for 16bit */
81+#ifndef PIXEL16
82+#define PIXEL16(r, g, b) ((r) << 11 | (g) << 5 | (b))
83+ /* 0 <= r <= 31, 0 <= g <= 63, 0 <= b <= 31 */
84+#endif
85+
86+//int info_JPEG(struct DLL_STRPICENV *env, int *info, int size, UCHAR *fp);
87+//int decode0_JPEG(struct DLL_STRPICENV *env, int size, UCHAR *fp, int b_type, UCHAR *buf, int skip);
88+
89+void jpeg_idct_init(int base_img[64][64]);
90+int jpeg_init(JPEG *jpeg);
91+void jpeg_decode(JPEG *jpeg, unsigned char *rgb, int b_type);
92+
93+/* ----------------- start main section ----------------- */
94+
95+int info_JPEG(struct DLL_STRPICENV *env, int *info, int size, UCHAR *fp0)
96+{
97+ JPEG *jpeg = (JPEG *) (((int *) env) + 128);
98+ jpeg->fp = fp0;
99+ jpeg->fp1 = fp0 + size;
100+
101+ if (jpeg_init(jpeg))
102+ return 0;
103+
104+ if (jpeg->width == 0)
105+ return 0;
106+
107+ info[0] = 0x0002;
108+ info[1] = 0x0000;
109+ info[2] = jpeg->width;
110+ info[3] = jpeg->height;
111+
112+ /* OK */
113+ return 1;
114+}
115+
116+int decode0_JPEG(struct DLL_STRPICENV *env, int size, UCHAR *fp0, int b_type, UCHAR *buf, int skip)
117+{
118+ JPEG *jpeg = (JPEG *) (((int *) env) + 128);
119+ jpeg->fp = fp0;
120+ jpeg->fp1 = fp0 + size;
121+
122+ jpeg_idct_init(jpeg->base_img);
123+ jpeg_init(jpeg);
124+
125+ jpeg->width_buf = skip / (b_type & 0x7f) + jpeg->width;
126+ jpeg_decode(jpeg, buf, b_type);
127+
128+ /* OK */
129+ return 0;
130+}
131+
132+// -------------------------- I/O ----------------------------
133+
134+unsigned short get_bits(JPEG *jpeg, int bit)
135+{
136+ unsigned char c;
137+ unsigned short ret;
138+ unsigned long buff;
139+ int remain;
140+
141+ buff = jpeg->bit_buff;
142+ remain = jpeg->bit_remain;
143+
144+ while (remain <= 16) {
145+ if (jpeg->fp >= jpeg->fp1) {
146+ ret = 0;
147+ goto fin;
148+ }
149+ c = *jpeg->fp++;
150+ if (c == 0xff) { // マーカエラーを防ぐため、FF -> FF 00 にエスケープされてる
151+ if (jpeg->fp >= jpeg->fp1) {
152+ ret = 0;
153+ goto fin;
154+ }
155+ jpeg->fp++; /* 00をskip */
156+ }
157+ buff = (buff << 8) | c;
158+ remain += 8;
159+ }
160+ ret = (buff >> (remain - bit)) & ((1 << bit) - 1);
161+ remain -= bit;
162+
163+ jpeg->bit_remain = remain;
164+ jpeg->bit_buff = buff;
165+fin:
166+ return ret;
167+}
168+
169+// ------------------------ JPEG セグメント実装 -----------------
170+
171+// start of frame
172+int jpeg_sof(JPEG *jpeg)
173+{
174+ unsigned char c;
175+ int i, h, v, n;
176+
177+ if (jpeg->fp + 8 > jpeg->fp1)
178+ goto err;
179+ /* fp[2] は bpp */
180+ jpeg->height = jpeg->fp[3] << 8 | jpeg->fp[4];
181+ jpeg->width = jpeg->fp[5] << 8 | jpeg->fp[6];
182+ n = jpeg->compo_count = jpeg->fp[7]; // Num of compo, nf
183+ jpeg->fp += 8;
184+ if (jpeg->fp + n * 3 > jpeg->fp1)
185+ goto err;
186+
187+ for (i = 0; i < n; i++) {
188+ jpeg->compo_id[i] = jpeg->fp[0];
189+
190+ jpeg->compo_sample[i] = c = jpeg->fp[1];
191+ h = jpeg->compo_h[i] = (c >> 4) & 0x0f;
192+ v = jpeg->compo_v[i] = c & 0x0f;
193+
194+ if (jpeg->max_h < h)
195+ jpeg->max_h = h;
196+ if (jpeg->max_v < v)
197+ jpeg->max_v = v;
198+
199+ jpeg->compo_qt[i] = jpeg->fp[2];
200+ jpeg->fp += 3;
201+ }
202+ return 0;
203+err:
204+ jpeg->fp = jpeg->fp1;
205+ return 1;
206+}
207+
208+// define quantize table
209+int jpeg_dqt(JPEG *jpeg)
210+{
211+ unsigned char c;
212+ int i, j, size;
213+
214+ if (jpeg->fp + 2 > jpeg->fp1)
215+ goto err;
216+ size = (jpeg->fp[0] << 8 | jpeg->fp[1]) - 2;
217+ jpeg->fp += 2;
218+ if (jpeg->fp + size > jpeg->fp1)
219+ goto err;
220+
221+ while (size > 0) {
222+ c = *jpeg->fp++;
223+ size--;
224+ j = c & 7;
225+ if (j > jpeg->n_dqt)
226+ jpeg->n_dqt = j;
227+
228+ if (c & 0xf8) {
229+ // 16 bit DQT
230+ for (i = 0; i < 64; i++) {
231+ jpeg->dqt[j][i] = jpeg->fp[0]; /* 下位は読み捨てている */
232+ jpeg->fp += 2;
233+ }
234+ size += -64 * 2;
235+ } else {
236+ // 8 bit DQT
237+ for (i = 0; i < 64; i++)
238+ jpeg->dqt[j][i] = *jpeg->fp++;
239+ size -= 64;
240+ }
241+ }
242+ return 0;
243+err:
244+ jpeg->fp = jpeg->fp1;
245+ return 1;
246+}
247+
248+// define huffman table
249+int jpeg_dht(JPEG *jpeg)
250+{
251+ unsigned tc, th;
252+ unsigned code = 0;
253+ unsigned char val;
254+ int i, j, k, num, Li[17];
255+ int len;
256+ HUFF *table;
257+
258+ if (jpeg->fp + 2 > jpeg->fp1)
259+ goto err;
260+ len = (jpeg->fp[0] << 8 | jpeg->fp[1]) - 2;
261+ jpeg->fp += 2;
262+
263+ while (len > 0) {
264+ if (jpeg->fp + 17 > jpeg->fp1)
265+ goto err;
266+ val = jpeg->fp[0];
267+
268+ tc = (val >> 4) & 0x0f; // テーブルクラス(DC/AC成分セレクタ)
269+ th = val & 0x0f; // テーブルヘッダ(何枚目のプレーンか)
270+ table = &(jpeg->huff[tc][th]);
271+
272+ num = 0;
273+ k = 0;
274+ for (i = 1; i <= 16; i++) {
275+ Li[i] = jpeg->fp[i];
276+ num += Li[i];
277+ for (j = 0; j < Li[i]; j++)
278+ table->size[k++] = i;
279+ }
280+ table->elem = num;
281+ jpeg->fp += 17;
282+
283+ k=0;
284+ code=0;
285+ i = table->size[0];
286+ while (k < num) {
287+ while (table->size[k] == i)
288+ table->code[k++] = code++;
289+ if (k >= num)
290+ break;
291+ do {
292+ code <<= 1;
293+ i++;
294+ } while (table->size[k] != i);
295+ }
296+
297+ if (jpeg->fp + num > jpeg->fp1)
298+ goto err;
299+ for (k = 0; k < num; k++)
300+ table->value[k] = jpeg->fp[k];
301+ jpeg->fp += num;
302+
303+ len -= 18 + num;
304+ }
305+ return 0;
306+err:
307+ jpeg->fp = jpeg->fp1;
308+ return 1;
309+}
310+
311+int jpeg_init(JPEG *jpeg)
312+{
313+ unsigned char c;
314+ int r = 0, i;
315+ jpeg->width = 0;
316+ jpeg->mcu_preDC[0] = 0;
317+ jpeg->mcu_preDC[1] = 0;
318+ jpeg->mcu_preDC[2] = 0;
319+ jpeg->n_dqt = 0;
320+ jpeg->max_h = 0;
321+ jpeg->max_v = 0;
322+ jpeg->bit_remain = 0;
323+ jpeg->bit_buff = 0;
324+ // DRIリセット無し
325+ jpeg->interval = 0;
326+
327+ for (;;) {
328+ if (jpeg->fp + 2 > jpeg->fp1)
329+ goto err;
330+ if (jpeg->fp[0] != 0xff)
331+ goto err0;
332+ c = jpeg->fp[1];
333+ jpeg->fp += 2;
334+ if (c == 0xd8)
335+ continue; /* SOI */
336+ if (c == 0xd9)
337+ goto err; /* EOI */
338+
339+ if (c == 0xc0)
340+ jpeg_sof(jpeg);
341+ else if (c == 0xc4)
342+ jpeg_dht(jpeg);
343+ else if (c == 0xdb)
344+ jpeg_dqt(jpeg);
345+ else if (c == 0xdd) {
346+ if (jpeg->fp + 4 > jpeg->fp1)
347+ goto err;
348+ jpeg->interval = jpeg->fp[2] << 8 | jpeg->fp[3];
349+ jpeg->fp += 4;
350+ } else if (c == 0xda) {
351+ if (jpeg->fp + 3 > jpeg->fp1)
352+ goto err;
353+ jpeg->scan_count = jpeg->fp[2];
354+ jpeg->fp += 3;
355+ if (jpeg->fp + jpeg->scan_count * 2 > jpeg->fp1)
356+ goto err;
357+ for (i = 0; i < jpeg->scan_count; i++) {
358+ jpeg->scan_id[i] = jpeg->fp[0];
359+ jpeg->scan_dc[i] = jpeg->fp[1] >> 4; // DC Huffman Table
360+ jpeg->scan_ac[i] = jpeg->fp[1] & 0x0F; // AC Huffman Table
361+ jpeg->fp += 2;
362+ }
363+ jpeg->fp += 3; /* 3bytes skip */
364+ goto fin;
365+ } else {
366+ /* 未対応 */
367+ if (jpeg->fp + 2 > jpeg->fp1)
368+ goto err;
369+ jpeg->fp += jpeg->fp[0] << 8 | jpeg->fp[1];
370+ }
371+ }
372+err:
373+ jpeg->fp = jpeg->fp1;
374+err0:
375+ r++;
376+fin:
377+ return r;
378+}
379+
380+// MCU decode
381+
382+// デコード
383+void jpeg_decode_init(JPEG *jpeg)
384+{
385+ int i, j;
386+
387+ for (i = 0; i < jpeg->scan_count; i++) {
388+ // i:scan
389+ for (j = 0; j < jpeg->compo_count; j++) {
390+ // j:frame
391+ if (jpeg->scan_id[i] == jpeg->compo_id[j]) {
392+ jpeg->scan_h[i] = jpeg->compo_h[j];
393+ jpeg->scan_v[i] = jpeg->compo_v[j];
394+ jpeg->scan_qt[i] = jpeg->compo_qt[j];
395+ break;
396+ }
397+ }
398+ }
399+ jpeg->mcu_width = jpeg->max_h * 8;
400+ jpeg->mcu_height = jpeg->max_v * 8;
401+
402+ for (i = 0; i < 32 * 32 * 4; i++)
403+ jpeg->mcu_buf[i] = 0x80;
404+
405+ for (i = 0; i < jpeg->scan_count; i++)
406+ jpeg->mcu_yuv[i] = jpeg->mcu_buf + (i << 10);
407+ return;
408+}
409+
410+// ハフマン 1シンボル復号
411+int jpeg_huff_decode(JPEG *jpeg, int tc, int th)
412+{
413+ HUFF *h = &(jpeg->huff[tc][th]);
414+ int code,size,k,v;
415+ code = 0;
416+ size = 0;
417+ k = 0;
418+ while( size < 16 ){
419+ size++;
420+ v = get_bits(jpeg,1);
421+ if(v < 0){
422+ return v;
423+ }
424+ code = (code << 1) | v;
425+
426+ while(h->size[k] == size){
427+ if(h->code[k] == code){
428+ return h->value[k];
429+ }
430+ k++;
431+ }
432+ }
433+
434+ return -1;
435+}
436+
437+void jpeg_idct_init(int base_img[64][64])
438+{
439+ int u, v, m, n;
440+ int tmpm[8], tmpn[8];
441+ int cost[32];
442+ cost[ 0] = 32768; cost[ 1] = 32138; cost[ 2] = 30274; cost[ 3] = 27246; cost[ 4] = 23170; cost[ 5] = 18205; cost[ 6] = 12540; cost[ 7] = 6393;
443+ cost[ 8] = 0; cost[ 9] = -6393; cost[10] = -12540; cost[11] = -18205; cost[12] = -23170; cost[13] = -27246; cost[14] = -30274; cost[15] = -32138;
444+ for (u = 0; u < 16; u++)
445+ cost[u + 16] = - cost[u];
446+
447+ for (u = 0; u < 8; u++) {
448+ {
449+ int i=u, d=u*2;
450+ if (d == 0)
451+ i = 4;
452+ for (m = 0; m < 8; m++){
453+ tmpm[m] = cost[i]; // 横のCos波形
454+ i=(i+d)&31;
455+ }
456+ }
457+ for (v = 0; v < 8; v++) {
458+ {
459+ int i=v,d=v*2;
460+ if (d == 0)
461+ i=4;
462+ for (n = 0; n < 8; n++){
463+ tmpn[n] = cost[i]; // 縦のCos波形
464+ i=(i+d)&31;
465+ }
466+ }
467+ // 掛け算して基底画像に
468+ for (m = 0; m < 8; m++) {
469+ for (n = 0; n < 8; n++) {
470+ base_img[u * 8 + v][m * 8 + n] = (tmpm[m] * tmpn[n])>>15;
471+ }
472+ }
473+ }
474+ }
475+ return;
476+}
477+
478+void jpeg_idct(int *block, int *dest, int base_img[64][64])
479+{
480+ int i, j ,k;
481+
482+ for (i = 0; i < 64; i++)
483+ dest[i] = 0;
484+
485+ for (i = 0; i < 64; i++) {
486+ k = block[i];
487+ if(k) { //0係数はステ
488+ for (j = 0; j < 64; j++) {
489+ dest[j] += k * base_img[i][j];
490+ }
491+ }
492+ }
493+ // 固定小数点を元に戻す+ 4で割る
494+ for (i = 0; i < 64; i++)
495+ dest[i] >>= 17;
496+ return;
497+}
498+
499+// 符号化された数値を元に戻す
500+int jpeg_get_value(JPEG *jpeg, int size)
501+{
502+ int val = 0;
503+ if (size) {
504+ val = get_bits(jpeg,size);
505+ if (val < 0)
506+ val = 0x10000 | (0 - val);
507+ else if (!(val & (1<<(size-1))))
508+ val -= (1 << size) - 1;
509+ }
510+ return val;
511+}
512+
513+// ---- ブロックのデコード ---
514+// ハフマンデコード+逆量子化+逆ジグザグ
515+int jpeg_decode_huff(JPEG *jpeg, int scan, int *block, UCHAR *zigzag_table)
516+{
517+ int size, val, run, index;
518+ int *pQt = (int *)(jpeg->dqt[jpeg->scan_qt[scan]]);
519+
520+ // DC
521+ size = jpeg_huff_decode(jpeg,0,jpeg->scan_dc[scan]);
522+ if(size < 0)
523+ return 0;
524+ val = jpeg_get_value(jpeg,size);
525+ jpeg->mcu_preDC[scan] += val;
526+ block[0] = jpeg->mcu_preDC[scan] * pQt[0];
527+
528+ //AC復号
529+ index = 1;
530+ while(index<64)
531+ {
532+ size = jpeg_huff_decode(jpeg,1,jpeg->scan_ac[scan]);
533+ if(size < 0)
534+ break;
535+ // EOB
536+ if(size == 0)
537+ break;
538+
539+ // RLE
540+ run = (size>>4)&0xF;
541+ size = size & 0x0F;
542+
543+ val = jpeg_get_value(jpeg,size);
544+ if(val>=0x10000) {
545+ //マーカ発見
546+ return val;
547+ }
548+
549+ // ZRL
550+ while (run-- > 0)
551+ block[ zigzag_table[index++] ] = 0;
552+
553+ block[ zigzag_table[index] ] = val * pQt[index];
554+ index++;
555+ }
556+ while(index<64)
557+ block[zigzag_table[index++]]=0;
558+ return 0;
559+}
560+
561+// ブロック (補間かけるには、ここで)
562+// リサンプリング
563+void jpeg_mcu_bitblt(int *src, int *dest, int width,
564+ int x0, int y0, int x1, int y1)
565+{
566+ int w, h;
567+ int x, y, y2;
568+ w = x1 - x0;
569+ h = y1 - y0;
570+ dest += y0 * width + x0;
571+ width -= w;
572+
573+ for (y = 0; y < h; y++) {
574+ y2 = (y * 8 / h) * 8;
575+ for (x = 0; x < w; x++)
576+ *dest++ = src[y2 + (x * 8 / w)];
577+ dest += width;
578+ }
579+}
580+
581+// MCU一個変換
582+void jpeg_decode_mcu(JPEG *jpeg, UCHAR *zigzag_table)
583+{
584+ int scan, val;
585+ int h, v;
586+ int *p, hh, vv;
587+ int block[64], dest[64];
588+
589+ // mcu_width x mcu_heightサイズのブロックを展開
590+ for (scan = 0; scan < jpeg->scan_count; scan++) {
591+ hh = jpeg->scan_h[scan];
592+ vv = jpeg->scan_v[scan];
593+ for (v = 0; v < vv; v++) {
594+ for (h = 0; h < hh; h++) {
595+ // ブロック(8x8)のデコード
596+ val = jpeg_decode_huff(jpeg, scan, block, zigzag_table);
597+
598+ // 逆DCT
599+ jpeg_idct(block, dest, jpeg->base_img);
600+ // リサンプリング
601+
602+ // 書き込みバッファ
603+ p = jpeg->mcu_buf + (scan << 10);
604+
605+ // 拡大転送
606+ jpeg_mcu_bitblt(dest, p, jpeg->mcu_width,
607+ jpeg->mcu_width * h / hh, jpeg->mcu_height * v / vv,
608+ jpeg->mcu_width * (h + 1) / hh, jpeg->mcu_height * (v + 1) / vv);
609+ }
610+ }
611+ }
612+}
613+
614+// YCrCb=>RGB
615+
616+void jpeg_decode_yuv(JPEG *jpeg, int h, int v, unsigned char *rgb, int b_type)
617+{
618+ int x0, y0, x, y, x1, y1;
619+ int *py;
620+ int Y12, V;
621+ int mw, mh, w;
622+
623+ mw = jpeg->mcu_width;
624+ mh = jpeg->mcu_height;
625+
626+ x0 = h * jpeg->max_h * 8;
627+ y0 = v * jpeg->max_v * 8;
628+
629+ x1 = jpeg->width - x0;
630+ if (x1 > mw)
631+ x1 = mw;
632+ y1 = jpeg->height - y0;
633+ if (y1 > mh)
634+ y1 = mh;
635+
636+ py = jpeg->mcu_buf;
637+ rgb += (y0 * jpeg->width_buf + x0) * (b_type & 0x7f);
638+ w = (jpeg->width_buf - x1) * (b_type & 0x7f);
639+
640+ for (y = 0; y < y1; y++) {
641+ for (x = 0; x < x1; x++) {
642+ int b, g, r;
643+ Y12 = py[0] << 12;
644+ // U = py[1024]; /* pu */
645+ V = py[2048]; /* pv */
646+
647+ /* blue */
648+ b = 128 + ((Y12 - V * 4 + py[1024] /* pu */ * 0x1C59) >> 12);
649+ if (b & 0xffffff00)
650+ b = (~b) >> 24;
651+
652+ /* green */
653+ g = 128 + ((Y12 - V * 0x0B6C) >> 12);
654+ if (g & 0xffffff00)
655+ g = (~g) >> 24;
656+
657+ /* red */
658+ r = 128 + ((Y12 + V * 0x166E) >> 12);
659+ if (r & 0xffffff00)
660+ r = (~r) >> 24;
661+ if (b_type == 0x0004) {
662+ rgb[0] = b;
663+ rgb[1] = g;
664+ rgb[2] = r;
665+ py++;
666+ rgb += 4;
667+ } else if (b_type == 0x0002) {
668+ r &= 0xff;
669+ g &= 0xff;
670+ b &= 0xff;
671+ *(short *) rgb = PIXEL16(r >> 3, g >> 2, b >> 3);
672+ rgb += 2;
673+ }
674+ }
675+ py += mw - x1;
676+ rgb += w;
677+ }
678+ return;
679+}
680+
681+#define INIT_ZTABLE(i, b0, b1, b2, b3) *(int *) &zigzag_table[i] = b0 | b1 << 8 | b2 << 16 | b3 << 24
682+
683+void jpeg_decode(JPEG *jpeg, UCHAR *rgb, int b_type)
684+{
685+ int h_unit, v_unit;
686+ int mcu_count, h, v;
687+
688+ UCHAR zigzag_table[64];
689+
690+ INIT_ZTABLE( 0, 0, 1, 8, 16); INIT_ZTABLE( 4, 9, 2, 3, 10);
691+ INIT_ZTABLE( 8, 17, 24, 32, 25); INIT_ZTABLE(12, 18, 11, 4, 5);
692+ INIT_ZTABLE(16, 12, 19, 26, 33); INIT_ZTABLE(20, 40, 48, 41, 34);
693+ INIT_ZTABLE(24, 27, 20, 13, 6); INIT_ZTABLE(28, 7, 14, 21, 28);
694+ INIT_ZTABLE(32, 35, 42, 49, 56); INIT_ZTABLE(36, 57, 50, 43, 36);
695+ INIT_ZTABLE(40, 29, 22, 15, 23); INIT_ZTABLE(44, 30, 37, 44, 51);
696+ INIT_ZTABLE(48, 58, 59, 52, 45); INIT_ZTABLE(52, 38, 31, 39, 46);
697+ INIT_ZTABLE(56, 53, 60, 61, 54); INIT_ZTABLE(60, 47, 55, 62, 63);
698+
699+ // MCUサイズ計算
700+ jpeg_decode_init(jpeg);
701+
702+ h_unit = (jpeg->width + jpeg->mcu_width - 1) / jpeg->mcu_width;
703+ v_unit = (jpeg->height + jpeg->mcu_height - 1) / jpeg->mcu_height;
704+
705+ // 1ブロック展開するかもしれない
706+ mcu_count = 0;
707+ for (v = 0; v < v_unit; v++) {
708+ for (h = 0; h < h_unit; h++) {
709+ mcu_count++;
710+ jpeg_decode_mcu(jpeg, zigzag_table);
711+ jpeg_decode_yuv(jpeg, h, v, rgb, b_type & 0x7fff);
712+ if (jpeg->interval > 0 && mcu_count >= jpeg->interval) {
713+ // RSTmマーカをすっ飛ばす(FF hoge)
714+ // hogeは読み飛ばしてるので、FFも飛ばす
715+ jpeg->bit_remain -= (jpeg->bit_remain & 7);
716+ jpeg->bit_remain -= 8;
717+ jpeg->mcu_preDC[0] = 0;
718+ jpeg->mcu_preDC[1] = 0;
719+ jpeg->mcu_preDC[2] = 0;
720+ mcu_count = 0;
721+ }
722+ }
723+ }
724+ return;
725+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/!cons_nt.bat (nonexistent)
+++ haribote/trunk/bayos_exp/!cons_nt.bat (revision 181)
@@ -0,0 +1 @@
1+cmd.exe
\ No newline at end of file
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/mouse.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/mouse.cpp (revision 181)
@@ -0,0 +1,176 @@
1+/* マウス関係 */
2+
3+#include "bootpack.h"
4+#include <stdio.h>
5+
6+Queue *mousefifo;
7+int mousedata0;
8+
9+void inthandler2c(int *esp)
10+/* PS/2マウスからの割り込み */
11+{
12+ int data;
13+ io_out8(PIC1_OCW2, 0x64); /* IRQ-12受付完了をPIC1に通知 */
14+ io_out8(PIC0_OCW2, 0x62); /* IRQ-02受付完了をPIC0に通知 */
15+ data = io_in8(PORT_KEYDAT);
16+ Queue::push(mousefifo, data + mousedata0);
17+ return;
18+}
19+
20+extern unsigned short table_8_565[256];
21+
22+void MouseCursor::init(unsigned short *mouse, char bc)
23+/* マウスカーソルを準備(16x16) */
24+{
25+ static char* cursor[16]/*[16]*/ = {
26+ "**************..",
27+ "*OOOOOOOOOOO*...",
28+ "*OOOOOOOOOO*....",
29+ "*OOOOOOOOO*.....",
30+ "*OOOOOOOO*......",
31+ "*OOOOOOO*.......",
32+ "*OOOOOOO*.......",
33+ "*OOOOOOOO*......",
34+ "*OOOO**OOO*.....",
35+ "*OOO*..*OOO*....",
36+ "*OO*....*OOO*...",
37+ "*O*......*OOO*..",
38+ "**........*OOO*.",
39+ "*..........*OOO*",
40+ "............*OO*",
41+ ".............***"
42+ };
43+ int x, y;
44+
45+ for (y = 0; y < 16; y++) {
46+ for (x = 0; x < 16; x++) {
47+ if (cursor[y][x] == '*') {
48+ mouse[y * 16 + x] = table_8_565[COL8_000000];
49+ }
50+ if (cursor[y][x] == 'O') {
51+ mouse[y * 16 + x] = table_8_565[COL8_FFFFFF];
52+ }
53+ if (cursor[y][x] == '.') {
54+ mouse[y * 16 + x] = table_8_565[bc & 0xff];
55+ }
56+ }
57+ }
58+ return;
59+}
60+
61+#define KEYCMD_SENDTO_MOUSE 0xd4
62+#define MOUSECMD_ENABLE 0xf4
63+
64+void Mouse::init(Queue *fifo, int data0, Mouse *mdec)
65+{
66+ int result, i;
67+ static unsigned char cmd[7] = {
68+ 0xF3, /* サンプリングレート設定 */
69+ 0xC8, /* 200 */
70+ 0xF3, /* サンプリングレート設定 */
71+ 0x64, /* 100 */
72+ 0xF3, /* サンプリングレート設定 */
73+ 0x50, /* 80 */
74+ 0xF2 /* デバイスタイプ取得 */
75+ };
76+
77+ /* 書き込み先のFIFOバッファを記憶 */
78+ mousefifo = fifo;
79+ mousedata0 = data0;
80+
81+ /* ホイールマウス初期化 */
82+ for (i = 0; i < 7; i++) {
83+ Keyboard::sendready();
84+ io_out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);
85+ Keyboard::sendready();
86+ io_out8(PORT_KEYDAT, cmd[i]);
87+ }
88+
89+ /* デバイスタイプ取得 */
90+ io_cli();
91+ for (i = 0; i < 8; i++) {
92+ result = io_in8(PORT_KEYDAT);
93+ }
94+ io_sti();
95+
96+ /* ホイールが有効かどうかチェック */
97+ if (result == 0x03) {
98+ mdec->scrollmode = 1;
99+ } else {
100+ mdec->scrollmode = 0;
101+ }
102+
103+ /* マウス有効 */
104+ Keyboard::sendready();
105+ io_out8(PORT_KEYCMD, KEYCMD_SENDTO_MOUSE);
106+ Keyboard::sendready();
107+ io_out8(PORT_KEYDAT, MOUSECMD_ENABLE);
108+ /* うまくいくとACK(0xfa)が送信されてくる */
109+ mdec->phase = 0; /* マウスの0xfaを待っている段階 */
110+ return;
111+}
112+
113+int Mouse::decode(Mouse *mdec, unsigned char dat)
114+{
115+ if (mdec->phase == 0) {
116+ /* マウスの0xfaを待っている段階 */
117+ if (dat == 0xfa) {
118+ mdec->phase = 1;
119+ }
120+ return 0;
121+ }
122+ if (mdec->phase == 1) {
123+ /* マウスの1バイト目を待っている段階 */
124+ if ((dat & 0xc8) == 0x08) {
125+ /* 正しい1バイト目だった */
126+ mdec->buf[0] = dat;
127+ mdec->phase = 2;
128+ }
129+ return 0;
130+ }
131+ if (mdec->phase == 2) {
132+ /* マウスの2バイト目を待っている段階 */
133+ mdec->buf[1] = dat;
134+ mdec->phase = 3;
135+ return 0;
136+ }
137+ if (mdec->phase == 3) {
138+ /* マウスの3バイト目を待っている段階 */
139+ mdec->buf[2] = dat;
140+ if (mdec->scrollmode != 0) {
141+ mdec->phase = 4;
142+ } else {
143+ mdec->phase = 1;
144+ }
145+ mdec->btn = mdec->buf[0] & 0x07;
146+ mdec->x = mdec->buf[1];
147+ mdec->y = mdec->buf[2];
148+ if ((mdec->buf[0] & 0x10) != 0) {
149+ mdec->x |= 0xffffff00;
150+ }
151+ if ((mdec->buf[0] & 0x20) != 0) {
152+ mdec->y |= 0xffffff00;
153+ }
154+ mdec->y = - mdec->y; /* マウスではy方向の符号が画面と反対 */
155+ if (mdec->scrollmode != 0) {
156+ return 0;
157+ } else {
158+ return 1;
159+ }
160+ }
161+ if (mdec->phase == 4) {
162+ /* マウスの4バイト目を待っている段階 */
163+ mdec->buf[3] = dat;
164+ /* スクロール対応マウスのみスクロール */
165+ mdec->phase = 1;
166+ /* mdec.buf[3]は、下位4ビットだけが有効な値である */
167+ /* とりあえず解析せずに値をしまう */
168+ mdec->scroll = mdec->buf[3] & 0x0f;
169+ if (mdec->scroll & 0x08) {
170+ /* マイナスの値だった */
171+ mdec->scroll |= 0xfffffff0;
172+ }
173+ return 1;
174+ }
175+ return -1; /* ここに来ることはないはず */
176+}
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/int.cpp (nonexistent)
+++ haribote/trunk/bayos_exp/int.cpp (revision 181)
@@ -0,0 +1,34 @@
1+/* 割り込み関係 */
2+
3+#include "bootpack.h"
4+#include <stdio.h>
5+
6+void PIC::init(void)
7+/* PICの初期化 */
8+{
9+ io_out8(PIC0_IMR, 0xff ); /* 全ての割り込みを受け付けない */
10+ io_out8(PIC1_IMR, 0xff ); /* 全ての割り込みを受け付けない */
11+
12+ io_out8(PIC0_ICW1, 0x11 ); /* エッジトリガモード */
13+ io_out8(PIC0_ICW2, 0x20 ); /* IRQ0-7は、INT20-27で受ける */
14+ io_out8(PIC0_ICW3, 1 << 2); /* PIC1はIRQ2にて接続 */
15+ io_out8(PIC0_ICW4, 0x01 ); /* ノンバッファモード */
16+
17+ io_out8(PIC1_ICW1, 0x11 ); /* エッジトリガモード */
18+ io_out8(PIC1_ICW2, 0x28 ); /* IRQ8-15は、INT28-2fで受ける */
19+ io_out8(PIC1_ICW3, 2 ); /* PIC1はIRQ2にて接続 */
20+ io_out8(PIC1_ICW4, 0x01 ); /* ノンバッファモード */
21+
22+ io_out8(PIC0_IMR, 0xfb ); /* 11111011 PIC1以外は全て禁止 */
23+ io_out8(PIC1_IMR, 0xff ); /* 11111111 全ての割り込みを受け付けない */
24+
25+ return;
26+}
27+
28+void inthandler27(int *esp)
29+{
30+ /* PIC0からの不完全割り込み対策 */
31+ io_out8(PIC0_OCW2, 0x67); /* IRQ-07受付完了をPICに通知 */
32+ return;
33+}
34+
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
--- haribote/trunk/bayos_exp/Makefile (nonexistent)
+++ haribote/trunk/bayos_exp/Makefile (revision 181)
@@ -0,0 +1,103 @@
1+OBJS_BOOTPACK = bootpack.obj naskfunc.obj hankaku.obj graphic.obj dsctbl.obj \
2+ int.obj fifo.obj keyboard.obj mouse.obj memory.obj sheet.obj timer.obj \
3+ mtask.obj window.obj console.obj file.obj tek.obj jpeg.obj alloca.obj
4+
5+TOOLPATH = ../z_tools/
6+INCPATH = ../z_tools/haribote/
7+
8+MAKE = $(TOOLPATH)make.exe -r
9+NASK = $(TOOLPATH)nask.exe
10+CC1 = $(TOOLPATH)cc1.exe -I$(INCPATH) -Os -Wall -quiet
11+CPP = $(TOOLPATH)c++.exe -I../z_tools/haribote -Os -Wall -nostdlib -fno-builtin -fno-exceptions -fno-rtti -B../z_tools -c
12+GAS2NASK = $(TOOLPATH)gas2nask.exe -a
13+OBJ2BIM = $(TOOLPATH)obj2bim.exe
14+MAKEFONT = $(TOOLPATH)makefont.exe
15+BIN2OBJ = $(TOOLPATH)bin2obj.exe
16+BIM2HRB = $(TOOLPATH)bim2hrb.exe
17+RULEFILE = haribote.rul
18+EDIMG = $(TOOLPATH)edimg.exe
19+IMGTOL = $(TOOLPATH)imgtol.com
20+GOLIB = $(TOOLPATH)golib00.exe
21+COPY = copy
22+DEL = del
23+OSACMP = $(TOOLPATH)bim2bin.exe -osacmp
24+
25+# デフォルト動作
26+
27+default :
28+ $(MAKE) ipl20.bin
29+ $(MAKE) haribote.sys
30+
31+# ファイル生成規則
32+
33+ipl20.bin : ipl20.nas Makefile
34+ $(NASK) ipl20.nas ipl20.bin ipl20.lst
35+
36+asmhead.bin : asmhead_bpp16.nas Makefile
37+ $(NASK) asmhead_bpp16.nas asmhead.bin asmhead.lst
38+
39+hankaku.bin : hankaku.txt Makefile
40+ $(MAKEFONT) hankaku.txt hankaku.bin
41+
42+hankaku.obj : hankaku.bin Makefile
43+ $(BIN2OBJ) hankaku.bin hankaku.obj _hankaku
44+
45+bootpack.bim : $(OBJS_BOOTPACK) Makefile
46+ $(OBJ2BIM) @$(RULEFILE) out:bootpack.bim stack:3136k map:bootpack.map \
47+ $(OBJS_BOOTPACK)
48+# 3MB+64KB=3136KB
49+
50+bootpack.hrb : bootpack.bim Makefile
51+ $(BIM2HRB) bootpack.bim bootpack.hrb 0
52+
53+haribote.sys : asmhead.bin bootpack.hrb Makefile
54+ copy /B asmhead.bin+bootpack.hrb haribote.sys
55+
56+haribote.img : ipl20.bin haribote.sys Makefile
57+ $(EDIMG) imgin:../z_tools/fdimg0at.tek \
58+ wbinimg src:ipl20.bin len:512 from:0 to:0 \
59+ copy from:haribote.sys to:@: \
60+ copy from:nihongo.fnt to:@: \
61+ imgout:haribote.img
62+
63+# copy from:hrbwall.jpg to:@: \
64+
65+# 一般規則
66+
67+%.gas : %.c bootpack.h Makefile
68+ $(CC1) -o $*.gas $*.c
69+
70+%.nas : %.gas Makefile
71+ $(GAS2NASK) $*.gas $*.nas
72+
73+%.obj : %.nas Makefile
74+ $(NASK) $*.nas $*.obj $*.lst
75+
76+%.obj : %.cpp Makefile
77+ $(CPP) -o $*.obj $*.cpp
78+
79+# コマンド
80+
81+clean :
82+ -$(DEL) asmhead.bin
83+ -$(DEL) hankaku.bin
84+ -$(DEL) *.lst
85+ -$(DEL) *.obj
86+ -$(DEL) *.map
87+ -$(DEL) *.bim
88+ -$(DEL) *.hrb
89+ -$(DEL) *.bin
90+ -$(DEL) *.sys
91+
92+img :
93+ -$(DEL) haribote.img
94+ $(MAKE) haribote.img
95+
96+run :
97+ $(MAKE) img
98+ $(COPY) haribote.img ..\z_tools\qemu\fdimage0.bin
99+ $(MAKE) -C ../z_tools/qemu
100+
101+install :
102+ $(MAKE) img
103+ $(IMGTOL) w a: haribote.img
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Show on old repository browser