|
5 | 5 | #include "../Drivers/Keyboard.h" |
6 | 6 | #include "../Shell/Shell.h" |
7 | 7 | #include "../Include/multiboot.h" |
| 8 | +#include "../Hardcom/SerialPort.h" |
8 | 9 | #include "../CPU/syscall.h" |
9 | 10 | #include "../Drivers/Mouse.h" |
10 | 11 | #include "../Drivers/Driver.h" |
@@ -525,6 +526,32 @@ char *INTTOCHARPOINT(int num) |
525 | 526 | return res; |
526 | 527 | } |
527 | 528 |
|
| 529 | +void enable_cursor(uint8_t cursor_start, uint8_t cursor_end) |
| 530 | +{ |
| 531 | + port8BIT P1(0x3D4); |
| 532 | + port8BIT P2(0x3D5); |
| 533 | + |
| 534 | + P1.WriteToPort(0x0A); |
| 535 | + P2.WriteToPort((P2.ReadFromPort() & 0xC0) | cursor_start); |
| 536 | + |
| 537 | + P1.WriteToPort(0x0B); |
| 538 | + P2.WriteToPort((P2.ReadFromPort() & 0xE0) | cursor_end); |
| 539 | +} |
| 540 | + |
| 541 | +void update_cursor(int x, int y) |
| 542 | +{ |
| 543 | + int VGA_WIDTH = 80; |
| 544 | + port8BIT P1(0x3D4); |
| 545 | + port8BIT P2(0x3D5); |
| 546 | + |
| 547 | + uint16_t pos = y * VGA_WIDTH + x; |
| 548 | + |
| 549 | + P1.WriteToPort(0x0F); |
| 550 | + P2.WriteToPort((uint8_t)(pos & 0xFF)); |
| 551 | + P1.WriteToPort(0x0E); |
| 552 | + P2.WriteToPort((uint8_t)((pos >> 8) & 0xFF)); |
| 553 | +} |
| 554 | + |
528 | 555 | uint16_t GetAvailableMem() |
529 | 556 | { |
530 | 557 | port8BIT port(0x70); |
@@ -693,6 +720,8 @@ void printf(char *str) |
693 | 720 | printf(" Type: Shell "); |
694 | 721 | } |
695 | 722 | } |
| 723 | + |
| 724 | + update_cursor(x, y + 1); |
696 | 725 | } |
697 | 726 |
|
698 | 727 | // Uses 10 Character Space |
@@ -790,6 +819,8 @@ void printfchar(char st) |
790 | 819 | x = 0; |
791 | 820 | y = 0; |
792 | 821 | } |
| 822 | + |
| 823 | + update_cursor(x, y + 1); |
793 | 824 | } |
794 | 825 |
|
795 | 826 | void printHex(uint8_t Key) |
@@ -828,9 +859,7 @@ void PrintMEM(const void *multiboot_structure) |
828 | 859 | printf("\n"); |
829 | 860 | } |
830 | 861 |
|
831 | | -#define cpuid(in, a, b, c, d) __asm__("cpuid" \ |
832 | | - : "=a"(a), "=b"(b), "=c"(c), "=d"(d) \ |
833 | | - : "a"(in)); |
| 862 | +#define cpuid(in, a, b, c, d) __asm__("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d): "a"(in)); |
834 | 863 |
|
835 | 864 | int do_intel(void) |
836 | 865 | { |
@@ -1074,6 +1103,7 @@ extern "C" void callConstructors() |
1074 | 1103 |
|
1075 | 1104 | extern "C" void kernelMain(const void *multiboot_structure, uint32_t multiboot_m) |
1076 | 1105 | { |
| 1106 | + enable_cursor(0, 0); |
1077 | 1107 | TaskManager taskManager; |
1078 | 1108 | uint32_t mm = multiboot_m; |
1079 | 1109 | printf("Initializing SectorOS Kernel "); |
@@ -1138,7 +1168,7 @@ extern "C" void kernelMain(const void *multiboot_structure, uint32_t multiboot_m |
1138 | 1168 | printf(KERNEL_VERSION); |
1139 | 1169 | printf(" "); |
1140 | 1170 | PrintDate(); |
1141 | | - printf(" Type: Shell\nhttps://github.com/Arun007coder/SectorOS \n"); |
| 1171 | + printf(" Type: Shell\nhttps://github.com/Arun007coder/SectorOS \n"); |
1142 | 1172 |
|
1143 | 1173 | printf("Initializing "); |
1144 | 1174 | printf(SHELL_NAME); |
|
0 commit comments