mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-03 10:03:20 +08:00
增加命令行窗口(1)
This commit is contained in:
@@ -19,9 +19,9 @@ void HariMain(void)
|
||||
unsigned int memtotal;
|
||||
struct MOUSE_DEC mdec;
|
||||
struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR;
|
||||
unsigned char *buf_back, buf_mouse[256], *buf_win, *buf_cons;
|
||||
struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons;
|
||||
struct TASK *task_a, *task_cons;
|
||||
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 TIMER *timer;
|
||||
static char keytable0[0x80] = {
|
||||
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0, 0,
|
||||
@@ -78,23 +78,27 @@ void HariMain(void)
|
||||
init_screen8(buf_back, binfo->scrnx, binfo->scrny);
|
||||
|
||||
/* sht_cons */
|
||||
sht_cons = sheet_alloc(shtctl);
|
||||
buf_cons = (unsigned char *) memman_alloc_4k(memman, 256 * 165);
|
||||
sheet_setbuf(sht_cons, buf_cons, 256, 165, -1); /* 无透明色 */
|
||||
make_window8(buf_cons, 256, 165, "console", 0);
|
||||
make_textbox8(sht_cons, 8, 28, 240, 128, COL8_000000);
|
||||
task_cons = task_alloc();
|
||||
task_cons->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024 - 12;
|
||||
task_cons->tss.eip = (int) &console_task;
|
||||
task_cons->tss.es = 1 * 8;
|
||||
task_cons->tss.cs = 2 * 8;
|
||||
task_cons->tss.ss = 1 * 8;
|
||||
task_cons->tss.ds = 1 * 8;
|
||||
task_cons->tss.fs = 1 * 8;
|
||||
task_cons->tss.gs = 1 * 8;
|
||||
*((int *) (task_cons->tss.esp + 4)) = (int) sht_cons;
|
||||
*((int *) (task_cons->tss.esp + 8)) = memtotal;
|
||||
task_run(task_cons, 2, 2); /* level=2, priority=2 */
|
||||
for (i = 0; i < 2; i++) {
|
||||
sht_cons[i] = sheet_alloc(shtctl);
|
||||
buf_cons[i] = (unsigned char *) memman_alloc_4k(memman, 256 * 165);
|
||||
sheet_setbuf(sht_cons[i], buf_cons[i], 256, 165, -1); /*没有透明色*/
|
||||
make_window8(buf_cons[i], 256, 165, "console", 0);
|
||||
make_textbox8(sht_cons[i], 8, 28, 240, 128, COL8_000000);
|
||||
task_cons[i] = task_alloc();
|
||||
task_cons[i]->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024 - 12;
|
||||
task_cons[i]->tss.eip = (int) &console_task;
|
||||
task_cons[i]->tss.es = 1 * 8;
|
||||
task_cons[i]->tss.cs = 2 * 8;
|
||||
task_cons[i]->tss.ss = 1 * 8;
|
||||
task_cons[i]->tss.ds = 1 * 8;
|
||||
task_cons[i]->tss.fs = 1 * 8;
|
||||
task_cons[i]->tss.gs = 1 * 8;
|
||||
*((int *) (task_cons[i]->tss.esp + 4)) = (int) sht_cons[i];
|
||||
*((int *) (task_cons[i]->tss.esp + 8)) = memtotal;
|
||||
task_run(task_cons[i], 2, 2); /* level=2, priority=2 */
|
||||
sht_cons[i]->task = task_cons[i];
|
||||
sht_cons[i]->flags |= 0x20; /*有光标*/
|
||||
}
|
||||
|
||||
/* sht_win */
|
||||
sht_win = sheet_alloc(shtctl);
|
||||
@@ -116,16 +120,16 @@ void HariMain(void)
|
||||
my = (binfo->scrny - 28 - 16) / 2;
|
||||
|
||||
sheet_slide(sht_back, 0, 0);
|
||||
sheet_slide(sht_cons, 32, 4);
|
||||
sheet_slide(sht_cons[1], 56, 6);
|
||||
sheet_slide(sht_cons[0], 8, 2);
|
||||
sheet_slide(sht_win, 64, 56);
|
||||
sheet_slide(sht_mouse, mx, my);
|
||||
sheet_updown(sht_back, 0);
|
||||
sheet_updown(sht_cons, 1);
|
||||
sheet_updown(sht_win, 2);
|
||||
sheet_updown(sht_mouse, 3);
|
||||
sheet_updown(sht_cons[1], 1);
|
||||
sheet_updown(sht_cons[0], 2);
|
||||
sheet_updown(sht_win, 3);
|
||||
sheet_updown(sht_mouse, 4);
|
||||
key_win = sht_win;
|
||||
sht_cons->task = task_cons;
|
||||
sht_cons->flags |= 0x20; /*有光标*/
|
||||
|
||||
/*为了避免和键盘当前状态冲突,在一开始先进行设置*/
|
||||
fifo32_put(&keycmd, KEYCMD_LED);
|
||||
@@ -228,12 +232,12 @@ void HariMain(void)
|
||||
fifo32_put(&keycmd, KEYCMD_LED);
|
||||
fifo32_put(&keycmd, key_leds);
|
||||
}
|
||||
if (i == 256 + 0x3b && key_shift != 0 && task_cons->tss.ss0 != 0) { /* Shift+F1 */
|
||||
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->tss.eax = (int) &(task_cons->tss.esp0);
|
||||
task_cons->tss.eip = (int) asm_end_app;
|
||||
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 + 0x57 && shtctl->top > 2) { /* F11 */
|
||||
@@ -297,9 +301,8 @@ void HariMain(void)
|
||||
cons = (struct CONSOLE *) *((int *) 0x0fec);
|
||||
cons_putstr0(cons, "\nBreak(mouse) :\n");
|
||||
io_cli(); /*强制结束处理中禁止切换任务*/
|
||||
task_cons->tss.eax = (int)
|
||||
&(task_cons->tss.esp0);
|
||||
task_cons->tss.eip = (int) asm_end_app;
|
||||
task_cons[0]->tss.eax = (int) &(task_cons[0]->tss.esp0);
|
||||
task_cons[0]->tss.eip = (int) asm_end_app;
|
||||
io_sti();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user