Changing super-basic test function to just test() because of how small and bland it is

This commit is contained in:
Medium Fries 2019-02-03 16:37:20 -08:00
parent 88fad3c56e
commit d42d68e5a9
3 changed files with 19 additions and 20 deletions

View File

@ -24,12 +24,14 @@ void clear_buffer() {
*fp = 0x00; *fp = 0x00;
} }
} }
void print(char* str) {
for(unsigned i =0;i<strlen(str);i+=2) { // TODO: move this to the stl with printf functionality
void print_fb(char* str) {
for(unsigned i =0;i<strlen(str);i++) {
write_cell(i, str[i], Green, White); write_cell(i, str[i], Green, White);
} }
} }
void yote() { void test() {
print("asdf"); print_fb("asdf");
} }

View File

@ -4,7 +4,13 @@
#define AREA ( COLUMNS * ROWS ) #define AREA ( COLUMNS * ROWS )
// address of our frame buffer
#define FRAME_BUFFER_ADDR 0x000B8000 #define FRAME_BUFFER_ADDR 0x000B8000
// Logical index of a cell in the frame buffer
#define FRAME_CELL(cell_) (cell_ * 2)
// Colors available in text framebuffer
#define Black 0x01 #define Black 0x01
#define Blue 0x02 #define Blue 0x02
#define Green 0x03 #define Green 0x03
@ -26,6 +32,6 @@ void write_cell(unsigned cell, char c , char fg, char bg);
void clear_buffer(); void clear_buffer();
void print(char* str); void print_fb(char* str);
void yote(); void test();

View File

@ -1,6 +1,7 @@
; since we have no stack we have to create one for the OS ; since we have no stack we have to create one for the OS
global loader global loader
; this section is partly handled by nasm tolerating some minor bs
MAGIC_NUMBER equ 0x1BADB002 MAGIC_NUMBER equ 0x1BADB002
FLAGS equ 0x0 FLAGS equ 0x0
CHECKSUM equ -MAGIC_NUMBER CHECKSUM equ -MAGIC_NUMBER
@ -9,18 +10,9 @@ CHECKSUM equ -MAGIC_NUMBER
; size in bytes of stack ; size in bytes of stack
KERNEL_STACK_SIZE equ 4096 KERNEL_STACK_SIZE equ 4096
; external labels(cdecl) calling convention
extern yote
section .bss ; external labels(cdecl) calling convention
align 4 ; aligning to bytes for x86(32-bit) reasons extern test
; because this is the first thing we actually do (virual)address 0x00000000 will
; contain 4KB of memory for our stack
kernel_stack:
resb KERNEL_STACK_SIZE ; reserver bytes instruction
; point to what will be bottom of stack
; which will grow down towards (virtual)address 0x00000000
mov esp, kernel_stack + KERNEL_STACK_SIZE
section .text section .text
; align all instructions to 4 byte boundary by the x86 instruction set law ; align all instructions to 4 byte boundary by the x86 instruction set law
@ -31,12 +23,11 @@ align 4
dd CHECKSUM dd CHECKSUM
loader: loader:
call yote call test
.loop: .loop:
jmp .loop jmp .loop
; section for our kernel stack
KERNEL_STACK_SIZE equ 4096
section .bss section .bss
align 4 ; aligned to 4 bytes for performance align 4 ; aligned to 4 bytes for performance
kernel_stack: kernel_stack: