Hi Victor,
You asked:
VK>Hi, can someone please tell me what exactly happens when
VK>you declare a function as 'interrupt'. If it's compiler
VK>specific then I'm using Turbo C++ v3.0. (I figure that it
VK>will behave the same way in c as c++ though).
I'll try. It's generally similar across all compilers that provide
interrupt support, and is not the same in C as C++.
VK>It appears that it is disabling all(at least some unrelated) hardware
VK>interrupts while in the function, is this true? I don't
VK>seem to be getting any even if I give it an STI
VK>instruction. I would really like to be able to wait for an
VK>interrupt to occur from within the interrupt function, but
VK>waiting for it just makes it sit there forever.
A function declared as "interrupt" is designed to be hooked to a
specific machine interrupt, and is called whenever the interrupt is
activated. Because of this it cannot sensibly re-enable interrupts until
it completes as the IBM PC interrupt control hardware cannot
conveniently support use this way.
Look at getvect() and setvect() to see how to install the interrupt
handler (it does include at simple example of an interrpt function).
You emphatically do not call an "interrupt" function and wait for the
interrupt to occur, rather the "interrupt" function should do the
necessary work to process the interrupt and return as quickly as
possible, and store any data retrieved in a buffer for the rest of the
program to access outside interrupt time.
George
* SLMR 2.1a * All Trademarks acknowledged (just in case ).
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
|