type命令改良

This commit is contained in:
Yourtion
2016-04-28 15:33:00 +08:00
parent 99f265e6fb
commit 021ae344eb

View File

@@ -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 {