Skip to content
Snippets Groups Projects
Commit 5c358d12 authored by m3-zayan's avatar m3-zayan
Browse files

Final changes

parent 45461101
Branches master
No related tags found
No related merge requests found
......@@ -88,7 +88,21 @@ void terminal_putchar(char c) {
if (c == '\n'){
terminal_column = 0;
if (++terminal_row == VGA_HEIGHT){
terminal_row = 0;
/*terminal_row = 0;*/
terminal_row = VGA_HEIGHT - 1;
/*Perform scrolling by moving each row up by one*/
for (size_t y = 1;y < VGA_HEIGHT; y++){
for (size_t x = 0; x < VGA_WIDTH; x++){
size_t prev_index = (y - 1) * VGA_WIDTH + x;
size_t curr_index = y * VGA_WIDTH + x;
terminal_buffer[prev_index] = terminal_buffer[curr_index];
}
}
/*Clear the last row*/
size_t last_row_index = (VGA_HEIGHT - 1) * VGA_WIDTH;
for (size_t x = 0; x < VGA_WIDTH; x++) {
terminal_buffer[last_row_index + x] = make_vgaentry(' ',terminal_color);
}
}
}else{
......@@ -122,11 +136,26 @@ void kernel_main() {
* This is normal.
*/
/*Output "Hello World" in blue */
/*Outputs "Hello World" in red once */
terminal_setcolor(make_color(COLOR_RED, COLOR_BLACK));
terminal_writestring("Hello, kernel World!\n");
/*Outputs "Hello World" in white 6 times */
terminal_setcolor(make_color(COLOR_WHITE, COLOR_BLACK));
for (int i = 0; i < 6; i++){
terminal_writestring("Hello, kernel World!\n");
}
/*Outputs "Hello World" in blue 18 times */
terminal_setcolor(make_color(COLOR_BLUE, COLOR_BLACK));
for (int i = 0; i < 18; i++){
terminal_writestring("Hello, kernel World!\n");
}
/*Output "Hello World" in red */
terminal_setcolor(make_color(COLOR_RED, COLOR_BLACK));
/*Outputs "Hello World" in green 5 times */
terminal_setcolor(make_color(COLOR_GREEN, COLOR_BLACK));
for (int i = 0; i < 5; i++){
terminal_writestring("Hello, kernel World!\n");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment