From 1fdb7736f7169f3e1487391489d6b2bcfc2b2d93 Mon Sep 17 00:00:00 2001 From: Yourtion Date: Wed, 27 Apr 2016 15:11:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E5=9B=9E=E8=BD=A6=E9=94=AE=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 18_day/bootpack.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/18_day/bootpack.c b/18_day/bootpack.c index f302ef1..9087977 100644 --- a/18_day/bootpack.c +++ b/18_day/bootpack.c @@ -185,6 +185,11 @@ void HariMain(void) fifo32_put(&task_cons->fifo, 8 + 256); } } + if (i == 256 + 0x1c) { /*回车键*/ + if (key_to != 0) { /*发送至命令行窗口*/ + fifo32_put(&task_cons->fifo, 10 + 256); + } + } if (i == 256 + 0x0f) { /* Tab键*/ if (key_to == 0) { key_to = 1; @@ -389,7 +394,7 @@ void console_task(struct SHEET *sheet) struct TIMER *timer; struct TASK *task = task_now(); - int i, fifobuf[128], cursor_x = 16, cursor_c = -1; + int i, fifobuf[128], cursor_x = 16, cursor_y = 28, cursor_c = -1; char s[2]; fifo32_init(&task->fifo, 128, fifobuf, task); @@ -426,7 +431,7 @@ void console_task(struct SHEET *sheet) cursor_c = COL8_FFFFFF; } if (i == 3) { /*光标OFF */ - boxfill8(sheet->buf, sheet->bxsize, COL8_000000, cursor_x, 28, cursor_x + 7, 43); + boxfill8(sheet->buf, sheet->bxsize, COL8_000000, cursor_x, cursor_y, cursor_x + 7, cursor_y + 15); cursor_c = -1; } if (256 <= i && i <= 511) { /*键盘数据(通过任务A) */ @@ -434,25 +439,35 @@ void console_task(struct SHEET *sheet) /*退格键*/ if (cursor_x > 16) { /*用空白擦除光标后将光标前移一位*/ - putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, " ", 1); + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1); cursor_x -= 8; } + } else if (i == 10 + 256) { + /*回车键*/ + if (cursor_y < 28 + 112) { + /*用空格将光标擦除*/ + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1); + cursor_y += 16; + /*显示提示符*/ + putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, ">", 1); + cursor_x = 16; + } } else { /*一般字符*/ if (cursor_x < 240) { /*显示一个字符之后将光标后移一位 */ s[0] = i - 256; s[1] = 0; - putfonts8_asc_sht(sheet, cursor_x, 28, COL8_FFFFFF, COL8_000000, s, 1); + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, s, 1); cursor_x += 8; } } } /*重新显示光标*/ if (cursor_c >= 0) { /*从此开始*/ - boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, 28, cursor_x + 7, 43); + boxfill8(sheet->buf, sheet->bxsize, cursor_c, cursor_x, cursor_y, cursor_x + 7, cursor_y + 15); } - sheet_refresh(sheet, cursor_x, 28, cursor_x + 8, 44); + sheet_refresh(sheet, cursor_x, cursor_y, cursor_x + 8, cursor_y + 16); } } }