🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: iret and retf

#5197
From: kevin.laux
Date: Thu, 14 Mar 1991 14:34
27 lines
1693 bytes
In article <1991Mar14.031024.12576@msuinfo.cl.msu.edu>, leeda@frith.egr.msu.edu (Dae Hee Lee) writes:
> 
> When can I use retf instead of iret?
> I was told that retf discards some register in a stack.  Then, why and when can I discard any registers in a stack?
> Thank you for your help!
> 
> Daehee
> 

	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.

	For example, if one is using Int 15h, Function 4Fh, the keyboard
intercept to do character translations, returning with the Carry flag clear
causes Int 9h to ignore the character; returning with the Carry flag set
(the default) make Int 9h continue processing.

-- 
________________________________________________________________________________
	R. Kevin Laux				Email: rkl1@hound.att.com
	AT&T Bell Labs				Voice: (908) 949-1160
	Holmdel, NJ 07733			Fax:   (908) 949-0959
Technical Details
Message-ID: <1991Mar14.143454.18993@cbnewsh.att.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!att!cbnewsh!rkl
References: <1991Mar14.031024.12576@msuinfo.cl.msu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!att!cbnewsh!rkl
From: rkl@cbnewsh.att.com (kevin.laux)
Newsgroups: comp.os.msdos.programmer
Subject: Re: iret and retf
Message-ID: <1991Mar14.143454.18993@cbnewsh.att.com>
Date: 14 Mar 91 14:34:54 GMT
References: <1991Mar14.031024.12576@msuinfo.cl.msu.edu>
Distribution: na
Organization: AT&T Bell Laboratories
Lines: 27