fixing merge conflicts from local merg in loader.asm

This commit is contained in:
Medium Fries 2019-02-25 16:57:11 -08:00
commit d745d42a54
6 changed files with 35 additions and 17 deletions

View File

@ -8,28 +8,32 @@
#include "framebuffer.h"
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
//static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
// Writes character to a given cell in the framebuffer
// @cell parameter is the logical (linear)index into the buffer
// _not_ the actual offset from the buffer addr
// also proper location is caller's responsibility
void writech_fb(unsigned cell, char c, char fg, char bg) {
void write_cell_fb(unsigned cell, char c, char fg, char bg) {
Frame_Buffer[cell] = c;
Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f);
}
/* this probably doesn't belong here */
void print_fb(char* str) {
for(unsigned i =0;i<strlen(str);i++) {
writech_fb(FRAME_CELL(i), str[i], Green, White);
/* should be passing in a cell-position for position param*/
void print_fb(char* str, unsigned position) {
unsigned relative_end = position + strlen(str);
for(unsigned i = position; i<relative_end; i++) {
write_cell_fb(FRAME_CELL(i), str[i], Green, White);
}
}
/* moving the cursor to our given position */
void cursor_adjust() {
// TODO: c ipmle
void clear_fb() {
for(unsigned cell=0;cell<AREA; cell+=2) {
write_cell_fb(cell, ' ', 0x00, 0x00);
}
}
/* generic test func for this module */
void test_fb() {
print_fb("adsf");
clear_fb();
print_fb("adsf", POSITION(0,5));
}

View File

@ -1,8 +1,9 @@
#include "stl/string.h"
#define COLUMNS 80
#define ROWS 25
#define AREA ( COLUMNS * ROWS )
#define POSITION(ROW, COL) ( (ROW * COLUMNS) + COL )
// address of our frame buffer
#define FRAME_BUFFER_ADDR 0x000B8000
@ -28,9 +29,11 @@
#define LightBrown 0x0e
#define White 0x0f
void writech_fb(unsigned cell, char c , char fg, char bg);
void write_cell_fb(unsigned cell, char c , char fg, char bg);
void print_fb(char* str);
void print_fb(char* str, unsigned position);
void clear_fb();
/* Testing function because yote squad in here yeye */
void test_fb();

View File

@ -9,9 +9,7 @@ CHECKSUM equ -MAGIC_NUMBER
; size in bytes of stack
KERNEL_STACK_SIZE equ 4096
; Test funcs are generic void handler's in whatever the target module is
extern test_fb
section .text
; align all instructions to 4 byte boundary by the x86 instruction set law
@ -22,6 +20,7 @@ align 4
dd CHECKSUM
loader:
call test_fb
.loop:
jmp .loop

8
stl/stdlib.c Normal file
View File

@ -0,0 +1,8 @@
int memcmp(const void* left, const void* right, const unsigned length) {
for(unsigned i=0;i<length;i++) {
if(left[i] != right[i]) {
return 1;
}
}
return 0;
}

1
stl/stdlib.h Normal file
View File

@ -0,0 +1 @@
int memcmp(const void* left, const void* right, const unsigned length);

View File

@ -1,4 +1,7 @@
// our own stuff for stl utilities
/*
* string.h
* String based utilities
*/
unsigned strlen(const char* str) {
unsigned idx = 0;