interrupt type in Turbo C

William J. Murphy murphy at pur-phy
Sat Jul 29 03:53:20 AEST 1989


I am woking on a program to interface with a DataTranslation board
from my Zenith PC 386.  I came across a type of variable which I know
nothing about.  The program was written in Turbo C and TC uses a type
interrupt.  I looked at the manual for TC and found that this is specific
to TC, so my question is how would I implement this in MicroSoft C 5.1?
I have little experience programming interrupts, in fact this is 
my first time in MS-DOS.


/* Function Prototypes */
void interrupt DTintHandler(unsigned bp, unsigned di, unsigned si,
			    unsigned ds, unsigned es, unsigned dx,
			    unsigned cx, unsigned bx, unsigned ax);
void InitInt( int vector, void interrupt (*haddr) ());


void interrupt DTintHandler(unsigned bp, unsigned di, unsigned si,
			    unsigned ds, unsigned es, unsigned dx,
			    unsigned cx, unsigned bx, unsigned ax);
{
	if (( inport(ADSCR) & BIT15) == BIT15)
		aderror = TRUE;
	if(( inport(SUPSCR) & BIT15) == BIT15)
	{
		done = TRUE;
		outport(SUPSCR, BIT13);
	}
	outport(MASTER, EOI);
	outport(SLAVE, EOI);
}	
void InitInt( int vector, void interrupt (*haddr) ());
{
	unsigned regvalue;
	setvect(vector, haddr);
	disable();
	regvalue = inport(MSTRMASKREG);
	outport(MSTRMASKREG, regvalue & 0xFB);
	regvalue = inport(SLVMASKREG);
	outport(SLVMASKREG, regvalue & !IRQ15);
	enable();
}

Well, there are the two functions, I believe the  inport and outport
would be equivalent to MSC's inpw, and outpw.  setvect must be taking the
address which is passed and shoving it into the appropriate interrupt 
register.  inthis case what gets passed is the following
  InitInt(VECTNUM, DTintHandler)
where VECTNUM = 0x77. Lastly I assume that enable() and disable() perform
on the enabling/disabling of interrupts.  

Since I don't own Turbo C, I would rather get this translated to MSC. 
Does anyone have experience with this?  
Please e-mail any ideas (can you really e-mail and idea) or thoughts
on this subject.  I am not a regular reader of comp.lang.c or comp.sys.ibm.pc.
Thanks,
Bill Murphy
murphy at newton.physics.purdue.edu



More information about the Comp.lang.c mailing list