home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:12293 rec.games.programmer:3403
- Path: sparky!uunet!olivea!bu.edu!wang!smayo
- From: smayo@wang.com (Scott Mayo)
- Newsgroups: comp.lang.c,rec.games.programmer
- Subject: Need help with Microsoft C calling sequence & interrupts
- Message-ID: <bsxs77.67g@wang.com>
- Date: 13 Aug 92 19:16:18 GMT
- Sender: news@wang.com
- Organization: Wang Labs, Lowell MA, USA
- Lines: 32
-
- Please mail responses (to smayo@wang.com). This question goes to folk
- who are familiar with Large model C as done by the Microsoft Compiler,
- and with DOS and PC interrupts. Apologies, if this is not exactly the
- right newsgroup.
-
- I am using the C runtime _dos_getvect() and _dos_setvect() calls to
- snag an interrupt on the PC, and provide my own handler (0x9, the keyboard,
- if you are curious, but the question applies to any interrupt). As far
- as I know, you can't code inline assembly in Microsoft's C, and I'm
- not an ASM programmer anyway. I can hook the interrupt easily
- enough. _setvect works just fine.
-
- At the end of my interrupt handler, though, I need to pass control to
- the previous handler of the interrupt - which is BIOS in this case. I
- have the address to jump to, courtesy of my call to _getvect. I just don't
- seem to have any way to *get* there. If I *call* through the pointer,
- I seem, not too suprisingly, to end up with an eventual stack overflow. But I
- have no way to JMP there, which is probably what this situation calls for.
-
- If I wedge the address into the right place on the stack, and just let
- my interrupt routine pick up the address as it returns, will it work?
- (I have my doubts - I imagine my interrupt routine ends with an IRET).
-
- Is there some evil trickery I can do with longjmp() to get to the right
- place? (Again, I have doubts).
-
- Is there a sane way to do this, or do I simply have to use ASM to do this
- right? Thanks for any information - please mail responses.
- --
- The moment you step into the world of facts, you step into a world of
- limits. GKChesterton
- smayo@wang.com
-