martino@logitek.co.uk (Martin O'Nions) (01/21/91)
lorvig@gsg.UUCP (Don Lorvig) writes: > have been using void far interrupt routines for some time now. The >addresses of this routines are passed to a TSR which executes them. >Recently I began attempting to make this functions more complex. (They >merely set flags before). When I attempt function calls from within >these interrupt routines, strange behavior results. Probable causes are assumptions made by the C as to the state of segment registers, or stretching the stack beyond its intended length. I normally use an assembler interrupt handler, and call the compiled C after setting the stack and registers to appropriate values,changing them back afterwards. Mail me if you want details - I may be able to resurect some code if I dig deep enough. Martin -- DISCLAIMER: All My Own Work (Unless stated otherwise) -------------------------------------------------------------------------- Martin O'Nions Logitek Group Support martino@logitek.co.uk -------------------------------------------------------------------------- Down the drinking well / Which the plumber built her Aunt Mathilda fell / - We should buy a filter.... (Harry Graham - Ruthless Rhymes for Heartless Homes)
kaiser@ananke.stgt.sub.org (Andreas Kaiser) (01/22/91)
In a message of <Jan 18 17:19>, Don Lorvig (lorvig@gsg.UUCP ) writes:
DL> have been using void far interrupt routines for some time now. The
DL> addresses of this routines are passed to a TSR which executes them.
DL> Recently I began attempting to make this functions more complex. (They
DL> merely set flags before). When I attempt function calls from within
DL> these interrupt routines, strange behavior results.
I don't know if this is applicable to your problem, but the following is a
common problem with interrupt routines in C (and perhaps the reason for the more
sophisticated interrupt library in Zortech C):
Interrupt functions are called from everywhere, so you cannot assume the stack
segment is the same as the data segment, which is a requirement at least for the
small data models (small, medium). Thus an address within the interrupt
function's stack frame (of a local variable) cannot be addressed via a near
pointer, not even within the interrupt function itself. Should not be a problem
in MSC's large model unless pointers are explicitly qualified as "near", but you
didn't tell the model used.
Andreas
jvb7u@fermi.clas.Virginia.EDU (Jon Brinkmann) (01/24/91)
In article <martino.664466611@krypton> martino@logitek.co.uk (Martin O'Nions) writes: #lorvig@gsg.UUCP (Don Lorvig) writes: #> have been using void far interrupt routines for some time now. The #>addresses of this routines are passed to a TSR which executes them. #>Recently I began attempting to make this functions more complex. (They #>merely set flags before). When I attempt function calls from within #>these interrupt routines, strange behavior results. I've encountered similar problems. Many of the MSC routines will not work when used in a ISR or TSR. A good addition to your MSC manuals is an article on writing TSRs in MSC: Christian, Kaare, "Using MicroSoft C Version 5.1 to Write Terminate-and-Stay-Resident Programs", MicroSoft Systems Journal, September 1988, Volume 3, Number 5, pages 47 - 57. Jon -- Jon Brinkmann Astronomy Department Internet: jvb7u@Virginia.EDU University of Virginia UUCP: ...!uunet!virginia!jvb7u P.O. Box 3818 SPAN/HEPnet: 6654::jvb7u Charlottesville, VA 22903-0818