feat: ajout d'une commande view qui permet de voir la mémoire, à rajouter visu ASCII + taille
This commit is contained in:
parent
5315bb549f
commit
946355b687
|
@ -18,4 +18,5 @@ int clear();
|
|||
int regs();
|
||||
int info();
|
||||
int err();
|
||||
int view();
|
||||
int test(void);
|
||||
|
|
|
@ -18,6 +18,7 @@ typedef struct console {
|
|||
|
||||
void showhex(u8 src);
|
||||
void putchar(u8 thechar);
|
||||
void clearscreen(void);
|
||||
u32 print(u8* string);
|
||||
u32 printf (const u8 *string, ...);
|
||||
void changevc(u8 vc);
|
||||
|
|
31
lib/shell.c
31
lib/shell.c
|
@ -25,6 +25,7 @@ static command commands[] = {
|
|||
{"info" , "", &info},
|
||||
{"err" , "", &err},
|
||||
{"test" , "", &test},
|
||||
{"view" , "", &view},
|
||||
};
|
||||
|
||||
/*******************************************************************************/
|
||||
|
@ -66,6 +67,33 @@ int test(void)
|
|||
/*******************************************************************************/
|
||||
/* 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)
|
||||
{
|
||||
u8 arg[] = " \000";
|
||||
|
@ -200,8 +228,7 @@ int mode(u8* commandline)
|
|||
|
||||
int clear()
|
||||
{
|
||||
fill(0x00);
|
||||
gotoscr(0, 0);
|
||||
clearscreen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,6 +193,15 @@ bool makeansi(u8 c)
|
|||
vc[usedvc].ansi = 0;
|
||||
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 */
|
||||
|
|
Loading…
Reference in New Issue