removed jank functions and got a cursor to blink properly

This commit is contained in:
shockrahwow 2019-05-01 02:06:27 -07:00
parent 74d88173b1
commit 86f2db05a0
3 changed files with 20 additions and 16 deletions

View File

@ -19,21 +19,17 @@ void write_cell_fb(unsigned cell, char c, char fg, char bg) {
Frame_Buffer[cell+1] = (fg & 0x0f << 4) | (bg & 0x0f);
}
/* 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);
}
}
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() {
clear_fb();
print_fb("adsf", POSITION(0,5));
write_cell_fb(FRAME_CELL(0), 'a', Green, White);
write_cell_fb(FRAME_CELL(1), 'b', Green, White);
write_cell_fb(FRAME_CELL(2), 'c', Green, White);
}

View File

@ -3,7 +3,6 @@
#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

View File

@ -20,15 +20,24 @@ align 4
dd CHECKSUM
loader:
mov al, 14
mov dx, 0x3d4
out dx, al ; 14 tells the framebuffer to expect the highest 8 bits of the position
mov al, 0
mov dx, 0x3d5
out dx, al ; sending the highest 8 bits of 0x0050
mov al, 15
mov dx, 0x3d4
out dx, al ; 15 tells the framebuffer to expect the lowest 8 bits of the position
mov al, 0
mov dx, 0x3d5
out dx, al ; sending the lowest 8 bits of 0x0050
call test_fb
.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