To: djgpp AT sun DOT soe DOT clarkson DOT edu From: SAM AT argonaut DOT demon DOT co DOT uk Organization: Argonaut Ltd. Date: 4 Jun 93 16:03:42 GMT Subject: No DPMI I had a slight problem with 386max - It provides both DPMI & VCPI. Since I have other things that need DPMI, I added 'nodpmi' option to the GO32 env variable. While I was at it, I changed a couple of things that occured to me for exceptions - no stack backtrace on ^C and restore old video mode if it has changed. The only changes were to control.c - *** t:\djgpp\go32\control.c Mon May 31 22:32:14 1993 --- control.c Thu Jun 03 12:31:26 1993 *************** *** 59,63 **** int16 ems_handle=0; /* Get EMS Handle */ word16 vcpi_installed = 0; /* VCPI Installed Flag */ ! char use_DPMI = 0; word32 ARENA = 0x10000000; --- 59,63 ---- int16 ems_handle=0; /* Get EMS Handle */ word16 vcpi_installed = 0; /* VCPI Installed Flag */ ! char use_DPMI = 1; /* Default to use DPMI if available */ word32 ARENA = 0x10000000; *************** *** 302,306 **** fflush(stdout); ! { DPMIinfo info; if (initDPMI(&info)) { --- 302,371 ---- fflush(stdout); ! /* ! * Pick apart GO32 environment variable ! */ ! cp = getenv("GO32"); ! path = 0; ! if (cp) ! while (1) ! { ! char sw[100]; ! char val[100]; ! if (sscanf(cp, "%s%n", sw, &i) < 1) ! break; ! cp += i; ! if (stricmp(sw, "ansi") == 0) ! use_ansi = 1; ! else if (stricmp(sw, "mono") == 0) ! use_mono = 1; ! else if (stricmp(sw, "2r1") == 0) ! redir_2_1 = 1; ! else if (stricmp(sw, "1r2") == 0) ! redir_1_2 = 1; ! else if (stricmp(sw, "2rm") == 0) ! redir_2_mono = 1; ! else if (stricmp(sw, "1rm") == 0) ! redir_1_mono = 1; ! else if (stricmp(sw, "glob") == 0) ! globbing = 1; ! else if (stricmp(sw, "noglob") == 0) ! globbing = 0; ! else if (stricmp(sw, "nodpmi") == 0) ! use_DPMI = 0; ! else ! { ! val[0] = 0; ! sscanf(cp, "%s%n", val, &i); ! cp += i; ! if (val[0] == 0) ! break; ! } ! if (stricmp(sw, "driver") == 0) ! { ! if (path) free(path); ! path = strdup(val); ! } ! else if (stricmp(sw, "tw") == 0) ! gr_def_tw = atoi(val); ! else if (stricmp(sw, "th") == 0) ! gr_def_th = atoi(val); ! else if (stricmp(sw, "gw") == 0) ! gr_def_gw = atoi(val); ! else if (stricmp(sw, "gh") == 0) ! gr_def_gh = atoi(val); ! else if (stricmp(sw, "nc") == 0) ! gr_def_numcolor = atoi(val); ! else if (stricmp(sw, "emu") == 0) ! { ! if (emu_fn) free(emu_fn); ! emu_fn = strdup(val); ! } ! } ! ! /* ! * See if DPMI is available (this can be disabled via nodpmi in ! * GO32 - for things like 386max which provide both) ! */ ! if(use_DPMI) { DPMIinfo info; if (initDPMI(&info)) { *************** *** 310,313 **** --- 375,379 ---- ARENA = 0; } else { + use_DPMI = 0; if (xms_installed()) use_xms = 1; *************** *** 314,317 **** --- 380,384 ---- } } + bump_file_limit(); old_video_mode = peekb(0x40, 0x49); *************** *** 373,431 **** _fmode = O_BINARY; - cp = getenv("GO32"); - path = 0; - if (cp) - while (1) - { - char sw[100]; - char val[100]; - if (sscanf(cp, "%s%n", sw, &i) < 1) - break; - cp += i; - if (stricmp(sw, "ansi") == 0) - use_ansi = 1; - else if (stricmp(sw, "mono") == 0) - use_mono = 1; - else if (stricmp(sw, "2r1") == 0) - redir_2_1 = 1; - else if (stricmp(sw, "1r2") == 0) - redir_1_2 = 1; - else if (stricmp(sw, "2rm") == 0) - redir_2_mono = 1; - else if (stricmp(sw, "1rm") == 0) - redir_1_mono = 1; - else if (stricmp(sw, "glob") == 0) - globbing = 1; - else if (stricmp(sw, "noglob") == 0) - globbing = 0; - else - { - val[0] = 0; - sscanf(cp, "%s%n", val, &i); - cp += i; - if (val[0] == 0) - break; - } - if (stricmp(sw, "driver") == 0) - { - if (path) free(path); - path = strdup(val); - } - else if (stricmp(sw, "tw") == 0) - gr_def_tw = atoi(val); - else if (stricmp(sw, "th") == 0) - gr_def_th = atoi(val); - else if (stricmp(sw, "gw") == 0) - gr_def_gw = atoi(val); - else if (stricmp(sw, "gh") == 0) - gr_def_gh = atoi(val); - else if (stricmp(sw, "nc") == 0) - gr_def_numcolor = atoi(val); - else if (stricmp(sw, "emu") == 0) - { - if (emu_fn) free(emu_fn); - emu_fn = strdup(val); - } - } #if ! DEBUGGER #if ! TOPLINEINFO --- 440,443 ---- *************** *** 630,633 **** --- 642,649 ---- return 0; #else + + /* + * Execute program until exception + */ if(use_DPMI) do { DPMIexecute(); } while (! exception_handler()); *************** *** 634,639 **** else go_til_stop(); if (tss_ptr->tss_irqn == hard_master_lo+1) ! fprintf(stderr, "Ctrl-C Hit! Stopped at address %lx\n", tss_ptr->tss_eip); else { --- 650,665 ---- else go_til_stop(); + + /* + * Report why we stopped (making sure we are in the right mode) + */ + if (peekb(0x40, 0x49) != old_video_mode) + { + _AX = old_video_mode; + geninterrupt(0x10); + } + if (tss_ptr->tss_irqn == hard_master_lo+1) ! fprintf(stderr, "Ctrl-C Hit! Stopped at address 0x%08lx\n", tss_ptr->tss_eip); else { *************** *** 640,649 **** char *en = (tss_ptr->tss_irqn >= EXCEPTION_COUNT) ? 0 : exception_names[tss_ptr->tss_irqn]; if (en == 0) ! fprintf(stderr, "Exception %d (0x%02x) at eip=%lx\n", tss_ptr->tss_irqn, tss_ptr->tss_irqn, tss_ptr- >tss_eip); else ! fprintf(stderr, "%s at eip=%lx\n", en, tss_ptr->tss_eip); } - show_call_frame(); return 1; #endif --- 666,676 ---- char *en = (tss_ptr->tss_irqn >= EXCEPTION_COUNT) ? 0 : exception_names[tss_ptr->tss_irqn]; if (en == 0) ! fprintf(stderr, "Exception %d (0x%02x) at eip=0x%08lx\n", tss_ptr->tss_irqn, tss_ptr->tss_irqn, tss_ptr- >tss_eip); else ! fprintf(stderr, "%s at eip=0x%08lx\n", en, tss_ptr->tss_eip); ! ! show_call_frame(); } return 1; #endif ------------------------------------------ Sam Littlewood sam AT argonaut DOT demon DOT co DOT uk Argonaut Software Ltd. saml AT cix DOT compulink DOT co DOT uk Tel: +44 81 200 5777 Fax: +44 81 200 9866