diff --git a/26_day/bootpack.h b/26_day/bootpack.h index 31a6385..5da0cb7 100644 --- a/26_day/bootpack.h +++ b/26_day/bootpack.h @@ -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); diff --git a/26_day/console.c b/26_day/console.c index 2da67d9..f72e450 100644 --- a/26_day/console.c +++ b/26_day/console.c @@ -178,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) { /*不是命令,不是应用程序,也不是空行*/ @@ -271,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;