Your commit message here

This commit is contained in:
Gregory Kenneth Bowne 2024-04-08 23:25:11 -07:00
parent 11d0f9d492
commit 23228162c4
6 changed files with 13 additions and 14 deletions

BIN
src/impl/kernel/kernel.bin Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
#include "print.h" #include "../../../../../../"
void kernel_main() void kernel_main()
{ {

View File

@ -17,8 +17,8 @@ uint8_t color = PRINT_COLOR_WHITE | PRINT_COLOR_BLACK << 4;
void clear_row(size_t row) void clear_row(size_t row)
{ {
struct Char empty = (struct Char){ struct Char empty = (struct Char){
character : '', 0,
color : color, color,
}; };
for (size_t col = 0; col < NUM_COLS; col++) for (size_t col = 0; col < NUM_COLS; col++)
@ -62,7 +62,7 @@ void print_char(char character)
if (character == '\n') if (character == '\n')
{ {
print_newline(); print_newline();
return return;
} }
if (col > NUM_COLS) if (col > NUM_COLS)
@ -71,8 +71,8 @@ void print_char(char character)
} }
buffer[col + NUM_COLS * row] = (struct Char){ buffer[col + NUM_COLS * row] = (struct Char){
character : (uint8_t)character, (uint8_t)character,
color : color, color,
}; };
col++; col++;
@ -89,7 +89,7 @@ void print_str(char *str)
return; return;
} }
print_char(character)'' print_char(character);
} }
} }

View File

@ -1,9 +1,9 @@
global start global _start
extern long_mode_start extern long_mode_start
section .text section .text
bits 32 bits 32
start: _start:
mov esp, stack_top mov esp, stack_top
call check_multiboot call check_multiboot
@ -134,4 +134,4 @@ gdt64:
dq (1 << 43) | (1 << 44) | (1 << 47) | (1 << 53) ; code segment dq (1 << 43) | (1 << 44) | (1 << 47) | (1 << 53) ; code segment
.pointer: .pointer:
dw $ - gdt64 - 1 ; length dw $ - gdt64 - 1 ; length
dq gdt64 ; address dq gdt64 ; address

View File

@ -12,5 +12,5 @@ long_mode_start:
mov fs, ax mov fs, ax
mov gs, ax mov gs, ax
call kernel_main call kernel_main
hlt hlt

View File

@ -19,9 +19,8 @@ enum {
PRINT_COLOR_LIGHT_RED = 12, PRINT_COLOR_LIGHT_RED = 12,
PRINT_COLOR_PINK = 13, PRINT_COLOR_PINK = 13,
PRINT_COLOR_YELLOW = 14, PRINT_COLOR_YELLOW = 14,
PRINT_COLOR_WHITE = 15, PRINT_COLOR_WHITE = 15
};
}
void print_clear(); void print_clear();
void print_char(char character); void print_char(char character);