X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=seabios.git;a=blobdiff_plain;f=vgasrc%2Fvbe.c;h=68d20259827cd28aeda174fa69dd75265290624e;hp=7e847945e2e65d58845e33e41269a5b9b3fb4e62;hb=3876b531222c53124b0eb154fb331c0c662f5e09;hpb=9961f9958cbc169c531dbdb7c3a8f71d4f79d0c1 diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 7e84794..68d2025 100644 --- a/vgasrc/vbe.c +++ b/vgasrc/vbe.c @@ -241,8 +241,33 @@ fail: static void vbe_104f06(struct bregs *regs) { - debug_stub(regs); - regs->ax = 0x0100; + if (regs->bl > 0x02) + goto fail; + struct vgamode_s *vmode_g = get_current_mode(); + if (! vmode_g) + goto fail; + int bpp = vga_bpp(vmode_g); + + if (regs->bl == 0x00) { + int ret = vgahw_set_linelength(vmode_g, DIV_ROUND_UP(regs->cx * bpp, 8)); + if (ret) + goto fail; + } else if (regs->bl == 0x02) { + int ret = vgahw_set_linelength(vmode_g, regs->cx); + if (ret) + goto fail; + } + int linelength = vgahw_get_linelength(vmode_g); + if (linelength < 0) + goto fail; + + regs->bx = linelength; + regs->cx = (linelength * 8) / bpp; + regs->dx = GET_GLOBAL(VBE_total_memory) / linelength; + regs->ax = 0x004f; + return; +fail: + regs->ax = 0x014f; } static void