diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2012-01-24 00:07:44 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2012-02-01 20:38:49 -0500 |
commit | 3876b531222c53124b0eb154fb331c0c662f5e09 (patch) | |
tree | 23f39e04767b1da3b8983ab1432821ee95bdc42c /vgasrc/vbe.c | |
parent | 9961f9958cbc169c531dbdb7c3a8f71d4f79d0c1 (diff) | |
download | seabios-3876b531222c53124b0eb154fb331c0c662f5e09.tar.gz |
vgabios: Add support for vbe get/set line length function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vbe.c')
-rw-r--r-- | vgasrc/vbe.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c index 7e847945..68d20259 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 |