Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!ncar!ames!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C Interrupt Question Message-ID: <1990Oct10.163937.8166@Octopus.COM> Date: 10 Oct 90 16:39:37 GMT References: <32923@nigel.ee.udel.edu> Reply-To: stever@octopus.UUCP (Steve Resnick ) Organization: Octopus Enterprises, Cupertino CA Lines: 32 In article <32923@nigel.ee.udel.edu> shearer@cis.udel.edu (Rob Shearer) writes: > >I have hooked the INT 8 interrupt (IRQ 0, Clock_Tick Interrupt) on my >PC. Normaly I want the routine to happen on a set schedule.. but there >are times that I want the INT 8 routines to occur out of sync and I call >it from another part of my code with a geninterrupt(8); (I take care >of the REAL Clock no matter what...). Can you Gurus inform me how to >detect if the interrupt was hardware or software driven?? It is all >probably in the PIC... but ALL my reference books basically inform me that >there IS such a think as the PIC. > >(Before anyone tells me to hook INT 1C instead.. I NEED INT 8, that is why >I hooked it... and if I can differentiate between a hw and sw interrupt >then life is fantastic!) > According to Joe Campbell in "C Programmer's Guide to Serial Communication" the 8259 PIC has a register which indicates any pending interrupts. To read this input a byte from port 21H, since you want IRQ0 (Timer) test bit 0 to see if it is set. If it is, you have a pending timer interrupt, otherwise the int 8 was called via a software int. I haven't tried this, but it seems pretty straight forward. Hope this helps.... Steve -- ---------------------------------------------------------------------------- steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick Flames, grammar errors, spelling errrors >/dev/nul ----------------------------------------------------------------------------