Article View: comp.os.msdos.programmer
Article #6711Notes about Borland C++ interrupt keyword
From: James Birdsall
Date: Mon, 20 May 1991 17:15
Date: Mon, 20 May 1991 17:15
25 lines
1838 bytes
1838 bytes
Anyone writing interrupt handlers using TC++'s "interrupt" keyword
should be aware that DS is not preserved into the function. DS is preserved
through the function; the value of DS after the interrupt is the same as
before. However, the value of DS while the function is executing is not the
same as the value when it was called. The entry code pushes all the
registers on the stack and then reloads DS with the value for the program's
near data segment.
This doesn't matter for most interrupt handlers, but if you're trying to
revector an interrupt that uses DS as a parameter (for example, the DOS
interrupt (0x21)), then it becomes a major obstacle.
This behavior has been observed with Borland C++ 2.0. Presumably it is
the same with TC++ 1.0, and probably plain TC. It is not mentioned as such
in the documentation, although if you read it carefully it is implied.
Anyway, having spent an hour or two tracing the errors caused by this
behavior, I thought it worth posting a public notice to save other people
the trouble.
--
James W. Birdsall WORK: jwbirdsa@amc.com {uunet,uw-coco}!amc-gw!jwbirdsa
HOME: {uunet,uw-coco}!amc-gw!picarefy!jwbirdsa OTHER: 71261.1731@compuserve.com
================== Kitten: a small homicidal muffin on legs. ==================
=========== "For it is the doom of men that they forget." -- Merlin ===========
Technical Details
Message-ID:
<1991May20.171545.23591@amc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!ogicse!milton!sumax!amc-gw!jwbirdsaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!ogicse!milton!sumax!amc-gw!jwbirdsa From: jwbirdsa@amc.com (James Birdsall) Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,alt.msdos.programmer Subject: Notes about Borland C++ interrupt keyword Message-ID: <1991May20.171545.23591@amc.com> Date: 20 May 91 17:15:45 GMT Reply-To: jwbirdsa@polaris.amc.com () Organization: Applied Microsystems, Redmond, WA Lines: 25