Hi,
I have a serial communication program which was developed under DOS. This program installs a new 0x0C hardware interrupt handler to read from serial port COM1. Under DOS and Windows NT/XP/2000, it works very well. But when I run it under the DOS-box in Windows 98/Me, it cannot get anything from COM port. I traced the program and found that the new interrupt handler was invoked once and then will never be activated. I know it is due to the V86 mode. Could some one tell me how to code a new hardware interrupt handler for a DOS programme running in V86 mode.
BTW, I tried to install other software interrupt handler, such as 0x1C, it works OK in all the Windows OS.
Here is a simple example with BC 3.1. Actually, my interrupt handler is written with Assembler.
Could somebody give me a solution about it? Thanks
===============================================
#include
#include
#include
#define INTR 0X0C /* The COM1 interrupt */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
void interrupt ( *oldhandler)(__CPPARGS);
void interrupt ( *oldhandler1)(__CPPARGS);
int count=0;
void interrupt handler(__CPPARGS)
{
/* increase the global counter */
count++;
/* call the old routine */
oldhandler();
}
int main(void)
{
/* save the old interrupt vector */
oldhandler = getvect(INTR);
/* install the new interrupt handler */
setvect(INTR, handler);
oldhandler1 = getvect(INTR);
/* loop until the counter exceeds 20 */
while (count < 20 && !kbhit ())
printf("count is %d
",count);
/* reset the old interrupt handler */
setvect(INTR, oldhandler);
return 0;
}
I have a serial communication program which was developed under DOS. This program installs a new 0x0C hardware interrupt handler to read from serial port COM1. Under DOS and Windows NT/XP/2000, it works very well. But when I run it under the DOS-box in Windows 98/Me, it cannot get anything from COM port. I traced the program and found that the new interrupt handler was invoked once and then will never be activated. I know it is due to the V86 mode. Could some one tell me how to code a new hardware interrupt handler for a DOS programme running in V86 mode.
BTW, I tried to install other software interrupt handler, such as 0x1C, it works OK in all the Windows OS.
Here is a simple example with BC 3.1. Actually, my interrupt handler is written with Assembler.
Could somebody give me a solution about it? Thanks
===============================================
#include
#include
#include
#define INTR 0X0C /* The COM1 interrupt */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
void interrupt ( *oldhandler)(__CPPARGS);
void interrupt ( *oldhandler1)(__CPPARGS);
int count=0;
void interrupt handler(__CPPARGS)
{
/* increase the global counter */
count++;
/* call the old routine */
oldhandler();
}
int main(void)
{
/* save the old interrupt vector */
oldhandler = getvect(INTR);
/* install the new interrupt handler */
setvect(INTR, handler);
oldhandler1 = getvect(INTR);
/* loop until the counter exceeds 20 */
while (count < 20 && !kbhit ())
printf("count is %d
",count);
/* reset the old interrupt handler */
setvect(INTR, oldhandler);
return 0;
}