SET_FARVAR(seg, info->winB_attributes, 0);
SET_FARVAR(seg, info->win_granularity, GET_GLOBAL(VBE_win_granularity));
SET_FARVAR(seg, info->win_size, 64); /* Bank size 64K */
- SET_FARVAR(seg, info->winA_seg, SEG_GRAPH);
+ SET_FARVAR(seg, info->winA_seg, GET_GLOBAL(vmode_g->sstart));
SET_FARVAR(seg, info->winB_seg, 0x0);
- SET_FARVAR(seg, info->win_func_ptr.segoff, 0x0);
+ extern void entry_104f05(void);
+ SET_FARVAR(seg, info->win_func_ptr
+ , SEGOFF(get_global_seg(), (u32)entry_104f05));
int width = GET_GLOBAL(vmode_g->width);
int height = GET_GLOBAL(vmode_g->height);
int linesize = width * DIV_ROUND_UP(depth, 8);
SET_FARVAR(seg, info->bytes_per_scanline, linesize);
SET_FARVAR(seg, info->xres, width);
SET_FARVAR(seg, info->yres, height);
- SET_FARVAR(seg, info->xcharsize, 8);
- SET_FARVAR(seg, info->ycharsize, 16);
+ SET_FARVAR(seg, info->xcharsize, GET_GLOBAL(vmode_g->cwidth));
+ SET_FARVAR(seg, info->ycharsize, GET_GLOBAL(vmode_g->cheight));
if (depth == 4)
SET_FARVAR(seg, info->planes, 4);
else
{
dprintf(1, "VBE mode set: %x\n", regs->bx);
- int mode = regs->bx & 0x1ff;
- int flags = regs->bx & (MF_CUSTOMCRTC|MF_LINEARFB|MF_NOCLEARMEM);
- int ret = vgahw_set_mode(mode, flags);
+ int mode = regs->bx & ~MF_VBEFLAGS;
+ int flags = regs->bx & MF_VBEFLAGS;
+ int ret = vga_set_mode(mode, flags);
regs->ah = ret;
regs->al = 0x4f;
static void
vbe_104f03(struct bregs *regs)
{
- u16 mode = GET_BDA(vbe_mode);
- if (!mode)
- regs->bx = GET_BDA(video_mode);
-
+ regs->bx = GET_BDA(vbe_mode);
dprintf(1, "VBE current mode=%x\n", regs->bx);
-
regs->ax = 0x004f;
}
regs->ax = 0x0100;
}
-static void
+void VISIBLE16
vbe_104f05(struct bregs *regs)
{
- debug_stub(regs);
+ if (regs->bh > 1 || regs->bl > 1)
+ goto fail;
+ if (GET_BDA(vbe_mode) & MF_LINEARFB) {
+ regs->ah = VBE_RETURN_STATUS_INVALID;
+ return;
+ }
+ struct vgamode_s *vmode_g = get_current_mode();
+ if (! vmode_g)
+ goto fail;
+ if (regs->bh) {
+ int ret = vgahw_get_window(vmode_g, regs->bl);
+ if (ret < 0)
+ goto fail;
+ regs->dx = ret;
+ regs->ax = 0x004f;
+ return;
+ }
+ int ret = vgahw_set_window(vmode_g, regs->bl, regs->dx);
+ if (ret)
+ goto fail;
+ regs->ax = 0x004f;
+ return;
+fail:
regs->ax = 0x0100;
}
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