boolean_t vgahost_init (int max_width, int max_height, int max_bpp, boolean_t fixed_p, int *argc, char *argv[]) { int sel; /* Grab a 64K selector for 0xA000:0000, for the frame buffer. */ sel = __dpmi_segment_to_descriptor (0xA000); if (sel == -1) return FALSE; vga_window_selector = sel; vga_screen_selector = -1; /* no value yet. */ vesa_version = compute_vesa_version (); #if defined (SAVE_VGA_STATE) #if !defined (USE_VESA_STATE_SAVE) state_glue_funcp = vga_state_glue; #else /* USE_VESA_STATE_SAVE */ #error "this will break with the mods to try switching to fullscreen and querying VESA version again...we might save the wrong kind of state!" if (vesa_version >= 0x100) /* version 1.0 or greater? */ state_glue_funcp = vesa_state_glue; else state_glue_funcp = vga_state_glue; #endif /* USE_VESA_STATE_SAVE */ #endif /* Save the current VGA state, so we can clean up well when we exit. */ save_vga_state (); /* WinNT appears to not show us a VESA driver unless we start in * full screen mode. However, if we set a plain VGA graphics mode * it switches us to full screen mode. If we didn't see a VESA * driver, this attempts to switch to fullscreen mode and then try * again. */ if (vesa_version == 0 && !only_use_vga_p) { __dpmi_regs regs; dpmi_zero_regs (®s); regs.x.ax = 0x12; /* 640x480 VGA mode. AH == 0x00. Erase screen. */ if (__dpmi_int (0x10, ®s) == 0) { vesa_version = compute_vesa_version (); restore_vga_state (); } } return TRUE; }
int set_current_console(int i) { if (i < 0 || i >= MAX_OSS) { return -1; } SCR_STATE.current = 0; save_vga_state(dosemu_regs); current_console = i; dosemu_regs = &all_dosemu_regs[current_console]; restore_vga_state(dosemu_regs); SCR_STATE.current = 1; return 0; }