Path: utzoo!attcan!uunet!steinmetz!control!dixon From: dixon@control.steinmetz (walt dixon) Newsgroups: comp.sys.ibm.pc Subject: Re: How to respond to a hardware interrupt?? Message-ID: <11652@steinmetz.ge.com> Date: 26 Jul 88 13:43:16 GMT References: <130@kolvi.hut.fi> <431@c10sd1.StPaul.NCR.COM> Sender: news@steinmetz.ge.com Reply-To: dixon@control.steinmetz.ge.com (walt dixon) Organization: General Electric CRD, Schenectady, NY Lines: 46 It is possible and frequently very convenient to write drivers and TSRs in high level languages like C. One usually must write some assembly language glue code to make everything work; the amount of assembly language required varies from compiler to compiler. Many of the current compilers support an interrupt key word on a formal procedure definition. Interrupt procedures save all registers, hopefully initialize the stack and data segments properly, and exit with an iret. Lacking this support, you will need to write a short assembly language interface. Other frequently used assembly language instructions often are supported through library calls. Most decent C /Pascal libraries have outb, inb routines. If these routines aren't available, one can easily write them. The same is true for enabling/disabling interrupts. (Some compilers also support imbedded assembly langauge code.) There are some issues with the run time libraries. There are cases where the call overhead is not acceptable or the library structure has undesireable side effects (eg defining a transfer address, setting up a stack, etc). One must approach these libraries with some caution. The other problem with high level languages is that you must beat on the linker to get the correct format for your executable image. Generally, it is not hard to coerce the linker into generating the correct format image. There's a place for both C and assembly language. Certainly well written C code easier to read than assembly language. When you design your application, you have to make some trade-offs. I have written TSRs and drivers in both assembly langauge and C. All of this code works. Walt Dixon {ARPA: Dixon@GE-CRD.ARPA } {US Mail: GE CRD } { PO Box 8 } { Schenectady, NY 12345 } {Phone: 518-387-5798 } Standard disclaimers apply