diff --git a/18_day/bootpack.c b/18_day/bootpack.c index 9087977..283aff6 100644 --- a/18_day/bootpack.c +++ b/18_day/bootpack.c @@ -393,9 +393,9 @@ void console_task(struct SHEET *sheet) { struct TIMER *timer; struct TASK *task = task_now(); - int i, fifobuf[128], cursor_x = 16, cursor_y = 28, cursor_c = -1; char s[2]; + int x, y; fifo32_init(&task->fifo, 128, fifobuf, task); timer = timer_alloc(); @@ -444,6 +444,27 @@ void console_task(struct SHEET *sheet) } } else if (i == 10 + 256) { /*回车键*/ + /*用空格将光标擦除*/ + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1); + if (cursor_y < 28 + 112) { + cursor_y += 16; /*换行*/ + } else { + /*滚动*/ + for (y = 28; y < 28 + 112; y++) { + for (x = 8; x < 8 + 240; x++) { + sheet->buf[x + y * sheet->bxsize] = sheet->buf[x + (y + 16) * sheet->bxsize]; + } + } + for (y = 28 + 112; y < 28 + 128; y++) { + for (x = 8; x < 8 + 240; x++) { + sheet->buf[x + y * sheet->bxsize] = COL8_000000; + } + } + sheet_refresh(sheet, 8, 28, 8 + 240, 28 + 128); + } + /*显示提示符*/ + putfonts8_asc_sht(sheet, 8, cursor_y, COL8_FFFFFF, COL8_000000, ">", 1); + cursor_x = 16; if (cursor_y < 28 + 112) { /*用空格将光标擦除*/ putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1);