delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/05/30/14:51:07

Date: Tue, 30 May 1995 13:44:29 -0500
To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: cburke AT mitre DOT org (Carl D. Burke)
Subject: Re: Keyboard interrupt handler brokenness

>  If I uncommend the real mode handler calls in main(), the beeping
>doesn't happen, but if you type fast enough, the program will issue
>the message 'Unsupported INT 0xd' followed a keypress or two later
>by a segmentation fault.
>
[snip]
>static void install_rm_interrupt()
>{
>    int                         ret;
>
>    rm_si.pm_offset = (int)key_intr;

You must set the pm_selector to go32_my_cs(); otherwise you might not
have the correct overall address.  I don't know why it's required; it's
left out of the docs; but if you don't set both the offset and the
selector, performance is unreliable.  [I think this is the right
call, but I don't have my dual rm/pm keyboard handler code handy right
now so you should check the dpmi functions reference.]

>    ret = _go32_dpmi_allocate_real_mode_callback_iret(&rm_si, &rm_regs);
>    if (ret != 0) {
>        printf("cannot allocate real mode callback, error=%04x\n", ret);
>        exit(1);
>    }
>
[snip]

Also, if you don't have a real-mode keyboard handler it's quite likely that
some keypresses will get caught in real mode and miss your handlers completely.
At least that's my experience; typically I lost about 50% of them.

--

Carl Burke


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019