Xref: utzoo comp.sys.ibm.pc:44693 comp.lang.c:26036 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!handies.UCAR.EDU!wiener From: wiener@stout.UCAR.EDU (Gerry Wiener) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: microsoft c isr question Message-ID: Date: 18 Feb 90 00:21:47 GMT Sender: news@ncar.ucar.edu Distribution: usa Organization: NCAR Lines: 41 In the following code an interrupt handler for the keyboard is replaced by one that increments a counter then chains to the original handler. Question: Why doesn't "count" get incremented correctly? Please mail me the replies. Gerry Wiener Email:wiener@stout.ucar.edu ------------------------------------------------------------------------ #include #include #define KEYBD 0x16 void (interrupt far *oldkb)(void); void interrupt far newkb(void); int count; main() { int c; oldkb = _dos_getvect(KEYBD); _dos_setvect(KEYBD, newkb); count = 0; while ((c = getchar()) != 'x') { printf("count is %d\n", count); putchar(c); } _dos_setvect(KEYBD, oldkb); } void interrupt far newkb(void) { count++; _chain_intr(oldkb); }