I have dropped it because it was wrong ;D.
here is the new code:
Code: Select all
extern unsigned long mboot_info;
char font_a[]=???{0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x78, /* 01111000 */
???0x0c, /* 00001100 */
???0x7c, /* 01111100 */
???0xcc, /* 11001100 */
???0xcc, /* 11001100 */
???0xcc, /* 11001100 */
???0x76, /* 01110110 */
???0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x00, /* 00000000 */
???0x00};
unsigned long RGBA_black = 0x00000000;
#define CHAR_HEIGHT 16
#define CHAR_WIDTH 8
unsigned long *framebuffer;
SVGAMODEINFO *vbe_mode_info;
void show_character(char *font, unsigned long *VRAM, unsigned long color, int rowlength);
int vbe_init()
{
multiboot_info_t *mbi;
union flags_info flags;
char *image;
int len = 32*1024, i, j;
int done = 0;
image = (char *) kmalloc(len);
memcpy(image, biosimage, len);
kprintf("init VBE ... ");
mbi = (multiboot_info_t *)mboot_info;
flags.flags = mbi->flags;
if(flags.bits.bit11 == 1){
???done = 1;
???
???vbe_mode_info = (SVGAMODEINFO *)mbi->vbe_mode_info;
???framebuffer = (unsigned long *)vbe_mode_info->physbaseptr;
???if(framebuffer != NULL)
???{
??? int offset = 0;
??? for(j=0; j < 600; j++){
??????for(i=0; i < 800; i++){
?????? offset = 800*j + i;
?????? framebuffer[offset] = RGBA_black;
??????}
??? }
??? show_character(font_a,framebuffer,0xFFFFFFFF, 800);
???}
}
return 0;
}
void show_character(char *font, unsigned long *VRAM, unsigned long color, int rowlength) {
int i, j;
for (i=0;i<CHAR_HEIGHT;i++,VRAM+=rowlength) {
unsigned long *row=VRAM;
for (j=1<<CHAR_WIDTH;j!=0;j=j>>1) {
if (font[i]&j) *row=color;
row++;
}
}
}
is LBF realy a physical address, because I check it with bochsdbg, I notice it is in very heigh memory 0xE0000000. or that is the memory of video card but mapped to my physicall address?