简体   繁体   中英

How to implement terminal scrolling

I've followed the Bare Bones tutorial and created a kernel. I've added some support for terminal scolling, but it hasn't really worked. When I run my final ISO image in VirtualBox, it gives me a critical error. The log files are full of gibberish. Currently, my terminal scrolling function is:

void terminal_scroll()
{
    uint8_t attribyte = (0 << 4) | (15 & 0x0F);
    uint16_t blank = 0x20 | (attribyte << 8);

    unsigned int i;
    for (i = 0*80; i < 24*80; i++)
        terminal_buffer[i] = terminal_buffer[i + 80]

    for (i = 24*80; i < 25*80; i++)
        terminal_buffer[i] = blank;
}

This is how I did this:

void terminal_scroll(){
    for(int i = 0; i < vga_height; i++){
        for (int m = 0; m < vga_width; m++){
            terminal_buffer[i * vga_width + m] = terminal_buffer[(i + 1) * vga_width + m];
        }
    }
}

Hope this will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM