Mail Archives: djgpp/2002/05/23/13:30:47
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 -