Article View: comp.lang.asm.x86
Article #83Re: Relative jump out of range (ignore the last post)
From: John S. Fine
Date: Mon, 09 Aug 1999 00:00
Date: Mon, 09 Aug 1999 00:00
44 lines
2417 bytes
2417 bytes
assassin17@rocketmail.com wrote: > i'm trying to figure out how TASM determines whether a JMP is out > of range.. I never tested, but I think I understand the 386 manual and I expect that it is correct: A SMALL NEAR JMP does not sign extend to 32 bits. It adds the 16-bit offset to IP and clears the high half of EIP. That means you can SMALL NEAR JMP from anywhere to any address within the first 64Kb of the segment and you cannot ever SMALL NEAR JMP to any address outside the first 64Kb. > .386 > CODE SEGMENT USE32 'CODE' > ASSUME CS:CODE > lab: > jmp SMALL NEAR PTR krad > db 0FFFFh dup (0) > db 0 > krad: > jmp SMALL NEAR PTR lab > CODE ENDS > END lab > > the first JMP returns a "Relative jump out of range by 8002h bytes" > error, while the second one has no problem. i'm not complaining about > TASM here as i shouldn't be specifying SMALL jumps in the first place. > but does anybody know how the assembler could be calculating relative > jumps that would cause one to yield an error but not the other? I think part of the meaning of "SMALL" is that the assembler should accept a 16-bit offset in situations in which you can't know until link time whether a 16-bit offset can work. In your second JMP, you can't know til link time whether the target will be in the first 64Kb of CODE. In your first JMP, you know at assembly time that it can't be correct. -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/
Technical Details
Message-ID:
<7omrg4$pfj$1@autumn.news.rcn.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7oin4q$fpb$3@autumn.news.rcn.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: feaef,fb5a9873a6924049 X-Google-Attributes: gidfeaef,public X-Google-Thread: 114917,fb5a9873a6924049 X-Google-Attributes: gid114917,public From: "John S. Fine" <johnfine@EROLS.COM> Subject: Re: Relative jump out of range (ignore the last post) Date: 1999/08/09 Message-ID: <7omrg4$pfj$1@autumn.news.rcn.net> X-Deja-AN: 510624821 Content-Transfer-Encoding: 7bit Approved: <johnfine@erols.com> Sender: news <news@autumn.news.rcn.net> References: <7oin4q$fpb$3@autumn.news.rcn.net> Content-Type: text/plain; charset=us-ascii X-Mozilla-Status: 0801 X-Complaints-To: abuse@rcn.com X-Trace: CjhXbwh7ZymN6sek2tzYr067ZQvUTlwpvfetHm4QOrE= Organization: none Mime-Version: 1.0 Reply-To: johnfine@EROLS.COM NNTP-Posting-Date: 9 Aug 1999 15:18:28 GMT Newsgroups: comp.lang.asm.x86,borland.public.tasm