interrupt service routine using VC++ 2005

M

mysli

Hi all,

I need to write a ISR using Microsoft VC++ 2005. The proplem is I did
not found any hint on how to do it. I can register any function as a
ISR and it will be called by the hardware interrupt, interrupt 8
(timer) i.e., works fine in my little example progam. But the problem
is the compiler ends every function with RETN, after disassembling the
result of the compilation this can be seen easiely.
Every function starts and ends with:

push ebp //function entry
mov ebp,esp
....
pop ebp
retn //function exit

That's pretty fine for regular functions but as an interrupt handler
the function first of all should save all used registers, EAX is not
save by VC++ since its holding the return value, but ISR doesn't have
any return value. And second it needs to end with a IRETD !!!

Does anyone of you know how to solve this problem, maybe it points out
the VC++ is not the appropiated tool for my project. BTW, I do use VC++
only as editor and compiler, I do not program for windows, I just
generate code which can be executed in protected mode.

Many thanks,
Daniel
 
P

Phlip

mysli said:
push ebp //function entry
mov ebp,esp

That ... doesn't look like C++.

You will get the best results on a forum that discusses programming the
Win32 kernel. This newsgroup is only qualified to take a stab at C++. If
someone took a stab at your question, there aren't enough other regulars
here who could review their answer.
 
M

mysli

As I mentioned in my last sentence, I'm not programming for Windows
therefore anything regarding WinAPI / Win32 Kernel won't help my
either. But I agree my question is maybe to specific to the Microsoft
Compiler although I'm not using it to compile windows programs but own
developped protected mode programs.

But thanks for letting my know that I'm wrong here.
Daniel
 
P

Phlip

mysli said:
As I mentioned in my last sentence, I'm not programming for Windows
therefore anything regarding WinAPI / Win32 Kernel won't help my
either.

"I do not program for windows, I just generate code which can be executed in
protected mode."

Microsoft named their OS after their windows, and "protected mode" implies
.... kernelly things. So your last sentence was insufficient to distinguish
the exact group you should target!

Further, wedging interrupt service routines went out of style with MS-DOS,
so you really ought to find a more modern way to do what you need.

One worse way would be to get a compiler that can target 16-bit programs
that run in the "DOS Box" emulation environment. Two that come to mind are
http://www.delorie.com/djgpp/ and its 16-bit tools, and MS's old free
version of Visual C++ 1.5 or similar. Then you can wedge all the interrupts
you like, and the emulator will let you think the CPU actually gives a s--t
what you are interrupting. ;-)
 
M

mysli

Thanks anyway, I got the solution already.
"I do not program for windows, I just generate code which can be executed in
protected mode."

Microsoft named their OS after their windows, and "protected mode" implies
... kernelly things. So your last sentence was insufficient to distinguish
the exact group you should target!

Further, wedging interrupt service routines went out of style with MS-DOS,
so you really ought to find a more modern way to do what you need.

One worse way would be to get a compiler that can target 16-bit programs
that run in the "DOS Box" emulation environment. Two that come to mind are
http://www.delorie.com/djgpp/ and its 16-bit tools, and MS's old free
version of Visual C++ 1.5 or similar. Then you can wedge all the interrupts
you like, and the emulator will let you think the CPU actually gives a s--t
what you are interrupting. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top