MCPcopy Create free account
hub / github.com/NetHack/NetHack / vesa_SwitchMode

Function vesa_SwitchMode

sys/msdos/vidvesa.c:1259–1290  ·  view source on GitHub ↗

* 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. * */

Source from the content-addressed store, hash-verified

1257 *
1258 */
1259static void
1260vesa_SwitchMode(unsigned mode)
1261{
1262 __dpmi_regs regs;
1263
1264 if (mode == MODETEXT) {
1265 iflags.grmode = 0;
1266 memset(&regs, 0, sizeof(regs));
1267 regs.x.ax = mode;
1268 (void) __dpmi_int(VIDEO_BIOS, &regs);
1269#ifdef SIMULATE_CURSOR
1270 free(undercursor);
1271 undercursor = NULL;
1272#endif
1273 } else if (mode >= 0x100) {
1274 iflags.grmode = 1;
1275 memset(&regs, 0, sizeof(regs));
1276 regs.x.ax = 0x4F02;
1277 regs.x.bx = mode;
1278 (void) __dpmi_int(VIDEO_BIOS, &regs);
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(&regs, 0, sizeof(regs));
1285 regs.x.ax = MODETEXT;
1286 (void) __dpmi_int(VIDEO_BIOS, &regs);
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

Callers 4

vesa_SetWindowFunction · 0.85
vesa_term_end_screenFunction · 0.85
vesa_InitFunction · 0.85
vesa_FinishFunction · 0.85

Calls 1

impossibleFunction · 0.50

Tested by

no test coverage detected