From 946355b6876456970f7881b0e383de6b2cfb3159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Sun, 7 Oct 2018 14:53:48 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20ajout=20d'une=20commande=20view=20qui?= =?UTF-8?q?=20permet=20de=20voir=20la=20m=C3=A9moire,=20=C3=A0=20rajouter?= =?UTF-8?q?=20visu=20ASCII=20+=20taille?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/shell.h | 1 + include/video.h | 1 + lib/shell.c | 31 +++++++++++++++++++++++++++++-- lib/video.c | 9 +++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/include/shell.h b/include/shell.h index 714cdf8..d310260 100644 --- a/include/shell.h +++ b/include/shell.h @@ -18,4 +18,5 @@ int clear(); int regs(); int info(); int err(); +int view(); int test(void); diff --git a/include/video.h b/include/video.h index 0877148..9396755 100755 --- a/include/video.h +++ b/include/video.h @@ -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); diff --git a/lib/shell.c b/lib/shell.c index 3bd76ac..77cb726 100644 --- a/lib/shell.c +++ b/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