- Retesting framebuffer drivers
- clear_fb() fully working - trying to add positional buffer writes for fancy output - POSITION macro only seems to work for (0,0) coords for now haven't tested other edge cases yet
This commit is contained in:
parent
b5ae502520
commit
8d1879fe97
@ -9,27 +9,36 @@
|
|||||||
|
|
||||||
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 */
|
/* this probably doesn't belong here */
|
||||||
void print_fb(char* str) {
|
void print_fb(char* str, unsigned row, unsigned col) {
|
||||||
for(unsigned i =0;i<strlen(str);i++) {
|
// now we can write things to our buffer
|
||||||
writech_fb(FRAME_CELL(i), str[i], Green, White);
|
for(unsigned i =POSITION(row,col);i<strlen(str);i++) {
|
||||||
|
write_cell_fb(FRAME_CELL(i), str[i], Green, White);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* moving the cursor to our given position */
|
void clear_fb() {
|
||||||
void cursor_adjust() {
|
char* cell;
|
||||||
// TODO: c ipmle
|
unsigned idx = Frame_Buffer_End - Frame_Buffer;
|
||||||
|
|
||||||
|
for(cell=Frame_Buffer;cell != Frame_Buffer_End; cell+=2) {
|
||||||
|
idx = Frame_Buffer_End - cell;
|
||||||
|
write_cell_fb(idx, ' ', 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("Helo from the frame buffer", 0, 0);
|
||||||
|
print_fb("adsf", 2, 2);
|
||||||
}
|
}
|
||||||
|
@ -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 row, unsigned col);
|
||||||
|
|
||||||
|
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,10 +9,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
|
||||||
|
extern test_fb
|
||||||
|
|
||||||
; external labels(cdecl) calling convention
|
; external labels(cdecl) calling convention
|
||||||
extern test
|
|
||||||
|
|
||||||
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
|
||||||
@ -23,7 +22,7 @@ align 4
|
|||||||
dd CHECKSUM
|
dd CHECKSUM
|
||||||
|
|
||||||
loader:
|
loader:
|
||||||
call test
|
call test_fb
|
||||||
|
|
||||||
.loop:
|
.loop:
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
Loading…
Reference in New Issue
Block a user