🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6713

Re: Notes about Borland C++ interrupt keyword

#6713
From: Duncan Murdoch
Date: Mon, 20 May 1991 23:09
29 lines
2152 bytes
In article <1991May20.171545.23591@amc.com> jwbirdsa@polaris.amc.com () writes:
>
>   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.

I don't have any of the C flavours, but I'm surprised it's not documented 
there.  In TP, the prologue of an Interrupt procedure is explicitly given;
it says that DS is changed to the ISR's data segment.  If you want the old
DS, you just read the 3rd argument from the end; presumably in BC++ that
would be the 3rd from the beginning.

Duncan Murdoch
dmurdoch@watstat.waterloo.edu
Technical Details
Message-ID: <1991May20.230908.7178@maytag.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!news.cs.indiana.edu!maytag!watstat.waterloo.edu!dmurdoch
References: <1991May20.171545.23591@amc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!news.cs.indiana.edu!maytag!watstat.waterloo.edu!dmurdoch
From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch)
Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.programmer,alt.msdos.programmer
Subject: Re: Notes about Borland C++ interrupt keyword
Message-ID: <1991May20.230908.7178@maytag.waterloo.edu>
Date: 20 May 91 23:09:08 GMT
Article-I.D.: maytag.1991May20.230908.7178
References: <1991May20.171545.23591@amc.com>
Sender: news@maytag.waterloo.edu (News Owner)
Organization: University of Waterloo
Lines: 29