Merge branch 'master' of gitlab.com:shockrahwow/jankos
This commit is contained in:
commit
d14e1ea8d1
@ -10,25 +10,26 @@
|
||||
static char* Frame_Buffer = (char*)FRAME_BUFFER_ADDR;
|
||||
static char* Frame_Buffer_End = (char*)(FRAME_BUFFER_ADDR + AREA);
|
||||
// Writes character to a given cell in the framebuffer
|
||||
// Safety handled by caller function
|
||||
// @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 write_cell(unsigned cell, char c, char fg, char bg) {
|
||||
void writech_fb(unsigned cell, char c, char fg, char bg) {
|
||||
Frame_Buffer[cell] = c;
|
||||
Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f);
|
||||
}
|
||||
|
||||
void clear_buffer() {
|
||||
char* fp = Frame_Buffer;
|
||||
while(fp!=Frame_Buffer_End) {
|
||||
*fp = 0x00;
|
||||
}
|
||||
}
|
||||
void print(char* str) {
|
||||
for(unsigned i =0;i<strlen(str);i+=2) {
|
||||
write_cell(i, str[i], Green, White);
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
||||
void yote() {
|
||||
print("asdf");
|
||||
/* moving the cursor to our given position */
|
||||
void cursor_adjust() {
|
||||
// TODO: c ipmle
|
||||
}
|
||||
/* generic test func for this module */
|
||||
void test_fb() {
|
||||
print_fb("adsf");
|
||||
}
|
||||
|
@ -4,7 +4,13 @@
|
||||
#define AREA ( COLUMNS * ROWS )
|
||||
|
||||
|
||||
// address of our frame buffer
|
||||
#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 Blue 0x02
|
||||
#define Green 0x03
|
||||
@ -22,10 +28,9 @@
|
||||
#define LightBrown 0x0e
|
||||
#define White 0x0f
|
||||
|
||||
void write_cell(unsigned cell, char c , char fg, char bg);
|
||||
void writech_fb(unsigned cell, char c , char fg, char bg);
|
||||
|
||||
void clear_buffer();
|
||||
void print_fb(char* str);
|
||||
|
||||
void print(char* str);
|
||||
|
||||
void yote();
|
||||
/* Testing function because yote squad in here yeye */
|
||||
void test_fb();
|
||||
|
Binary file not shown.
24
loader.asm
24
loader.asm
@ -1,6 +1,7 @@
|
||||
; since we have no stack we have to create one for the OS
|
||||
|
||||
global loader
|
||||
; this section is partly handled by nasm tolerating some minor bs
|
||||
MAGIC_NUMBER equ 0x1BADB002
|
||||
FLAGS equ 0x0
|
||||
CHECKSUM equ -MAGIC_NUMBER
|
||||
@ -9,18 +10,9 @@ CHECKSUM equ -MAGIC_NUMBER
|
||||
; size in bytes of stack
|
||||
KERNEL_STACK_SIZE equ 4096
|
||||
|
||||
; external labels(cdecl) calling convention
|
||||
extern yote
|
||||
|
||||
section .bss
|
||||
align 4 ; aligning to bytes for x86(32-bit) reasons
|
||||
; 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
|
||||
; external labels(cdecl) calling convention
|
||||
extern test
|
||||
|
||||
section .text
|
||||
; align all instructions to 4 byte boundary by the x86 instruction set law
|
||||
@ -31,7 +23,15 @@ align 4
|
||||
dd CHECKSUM
|
||||
|
||||
loader:
|
||||
call yote
|
||||
call test
|
||||
|
||||
.loop:
|
||||
jmp .loop
|
||||
|
||||
section .bss
|
||||
align 4 ; aligned to 4 bytes for performance
|
||||
kernel_stack:
|
||||
; (res)erve (b)ytes x
|
||||
resb KERNEL_STACK_SIZE ; 4k of stack size in mem
|
||||
; now we setup the stack pointer for our kernel
|
||||
mov esp, kernel_stack + KERNEL_STACK_SIZE
|
||||
|
Loading…
Reference in New Issue
Block a user