Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!valley From: valley@uchicago (Doug Dougherty) Newsgroups: comp.os.msdos.programmer Subject: Re: iret and retf Message-ID: Date: 14 Mar 91 18:54:00 GMT References: <1991Mar14.031024.12576@msuinfo.cl.msu.edu> <1991Mar14.143454.18993@cbnewsh.att.com> Sender: news@midway.uchicago.edu (News Administrator) Distribution: na Organization: University of Chicago Lines: 16 rkl@cbnewsh.att.com (kevin.laux) writes: > RETF is used when interrupt handlers want to return one of the Flags >bits. The INT instruction pushes the Flags onto the current stack, then CS, >then IP. When the interrupt handler uses the flags bits to return success, >failure or whatever, it cannot use an IRET as this will end up popping the >old flags off the stack destroying the bits that were purposely set up. >The RETF 0002h instruction will pop CS:IP off the stack and then will discard >two bytes. I think you are wrong. (Purely conjecture, since I haven't debugged the code, of course). I think routines that return information in the flags (such as, e.g., almost all of the INT 21 routines) do it by manipulating the word on the stack itself (at, I believe, [SP+4]), so that the final IRET returns a diferent flags value than the one originally pushed by the INT instruction.