From 0306107e15a237bf66cf0159c47099a5f9b38468 Mon Sep 17 00:00:00 2001 From: Yourtion Date: Wed, 27 Apr 2016 15:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=85=89=E6=A0=87=E9=97=AA?= =?UTF-8?q?=E7=83=81=EF=BC=882=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 18_day/bootpack.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/18_day/bootpack.c b/18_day/bootpack.c index 0d09cbb..f302ef1 100644 --- a/18_day/bootpack.c +++ b/18_day/bootpack.c @@ -191,11 +191,13 @@ void HariMain(void) make_wtitle8(buf_win, sht_win->bxsize, "task_a", 0); make_wtitle8(buf_cons, sht_cons->bxsize, "console", 1); cursor_c = -1; /* 不显示光标 */ + fifo32_put(&task_cons->fifo, 2); /*命令行窗口光标ON */ } else { key_to = 0; make_wtitle8(buf_win, sht_win->bxsize, "task_a", 1); make_wtitle8(buf_cons, sht_cons->bxsize, "console", 0); cursor_c = COL8_000000; + fifo32_put(&task_cons->fifo, 3); /*命令行窗口光标OFF */ } sheet_refresh(sht_win, 0, 0, sht_win->bxsize, 21); sheet_refresh(sht_cons, 0, 0, sht_cons->bxsize, 21); @@ -387,7 +389,7 @@ void console_task(struct SHEET *sheet) struct TIMER *timer; struct TASK *task = task_now(); - int i, fifobuf[128], cursor_x = 16, cursor_c = COL8_000000; + int i, fifobuf[128], cursor_x = 16, cursor_c = -1; char s[2]; fifo32_init(&task->fifo, 128, fifobuf, task); @@ -409,13 +411,24 @@ void console_task(struct SHEET *sheet) if (i <= 1) { /*光标用定时器*/ if (i != 0) { timer_init(timer, &task->fifo, 0); /*下次置0 */ - cursor_c = COL8_FFFFFF; + if (cursor_c >= 0) { + cursor_c = COL8_FFFFFF; + } } else { timer_init(timer, &task->fifo, 1); /*下次置1 */ - cursor_c = COL8_000000; + if (cursor_c >= 0) { + cursor_c = COL8_000000; + } } timer_settime(timer, 50); } + if (i == 2) { /*光标ON */ + cursor_c = COL8_FFFFFF; + } + if (i == 3) { /*光标OFF */ + boxfill8(sheet->buf, sheet->bxsize, COL8_000000, cursor_x, 28, cursor_x + 7, 43); + cursor_c = -1; + } if (256 <= i && i <= 511) { /*键盘数据(通过任务A) */ if (i == 8 + 256) { /*退格键*/ @@ -436,7 +449,9 @@ void console_task(struct SHEET *sheet) } } /*重新显示光标*/ - boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43); + if (cursor_c >= 0) { /*从此开始*/ + boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43); + } sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44); } }