diff --git a/Makefile b/Makefile index e6b17d3..cf022c1 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ os-image: boot/boot_sect.bin kernel/kernel.bin kernel/kernel.bin: $(OBJ) $(LD) $(LDFLAGS) $^ -o $@ -%.o: %.c ${HEADERS} +%.o: %.c $(CC) $(CFLAGS) -c $< -o $@ %.o: %.asm diff --git a/drivers/screen.c b/drivers/screen.c index ad85a4c..f3bc4f2 100644 --- a/drivers/screen.c +++ b/drivers/screen.c @@ -32,6 +32,7 @@ void set_cursor(int offset) { port_byte_out(REG_SCREEN_CTRL, 14); port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset >> 8)); port_byte_out(REG_SCREEN_CTRL, 15); + port_byte_out(REG_SCREEN_DATA, (unsigned char)offset); } int handle_scrolling(int cursor_offset) { @@ -76,14 +77,10 @@ void print_char(char c, int col, int row, char attr_byte) { * as an offset */ if(col >= 0 && row >= 0) - { offset = get_screen_offset(col, row); - } /* otherwise use the cursor's current location */ else - { offset = get_cursor(); - } /* handle a newline */ if(c == '\n') @@ -95,7 +92,7 @@ void print_char(char c, int col, int row, char attr_byte) { else { vidmem[offset] = c; - vidmem[offset+1] = attr_byte; + vidmem[offset + 1] = attr_byte; } /* update the offset to the next cell */ diff --git a/drivers/screen.h b/drivers/screen.h index 704b79c..08068ea 100644 --- a/drivers/screen.h +++ b/drivers/screen.h @@ -9,6 +9,7 @@ #define REG_SCREEN_CTRL 0x3d4 #define REG_SCREEN_DATA 0x3d5 +void print_char(char c, int col, int row, char attr_byte); void print_at(const char *msg, int col, int row); void print(const char *msg); void clear_screen(); diff --git a/kernel/kernel.c b/kernel/kernel.c index cc9028c..53175c9 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,6 +1,5 @@ #include "../drivers/screen.h" void main() { - /*clear_screen(); - print_at("This is a test.", 0, 0);*/ + clear_screen(); }