3
3
static int keybufferpoint = 0 ;
4
4
static bool isShift = false ;
5
5
static bool isCTRLed = false ;
6
+
7
+
8
+
9
+ bool isUSRChanged = false ;
6
10
void printf (char *);
7
11
void printfchar (char st);
8
12
void printHex (uint8_t key);
@@ -34,6 +38,18 @@ CommandPort(0x64)
34
38
Task task2 (&gdt, taskB);
35
39
taskManager.AddTask (&task1);
36
40
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
+ }
37
53
}
38
54
39
55
KeyboardDriver::~KeyboardDriver ()
@@ -302,6 +318,13 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
302
318
{
303
319
printf (" cannot print null character" );
304
320
}
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
+ }
305
328
else
306
329
{
307
330
for (int i = 5 ; key_buffer[i] != " \n " ; i++)
@@ -328,15 +351,20 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
328
351
else if (key_buffer[5 ] == " 3" )
329
352
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." );
330
353
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. " );
332
355
else
333
356
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 " );
334
357
}
335
358
else if (key_buffer[0 ] == " c" & key_buffer[1 ] == " l" & key_buffer[2 ] == " e" & key_buffer[3 ] == " a" & key_buffer[4 ] == " r" )
336
359
{
337
360
COMNAME = " clear" ;
338
361
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 " );
340
368
}
341
369
else if (key_buffer[0 ] == " s" & key_buffer[1 ] == " d" )
342
370
{
@@ -487,13 +515,37 @@ void KeyboardDriver::CommandInterpreter() // SOSH v1.0.3 [SectorOS SHell]. 11 Co
487
515
printf (" esp2 is :" ); printHex (esp2);
488
516
isESPChanged = true ;
489
517
}
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
+ }
490
538
else
491
539
{
492
540
printf (" Unknown Command. Type help in console to get all the commands" );
493
541
}
494
542
if (!isTxtMode){
495
543
printf (" \n " );
496
- printf (" $: " );
544
+ for (int i = 0 ; SPIndex > i; i++)
545
+ {
546
+ printf (SP[i]);
547
+ }
548
+
497
549
}
498
550
serialport.logToSerialPort (" Command interpreter got a command :- " ); serialport.logToSerialPort (COMNAME); serialport.logToSerialPort (" \n " );
499
551
clear_key_buffer ();
@@ -507,12 +559,17 @@ void KeyboardDriver::returnHScreen()
507
559
// ColourPrint(0);
508
560
// printf("Welcome to SectorOS Monolithic kernel Type: Shell\nhttps://github.com/Arun007coder/SectorOS \n");
509
561
510
- printf (" SectorOS Monolithic kernel " );
562
+ printf (" SectorOS " );
563
+ printf (KERNEL_VERSION);
564
+ printf (" " );
511
565
PrintDate ();
512
- printf (" Type: Shell\n https://github.com/Arun007coder/SectorOS \n " );
566
+ printf (" Type: Shell\n https://github.com/Arun007coder/SectorOS \n " );
513
567
printf (" Run help to get the list of commands which is implemented \n \n " );
514
568
515
- printf (" $: " );
569
+ for (int i = 0 ; SPIndex > i; i++)
570
+ {
571
+ printf (SP[i]);
572
+ }
516
573
isTxtMode = false ;
517
574
}
518
575
0 commit comments