Skip to content
Snippets Groups Projects

Master

Open m3-zayan requested to merge m3-zayan/minimalOS:master into master
1 file
+ 35
6
Compare changes
  • Side-by-side
  • Inline
+ 35
6
@@ -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 */
terminal_setcolor(make_color(COLOR_BLUE, COLOR_BLACK));
terminal_writestring("Hello, kernel World!\n");
/*Output "Hello World" in red */
/*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");
}
/*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");
}
}
Loading