fixing merge conflicts from local merg in loader.asm
This commit is contained in:
commit
d745d42a54
@ -8,28 +8,32 @@
|
|||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
|
|
||||||
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
|
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
|
// Writes character to a given cell in the framebuffer
|
||||||
// @cell parameter is the logical (linear)index into the buffer
|
// @cell parameter is the logical (linear)index into the buffer
|
||||||
// _not_ the actual offset from the buffer addr
|
// _not_ the actual offset from the buffer addr
|
||||||
// also proper location is caller's responsibility
|
// 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] = c;
|
||||||
Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f);
|
Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this probably doesn't belong here */
|
/* should be passing in a cell-position for position param*/
|
||||||
void print_fb(char* str) {
|
void print_fb(char* str, unsigned position) {
|
||||||
for(unsigned i =0;i<strlen(str);i++) {
|
unsigned relative_end = position + strlen(str);
|
||||||
writech_fb(FRAME_CELL(i), str[i], Green, White);
|
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 clear_fb() {
|
||||||
void cursor_adjust() {
|
for(unsigned cell=0;cell<AREA; cell+=2) {
|
||||||
// TODO: c ipmle
|
write_cell_fb(cell, ' ', 0x00, 0x00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* generic test func for this module */
|
/* generic test func for this module */
|
||||||
void test_fb() {
|
void test_fb() {
|
||||||
print_fb("adsf");
|
clear_fb();
|
||||||
|
print_fb("adsf", POSITION(0,5));
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#include "stl/string.h"
|
#include "stl/string.h"
|
||||||
|
|
||||||
#define COLUMNS 80
|
#define COLUMNS 80
|
||||||
#define ROWS 25
|
#define ROWS 25
|
||||||
#define AREA ( COLUMNS * ROWS )
|
#define AREA ( COLUMNS * ROWS )
|
||||||
|
#define POSITION(ROW, COL) ( (ROW * COLUMNS) + COL )
|
||||||
|
|
||||||
// address of our frame buffer
|
// address of our frame buffer
|
||||||
#define FRAME_BUFFER_ADDR 0x000B8000
|
#define FRAME_BUFFER_ADDR 0x000B8000
|
||||||
@ -28,9 +29,11 @@
|
|||||||
#define LightBrown 0x0e
|
#define LightBrown 0x0e
|
||||||
#define White 0x0f
|
#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 */
|
/* Testing function because yote squad in here yeye */
|
||||||
void test_fb();
|
void test_fb();
|
||||||
|
@ -9,9 +9,7 @@ CHECKSUM equ -MAGIC_NUMBER
|
|||||||
|
|
||||||
; size in bytes of stack
|
; size in bytes of stack
|
||||||
KERNEL_STACK_SIZE equ 4096
|
KERNEL_STACK_SIZE equ 4096
|
||||||
|
extern test_fb
|
||||||
|
|
||||||
; Test funcs are generic void handler's in whatever the target module is
|
|
||||||
|
|
||||||
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
|
||||||
@ -22,6 +20,7 @@ align 4
|
|||||||
dd CHECKSUM
|
dd CHECKSUM
|
||||||
|
|
||||||
loader:
|
loader:
|
||||||
|
call test_fb
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
8
stl/stdlib.c
Normal file
8
stl/stdlib.c
Normal 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
1
stl/stdlib.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
int memcmp(const void* left, const void* right, const unsigned length);
|
@ -1,4 +1,7 @@
|
|||||||
// our own stuff for stl utilities
|
/*
|
||||||
|
* string.h
|
||||||
|
* String based utilities
|
||||||
|
*/
|
||||||
|
|
||||||
unsigned strlen(const char* str) {
|
unsigned strlen(const char* str) {
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user