Skip to content

Commit 2827ba4

Browse files
Update kernel.c
Fixxed it yeahh, thanks @chatgpt
1 parent eb399f0 commit 2827ba4

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

part4/kernel/kernel.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,41 @@ struct limine_memmap_response* memmap_info;
6868

6969
extern fs_node_t* fs_root;
7070
extern initrd_header_t* initrd_header;
71-
71+
static uint64_t cols;
72+
static uint64_t rows;
7273
extern void term_write(const char *string, size_t length) {
7374
terminal_request.response->write(main_terminal, string, length);
7475
}
7576

7677
void flushFrmbuffer(void) {
7778
asm volatile("" ::: "memory");
7879
}
80+
81+
void clear_Txt(void) {
82+
char *space_line = " "; // 80 spaces
83+
for(size_t raw = 0; raw<cols; raw++) {
84+
term_write(space_line, rows);
85+
}
86+
term_write("\033[H", 3);
87+
}
88+
89+
extern void term_clear(void) {
90+
fb_clear(0x000000);
91+
flushFrmbuffer(); // pllllspplg troung just sone useless txt :d
92+
clear_TxT();
93+
94+
}
95+
7996
// Kernel entrypoint
8097
void _start(void) {
8198
// set up terminal
8299
main_terminal = terminal_request.response->terminals[0];
83100
fb_init();
84101
// Access RSDP for ACPI
85102

86-
uint64_t cols = main_terminal->columns;
87-
uint64_t rows = main_terminal->rows;
88-
uint64_t results = cols * rows;
103+
cols = main_terminal->columns;
104+
rows = main_terminal->rows;
105+
89106
rsdp_descriptor = (RSDPDescriptor20*) rsdp_request.response->address;
90107
if (rsdp_descriptor->descriptor10.revision == 2)
91108
{
@@ -248,15 +265,6 @@ void _start(void) {
248265
// At this point, the entire screen is black, and all text or content is removed.
249266

250267

251-
252-
253-
254-
255-
// Get a pointer to the framebuffer's address.
256-
257-
258-
fb_clear(0x000000);
259-
flushFrmbuffer();
260268
doIt();
261269

262270
for (;;)

0 commit comments

Comments
 (0)