feat: ajout interpréteur de commande & fonctions clavier essentielles
This commit is contained in:
parent
aeeb371294
commit
2ce9d70b48
|
@ -29,5 +29,7 @@
|
||||||
#define STATUS_SCRL 0x4000
|
#define STATUS_SCRL 0x4000
|
||||||
|
|
||||||
void keyboard();
|
void keyboard();
|
||||||
|
void reboot();
|
||||||
void outkbd(u8 port, u8 data);
|
void outkbd(u8 port, u8 data);
|
||||||
u8 waitascii();
|
u8 waitascii();
|
||||||
|
u8* getstring(u8* temp);
|
||||||
|
|
|
@ -10,9 +10,9 @@ typedef int s32;
|
||||||
typedef int bool;
|
typedef int bool;
|
||||||
|
|
||||||
|
|
||||||
#define true -1;
|
#define true 1
|
||||||
#define false 0;
|
#define false 0
|
||||||
#define NULL 0x0000;
|
#define NULL 0x0000
|
||||||
|
|
||||||
struct dtr {
|
struct dtr {
|
||||||
|
|
||||||
|
|
|
@ -94,11 +94,33 @@ static const u8 set1_ctrl[] = {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* Attend une chaine de caractère de taille max */
|
||||||
|
|
||||||
|
u8* getstring(u8* temp) {
|
||||||
|
u8 maxwidth=strlen(temp);
|
||||||
|
u8 *pointer=temp;
|
||||||
|
u8 ascii=0;
|
||||||
|
while(ascii!='\r') {
|
||||||
|
ascii=waitascii();
|
||||||
|
if (ascii=='\b' && pointer>temp) {
|
||||||
|
pointer--;
|
||||||
|
putchar(ascii);
|
||||||
|
}
|
||||||
|
else if (ascii>31 && pointer<=&temp+80) {
|
||||||
|
*pointer++=ascii;
|
||||||
|
putchar(ascii);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*pointer='\000';
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
/* Fonction qui attend l'appuie d'une touche générant un code ASCII puis le retourne */
|
/* Fonction qui attend l'appuie d'une touche générant un code ASCII puis le retourne */
|
||||||
|
|
||||||
u8 waitascii()
|
u8 waitascii()
|
||||||
{
|
{
|
||||||
u8 oldptrscan = ptrscan;
|
|
||||||
u8 oldptrascii = ptrascii;
|
u8 oldptrascii = ptrascii;
|
||||||
while ((oldptrascii == ptrascii)) ;
|
while ((oldptrascii == ptrascii)) ;
|
||||||
return bufferascii[ptrascii];
|
return bufferascii[ptrascii];
|
||||||
|
@ -128,7 +150,7 @@ void outkbd(u8 port, u8 data)
|
||||||
|
|
||||||
/* Redemarre l'ordinateur */
|
/* Redemarre l'ordinateur */
|
||||||
|
|
||||||
static void reboot(void)
|
void reboot()
|
||||||
{
|
{
|
||||||
u8 temp;
|
u8 temp;
|
||||||
cli();
|
cli();
|
||||||
|
|
|
@ -376,7 +376,7 @@ u8 strgetbase(u8 *src) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* Renvoie la base du nombre */
|
/* Transforme une chaine en nombre */
|
||||||
|
|
||||||
u32 strtoint(u8 *src) {
|
u32 strtoint(u8 *src) {
|
||||||
u8* temp=src;
|
u8* temp=src;
|
||||||
|
|
|
@ -82,26 +82,16 @@ int main(void)
|
||||||
|
|
||||||
&cpu.techs);
|
&cpu.techs);
|
||||||
ok();
|
ok();
|
||||||
u8 test[]="0101011101b\000";
|
static u8 field[]=" \000";
|
||||||
u8 test2[]="12106567h\000";
|
static u8 item[]=" \000";
|
||||||
u8 test3[]="11A1baA7d\000";
|
static u8 cmd_reboot[]="REBOOT\000";
|
||||||
u8 test4[]="11454589d\000";
|
while (true) {
|
||||||
u8 test5[]="0x11A1b7\000";
|
print("\r\n# ");
|
||||||
u8 test6[]="0x11A1B7h\000";
|
getstring(&field);
|
||||||
u8 test7[]="129220\000";
|
if (strgetnbitems(&field,' ')<1) continue;
|
||||||
u8 dest[]=" \000";
|
strgetitem(&field, &item, ' ', 0);
|
||||||
u8 src[]="Ceci est un test pour voir si cela fonctionne correctement\000 ";
|
strtoupper(&item);
|
||||||
printf(&src);
|
if (strcmp(&item,&cmd_reboot)==0) reboot();
|
||||||
strtoint(&test);
|
|
||||||
strtoint(&test2);
|
|
||||||
strtoint(&test3);
|
|
||||||
strtoint(&test4);
|
|
||||||
strtoint(&test5);
|
|
||||||
strtoint(&test6);
|
|
||||||
strtoint(&test7);
|
|
||||||
while (1) {
|
|
||||||
key = waitascii();
|
|
||||||
putchar(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue