Solved

How to use _dos_setvect

Posted on 2000-03-22
6
1,141 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:zouying
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Expert Comment

by:asrik
ID: 2648169
try using the method
   _dos_setvect(0x5,<functionname>)
0
 
LVL 4

Expert Comment

by:nils pipenbrinck
ID: 2648902
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
 

Author Comment

by:zouying
ID: 2651699
I don't think it is reasonable.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:nisa
ID: 2652275
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
 
LVL 2

Accepted Solution

by:
xLs earned 100 total points
ID: 2655832
*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
 

Expert Comment

by:nisa
ID: 2656643
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question