Article View: comp.sys.ibm.pc
Article #42316Re: microsoft c isr question
From: D'Arcy J.M. Cain
Date: Sun, 18 Feb 1990 17:44
Date: Sun, 18 Feb 1990 17:44
44 lines
1614 bytes
1614 bytes
In article <WIENER.90Feb17172147@stout.stout.UCAR.EDU> wiener@stout.UCAR.EDU (Gerry Wiener) writes:
>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 <dos.h>
>#include <stdio.h>
>
>#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);
> [...]
> _dos_setvect(KEYBD, oldkb);
>}
>
>void interrupt far newkb(void)
>{
> count++;
> _chain_intr(oldkb);
>}
This is just an untested guess since I no longer have MSC to try
it on but try declaring count as a far int.
--
D'Arcy J.M. Cain (darcy@druid) | Thank goodness we don't get all
D'Arcy Cain Consulting | the government we pay for.
West Hill, Ontario, Canada |
(416) 281-6094 |
Technical Details
Message-ID:
<1990Feb18.174443.28133@druid.uucp>Path:
arc1-ca.pugleaf.net!utzoo!attcan!telly!druid!darcyReferences:
<WIENER.90Feb17172147@stout.stout.UCAR.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!telly!druid!darcy From: darcy@druid.uucp (D'Arcy J.M. Cain) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: microsoft c isr question Message-ID: <1990Feb18.174443.28133@druid.uucp> Date: 18 Feb 90 17:44:43 GMT References: <WIENER.90Feb17172147@stout.stout.UCAR.EDU> Reply-To: darcy@druid.UUCP (D'Arcy J.M. Cain) Distribution: usa Organization: D'Arcy Cain Consulting, West Hill, Ontario Lines: 44