Xref: utzoo comp.os.msdos.programmer:5246 alt.msdos.programmer:2720 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!mips!apple!portal!cup.portal.com!ekalenda From: ekalenda@cup.portal.com (Edward John Kalenda) Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer Subject: Re: Notes about Borland C++ interrupt keyword Message-ID: <42564@cup.portal.com> Date: 21 May 91 19:31:16 GMT References: <1991May20.171545.23591@amc.com> Organization: The Portal System (TM) Lines: 21 >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 is also the behaviour under Microsoft C. You can have access to all the registers pushed if you declare them as shorts in the formal parameter list of the function. The return address and flags are also available this way. I had to look at the code generated to see the order they push things so it is a bit version dependant but it worked for one project I did. Ed ekalenda@cup.portal.com