diff --git a/x86emu/int10/generic.c b/x86emu/int10/generic.c index b541403b..2c355779 100644 --- a/x86emu/int10/generic.c +++ b/x86emu/int10/generic.c @@ -272,6 +272,8 @@ unsigned long long vbios_addr; //static unsigned long long * vfb_top; void *vbiosMem = 0; +int cacluate_vesamode(); + int vga_bios_init(void) { xf86Int10InfoPtr pInt; @@ -645,15 +647,17 @@ int vga_bios_init(void) pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0x10; { + { char *mode; mode = getenv("vesa_mode"); if (mode != 0) vesa_mode = strtol(mode, 0, 0); else - vesa_mode = 0x00; + vesa_mode = cacluate_vesamode(0); + } } - for(vesa_mode = 0; vesa_mode <= 24; vesa_mode++){ + for(; vesa_mode>=0 ; vesa_mode = cacluate_vesamode(vesa_mode)){ printk("\n\nvesa_mode : 0x%x\n", vesa_mode); pInt->ax = 0x4f02; // pInt->bx = 0x4114; diff --git a/x86emu/int10/vesafb.c b/x86emu/int10/vesafb.c index 785ebbf9..bdef176e 100644 --- a/x86emu/int10/vesafb.c +++ b/x86emu/int10/vesafb.c @@ -462,6 +462,30 @@ struct vesamode *vesa_mode_head = vesamode; static u32 io_vaddr; +int cacluate_vesamode(int start) +{ + int x,y,depth,mode; + int i; + x=800; + y=600; + depth=16; + mode=-1; +#ifdef FB_XSIZE + x=FB_XSIZE; +#endif + +#ifdef FB_YSIZE + y=FB_YSIZE; +#endif + for(i=start;i0x107) + { + mode = i; + break; + } + return mode; +} + void tlbmap(u32 viraddr, u32 phyaddr, u32 size) {