473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

interrupt service routine using VC++ 2005

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

Aug 14 '06 #1
5 4240
m...@gmx.de wrote:
I need to write a ISR using Microsoft VC++ 2005.
[snip]

Your question is platform-specific and is thus off-topic here (see
http://www.parashift.com/c++-faq-lit....html#faq-5.9). Please
try a Microsoft forum.

Cheers! --M

Aug 14 '06 #2
mysli wrote:
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.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 14 '06 #3
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

Phlip schrieb:
mysli wrote:
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.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 14 '06 #4
mysli wrote:
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. ;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 15 '06 #5
Thanks anyway, I got the solution already.

Phlip schrieb:
mysli wrote:
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. ;-)

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: linesh.gajera | last post by:
Hi Guys, I am creating a Windows service that call a routine at given interval. Once routine is complete, windows service should wait for 5 minutes and then call the routine again. I was using...
0
by: LordHog | last post by:
Hello all, I have a little application that will be used for test environment that utilizes the CAN Messaging. The application will capture and then decode the CAN message that are received. In...
4
by: Groundskeeper | last post by:
I can't seem to get a custom UnhandledException handler working for a Windows Service I'm writing in VB.NET. I've read the MSDN and tried various different placements of the AddHandler call, to no...
2
by: Hartmut | last post by:
Hi guys out there..., I am not shure if this is the right forum for my Question. Have a problem using my own Keyboard interrupt handler. The handler works fine as long as i do not press keys...
7
by: Sunil Varma | last post by:
Hello all, I wrote a Windows Service in VC.NET 2005 I want to debug the solution. I tried as mentioned in the following link. ...
4
by: German Koninin | last post by:
Hi there. I just installed VC++ 2005. I was using VC++ 6 before. So I need to create a Windows Service. I tried to use wizard but code that was generated seems to be a .Net related. In fact I...
2
by: Eirik Midttun | last post by:
I have seen quite a few times that C programs contain a file named isr.c or files named a_isr.c, b_isr.c where a and b are hardware that generate interrupts. Obviously these files contain code to...
1
by: grup.epoo | last post by:
Hello, I am trying to program an specific ISR (interrupt service routine) at IRQ8 in order to get interrupts generated from a pci-device (which i am using its driver on my c++ application). ...
3
by: Russ | last post by:
I have a Web Service that was originally created with .NET VC 2003, and subsequently converted to the 2005 version. It works fine when built as a debug version, and run on the workstation it was...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.