Message-Id: <199604190924.FAA02932@delorie.com> Date: Fri, 19 Apr 96 12:21:35 LIT From: Martynas Kunigelis Subject: re: keyboard read To: DJGPP mailing list Jan-Pierre Cuvelli wrote: Your problem is: DS does not necessary point to your data segment when the keyboard interrup occurs. You need to add the following code to your handler: .... pushw %ds movw %cs:___djgpp_ds_alias, %ds ..... stuff... popw %ds .... ___djgpp_ds_alias is a locked system variable, so it can be accessed at inetrrupt-time. there's also a variable ___djgpp_app_DS, but it is not locked, plus DJGPP exception handler sometimes invalidates app's DS to raise another exception, while ds_alias remains valid. If you have further problems, you may have a look at the file mkkbd?.zip at v2/tk subdirectory of DJGPP 2 location. It contains my example of keyboard handler for DJGPP2. Kinda out-dated, as well. I prepared a new version a while ago, but forgot to send it to DJ. This reminds me. Hope this helps. Martynas P.S. you can also put the handler data to the .text section next to the handler code and lock one region, including code and data as well. I think the less regions you lock, the better DPMI memory performance you get.