-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.c
More file actions
65 lines (55 loc) · 1.4 KB
/
Copy pathkernel.c
File metadata and controls
65 lines (55 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "cmds.h"
#include "keyboard.h" // Додаємо заголовок для роботи з клавіатурою
volatile char *video = (volatile char*)0xB8000;
int cursor = 0;
int cursor_visible = 1;
int last_cursor_update = 0;
#define CURSOR_BLINK_INTERVAL 500000
#define SCREEN_WIDTH 80
#define SCREEN_HEIGHT 25
int get_time() {
static int time = 0;
return time++; // Лічильник часу для тесту
}
void update_cursor() {
int current_time = get_time();
if (current_time - last_cursor_update >= CURSOR_BLINK_INTERVAL) {
cursor_visible = !cursor_visible;
last_cursor_update = current_time;
}
}
void print_char_color(char c, unsigned char color) {
if (c == '\n') {
cursor += (160 - (cursor % 160));
} else {
video[cursor++] = c;
video[cursor++] = color;
}
if (cursor >= SCREEN_WIDTH * SCREEN_HEIGHT * 2) {
cursor = 0;
}
}
void print_prompt() {
print("Onexis: ");
print(get_current_path());
print("> ");
cursor_visible = 1;
}
void clear() {
for (int i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT * 2; i++) {
video[i] = 0;
}
cursor = 0;
}
void kernel_main(void) {
clear();
init_fs();
print("Welcome to Onexis!\n");
print_prompt();
while (1) {
if (keyboard_ready()) {
keyboard_handler();
}
update_cursor();
}
}