www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/23/13:30:47

Message-ID: <271DBBEEA095D511B80D009027DE7D67DAC0D2@mcoexc01.mlm.maxtor.com>
From: "Dykstra, Sean" <Sean_Dykstra AT maxtor DOT com>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: RE: PC DOS lockup - DPMI?
Date: Thu, 23 May 2002 11:31:47 -0600
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Reply-To: djgpp AT delorie DOT com

Ok, I have it nailed down a little more of the PC DOS int24 problem...

First, I tried 16-bit critical error handler code per Gautier's suggestion -
The 16-bit code works.

Second, I disabled my critical error handler per Sandmann's suggestion - it
also works, so the problem is definitely in my code.  I have now narrowed it
down to my keyboard handler code in the critical error handler.  I have
attached the code that is causing the problem in the hopes that someone may
have alternative keyboard handler code.  This code works perfectly in
MS-DOS, just not PC-DOS.  (I have an alternate set of code that works in
Windows as well - it too had to deal with the keyboard differently than
MS-DOS).

Our entire app is locked into memory using:

//This locks the whole app into memory
int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY |
_CRT0_FLAG_DISALLOW_RESPONSE_FILES;

so we are able to write this ISR in C and the code that is causing me
problems is below:

#define CRITIGNORE          0x00
#define CRITRETRY           0x01
#define CRITABORT           0x02
#define CRITFAIL            0x03

#define AKEY  30
#define RKEY  19
#define FKEY  33
#define IKEY  23

      while (0==ch)
         {
         unsigned char control_kbd;
      
         ch = inportb (0x60);

         control_kbd = inportb (0x61);
         outportb (0x61, control_kbd | 0x80);
         outportb (0x61, control_kbd);
         outportb (0x20, inportb (0x20));
      
         if ( (ch!=AKEY) && (ch!=RKEY) && (ch!=IKEY) && (ch!=FKEY) )
            {
            ch=0;
            }
         }

      switch (ch)
         {
         case AKEY: //'a'
            pclMsgWin->iPrintf (M_WINDOW,"a");
            _al = CRITFAIL;
            break;
         case RKEY: //'r'
            pclMsgWin->iPrintf (M_WINDOW,"r");
            _al = CRITRETRY;
            break;
         case FKEY: //'f'
            pclMsgWin->iPrintf (M_WINDOW,"f");
            _al = CRITFAIL;
            break;
         case IKEY: //'i'
            pclMsgWin->iPrintf (M_WINDOW,"i");
            _al = CRITIGNORE;
            break;
         }
      }
   pclMsgWin->iPrintf (M_WINDOW,"\n");

   r->h.al = _al;

If I comment out the keyboard input and change the last line to 

   r->h.al = CRITRETRY;  OR r->h.al = CRITFAIL;

The code works as expected.

Any thoughts on alternative keyboard handling within INT24h???

- Raw text -


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