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)
$(LD) $(LDFLAGS) $^ -o $@
%.o: %.c ${HEADERS}
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.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_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 */

View File

@ -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();

View File

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