From 021ae344eb5abdb33b2d467b4ece5ffad1b8da02 Mon Sep 17 00:00:00 2001 From: Yourtion Date: Thu, 28 Apr 2016 15:33:00 +0800 Subject: [PATCH] =?UTF-8?q?type=E5=91=BD=E4=BB=A4=E6=94=B9=E8=89=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 19_day/bootpack.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/19_day/bootpack.c b/19_day/bootpack.c index cac618a..ee8b293 100644 --- a/19_day/bootpack.c +++ b/19_day/bootpack.c @@ -480,7 +480,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal) } } cursor_y = cons_newline(cursor_y, sheet); - } else if (cmdline[0] == 't' && cmdline[1] == 'y' && cmdline[2] == 'p' && cmdline[3] == 'e' && cmdline[4] == ' ') { + } else if (strncmp(cmdline, "type ", 5) == 0 ) { /* type命令*/ /*准备文件名*/ for (y = 0; y < 11; y++) { @@ -524,11 +524,30 @@ void console_task(struct SHEET *sheet, unsigned int memtotal) /*逐字输出*/ s[0] = p[x]; s[1] = 0; - putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF,COL8_000000, s, 1); - cursor_x += 8; - if (cursor_x == 8 + 240) { /*到达最右端后换行*/ + if (s[0] == 0x09) { /*制表符*/ + for (;;) { + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1); + cursor_x += 8; + if (cursor_x == 8 + 240) { + cursor_x = 8; + cursor_y = cons_newline(cursor_y, sheet); + } + if (((cursor_x - 8) & 0x1f) == 0) { + break; /*被32整除则break */ + } + } + } else if (s[0] == 0x0a) { /*换行*/ cursor_x = 8; cursor_y = cons_newline(cursor_y, sheet); + } else if (s[0] == 0x0d) { /*回车*/ + /*这里暂且不进行任何操作*/ + } else { /*一般字符*/ + putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, s, 1); + cursor_x += 8; + if (cursor_x == 8 + 240) { + cursor_x = 8; + cursor_y = cons_newline(cursor_y, sheet); + } } } } else {