limine-bootloader / limine

Modern, advanced, portable, multiprotocol bootloader and boot manager.
https://limine-bootloader.org
BSD 2-Clause "Simplified" License
1.88k stars 141 forks source link

Can't figure out e9_printClear(); function. #415

Closed afifafifafifafifali closed 1 month ago

afifafifafifafifali commented 1 month ago

Code : https://github.com/afifafifafifafifali/osdev-guide/blob/main/part4.zip Now, In the kernel.c file: fb_clear(0xffffff);//Print white / Results Bg=white, doesn't remove the text completely. Instead , It duplicates into black text / fb_clear(0x000000);//Print black / Results bg = black shade on white text" /

Can anyone fix this for me? (_/) (.) (>❤

afifafifafifafifali commented 1 month ago

Thanks to oai. Here's the fix:void clear_terminal_text() { // Accurate terminal dimensions. Adjust as per your environment, or dynamically retrieve these. size_t term_width = 80; // Example terminal width, change based on your setup size_t term_height = 25; // Example terminal height, change based on your setup char *spaces = " "; // 80 spaces

// Write enough space to fill the entire terminal screen
for (size_t row = 0; row < term_height; row++) {
    term_write(spaces, term_width);  // Overwrite the current row with spaces
}

// Reset the cursor back to the top-left corner after clearing
term_write("\033[H", 3);  // ANSI escape code to move the cursor to 0,0 (top-left)

}