To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: switching into dpmi Date: Tue, 6 Sep 1994 10:54:43 PDT From: "Marty Leisner" I wrote a simple program to switch into dpmi protected mode... (I need to understand how go32 works). int dpmi_init(void) { unsigned hostdata_seg, hostdata_para, dpmi_flags; REGS regs; int flags; regs.AX = 0x1687; intr_2f(®s); if(regs.AX != 0) { printf("can't go into protected mode\n"); return; } printf("Bx = %x\n", regs.BX); flags = regs.BX; printf("Cl = %x\n", regs.CX & 0xff); printf("DX = %x\n", regs.DX); printf("Num paragraphs = %x\n", regs.SI); printf("CS = %x, DS = %x\n", get_my_cs(), get_my_ds()); printf("dpmi pm interface at %x:%x\n", regs.ES, regs.DI); hostdata_seg = malloc_dos_memory(regs.SI); if(!hostdata_seg) { printf("Cannot malloc dos memory\n"); exit(); } flags &= ~1; /* clear 32 bit flag */ if(!dpmi_protected_mode(regs.DI, regs.ES, flags, hostdata_seg )) { printf("No dpmi\n"); return; } #asm mov ax,04c01h int 21h #endasm ; go into dpmi protect mode (entry point is passed in entry_point (offset, segme) procdef dpmi_protected_mode,<,, > mov ax,hostseg mov es,ax mov ax,switch_flags call [entry_point] jc no_dpmi mov ax,1 ; it works if I do an exit directly here push 11h extrn _dos_exit_:near call _dos_exit_ pret no_dpmi: mov ax,0 pret Everything appear to make sense -- however, the only think I can do after I call the dpmi entry point which works is an int 21/0x4c... (the status code is there). 1) I can't call another function (I tried to call _dos_exit and this is giving me a protection fault 2) I can't return and do an exit (this gives me a protection fault...) Help!!! ????? marty Member of the League of Programming Freedom leisner AT sdsp DOT mc DOT xerox DOT com leisner AT eso DOT mc DOT xerox DOT com