Tell me please how to in C under DOS make proceeded not only single key pressing but specualy trace situation when a moving cursor key is pressed and beeing hold.
I've tryed it by the interruption but the following program hangs:
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#define INTR 0X09
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
void interrupt far ( *oldhandler)(__CPPARGS);
void interrupt far handler(__CPPARGS)
{
int pcode, updown, keycode;
outportb (0x20,0x20);
pcode = inportb (0x64);
updown = pcode & 0x80; - нажатие, 0x80 - отпускание
keycode = pcode & 0x7F;
/* call the old routine */
oldhandler();
if (updown == 0)
printf ("Key pressed");
else
printf ("Key unpressed");
}
int main(void)
{
/* save the old interrupt vector */
oldhandler = getvect(INTR);
/* install the new interrupt handler */
setvect(INTR, handler);
while (getch()!=27);
setvect(INTR, oldhandler);
}