Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!ames!vsi1!octopus!stever From: stever@Octopus.COM (Steve Resnick ) Newsgroups: comp.os.msdos.programmer Subject: Re: stealing an interrupt Message-ID: <1990Dec19.173515.14237@Octopus.COM> Date: 19 Dec 90 17:35:15 GMT References: <90351.150210TOMIII@MTUS5.BITNET> <18633@neptune.inf.ethz.ch> Reply-To: stever@octopus.UUCP (Steve Resnick ) Organization: Octopus Enterprises, Cupertino CA Lines: 48 In article valley@uchicago (Doug Dougherty) writes: >brandis@inf.ethz.ch (Marc Brandis) writes: > >>In article <90351.150210TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes: >>>Hi there. Would some kind soul please tell me why my machine hangs when >>>I run this TSR? What am I doing wrong? > >>[some stuff deleted] >>> assume cs:code,ds:code,es:code >>.... >>> 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) > >Yes, it is a good idea to be a little paranoid (maybe a lot paranoid) >when doing assembly language programming, but you are taking it too far. > >But then again, you probably code in MASM or TASM or something like >that, so it figures you'd be a little paranoid about segment registers... Oh come on. I can surely assume one of two things: 1) You do not understand interrupts. 2) You didn't read what the message said. 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 -- ---------------------------------------------------------------------------- steve.resnick@f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick Flames, grammar errors, spelling errrors >/dev/nul The Asylum OS/2 BBS - (408)263-8017 IFNA 1:143/105.0