🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: stealing an interrupt

#3991
From: Doug Dougherty
Date: Wed, 19 Dec 1990 20:11
48 lines
2561 bytes
stever@Octopus.COM (Steve Resnick ) writes:

>>>[some stuff deleted]
>>>>        mov     word ptr [old_int+2],es         ; Save old vector
>>>>        mov     word ptr [old_int],bx
>>
>>>Here, there is a rather unsafe assumption that ds points to the code segment
>>>after DOS has been called. You should better set ds explicitly to code (e.g.
>>>by push cs, pop ds) or use an segment prefix for cs. However, it is correct
>>>in this place that ds points to code, it is just unsafe.
>>
>>Oh, come on.  You can surely assume two things:
>>
>>	1) DS = CS on entry to a COM program
>>	2) No DOS call is gonna change DS (unless explicitly stated in
>>	the documentation; I can't imagine that any do as of this
>>	writing)

>Oh come on. I can surely assume one of two things: 

>	1) You do not understand interrupts.	(I do too)
>	2) You didn't read what the message said.	(I did too)(

>This code is for an interrupt handler. In an interrupt handler the ONLY
>segment address that is known upon entry is the CS register. 
>Sorry for the flame, but, please read the posters question(s) before 
>responding to them incorrectly. 

>Steve


Yes, this is turning into a flame war and should probably be moved to
talk.msdos (or some such)

Nevertheless, I am well aware of the need for a CS: override in the
interrupt handler itself (unless & until you set DS = CS)

I have written several TSRs and several device drivers, so I ain't no newbie.

However, you seemed to be saying that you thought it was a good idea to
(repetitively) set DS to CS *IN THE MAIN "BOOSTER"* (i.e., non-resident)
part of the program.  In fact, the two lines of code quoted above follow
immediately a INT 21, fn 35 call, which sets ES:BX equal to the current
interrupt value.  Surely that call is going to leave DS alone.
(It would be unwise [because of re-entrancy considerations], not to
mention pointless, to call INT 21, fn 35 inside the resident part of the TSR)

Gottit?  Good.
Technical Details
Message-ID: <valley.661637487@gsbsun>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!wuarchive!zaphod.mps.ohio-state.edu!ncar!midway!valley
References: <90351.150210TOMIII@MTUS5.BITNET> <18633@neptune.inf.ethz.ch> <valley.661550344@gsbsun> <1990Dec19.173515.14237@Octopus.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!wuarchive!zaphod.mps.ohio-state.edu!ncar!midway!valley
From: valley@uchicago (Doug Dougherty)
Newsgroups: comp.os.msdos.programmer
Subject: Re: stealing an interrupt
Message-ID: <valley.661637487@gsbsun>
Date: 19 Dec 90 20:11:27 GMT
References: <90351.150210TOMIII@MTUS5.BITNET> <18633@neptune.inf.ethz.ch> <valley.661550344@gsbsun> <1990Dec19.173515.14237@Octopus.COM>
Sender: news@midway.uchicago.edu (News Administrator)
Organization: University of Chicago
Lines: 48