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 display_dos_init() { __dpmi_regs r; /* Set char-smashed-together mode */ r.x.ax = 0x1201; r.h.bl = 0x30; __dpmi_int(0x10, &r); r.x.ax = 0x0003; __dpmi_int(0x10, &r); /* Pointer to video memory */ videomem = __dpmi_segment_to_descriptor(0xb800); /* Block cursor */ _setcursortype(_SOLIDCURSOR); /* No windows by default */ windows = 0; /* Check for Win95/Win98 */ if (getenv("winbootdir") != NULL) windows = 1; /* Check for WinNT/Win2k */ if ((getenv("OS") != NULL) && !strcmp(getenv("OS"), "Windows_NT")) windows = 2; lshift = rshift = 0; /* Save the old handler */ _go32_dpmi_get_protected_mode_interrupt_vector(KBD_INT, &old_kb_handler); /* Create new handler, chain it to old */ new_kb_handler.pm_offset = (int) kb_isr; new_kb_handler.pm_selector = _go32_my_cs(); _go32_dpmi_chain_protected_mode_interrupt_vector(KBD_INT, &new_kb_handler); /* flush the keystroke buffer just in case */ while (kbhit()) display_dos_getch(); return -1; }