diff --git a/src/idt/idt.c b/src/idt/idt.c index 7c59c64..c5094ce 100644 --- a/src/idt/idt.c +++ b/src/idt/idt.c @@ -185,13 +185,14 @@ struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context) break; case 32: - //DEBUG("Tick!"); + //DEBUG("Timer Interrupt"); ticks++; // Send an EOI so that we can continue having interrupts outb(0x20, 0x20); break; case 33: + DEBUG("Keyboard Interrupt"); keyboard_handler(); break; diff --git a/src/io/kbd/ps2.c b/src/io/kbd/ps2.c index d8b787a..8cb5622 100644 --- a/src/io/kbd/ps2.c +++ b/src/io/kbd/ps2.c @@ -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"); } \ No newline at end of file diff --git a/src/io/term/term.c b/src/io/term/term.c index b6ea2da..ae91835 100644 --- a/src/io/term/term.c +++ b/src/io/term/term.c @@ -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; ypitch; - 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(); diff --git a/src/io/term/term.h b/src/io/term/term.h index d525db4..e53981d 100644 --- a/src/io/term/term.h +++ b/src/io/term/term.h @@ -22,4 +22,7 @@ typedef struct uint8_t characterSize; // height } PSF1_Header; +// debug +void term_scroll(); + #endif diff --git a/src/kmain.c b/src/kmain.c index 73702df..aa22187 100644 --- a/src/kmain.c +++ b/src/kmain.c @@ -118,11 +118,11 @@ void kmain() term_init(); kputs(splash); - for (int i=0; i<50; i++) + for (int i=0; i<10; i++) { printf("testing, attention please %d\n", i); - timer_wait(1000); } + term_scroll(); hcf(); } diff --git a/src/time/timer.c b/src/time/timer.c index 07ede9e..a632a57 100644 --- a/src/time/timer.c +++ b/src/time/timer.c @@ -44,7 +44,7 @@ void pic_enable() // Enabling IRQ0 (unmasking it) but not the others uint8_t mask = inb(0x21); mask &= ~(1 << 0); // Set IRQ0 (timer, clear bit 0) - mask &= ~(1 << 1); // Set IRQ1 (PS/2 Keyboard, clear bit 1) + //mask &= ~(1 << 1); // Set IRQ1 (PS/2 Keyboard, clear bit 1) outb(0x21, mask); }