Broken term scrolling
This commit is contained in:
@@ -201,12 +201,11 @@ void keyboard_handler()
|
||||
|
||||
if (c)
|
||||
{
|
||||
putchar(c);
|
||||
// Should probably have a keyboard buffer here... instead of this
|
||||
//putchar(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
skputs("key pressed!\n");
|
||||
}
|
||||
|
||||
// End of Interrupt (to master PIC)
|
||||
@@ -233,5 +232,11 @@ void keyboard_init(unsigned char layout)
|
||||
skputs("Unsupported layout.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Unmask IRQ1
|
||||
uint8_t mask = inb(0x21);
|
||||
mask &= ~(1 << 1);
|
||||
outb(0x21, mask);
|
||||
|
||||
DEBUG("PS/2 Keyboard initialized");
|
||||
}
|
||||
@@ -23,6 +23,8 @@ uint8_t* glyphs = _binary_zap_light16_psf_start + sizeof(PSF1_Header);
|
||||
#define FONT_WIDTH 8
|
||||
#define FONT_HEIGHT font->characterSize
|
||||
|
||||
|
||||
|
||||
// Character cursor
|
||||
typedef struct
|
||||
{
|
||||
@@ -102,7 +104,7 @@ static void erase_char(size_t px, size_t py)
|
||||
|
||||
for (size_t y=0; y<FONT_HEIGHT; y++)
|
||||
{
|
||||
for (size_t x=0; x<FONT_HEIGHT; x++)
|
||||
for (size_t x=0; x<FONT_WIDTH; x++)
|
||||
{
|
||||
// Black
|
||||
putpixel(px+x, py+y, 0);
|
||||
@@ -112,21 +114,15 @@ static void erase_char(size_t px, size_t py)
|
||||
|
||||
void term_scroll()
|
||||
{
|
||||
const size_t row_height = FONT_HEIGHT;
|
||||
const size_t row_bytes = framebuffer->pitch;
|
||||
const size_t screen_rows = framebuffer->height;
|
||||
// Erase first text line
|
||||
memset(fb, 255, FONT_HEIGHT*framebuffer->pitch);
|
||||
|
||||
// Move framebuffer up by one text row
|
||||
//memmove(fb, fb + row_height * row_bytes, (screen_rows - row_height) * row_bytes);
|
||||
// Move whole framebuffer up by one text line
|
||||
memmove(fb, fb+(FONT_HEIGHT*framebuffer->pitch), (framebuffer->height-FONT_HEIGHT)*framebuffer->pitch);
|
||||
|
||||
for (size_t i = 0; i < (screen_rows - row_height) * row_bytes; i++)
|
||||
{
|
||||
fb[i] = fb[i + row_height * row_bytes];
|
||||
}
|
||||
|
||||
// Clear last text row
|
||||
size_t clear_start = (screen_rows - row_height) * row_bytes;
|
||||
memset(fb + clear_start, 0, row_height * row_bytes);
|
||||
// Clear last text line
|
||||
size_t clear_start = (framebuffer->height - FONT_HEIGHT) * framebuffer->pitch;
|
||||
memset(fb + clear_start, 255, FONT_HEIGHT * framebuffer->pitch);
|
||||
|
||||
// Shift line lengths by 1 (for backspace handling)
|
||||
size_t max_lines = term_max_lines();
|
||||
@@ -134,11 +130,9 @@ void term_scroll()
|
||||
{
|
||||
lines_length[i - 1] = lines_length[i];
|
||||
}
|
||||
|
||||
lines_length[max_lines - 1] = 0;
|
||||
}
|
||||
|
||||
|
||||
void putchar(char c)
|
||||
{
|
||||
const size_t max_cols = term_max_cols();
|
||||
|
||||
@@ -22,4 +22,7 @@ typedef struct
|
||||
uint8_t characterSize; // height
|
||||
} PSF1_Header;
|
||||
|
||||
// debug
|
||||
void term_scroll();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user