diff --git a/30_day/a/Makefile b/30_day/a/Makefile index 674a683..5539044 100644 --- a/30_day/a/Makefile +++ b/30_day/a/Makefile @@ -3,3 +3,6 @@ STACK = 1k MALLOC = 0k include ../app_make.txt + +$(APP).hrb : $(APP).org Makefile + $(COPY) $(APP).org $(APP).hrb diff --git a/30_day/apilib/apilib.lib b/30_day/apilib/apilib.lib deleted file mode 100644 index 29a8eee..0000000 Binary files a/30_day/apilib/apilib.lib and /dev/null differ diff --git a/30_day/haribote/bootpack.h b/30_day/haribote/bootpack.h index bb195ff..aa970dc 100644 --- a/30_day/haribote/bootpack.h +++ b/30_day/haribote/bootpack.h @@ -88,16 +88,16 @@ struct GATE_DESCRIPTOR { void init_gdtidt(void); void set_segmdesc(struct SEGMENT_DESCRIPTOR *sd, unsigned int limit, int base, int ar); void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar); -#define ADR_IDT 0x0026f800 -#define LIMIT_IDT 0x000007ff -#define ADR_GDT 0x00270000 -#define LIMIT_GDT 0x0000ffff +#define ADR_IDT 0x0026f800 +#define LIMIT_IDT 0x000007ff +#define ADR_GDT 0x00270000 +#define LIMIT_GDT 0x0000ffff #define ADR_BOTPAK 0x00280000 #define LIMIT_BOTPAK 0x0007ffff #define AR_DATA32_RW 0x4092 #define AR_CODE32_ER 0x409a -#define AR_LDT 0x0082 -#define AR_TSS32 0x0089 +#define AR_LDT 0x0082 +#define AR_TSS32 0x0089 #define AR_INTGATE32 0x008e /* int.c */ @@ -288,10 +288,10 @@ void file_loadfile(int clustno, int size, char *buf, int *fat, char *img); struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max); char *file_loadfile2(int clustno, int *psize, int *fat); -/* bootpack.c */ -struct TASK *open_constask(struct SHEET *sht, unsigned int memtotal); -struct SHEET *open_console(struct SHTCTL *shtctl, unsigned int memtotal); - /* tek.c */ int tek_getsize(unsigned char *p); int tek_decomp(unsigned char *p, char *q, int size); + +/* bootpack.c */ +struct TASK *open_constask(struct SHEET *sht, unsigned int memtotal); +struct SHEET *open_console(struct SHTCTL *shtctl, unsigned int memtotal); diff --git a/30_day/haribote/console.c b/30_day/haribote/console.c index 3e51686..e8c5c69 100644 --- a/30_day/haribote/console.c +++ b/30_day/haribote/console.c @@ -9,8 +9,8 @@ void console_task(struct SHEET *sheet, int memtotal) struct TASK *task = task_now(); struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; int i, *fat = (int *) memman_alloc_4k(memman, 4 * 2880); - struct FILEHANDLE fhandle[8]; struct CONSOLE cons; + struct FILEHANDLE fhandle[8]; char cmdline[30]; unsigned char *nihongo = (char *) *((int *) 0x0fe8); @@ -133,19 +133,19 @@ void cons_putchar(struct CONSOLE *cons, int chr, char move) cons_newline(cons); } if (((cons->cur_x - 8) & 0x1f) == 0) { - break; /*被32整除则break*/ + break; /* 32�Ŋ���؂ꂽ��break */ } } - } else if (s[0] == 0x0a) { /*换行*/ + } else if (s[0] == 0x0a) { /* ���s */ cons_newline(cons); - } else if (s[0] == 0x0d) { /*回车*/ - /*先不做任何操作*/ - } else { /*一般字符*/ + } else if (s[0] == 0x0d) { /* ���A */ + /* �Ƃ肠�����Ȃɂ����Ȃ� */ + } else { /* ���ʂ̕��� */ if (cons->sht != 0) { putfonts8_asc_sht(cons->sht, cons->cur_x, cons->cur_y, COL8_FFFFFF, COL8_000000, s, 1); } if (move != 0) { - /* move为0时光标不后移*/ + /* move��0�̂Ƃ��̓J�[�\����i�߂Ȃ� */ cons->cur_x += 8; if (cons->cur_x == 8 + 240) { cons_newline(cons); @@ -161,9 +161,9 @@ void cons_newline(struct CONSOLE *cons) struct SHEET *sheet = cons->sht; struct TASK *task = task_now(); if (cons->cur_y < 28 + 112) { - cons->cur_y += 16; /*到下一行*/ + cons->cur_y += 16; /* ���̍s�� */ } else { - /*滚动*/ + /* �X�N���[�� */ if (sheet != 0) { for (y = 28; y < 28 + 112; y++) { for (x = 8; x < 8 + 240; x++) { @@ -180,7 +180,7 @@ void cons_newline(struct CONSOLE *cons) } cons->cur_x = 8; if (task->langmode == 1 && task->langbyte1 != 0) { - cons->cur_x += 8; + cons->cur_x = 16; } return; } @@ -208,7 +208,7 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal) cmd_mem(cons, memtotal); } else if (strcmp(cmdline, "cls") == 0 && cons->sht != 0) { cmd_cls(cons); - } else if ((strcmp(cmdline, "dir") == 0 || strcmp(cmdline, "ls") == 0) && cons->sht != 0) { + } else if (strcmp(cmdline, "dir") == 0 && cons->sht != 0) { cmd_dir(cons); } else if (strcmp(cmdline, "exit") == 0) { cmd_exit(cons, fat); @@ -218,9 +218,9 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal) cmd_ncst(cons, cmdline, memtotal); } else if (strncmp(cmdline, "langmode ", 9) == 0) { cmd_langmode(cons, cmdline); - }else if (cmdline[0] != 0) { + } else if (cmdline[0] != 0) { if (cmd_app(cons, fat, cmdline) == 0) { - /*不是命令,不是应用程序,也不是空行*/ + /* �R�}���h�ł͂Ȃ��A�A�v���ł��Ȃ��A����ɋ�s�ł��Ȃ� */ cons_putstr0(cons, "Bad command.\n\n"); } } @@ -288,9 +288,9 @@ void cmd_exit(struct CONSOLE *cons, int *fat) memman_free_4k(memman, (int) fat, 4 * 2880); io_cli(); if (cons->sht != 0) { - fifo32_put(fifo, cons->sht - shtctl->sheets0 + 768); /* 768〜1023 */ + fifo32_put(fifo, cons->sht - shtctl->sheets0 + 768); /* 768�`1023 */ } else { - fifo32_put(fifo, task - taskctl->tasks0 + 1024); /*1024~2023*/ + fifo32_put(fifo, task - taskctl->tasks0 + 1024); /* 1024�`2023 */ } io_sti(); for (;;) { @@ -306,11 +306,11 @@ void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal) int i; sheet_slide(sht, 32, 4); sheet_updown(sht, shtctl->top); - /*将命令行输入的字符串逐字复制到新的命令行窗口中*/ + /* �R�}���h���C���ɓ��͂��ꂽ��������A�ꕶ�����V�����R���\�[���ɓ��� */ for (i = 6; cmdline[i] != 0; i++) { fifo32_put(fifo, cmdline[i] + 256); } - fifo32_put(fifo, 10 + 256); /*回车键*/ + fifo32_put(fifo, 10 + 256); /* Enter */ cons_newline(cons); return; } @@ -320,12 +320,11 @@ void cmd_ncst(struct CONSOLE *cons, char *cmdline, int memtotal) struct TASK *task = open_constask(0, memtotal); struct FIFO32 *fifo = &task->fifo; int i; - - /*将命令行输入的字符串逐字复制到新的命令行窗口中*/ + /* �R�}���h���C���ɓ��͂��ꂽ��������A�ꕶ�����V�����R���\�[���ɓ��� */ for (i = 5; cmdline[i] != 0; i++) { fifo32_put(fifo, cmdline[i] + 256); } - fifo32_put(fifo, 10 + 256); /*回车键*/ + fifo32_put(fifo, 10 + 256); /* Enter */ cons_newline(cons); return; } @@ -347,26 +346,25 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) { struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; struct FILEINFO *finfo; - struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT; char name[18], *p, *q; struct TASK *task = task_now(); int i, segsiz, datsiz, esp, dathrb, appsiz; struct SHTCTL *shtctl; struct SHEET *sht; - /*根据命令行生成文件名*/ + /* �R�}���h���C������t�@�C�����𐶐� */ for (i = 0; i < 13; i++) { if (cmdline[i] <= ' ') { break; } name[i] = cmdline[i]; } - name[i] = 0; /*暂且将文件名的后面置为0*/ + name[i] = 0; /* �Ƃ肠�����t�@�C�����̌���0�ɂ��� */ - /*寻找文件 */ + /* �t�@�C����T�� */ finfo = file_search(name, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); if (finfo == 0 && name[i - 1] != '.') { - /*由于找不到文件,故在文件名后面加上“.hrb”后重新寻找*/ + /* ���‚���Ȃ������̂Ō���".HRB"���‚��Ă�����x�T���Ă݂� */ name[i ] = '.'; name[i + 1] = 'H'; name[i + 2] = 'R'; @@ -376,7 +374,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) } if (finfo != 0) { - /*如果找到文件*/ + /* �t�@�C�������‚������ꍇ */ appsiz = finfo->size; p = file_loadfile2(finfo->clustno, &appsiz, fat); if (appsiz >= 36 && strncmp(p + 4, "Hari", 4) == 0 && *p == 0x00) { @@ -386,8 +384,8 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) dathrb = *((int *) (p + 0x0014)); q = (char *) memman_alloc_4k(memman, segsiz); task->ds_base = (int) q; - set_segmdesc(task->ldt + 0, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60); - set_segmdesc(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60); + set_segmdesc(task->ldt + 0, appsiz - 1, (int) p, AR_CODE32_ER + 0x60); + set_segmdesc(task->ldt + 1, segsiz - 1, (int) q, AR_DATA32_RW + 0x60); for (i = 0; i < datsiz; i++) { q[esp + i] = p[dathrb + i]; } @@ -396,11 +394,11 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) for (i = 0; i < MAX_SHEETS; i++) { sht = &(shtctl->sheets0[i]); if ((sht->flags & 0x11) == 0x11 && sht->task == task) { - /*找到被应用程序遗留的窗口*/ - sheet_free(sht); /*关闭*/ + /* �A�v�����J�����ςȂ��ɂ����������𔭌� */ + sheet_free(sht); /* �‚��� */ } } - for (i = 0; i < 8; i++) { /*将未关闭的文件关闭*/ + for (i = 0; i < 8; i++) { /* �N���[�Y���ĂȂ��t�@�C�����N���[�Y */ if (task->fhandle[i].buf != 0) { memman_free_4k(memman, (int) task->fhandle[i].buf, task->fhandle[i].size); task->fhandle[i].buf = 0; @@ -416,7 +414,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) cons_newline(cons); return 1; } - /*没有找到文件的情况*/ + /* �t�@�C�������‚���Ȃ������ꍇ */ return 0; } @@ -428,8 +426,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4); struct SHEET *sht; struct FIFO32 *sys_fifo = (struct FIFO32 *) *((int *) 0x0fec); - int *reg = &eax + 1; /* eax后面的地址*/ - /*强行改写通过PUSHAD保存的值*/ + int *reg = &eax + 1; /* eax�̎��̔Ԓn */ + /* �ۑ��̂��߂�PUSHAD�������ɏ��������� */ /* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */ /* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */ int i; @@ -452,7 +450,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int sheet_setbuf(sht, (char *) ebx + ds_base, esi, edi, eax); make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0); sheet_slide(sht, ((shtctl->xsize - esi) / 2) & ~3, (shtctl->ysize - edi) / 2); - sheet_updown(sht, shtctl->top); /*将窗口图层高度指定为当前鼠标所在图层的高度,鼠标移到上层*/ + sheet_updown(sht, shtctl->top); /* ���̃}�E�X�Ɠ��������ɂȂ�悤�Ɏw��F �}�E�X�͂��̏�ɂȂ� */ reg[7] = (int) sht; } else if (edx == 6) { sht = (struct SHEET *) (ebx & 0xfffffffe); @@ -468,13 +466,13 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int } } else if (edx == 8) { memman_init((struct MEMMAN *) (ebx + ds_base)); - ecx &= 0xfffffff0; /*以16字节为单位*/ + ecx &= 0xfffffff0; /* 16�o�C�g�P�ʂ� */ memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx); } else if (edx == 9) { - ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/ + ecx = (ecx + 0x0f) & 0xfffffff0; /* 16�o�C�g�P�ʂɐ؂�グ */ reg[7] = memman_alloc((struct MEMMAN *) (ebx + ds_base), ecx); } else if (edx == 10) { - ecx = (ecx + 0x0f) & 0xfffffff0; /*以16字节为单位进位取整*/ + ecx = (ecx + 0x0f) & 0xfffffff0; /* 16�o�C�g�P�ʂɐ؂�グ */ memman_free((struct MEMMAN *) (ebx + ds_base), eax, ecx); } else if (edx == 11) { sht = (struct SHEET *) (ebx & 0xfffffffe); @@ -508,7 +506,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int io_cli(); if (fifo32_status(&task->fifo) == 0) { if (eax != 0) { - task_sleep(task); /* FIFO为空,休眠并等待*/ + task_sleep(task); /* FIFO����Ȃ̂ŐQ�đ҂� */ } else { io_sti(); reg[7] = -1; @@ -517,32 +515,32 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int } i = fifo32_get(&task->fifo); io_sti(); - if (i <= 1) { /*光标用定时器*/ - /*应用程序运行时不需要显示光标,因此总是将下次显示用的值置为1*/ - timer_init(cons->timer, &task->fifo, 1); /*下次置为1*/ + if (i <= 1 && cons->sht != 0) { /* �J�[�\���p�^�C�} */ + /* �A�v�����s���̓J�[�\�����o�Ȃ��̂ŁA���‚����͕\���p��1�𒍕����Ă��� */ + timer_init(cons->timer, &task->fifo, 1); /* ����1�� */ timer_settime(cons->timer, 50); } - if (i == 2) { /*光标ON */ + if (i == 2) { /* �J�[�\��ON */ cons->cur_c = COL8_FFFFFF; } - if (i == 3) { /*光标OFF */ + if (i == 3) { /* �J�[�\��OFF */ cons->cur_c = -1; } - if (i == 4) { /*只关闭命令行窗口*/ + if (i == 4) { /* �R���\�[��������‚��� */ timer_cancel(cons->timer); io_cli(); - fifo32_put(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /*2024~2279*/ + fifo32_put(sys_fifo, cons->sht - shtctl->sheets0 + 2024); /* 2024�`2279 */ cons->sht = 0; io_sti(); } - if (i >= 256) { /*键盘数据(通过任务A)等*/ + if (i >= 256) { /* �L�[�{�[�h�f�[�^�i�^�X�NA�o�R�j�Ȃ� */ reg[7] = i - 256; return 0; } } } else if (edx == 16) { reg[7] = (int) timer_alloc(); - ((struct TIMER *) reg[7])->flags2 = 1; /*允许自动取消*/ + ((struct TIMER *) reg[7])->flags2 = 1; /* �����L�����Z���L�� */ } else if (edx == 17) { timer_init((struct TIMER *) ebx, &task->fifo, eax + 256); } else if (edx == 18) { @@ -570,13 +568,13 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int fh = &task->fhandle[i]; reg[7] = 0; if (i < 8) { - finfo = file_search((char *) ebx + ds_base, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); + finfo = file_search((char *) ebx + ds_base, + (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); if (finfo != 0) { reg[7] = (int) fh; - fh->buf = (char *) memman_alloc_4k(memman, finfo->size); fh->size = finfo->size; fh->pos = 0; - file_loadfile2(finfo->clustno, &fh->size, task->fat); + fh->buf = file_loadfile2(finfo->clustno, &fh->size, task->fat); } } } else if (edx == 22) { @@ -644,7 +642,7 @@ int *inthandler0c(int *esp) cons_putstr0(cons, "\nINT 0C :\n Stack Exception.\n"); sprintf(s, "EIP = %08X\n", esp[11]); cons_putstr0(cons, s); - return &(task->tss.esp0); /*强制结束程序*/ + return &(task->tss.esp0); /* �ُ�I�������� */ } int *inthandler0d(int *esp) @@ -655,7 +653,7 @@ int *inthandler0d(int *esp) cons_putstr0(cons, "\nINT 0D :\n General Protected Exception.\n"); sprintf(s, "EIP = %08X\n", esp[11]); cons_putstr0(cons, s); - return &(task->tss.esp0); /*强制结束程序*/ + return &(task->tss.esp0); /* �ُ�I�������� */ } void hrb_api_linewin(struct SHEET *sht, int x0, int y0, int x1, int y1, int col) diff --git a/30_day/haribote/haribote.sys b/30_day/haribote/haribote.sys deleted file mode 100644 index e098d2b..0000000 Binary files a/30_day/haribote/haribote.sys and /dev/null differ diff --git a/30_day/haribote/ipl20.nas b/30_day/haribote/ipl20.nas index 9b14835..5ccde9c 100644 --- a/30_day/haribote/ipl20.nas +++ b/30_day/haribote/ipl20.nas @@ -43,10 +43,8 @@ entry: MOV CH,0 ; 柱面0 MOV DH,0 ; 磁头0 MOV CL,2 ; 扇区2 - readloop: MOV SI,0 ; 记录失败次数寄存器 - retry: MOV AH,0x02 ; AH=0x02 : 读入磁盘 MOV AL,1 ; 1个扇区 @@ -82,8 +80,9 @@ next: JMP 0xc200 error: + MOV AX,0 + MOV ES,AX MOV SI,msg - putloop: MOV AL,[SI] ADD SI,1 ; 给SI加1 @@ -93,7 +92,6 @@ putloop: MOV BX,15 ; 指定字符颜色 INT 0x10 ; 调用显卡BIOS JMP putloop - fin: HLT ; 让CPU停止,等待指令 JMP fin ; 无限循环 diff --git a/30_day/haribote/mouse.c b/30_day/haribote/mouse.c index 0c6403e..8281311 100644 --- a/30_day/haribote/mouse.c +++ b/30_day/haribote/mouse.c @@ -16,8 +16,8 @@ void inthandler2c(int *esp) return; } -#define KEYCMD_SENDTO_MOUSE 0xd4 -#define MOUSECMD_ENABLE 0xf4 +#define KEYCMD_SENDTO_MOUSE 0xd4 +#define MOUSECMD_ENABLE 0xf4 void enable_mouse(struct FIFO32 *fifo, int data0, struct MOUSE_DEC *mdec) { @@ -31,7 +31,7 @@ void enable_mouse(struct FIFO32 *fifo, int data0, struct MOUSE_DEC *mdec) io_out8(PORT_KEYDAT, MOUSECMD_ENABLE); /* 顺利的话,ACK(0xfa)会被发送*/ mdec->phase = 0; /* 等待鼠标的0xfa的阶段*/ -return; + return; } int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat) @@ -40,13 +40,15 @@ int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat) /* 等待鼠标的0xfa的阶段 */ if (dat == 0xfa) { mdec->phase = 1; - } + } return 0; } if (mdec->phase == 1) { /* 等待鼠标第一字节的阶段 */ - mdec->buf[0] = dat; - mdec->phase = 2; + if ((dat & 0xc8) == 0x08) { + mdec->buf[0] = dat; + mdec->phase = 2; + } return 0; } if (mdec->phase == 2) { @@ -67,7 +69,7 @@ int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat) } if ((mdec->buf[0] & 0x20) != 0) { mdec->y |= 0xffffff00; - } + } mdec->y = - mdec->y; /* 鼠标的y方向与画面符号相反 */ return 1; } diff --git a/30_day/haribote/mtask.c b/30_day/haribote/mtask.c index f67b935..14bb46e 100644 --- a/30_day/haribote/mtask.c +++ b/30_day/haribote/mtask.c @@ -1,4 +1,4 @@ -/* 多任务管理 */ +/* �}���`�^�X�N�֌W */ #include "bootpack.h" @@ -16,7 +16,7 @@ void task_add(struct TASK *task) struct TASKLEVEL *tl = &taskctl->level[task->level]; tl->tasks[tl->running] = task; tl->running++; - task->flags = 2; /*活动中*/ + task->flags = 2; /* ���쒆 */ return; } @@ -25,38 +25,39 @@ void task_remove(struct TASK *task) int i; struct TASKLEVEL *tl = &taskctl->level[task->level]; - /*寻找task所在的位置*/ + /* task���ǂ��ɂ��邩��T�� */ for (i = 0; i < tl->running; i++) { if (tl->tasks[i] == task) { - /*在这里 */ + /* �����ɂ��� */ break; } } tl->running--; if (i < tl->now) { - tl->now--; /*需要移动成员,要相应地处理 */ + tl->now--; /* �����̂ŁA��������킹�Ă��� */ } if (tl->now >= tl->running) { - /*如果now的值出现异常,则进行修正*/ + /* now���������Ȓl�ɂȂ��Ă�����A�C������ */ tl->now = 0; } - task->flags = 1; /* 休眠中 */ + task->flags = 1; /* �X���[�v�� */ - /* 移动 */ + /* ���炵 */ for (; i < tl->running; i++) { tl->tasks[i] = tl->tasks[i + 1]; } + return; } void task_switchsub(void) { int i; - /*寻找最上层的LEVEL */ + /* ��ԏ�̃��x����T�� */ for (i = 0; i < MAX_TASKLEVELS; i++) { if (taskctl->level[i].running > 0) { - break; /*找到了*/ + break; /* ���‚����� */ } } taskctl->now_lv = i; @@ -77,7 +78,6 @@ struct TASK *task_init(struct MEMMAN *memman) struct TASK *task, *idle; struct SEGMENT_DESCRIPTOR *gdt = (struct SEGMENT_DESCRIPTOR *) ADR_GDT; - taskctl = (struct TASKCTL *) memman_alloc_4k(memman, sizeof (struct TASKCTL)); for (i = 0; i < MAX_TASKS; i++) { taskctl->tasks0[i].flags = 0; @@ -92,11 +92,11 @@ struct TASK *task_init(struct MEMMAN *memman) } task = task_alloc(); - task->flags = 2; /*活动中标志*/ - task->priority = 2; /* 0.02秒*/ - task->level = 0; /*最高LEVEL */ + task->flags = 2; /* ���쒆�}�[�N */ + task->priority = 2; /* 0.02�b */ + task->level = 0; /* �ō����x�� */ task_add(task); - task_switchsub(); /* LEVEL 设置*/ + task_switchsub(); /* ���x���ݒ� */ load_tr(task->sel); task_timer = timer_alloc(); timer_settime(task_timer, task->priority); @@ -151,7 +151,8 @@ void task_run(struct TASK *task, int level, int priority) if (priority > 0) { task->priority = priority; } - if (task->flags == 2 && task->level != level) { + + if (task->flags == 2 && task->level != level) { /*改变活动中的LEVEL */ task_remove(task); /*这里执行之后flag的值会变为1,于是下面的if语句块也会被执行*/ } @@ -160,6 +161,7 @@ void task_run(struct TASK *task, int level, int priority) task->level = level; task_add(task); } + taskctl->lv_change = 1; /*下次任务切换时检查LEVEL */ return; } @@ -181,7 +183,6 @@ void task_sleep(struct TASK *task) return; } - void task_switch(void) { struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv]; diff --git a/30_day/haribote/tek.c b/30_day/haribote/tek.c index 4062dcc..a765a64 100644 --- a/30_day/haribote/tek.c +++ b/30_day/haribote/tek.c @@ -231,7 +231,7 @@ static int tek_decode2(int siz, UCHAR *p, UCHAR *q) if (dsiz > bsiz || (hed & 0x21) != 0x01) return 1; if (hed & 0x40) - tek_getnum_s7s(&p); + tek_getnum_s7s(&p); /* �I�v�V�������ւ̃|�C���^��ǂݔ�΂� */ st = tek_lzrestore_stk2(p1 - p, p, dsiz, q); } return st; @@ -278,7 +278,7 @@ static int tek_lzrestore_tek5(int srcsiz, UCHAR *src, int outsiz, UCHAR *outbuf) lp = pb; pb = wrksiz; } - wrksiz = 0x180 * sizeof (UINT32) + (0x840 + (0x300 << (lc + lp))) * sizeof (tek_TPRB); /* Å’á15KB, lc+lp=3‚È‚çA36KB */ + wrksiz = 0x180 * sizeof (UINT32) + (0x840 + (0x300 << (lc + lp))) * sizeof (tek_TPRB); /* �Œ�15KB, lc+lp=3�Ȃ�A36KB */ work = (int *) memman_alloc_4k((struct MEMMAN *) MEMMAN_ADDR, wrksiz); if (work == NULL) return -1; @@ -457,7 +457,7 @@ static int tek_decmain5(int *work, UCHAR *src, int osiz, UCHAR *q, int lc, int p for (i = sizeof (struct tek_STR_PRB) / sizeof (tek_TPRB) + (0x300 << (lc + lp)) - 2; i >= 0; i--) ((tek_TPRB *) prb)[i] = 1 << 15; for (i = 0; i < 32; i++) { - rd->bm[i].lt = (i >= 4); + rd->bm[i].lt = (i >= 4); /* 0..3�͎����Ȃ� */ rd->bm[i].lt0 = (i < 24) ? 16 * 1024 : 8 * 1024; rd->bm[i].s &= 0; rd->bm[i].t = rd->bm[i].m = 5; @@ -466,7 +466,7 @@ static int tek_decmain5(int *work, UCHAR *src, int osiz, UCHAR *q, int lc, int p if (stk) { rd->rmsk = -1 << 11; for (i = 0; i < 32; i++) - rd->bm[i].lt = 0; + rd->bm[i].lt = 0; /* �S�Ď����Ȃ� */ for (i = 0; i < 14; i++) rd->ptbm[i] = &rd->bm[0]; } else { @@ -493,7 +493,7 @@ static int tek_decmain5(int *work, UCHAR *src, int osiz, UCHAR *q, int lc, int p rd->bm[22].t = 0; rd->bm[22].m = 1; prb->repg3 = 0xffff; if (flags == -2) { /* z1 */ - rd->bm[22].lt = 0; + rd->bm[22].lt = 0; /* repg3��lt��0�� */ for (i = 0; i < 14; i++) pt[i] = pt1[i]; } else {