From: "Peter Remmers" Newsgroups: comp.os.msdos.djgpp Subject: Re: strange interrupt chaining problem with keyboard interrupt Date: Mon, 9 Oct 2000 21:48:32 +0200 Organization: T-Online Lines: 45 Message-ID: <8rt7e2$ovq$18$1@news.t-online.com> References: <8rhi12$4up$10$1 AT news DOT t-online DOT com> <9003-Thu05Oct2000231854+0300-eliz AT is DOT elta DOT co DOT il> <8rj5td$l0o$14$1 AT news DOT t-online DOT com> <7458-Fri06Oct2000114142+0300-eliz AT is DOT elta DOT co DOT il> <8rliej$ecd$14$1 AT news DOT t-online DOT com> <2110-Sun08Oct2000073544+0300-eliz AT is DOT elta DOT co DOT il> <8rp9h0$j9f$15$1 AT news DOT t-online DOT com> <2561-Sun08Oct2000122936+0300-eliz AT is DOT elta DOT co DOT il> <8rporf$r6s$15$1 AT news DOT t-online DOT com> <8296-Sun08Oct2000151209+0300-eliz AT is DOT elta DOT co DOT il> <8rs7uo$e7k$18$1 AT news DOT t-online DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.t-online.com 971120899 18 25594 320094726121-0001 001009 19:48:19 X-Complaints-To: abuse AT t-online DOT de X-Sender: 320094726121-0001 AT t-dialin DOT net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I wrote: > I think I should dump the registers before and after the lcall. Done it, same registers before and after. Latest findings: I disassembled keyb.com and got some very interesting insights. Num-lock, scroll-lock and caps-lock are special in that they cause keyb to change the LEDs on the keyboard. This means keyb has to send commands to the keyboard which make the keyboard cause an interrupt to announce that its ACK (0xFA) is ready to be picked up. Keyb.com's interrupt handler sets up it own stack (512 bytes) and points DS to the BIOS data segment on entry. It also has a reentrance counter. If the reentrace counter is greater than zero it does NOT set up the stack again! And that's the problem: it expects an ACK from the keyboard, and it expects to be reentered by the ACK interrupt, and that means it expects SS and DS to have certain values when the interrupt occurs. Now, if I hook the keyboard interrupt and set up DJGPP's execution environment I (or the wrapper) overwrite keyb's SS and DS registers, which is fatal in the case of the keyboard's ACK interrupt - or any other case of reentry, for that matter. In which way the shift keys are special, I don't know. But KEYB for whatever reason treats them special, too, because they also cause the keyboard to send an ACK, which ends like explained above. Solutions: - Make the *wrapper* call the next ISR after restoring DS and SS. This is only possible with _go32_dpmi_chain_p_m_i_v(), or by writing your own wrapper in assembly. - install a real-mode callback for INT 0x15, which provides a way to eat scancodes, to change them or leave them alone. Peter