Compare commits

...

4 Commits

Author SHA1 Message Date
Yourtion
24945ddb18 增加命令行窗口(4) 2016-05-13 11:30:45 +08:00
Yourtion
d1e4c44149 增加命令行窗口(3) 2016-05-13 11:21:01 +08:00
Yourtion
34fc4eca27 bug fix 2016-05-13 11:18:02 +08:00
Yourtion
c512f3e391 增加命令行窗口(2) 2016-05-13 11:08:20 +08:00
4 changed files with 37 additions and 33 deletions

View File

@@ -429,18 +429,6 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
timer_settime((struct TIMER *) ebx, eax);
} else if (edx == 19) {
timer_free((struct TIMER *) ebx);
} else if (edx == 20) {
if (eax == 0) {
i = io_in8(0x61);
io_out8(0x61, i & 0x0d);
} else {
i = 1193180000 / eax;
io_out8(0x43, 0xb6);
io_out8(0x42, i & 0xff);
io_out8(0x42, i >> 8);
i = io_in8(0x61);
io_out8(0x61, (i | 0x03) & 0x0f);
}
}
return 0;
}

View File

@@ -21,7 +21,7 @@ void HariMain(void)
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
unsigned char *buf_back, buf_mouse[256], *buf_win, *buf_cons[2];
struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons[2];
struct TASK *task_a, *task_cons[2];
struct TASK *task_a, *task_cons[2], *task;
struct TIMER *timer;
static char keytable0[0x80] = {
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0, 0,
@@ -232,13 +232,15 @@ void HariMain(void)
fifo32_put(&keycmd, KEYCMD_LED);
fifo32_put(&keycmd, key_leds);
}
if (i == 256 + 0x3b && key_shift != 0 && task_cons[0]->tss.ss0 != 0) { /* Shift+F1 */
cons = (struct CONSOLE *) *((int *) 0x0fec);
cons_putstr0(cons, "\nBreak(key) :\n");
io_cli(); /*强制结束处理时禁止任务切换*/
task_cons[0]->tss.eax = (int) &(task_cons[0]->tss.esp0);
task_cons[0]->tss.eip = (int) asm_end_app;
io_sti();
if (i == 256 + 0x3b && key_shift != 0) {
task = key_win->task;
if (task != 0 && task->tss.ss0 != 0) { /* Shift+F1 */
cons_putstr0(cons, "\nBreak(key) :\n");
io_cli(); /*强制结束处理时禁止任务切换*/
task->tss.eax = (int) &(task->tss.esp0);
task->tss.eip = (int) asm_end_app;
io_sti();
}
}
if (i == 256 + 0x57 && shtctl->top > 2) { /* F11 */
sheet_updown(shtctl->sheets[1], shtctl->top - 1);
@@ -298,11 +300,11 @@ void HariMain(void)
if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <=y && y < 19) {
/*点击“×”按钮*/
if ((sht->flags & 0x10) != 0) { /*该窗口是否为应用程序窗口?*/
cons = (struct CONSOLE *) *((int *) 0x0fec);
task = sht->task;
cons_putstr0(cons, "\nBreak(mouse) :\n");
io_cli(); /*强制结束处理禁止切换任务*/
task_cons[0]->tss.eax = (int) &(task_cons[0]->tss.esp0);
task_cons[0]->tss.eip = (int) asm_end_app;
io_cli(); /*强制结束处理禁止任务切换*/
task->tss.eax = (int) &(task->tss.esp0);/*到此结束*/
task->tss.eip = (int) asm_end_app;
io_sti();
}
}

View File

@@ -212,6 +212,8 @@ struct TASK {
int level, priority; /* 优先级 */
struct FIFO32 fifo;
struct TSS32 tss;
struct CONSOLE *cons;
int ds_base;
};
struct TASKLEVEL {
int running; /*正在运行的任务数量*/

View File

@@ -16,7 +16,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
cons.cur_x = 8;
cons.cur_y = 28;
cons.cur_c = -1;
*((int *) 0x0fec) = (int) &cons;
task->cons = &cons;
fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
@@ -293,13 +293,13 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
datsiz = *((int *) (p + 0x0010));
dathrb = *((int *) (p + 0x0014));
q = (char *) memman_alloc_4k(memman, segsiz);
*((int *) 0xfe8) = (int) q;
set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(gdt + 1004, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
task->ds_base = (int) q;
set_segmdesc(gdt + task->sel / 8 + 1000, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(gdt + task->sel / 8 + 2000, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
for (i = 0; i < datsiz; i++) {
q[esp + i] = p[dathrb + i];
}
start_app(0x1b, 1003 * 8, esp, 1004 * 8, &(task->tss.esp0));
start_app(0x1b, task->sel + 1000 * 8, esp, task->sel + 2000 * 8, &(task->tss.esp0));
shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
for (i = 0; i < MAX_SHEETS; i++) {
sht = &(shtctl->sheets0[i]);
@@ -323,9 +323,9 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax)
{
int ds_base = *((int *) 0xfe8);
struct TASK *task = task_now();
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
int ds_base = task->ds_base;
struct CONSOLE *cons = task->cons;
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht;
int *reg = &eax + 1; /* eax后面的地址*/
@@ -429,14 +429,26 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int
timer_settime((struct TIMER *) ebx, eax);
} else if (edx == 19) {
timer_free((struct TIMER *) ebx);
} else if (edx == 20) {
if (eax == 0) {
i = io_in8(0x61);
io_out8(0x61, i & 0x0d);
} else {
i = 1193180000 / eax;
io_out8(0x43, 0xb6);
io_out8(0x42, i & 0xff);
io_out8(0x42, i >> 8);
i = io_in8(0x61);
io_out8(0x61, (i | 0x03) & 0x0f);
}
}
return 0;
}
int *inthandler0c(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0C :\n Stack Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);
@@ -446,8 +458,8 @@ int *inthandler0c(int *esp)
int *inthandler0d(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0D :\n General Protected Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);