Newsgroups: comp.os.msdos.djgpp From: Andy Eder Subject: Keyboard Handlers Content-Type: TEXT/PLAIN; charset=US-ASCII Message-ID: Sender: news AT doc DOT ntu DOT ac DOT uk Organization: The Nottingham Trent University, DOC. Mime-Version: 1.0 Date: Tue, 22 Apr 1997 08:47:46 GMT Lines: 64 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Can somebody please help ? I am attempting to implement my own keyboard handler and I cannot get it to work. My system either crashes or locks up. As this is my first attempt at such things, I don't know where I am going wrong. If you can help me out, or suggest some links that might help, please do. My code is outlined below... .. .. void OldKeyISR(); // For old handler void NewKeyISR(); // For new handler _go32_dpmi_seginfo Old_Handler,New_Handler; int Key; .. .. void NewKeyISR() { asm(" sti inb $0x60,%%al xorb %%ah,%%ah movw %%ax,_Key inb $0x61,%%al orb $0x82,%%al outb %%al,$0x61 andb $0x7f,%%al outb %%al,$0x61 movb $0x20,%%al outb %%al,$0x20" : // no output registers : // no input registers : "%eax" ); // KEYPRESS PROCESSED HERE } void InstallKeyboard() { New_Handler.pm_offset = (long unsigned int)NewKeyISR; New_Handler.pm_selector = _go32_my_cs(); _go32_dpmi_allocate_iret_wrapper(&New_Handler); _go32_dpmi_get_protected_mode_interrupt_vector(0x09,&Old_Handler); _go32_dpmi_set_protected_mode_interrupt_vector(0x09,&New_Handler); } void RemoveKeyboard() { _go32_dpmi_set_protected_mode_interrupt_vector(0x09,&Old_Handler); } Any suggestions ??? Thanks, Andy Andy - cc505870 AT ntu DOT ac DOT uk