Meaty Skeleton: Difference between revisions
Jump to navigation
Jump to search
[unchecked revision] | [unchecked revision] |
Content deleted Content added
New section: Forum Posts |
|||
Line 393: | Line 393: | ||
const size_t index = y * VGA_WIDTH + x; |
const size_t index = y * VGA_WIDTH + x; |
||
terminal_buffer[index] = vga_entry(c, color); |
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) { |
void terminal_putchar(char c) { |
||
int line; |
|||
unsigned char uc = c; |
unsigned char uc = c; |
||
terminal_putentryat(uc, terminal_color, terminal_column, terminal_row); |
terminal_putentryat(uc, terminal_color, terminal_column, terminal_row); |
||
if (++terminal_column == VGA_WIDTH) { |
if (++terminal_column == VGA_WIDTH) { |
||
terminal_column = 0; |
terminal_column = 0; |
||
if (++terminal_row == VGA_HEIGHT) |
if (++terminal_row == VGA_HEIGHT) |
||
{ |
|||
⚫ | |||
for(line=1; line<=VGA_HEIGHT-1; line++) |
|||
{ |
|||
scroll(line); |
|||
} |
|||
delete_last_line(); |
|||
⚫ | |||
} |
|||
} |
} |
||
} |
} |