Anonymous user
Meaty Skeleton: Difference between revisions
→kernel/arch/i386/tty.c
[unchecked revision] | [unchecked revision] |
(New section: Forum Posts) |
|||
Line 393:
const size_t index = y * VGA_WIDTH + x;
terminal_buffer[index] = vga_entry(c, color);
}
void scroll(int line) {
int loop;
char c;
for(loop=line*(VGA_WIDTH*2)+0xB8000; loop<VGA_WIDTH*2; loop++)
{
c = *loop;
*(loop-(VGA_WIDTH*2)) = c;
}
}
void delete_last_line() {
int x, *ptr;
for(x=0; x<VGA_WIDTH*2; x++)
{
ptr = 0xB8000 + (VGA_WIDTH*2)*(VGA_HEIGHT-1) + x;
*ptr = 0;
}
}
void terminal_putchar(char c) {
int line;
unsigned char uc = c;
terminal_putentryat(uc, terminal_color, terminal_column, terminal_row);
if (++terminal_column == VGA_WIDTH) {
terminal_column = 0;
if (++terminal_row == VGA_HEIGHT)
{
terminal_row = 0;▼
for(line=1; line<=VGA_HEIGHT-1; line++)
{
scroll(line);
}
delete_last_line();
}
}
}
|