Should be working, but function call fails.

This commit is contained in:
Nicolás Ortega Froysa 2018-02-26 16:53:13 +01:00
parent ad43ca56b1
commit 3f35a78c07
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF
4 changed files with 5 additions and 8 deletions

View File

@ -17,7 +17,7 @@ os-image: boot/boot_sect.bin kernel/kernel.bin
kernel/kernel.bin: $(OBJ) kernel/kernel.bin: $(OBJ)
$(LD) $(LDFLAGS) $^ -o $@ $(LD) $(LDFLAGS) $^ -o $@
%.o: %.c ${HEADERS} %.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
%.o: %.asm %.o: %.asm

View File

@ -32,6 +32,7 @@ void set_cursor(int offset) {
port_byte_out(REG_SCREEN_CTRL, 14); port_byte_out(REG_SCREEN_CTRL, 14);
port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset >> 8)); port_byte_out(REG_SCREEN_DATA, (unsigned char)(offset >> 8));
port_byte_out(REG_SCREEN_CTRL, 15); port_byte_out(REG_SCREEN_CTRL, 15);
port_byte_out(REG_SCREEN_DATA, (unsigned char)offset);
} }
int handle_scrolling(int cursor_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 * as an offset
*/ */
if(col >= 0 && row >= 0) if(col >= 0 && row >= 0)
{
offset = get_screen_offset(col, row); offset = get_screen_offset(col, row);
}
/* otherwise use the cursor's current location */ /* otherwise use the cursor's current location */
else else
{
offset = get_cursor(); offset = get_cursor();
}
/* handle a newline */ /* handle a newline */
if(c == '\n') if(c == '\n')

View File

@ -9,6 +9,7 @@
#define REG_SCREEN_CTRL 0x3d4 #define REG_SCREEN_CTRL 0x3d4
#define REG_SCREEN_DATA 0x3d5 #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_at(const char *msg, int col, int row);
void print(const char *msg); void print(const char *msg);
void clear_screen(); void clear_screen();

View File

@ -1,6 +1,5 @@
#include "../drivers/screen.h" #include "../drivers/screen.h"
void main() { void main() {
/*clear_screen(); clear_screen();
print_at("This is a test.", 0, 0);*/
} }