* Switches modes of the video card. * * If mode == MODETEXT (0x03), then the card is placed into text * mode. Otherwise, the card is placed in the mode selected by * vesa_detect. * */
| 1257 | * |
| 1258 | */ |
| 1259 | static void |
| 1260 | vesa_SwitchMode(unsigned mode) |
| 1261 | { |
| 1262 | __dpmi_regs regs; |
| 1263 | |
| 1264 | if (mode == MODETEXT) { |
| 1265 | iflags.grmode = 0; |
| 1266 | memset(®s, 0, sizeof(regs)); |
| 1267 | regs.x.ax = mode; |
| 1268 | (void) __dpmi_int(VIDEO_BIOS, ®s); |
| 1269 | #ifdef SIMULATE_CURSOR |
| 1270 | free(undercursor); |
| 1271 | undercursor = NULL; |
| 1272 | #endif |
| 1273 | } else if (mode >= 0x100) { |
| 1274 | iflags.grmode = 1; |
| 1275 | memset(®s, 0, sizeof(regs)); |
| 1276 | regs.x.ax = 0x4F02; |
| 1277 | regs.x.bx = mode; |
| 1278 | (void) __dpmi_int(VIDEO_BIOS, ®s); |
| 1279 | /* Record that the window position is unknown */ |
| 1280 | vesa_win_pos[0] = 0xFFFFFFFF; |
| 1281 | vesa_win_pos[1] = 0xFFFFFFFF; |
| 1282 | } else { |
| 1283 | iflags.grmode = 0; /* force text mode for error msg */ |
| 1284 | memset(®s, 0, sizeof(regs)); |
| 1285 | regs.x.ax = MODETEXT; |
| 1286 | (void) __dpmi_int(VIDEO_BIOS, ®s); |
| 1287 | g_attribute = attrib_text_normal; |
| 1288 | impossible("vesa_SwitchMode: Bad video mode requested 0x%X", mode); |
| 1289 | } |
| 1290 | } |
| 1291 | |
| 1292 | /* |
| 1293 | * This allows grouping of several tasks to be done when |
no test coverage detected