Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6372

How to implement terminal scrolling?

$
0
0

I am currently trying to develop an OS for drones. I am following this guide: https://wiki.osdev.org/Bare_Bones

Please find my code here, I intentionally removed the header files.

void terminal_putentryat(char c, uint8_t color, size_t x, size_t y) {    if(y > VGA_HEIGHT) {        for(size_t y = 0; y < VGA_HEIGHT; y++) {            const size_t index = y * VGA_WIDTH + x;            terminal_buffer[index] = terminal_buffer[index+1];            terminal_buffer[index] = vga_entry(c, color);        }    }    const size_t index = y * VGA_WIDTH + x;    terminal_buffer[index] = vga_entry(c, color);}void terminal_putchar(char c) {    if(c == '\n') {                terminal_row = terminal_row+1;                terminal_column = 0;                return;        }    terminal_putentryat(c, terminal_color, terminal_column, terminal_row);    if(++terminal_column == VGA_WIDTH) {        terminal_column = 0;        if (++terminal_row == VGA_HEIGHT)         terminal_row = 0;    }}void terminal_write(const char* data, size_t size) {    for (size_t i = 0; i < size; i++)        terminal_putchar(data[i]);}void terminal_writestring(const char* data) {    terminal_write(data, strlen(data));}

Viewing all articles
Browse latest Browse all 6372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>