jku@kolvi.hut.fi (Juha Kuusama) (07/19/88)
I need to write a program to serve a hardware interrupt on a PC. I know I could search all the stuff needed and get it together by trial and error, but... Would some kind soul there post me a bare-bones program showing what all is needed to do this? (How to talk to the int controller etc.) I prefer pascal, but I can read almost any language. Thankyou. -- Juha Kuusama, ...mcvax!tut!kolvi!jku
johnson@c10sd1.StPaul.NCR.COM (Wayne D. T. Johnson) (07/26/88)
In article <130@kolvi.hut.fi> jku@kolvi.UUCP (Juha Kuusama) writes: >Would some kind soul there post me a bare-bones program showing what all is >needed to do this? (How to talk to the int controller etc.) I prefer pascal, >but I can read almost any language. > Good Luck. Muck of what you need is only available in assembly language. Not only do you need to do read and writes to the hardware ports (which most languages will do) you have to be able to execute the IRET instruction. If you are still interested, drop a note and I will attempt to explain. By then I should be able to find my 80xxx reference manual. -- Wayne Johnson (Voice) 612-638-7665 NCR Comten, Inc. (E-MAIL) W.Johnson@StPaul.NCR.COM or Roseville MN 55113 johnson@c10sd1.StPaul.NCR.COM These opinions (or spelling) do not necessarily reflect those of NCR Comten.
dixon@control.steinmetz (walt dixon) (07/26/88)
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