feat: ajout d'une commande view qui permet de voir la mémoire, à rajouter visu ASCII + taille

This commit is contained in:
Nicolas Hordé 2018-10-07 14:53:48 +02:00
parent 5315bb549f
commit 946355b687
4 changed files with 40 additions and 2 deletions

View File

@ -18,4 +18,5 @@ int clear();
int regs(); int regs();
int info(); int info();
int err(); int err();
int view();
int test(void); int test(void);

View File

@ -18,6 +18,7 @@ typedef struct console {
void showhex(u8 src); void showhex(u8 src);
void putchar(u8 thechar); void putchar(u8 thechar);
void clearscreen(void);
u32 print(u8* string); u32 print(u8* string);
u32 printf (const u8 *string, ...); u32 printf (const u8 *string, ...);
void changevc(u8 vc); void changevc(u8 vc);

View File

@ -25,6 +25,7 @@ static command commands[] = {
{"info" , "", &info}, {"info" , "", &info},
{"err" , "", &err}, {"err" , "", &err},
{"test" , "", &test}, {"test" , "", &test},
{"view" , "", &view},
}; };
/*******************************************************************************/ /*******************************************************************************/
@ -66,6 +67,33 @@ int test(void)
/*******************************************************************************/ /*******************************************************************************/
/* Génère des exceptions */ /* Génère des exceptions */
int view(u8* commandline)
{
u8 arg[] = " \000";
u32 address;
u8 size;
u8* pointer;
if (strgetnbitems(commandline, ' ') < 3)
{
print("Syntaxe de la commande VIEW\r\nview \33[32madresse taille\r\n\r\n \33[32madresse\33[0m - Adresse a visualiser\r\n \33[32mtaille\33[0m - nombre d'octets a visualiser <256\r\n");
return;
}
strgetitem(commandline, &arg, ' ', 1);
address=strtoint(&arg);
strgetitem(commandline, &arg, ' ', 2);
size=strtoint(&arg);
printf("Adresse %Y - % hhu",address,size);
pointer=address;
for(u32 i=0;i<size;i++) {
if (i%16==0)
printf("\r\n:%Y - ",pointer);
else
printf("%hhY ",*(pointer++));
}
}
/*******************************************************************************/
/* Génère des exceptions */
int err(u8* commandline) int err(u8* commandline)
{ {
u8 arg[] = " \000"; u8 arg[] = " \000";
@ -200,8 +228,7 @@ int mode(u8* commandline)
int clear() int clear()
{ {
fill(0x00); clearscreen();
gotoscr(0, 0);
return 0; return 0;
} }

View File

@ -193,6 +193,15 @@ bool makeansi(u8 c)
vc[usedvc].ansi = 0; vc[usedvc].ansi = 0;
return 0; /* Ansi fini ;) */ return 0; /* Ansi fini ;) */
} }
/*******************************************************************************/
/* Efface la console en cours d'utilisation */
void clearscreen(void)
{
fill(0x00);
vc[usedvc].cursX=0;
vc[usedvc].cursY=0;
gotoscr(0,0);
}
/*******************************************************************************/ /*******************************************************************************/
/* Change la console en cours d'utilisation */ /* Change la console en cours d'utilisation */