How to use _dos_setvect

Hello,

I want to install an ISR for interrupt 5, how to write the code using _dos_setvect in Visual C++ 1.5?

In BC++, it needs to add 8 to it, that means, _setvect(0xD), is it the same in VC++?

Thanks
zouying
zouyingAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
xLsConnect With a Mentor Commented:
*GRRINNNN* you guys when are you moving over to win32, where no Interrupts are allowed , whats the use of NE (16bit)executables :)


cheers..

just though i could give you some hints :)
0
 
asrikCommented:
try using the method
   _dos_setvect(0x5,<functionname>)
0
 
nils pipenbrinckCommented:
I haven't ever written code with VC 1.5, but it should be the same as for other dos compilers.

You write, that you want to install a ISR for interrupt 5.. I think you don't mean the interrupt 5 but the Hardware IRQ line 5. That's a different thing.

When the IRQ lines 5 (for example) signal an interrupt not interrupt 5 will be called but interrupt 5+8 (as you already said). That's a little bit strange, and I don't know the reason for it. My guess is, that the first 8 interrupts are reserved for the cpu.

so in summary interrupt 0x0d will be called when IRQ5 is raised.

Nils
0
Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

 
zouyingAuthor Commented:
I don't think it is reasonable.

0
 
nisaCommented:
Hi,
 Yes it is the same concept.. that is you have to add 8 to actual interrupt number .. for example standard IRQ line for keyboard is IRQ 1 but software wise you have to add 8.


Example for int 5:



#define INT13    0x0D //5+8


//the pointer to function that will point to your ISR

void (interrupt far *myIntPtr)(void);


void main()
{
  ..
   myIntPtr = myInt13;
   _dos_setvect( INT13, myIntPtr);

  ..
}


void interrupt far myInt13( void )
{
     .......
}


Hope this helps

Best Regards,

Nisa.


0
 
nisaCommented:
Hi Xls,
Although DOS seems to be obsolete to some applications .. but it remains important to many embedded systems (ie there are some realtime kernel coexist with dos to make it "multitasking capable").


Regards,
Nisa.
0
All Courses

From novice to tech pro — start learning today.