🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm.x86
Article #81

Re: Relative jump out of range (ignore the last post)

#81
From: assassin17
Date: Sun, 15 Aug 1999 00:00
55 lines
2815 bytes
  johnfine@EROLS.COM wrote:
> 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.

thanks for the reply.  that definitely makes more sense of things, and
testing largely confirms the above rule.  but this code has left me
boggled:

.386
CODE SEGMENT USE32 'CODE'
    ASSUME  CS:CODE
    lab:
    db 65536 dup (0)
    krad:
    db 200 dup (55h)  ;padding to prevent a SHORT jmp
    jmp SMALL NEAR PTR krad
CODE ENDS
END lab

if i understood you right, you're saying "you cannot ever SMALL NEAR JMP
to any address outside the first 64Kb" -- _from anywhere_?  yet the
code assembles fine.  however, if 65536 is upped to 65539, a
"Relative jump out of range by 8001h bytes" error results.  what's the
significance of 65539 (or 3)?

and SHORT JMPs don't get error messages from TASM in the same
cases as the SMALL NEAR ones, but that's not really bugging me. :P

assassin17@rocketmail.com

[snip - my garbage]

>   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.

--
=-=  assassin17@rocketmail.com  =-=
Technical Details
Message-ID: <7p75ru$evl$4@autumn.news.rcn.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7oin4q$fpb$3@autumn.news.rcn.net> <7omrg4$pfj$1@autumn.news.rcn.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114917,fb5a9873a6924049
X-Google-Attributes: gid114917,public
X-Google-Thread: feaef,fb5a9873a6924049
X-Google-Attributes: gidfeaef,public
From: assassin17@rocketmail.com
Subject: Re: Relative jump out of range (ignore the last post)
Date: 1999/08/15
Message-ID: <7p75ru$evl$4@autumn.news.rcn.net>
X-Deja-AN: 513115726
Approved: <johnfine@erols.com>
References: <7oin4q$fpb$3@autumn.news.rcn.net> <7omrg4$pfj$1@autumn.news.rcn.net>
X-Http-User-Agent: Mozilla/4.08 [en] (Win95; I)
X-Complaints-To: abuse@rcn.com
X-Trace: AyQoghUwQ+Mzvz+H6g1TE0TlsSZTDS32aN3JrLd1sOs=
X-Http-Proxy: 1.0 x28.deja.com:80 (Squid/1.1.22) for client 192.234.16.2
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Sun Aug 15 06:44:16 1999 GMT
X-MyDeja-Info: XMYDJUIDassassin17
NNTP-Posting-Date: 15 Aug 1999 19:53:34 GMT
Newsgroups: comp.lang.asm.x86,borland.public.tasm