Ejemplo n.º 1
0
static void
vbe_104f08(struct bregs *regs)
{
    struct vgamode_s *vmode_g = get_current_mode();
    if (! vmode_g)
        goto fail;
    u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
    if (memmodel == MM_DIRECT || memmodel == MM_YUV) {
        regs->ax = 0x034f;
        return;
    }
    if (regs->bl > 1)
        goto fail;
    if (regs->bl == 0) {
        int ret = vgahw_set_dacformat(vmode_g, regs->bh);
        if (ret < 0)
            goto fail;
    }
    int ret = vgahw_get_dacformat(vmode_g);
    if (ret < 0)
        goto fail;
    regs->bh = ret;
    regs->ax = 0x004f;
    return;
fail:
    regs->ax = 0x014f;
}
Ejemplo n.º 2
0
static void
vbe_104f07(struct bregs *regs)
{
    struct vgamode_s *vmode_g = get_current_mode();
    if (! vmode_g)
        goto fail;
    int bpp = vga_bpp(vmode_g);
    int linelength = vgahw_get_linelength(vmode_g);
    if (linelength < 0)
        goto fail;

    int ret;
    switch (regs->bl) {
    case 0x80:
    case 0x00:
        ret = vgahw_set_displaystart(
            vmode_g, DIV_ROUND_UP(regs->cx * bpp, 8) + linelength * regs->dx);
        if (ret)
            goto fail;
        break;
    case 0x01:
        ret = vgahw_get_displaystart(vmode_g);
        if (ret < 0)
            goto fail;
        regs->dx = ret / linelength;
        regs->cx = (ret % linelength) * 8 / bpp;
        break;
    default:
        goto fail;
    }
    regs->ax = 0x004f;
    return;
fail:
    regs->ax = 0x014f;
}
Ejemplo n.º 3
0
void VISIBLE16
vbe_104f05(struct bregs *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 = 0x014f;
}
Ejemplo n.º 4
0
static void
vbe_104f06(struct bregs *regs)
{
    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;
}
Ejemplo n.º 5
0
bool BeOS_monitor_desc::video_open() {
	// Create semaphore
	mac_os_lock = create_sem(0, "MacOS Frame Buffer Lock");

	const video_mode &mode = get_current_mode();

	// Open display
	switch (display_type) {
		case DISPLAY_WINDOW:
			the_window = new MacWindow(BRect(0, 0, mode.x-1, mode.y-1), *this);
			break;
		case DISPLAY_SCREEN: {
			status_t screen_error;
			the_screen = new MacScreen(*this, GetString(STR_WINDOW_TITLE), scr_mode_bit & 0x1f, &screen_error);
			if (screen_error != B_NO_ERROR) {
				the_screen->PostMessage(B_QUIT_REQUESTED);
				while (the_screen)
					snooze(200000);
				ErrorAlert(STR_OPEN_SCREEN_ERR);
				return false;
			} else {
				the_screen->Show();
				acquire_sem(mac_os_lock);
			}
			break;
		}
	}
	return true;
}