Compare commits

...

2 Commits

Author SHA1 Message Date
Yourtion
87b1d4027c start命令 2016-05-16 12:39:56 +08:00
Yourtion
0c2b6c5934 关闭命令行窗口(2) 2016-05-16 12:36:44 +08:00
3 changed files with 29 additions and 1 deletions

View File

@@ -268,8 +268,13 @@ void HariMain(void)
task->tss.eax = (int) &(task->tss.esp0);
task->tss.eip = (int) asm_end_app;
io_sti();
} else { /*命令行窗口*/
task = sht->task;
io_cli();
fifo32_put(&task->fifo, 4);
io_sti();
}
}
}
break;
}
}

View File

@@ -256,6 +256,7 @@ void cmd_cls(struct CONSOLE *cons);
void cmd_dir(struct CONSOLE *cons);
void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline);
void cmd_exit(struct CONSOLE *cons, int *fat);
void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal);
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 *inthandler0d(int *esp);

View File

@@ -54,6 +54,9 @@ void console_task(struct SHEET *sheet, int memtotal)
boxfill8(sheet->buf, sheet->bxsize, COL8_000000, cons.cur_x, cons.cur_y, cons.cur_x + 7, cons.cur_y + 15);
cons.cur_c = -1;
}
if (i == 4) { /*点击命令行窗口的“×”按钮*/
cmd_exit(&cons, fat);
}
if (256 <= i && i <= 511) { /*键盘数据通过任务A*/
if (i == 8 + 256) {
/*退格键*/
@@ -175,6 +178,8 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal)
cmd_type(cons, fat, cmdline);
} else if (strcmp(cmdline, "exit") == 0) {
cmd_exit(cons, fat);
} else if (strncmp(cmdline, "start ", 6) == 0) {
cmd_start(cons, cmdline, memtotal);
} else if (cmdline[0] != 0) {
if (cmd_app(cons, fat, cmdline) == 0) {
/*不是命令,不是应用程序,也不是空行*/
@@ -268,6 +273,23 @@ void cmd_exit(struct CONSOLE *cons, int *fat)
}
}
void cmd_start(struct CONSOLE *cons, char *cmdline, int memtotal)
{
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht = open_console(shtctl, memtotal);
struct FIFO32 *fifo = &sht->task->fifo;
int i;
sheet_slide(sht, 32, 4);
sheet_updown(sht, shtctl->top);
/*将命令行输入的字符串逐字复制到新的命令行窗口中*/
for (i = 6; cmdline[i] != 0; i++) {
fifo32_put(fifo, cmdline[i] + 256);
}
fifo32_put(fifo, 10 + 256); /*回车键*/
cons_newline(cons);
return;
}
int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
{
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;