From: "Anthony.Appleyard" Organization: Materials Science Centre To: DJGPP AT delorie DOT com Date: Tue, 23 Dec 1997 09:15:14 GMT Subject: What do cwsdpmi.exe & djgpp v2 programs do to interrupt 9? Reply-to: Anthony DOT Appleyard AT umist DOT ac DOT uk Message-ID: <60E7074F3A@fs2.mt.umist.ac.uk> Precedence: bulk Please reply to me in person, as I had to unsubscribe from djgpp due to email intray overload: I will be away from my email over Xmas and New Year. My Gnu C++ program SPATRL.CC reads the keyboard events directly rather than via the usual keyboard handler. To do this I usually use the djgpp functions _go32_dpmi_get_protected_mode_interrupt_vector(9,&old_I9handler); _go32_dpmi_chain_protected_mode_interrupt_vector(9,&new_I9handler); _go32_dpmi_set_protected_mode_interrupt_vector(9,&old_I9handler); I use (a) a 486 desktop with a normal keyboard, and (b) a Pentium laptop. Both run DOS 6.22 and Windows for Workgroups. I usually run under DOS. The laptop simulates its missing keys by combinations of its Fn key; doing this presumably needs extra matter in its DOS or BIOS. I hereinafter call this extra matter `Package Z' (I don't know its proper name). SPATRL.EXE on my desktop using the djgpp routines runs and terminates OK. SPATRL.EXE on my laptop using the djgpp routines runs OK, but sometimes after it exits it gives me a DOS prompt as expected but then half a screenful about `TSR error' and a load of numbers, as if the djgpp routines clashed with the abovementioned Package Z. So recently I wrote an Assembler program AAKEYS.COM which drops a TSR which hooks (a) interrupt 9 so it also saves the key events in a buffer, and (b) interrupt 0x16 so that also AX=0x0600 reads a key event from that buffer, and AX=0x0602 leaves that TSR resident but restores int9 and int16's vector addresses to as they were just before AAKEYS.COM was called. SPATRL.EXE on my desktop and on my laptop using my TSR run and terminate OK, if I remembered to call AAKEYS.COM from the DOS prompt first. But how to do that e.g. from in Windows? So I wrote a version of SPATRL.CC which:- - calls AAKEYS.COM using spawnl(). - then runs OK. - then calls `AX=0x0602, int16' abovementioned to restore the vector addresses of int9 and int16 to as they were before AAKEYS.COM was called. - then after that in the signing-off matter still seems to read the keyboard OK using the ordinary keyboard reader. - but on exit back to DOS does not give a DOS prompt amd either refuses to obey instructions or refuses to display on screen, but it obeys ctrl-alt-del - as if that last method clashes with something that djgpp does to interrupts 9 and/or 16. Please: what exactly do (cwsdpmi.exe and programs compiled with djgpp v2) do to the interrupts?