diff options
Diffstat (limited to 'driver/vesa.c')
| -rw-r--r-- | driver/vesa.c | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/driver/vesa.c b/driver/vesa.c index c882595..ba87e6d 100644 --- a/driver/vesa.c +++ b/driver/vesa.c @@ -12,7 +12,7 @@ //#define FOOLSOS_SHOW_VESAMODES static foolfont *deffont; -static vbemodeinfo *VbeModeInfoBlock; +//static vbemodeinfo *VbeModeInfoBlock; static int console_x; static int console_y; @@ -26,6 +26,13 @@ static uint8_t* physbase; void PutConsoleNL(); void PutPixel(int x,int y, int color); +// we need to obtain this from somewhere else.. +static uint32_t vesaXres; +static uint32_t vesaYres; +static uint32_t vesaPitch; +static uint32_t vesaBpp; +static uint32_t vesaAddr; + //static char buf[80][24]; void vesa_update_cursor(uint32_t col,uint32_t row) @@ -96,12 +103,12 @@ void vesa_put_rect(int x, int y, int w , int h, int color) void vesa_clear_screen() { - vesa_put_rect(0,0,VbeModeInfoBlock->Xres, VbeModeInfoBlock->Yres, 0xffffff); + vesa_put_rect(0,0,vesaXres, vesaYres, 0xffffff); } void vesa_set_physbase(uint32_t addr) { - VbeModeInfoBlock->physbase=addr; + vesaAddr=addr; } // @@ -124,23 +131,31 @@ void vesa_set_physbase(uint32_t addr) // our video memory // -uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) +uint32_t vesa_init(multiboot_information *inf, foolfont *rawfont) { +//inf->framebuffer_type + + vesaXres=inf->framebuffer_width; + vesaYres=inf->framebuffer_height; + vesaPitch=inf->framebuffer_pitch; + vesaBpp=inf->framebuffer_bpp; + vesaAddr=inf->framebuffer_addr; + //the only functionallu important init lines! (rest is log) - VbeModeInfoBlock=mode; + //VbeModeInfoBlock=mode; deffont=rawfont; console_x=0; console_y=0; int line_height=12; int col_width=10; - console_lines=mode->Yres/line_height; - console_cols=mode->Xres/col_width; + console_lines=vesaYres/line_height; + console_cols=vesaXres/col_width; //TODO dynamic (but need to sync with terminal!) console_cols=80; console_lines=24; - + /* // vesa info klog("vbe version: 0x%x / video mode ptr: 0x%x 0x%x", info->VbeVersion, info->VideoModePtr[1], info->VideoModePtr[0]); @@ -167,9 +182,10 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) modeptr++; } #endif +*/ - return VbeModeInfoBlock->physbase; + return vesaAddr; } @@ -177,9 +193,9 @@ uint32_t vesa_init(vbeinfo *info,vbemodeinfo *mode,foolfont *rawfont) void PutPixel(int x,int y, int color) { //do not write memory outside the screen buffer, check parameters against the VBE mode info - if (x<0 || x>VbeModeInfoBlock->Xres|| y<0 || y>VbeModeInfoBlock->Yres) return; - if (x) x = (x*(VbeModeInfoBlock->bpp>>3)); // get bytes (divide by 8) - if (y) y = (y*VbeModeInfoBlock->pitch); + if (x<0 || x>vesaXres|| y<0 || y>vesaYres) return; + if (x) x = (x*(vesaBpp>>3)); // get bytes (divide by 8) + if (y) y = (y*vesaPitch); //uint8_t *cTemp=VbeModeInfoBlock->physbase; uint8_t *cTemp=VMEM_FRAMEBUFFER; @@ -300,12 +316,12 @@ static int boxy; void vesa_render() { vesa_clear_screen(); - vesa_put_rect(100,100,VbeModeInfoBlock->Xres-200,VbeModeInfoBlock->Yres-200,0xff); + vesa_put_rect(100,100,vesaXres-200,vesaYres-200,0xff); vesa_put_rect(boxx-10,boxy-10,20,20,0x999999); boxx++; // boxy+=boxx; - if(boxx>VbeModeInfoBlock->Xres-100)boxx=100; + if(boxx>vesaXres-100)boxx=100; // if(boxy>VbeModeInfoBlock->Yres-200)boxy=200; vesa_switch_buffers(); |
