[comp.sys.ibm.pc.misc] interrupt far functions in Microsoft 5.1

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)

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

jvb7u@Virginia.EDU (Jon Brinkmann) (01/24/91)

In article <801@gsg.UUCP> 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.

The software examples in this article are available from SIMTEL in the
file PD1:<MSDOS.MSJOURNAL>MSJV3-5.ARC.

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

archer@stlvm2.iinus1.ibm.com ("Gary D. Archer") (01/26/91)

From: jvb7u@Virginia.EDU (Jon Brinkmann)
Message-ID: <1991Jan23.222037.3970@murdoch.acc.Virginia.EDU>
Date: 23 Jan 91 22:20:37 GMT
References: <801@gsg.UUCP>

<In article <801@gsg.UUCP> 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.
<
<The software examples in this article are available from SIMTEL in the
<file PD1:<MSDOS.MSJOURNAL>MSJV3-5.ARC.

Another good book is:
 Writing DOS Device Drivers in C
  "Phillip M. Adams/ Clovis L. Tondo"
  Prentice Hall, 1990  ISBN 0-13-970864-2

Gary