2
2
3
3
#include "bootpack.h"
4
4
#include <stdio.h>
5
+ #include <string.h>
5
6
6
7
void make_window8 (unsigned char * buf , int xsize , int ysize , char * title , char act );
7
8
void putfonts8_asc_sht (struct SHEET * sht , int x , int y , int c , int b , char * s , int l );
@@ -378,6 +379,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
378
379
int i , fifobuf [128 ], cursor_x = 16 , cursor_y = 28 , cursor_c = -1 ;
379
380
char s [30 ], cmdline [30 ];
380
381
struct MEMMAN * memman = (struct MEMMAN * ) MEMMAN_ADDR ;
382
+ int x , y ;
381
383
382
384
fifo32_init (& task -> fifo , 128 , fifobuf , task );
383
385
timer = timer_alloc ();
@@ -431,7 +433,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
431
433
cmdline [cursor_x / 8 - 2 ] = 0 ;
432
434
cursor_y = cons_newline (cursor_y , sheet );
433
435
/*执行命令*/
434
- if (cmdline [ 0 ] == 'm' && cmdline [ 1 ] == 'e' && cmdline [ 2 ] == 'm' && cmdline [ 3 ] == 0 ) {
436
+ if (strcmp ( cmdline , "mem" ) == 0 ) {
435
437
/* mem命令*/
436
438
sprintf (s , "total %dMB" , memtotal / (1024 * 1024 ));
437
439
putfonts8_asc_sht (sheet , 8 , cursor_y , COL8_FFFFFF , COL8_000000 , s , 30 );
@@ -440,7 +442,16 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
440
442
putfonts8_asc_sht (sheet , 8 , cursor_y , COL8_FFFFFF , COL8_000000 , s , 30 );
441
443
cursor_y = cons_newline (cursor_y , sheet );
442
444
cursor_y = cons_newline (cursor_y , sheet );
443
- } else if (cmdline [0 ] != 0 ) {
445
+ } else if (strcmp (cmdline , "cls" ) == 0 ) {
446
+ /* cls命令*/
447
+ for (y = 28 ; y < 28 + 128 ; y ++ ) {
448
+ for (x = 8 ; x < 8 + 240 ; x ++ ) {
449
+ sheet -> buf [x + y * sheet -> bxsize ] = COL8_000000 ;
450
+ }
451
+ }
452
+ sheet_refresh (sheet , 8 , 28 , 8 + 240 , 28 + 128 );
453
+ cursor_y = 28 ;
454
+ } else if (cmdline [0 ] != 0 ) {
444
455
/*不是命令,也不是空行 */
445
456
putfonts8_asc_sht (sheet , 8 , cursor_y , COL8_FFFFFF , COL8_000000 , "Bad command." , 12 );
446
457
cursor_y = cons_newline (cursor_y , sheet );
0 commit comments