33static int keybufferpoint = 0 ;
44static bool isShift = false ;
55static bool isCTRLed = false ;
6+
7+
8+
9+ bool isUSRChanged = false ;
610void printf (char *);
711void printfchar (char st);
812void printHex (uint8_t key);
@@ -34,6 +38,18 @@ CommandPort(0x64)
3438 Task task2 (&gdt, taskB);
3539 taskManager.AddTask (&task1);
3640 taskManager.AddTask (&task2);
41+
42+ for (int i = 0 ; i < 30 ; i++)
43+ {
44+ SP[i] = " \0 " ;
45+ }
46+
47+ char * Shell_Prompt[15 ] = {" r" ," o" ," o" ," t" ," @" ," s" ," e" ," c" ," o" ," s" ," :" ," ~" ," #" ," >" , " " };
48+ for (int i = 0 ; i < 15 ; i++)
49+ {
50+ SP[SPIndex] = Shell_Prompt[i];
51+ SPIndex++;
52+ }
3753}
3854
3955KeyboardDriver::~KeyboardDriver ()
@@ -302,6 +318,13 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
302318 {
303319 printf (" cannot print null character" );
304320 }
321+ else if (key_buffer[5 ] == " $" && key_buffer[6 ] == " S" && key_buffer[7 ] == " P" )
322+ {
323+ for (int i = 0 ; i < SPIndex; i++)
324+ {
325+ printf (SP[i]);
326+ }
327+ }
305328 else
306329 {
307330 for (int i = 5 ; key_buffer[i] != " \n " ; i++)
@@ -328,15 +351,20 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
328351 else if (key_buffer[5 ] == " 3" )
329352 printf (" Help page 3:\n spi : To print the data in serial port 0x3F8.\n spo : To write data to serial port 0x3F8.\n sysinfo [option] : To get info about system.\n vga : To use experimental vga graphics." );
330353 else if (key_buffer[5 ] == " 4" )
331- printf (" Help page 4:\n lspt: To list partitions in a drive.\n tsk:to change instance.[EXPERIMENTAL]" );
354+ printf (" Help page 4:\n lspt: To list partitions in a drive.\n tsk:to change instance.[EXPERIMENTAL]\n export [var]=[value] : To change value of a ENV var in shell. " );
332355 else
333356 printf (" Help page 1:\n echo <message> : to print the message in the console \n help : to show this message \n clear : to clear the screen \n sd <options> : controls the power of the computer " );
334357 }
335358 else if (key_buffer[0 ] == " c" & key_buffer[1 ] == " l" & key_buffer[2 ] == " e" & key_buffer[3 ] == " a" & key_buffer[4 ] == " r" )
336359 {
337360 COMNAME = " clear" ;
338361 printf (" \5 " );
339- printf (" SectorOS Monolithic kernel " );PrintDate ();printf (" Type: Shell\n " );
362+
363+ printf (" SectorOS " );
364+ printf (KERNEL_VERSION);
365+ printf (" " );
366+ PrintDate ();
367+ printf (" Type: Shell " );
340368 }
341369 else if (key_buffer[0 ] == " s" & key_buffer[1 ] == " d" )
342370 {
@@ -487,13 +515,37 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
487515 printf (" esp2 is :" ); printHex (esp2);
488516 isESPChanged = true ;
489517 }
518+ else if (key_buffer[0 ] == " e" && key_buffer[1 ] == " x" && key_buffer[2 ] == " p" && key_buffer[3 ] == " o" && key_buffer[4 ] == " r" && key_buffer[5 ] == " t" )
519+ {
520+ COMNAME = " export" ;
521+
522+ if (key_buffer[7 ] == " S" && key_buffer[8 ] == " P" && key_buffer[9 ] == " =" )
523+ {
524+ SPIndex = 0 ;
525+
526+ for (int i = 10 ; key_buffer[i] != " \n " ; i++)
527+ {
528+ SP[SPIndex] = key_buffer[i];
529+ SPIndex++;
530+ }
531+ printf (" SP is set to : " );
532+ for (int i = 0 ; i < SPIndex; i++)
533+ {
534+ printf (SP[i]);
535+ }
536+ }
537+ }
490538 else
491539 {
492540 printf (" Unknown Command. Type help in console to get all the commands" );
493541 }
494542 if (!isTxtMode){
495543 printf (" \n " );
496- printf (" $: " );
544+ for (int i = 0 ; SPIndex > i; i++)
545+ {
546+ printf (SP[i]);
547+ }
548+
497549 }
498550 serialport.logToSerialPort (" Command interpreter got a command :- " ); serialport.logToSerialPort (COMNAME); serialport.logToSerialPort (" \n " );
499551 clear_key_buffer ();
@@ -507,12 +559,17 @@ void KeyboardDriver::returnHScreen()
507559 // ColourPrint(0);
508560 // printf("Welcome to SectorOS Monolithic kernel Type: Shell\nhttps://github.com/Arun007coder/SectorOS \n");
509561
510- printf (" SectorOS Monolithic kernel " );
562+ printf (" SectorOS " );
563+ printf (KERNEL_VERSION);
564+ printf (" " );
511565 PrintDate ();
512- printf (" Type: Shell\n https://github.com/Arun007coder/SectorOS \n " );
566+ printf (" Type: Shell\n https://github.com/Arun007coder/SectorOS \n " );
513567 printf (" Run help to get the list of commands which is implemented \n \n " );
514568
515- printf (" $: " );
569+ for (int i = 0 ; SPIndex > i; i++)
570+ {
571+ printf (SP[i]);
572+ }
516573 isTxtMode = false ;
517574}
518575
0 commit comments