Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

<Skyhook> Where is 'bavaria' proper? I thought it was austria. -- Seen on #Linux


programming / comp.lang.asm.x86 / Re: Help! JMP out of range?

SubjectAuthor
* Re: Help! JMP out of range?Nicolae Nasturica
`* Re: Help! JMP out of range?wolfgang kern
 `* Re: Help! JMP out of range?Kerr-Mudd, John
  `* Re: Help! JMP out of range?Terje Mathisen
   `- Re: Help! JMP out of range?Kerr-Mudd, John

1
Subject: Re: Help! JMP out of range?
From: Nicolae Nasturica
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 22 Nov 2021 19:16 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nasturic...@nospicedham.gmail.com (Nicolae Nasturica)
Newsgroups: comp.lang.asm.x86
Subject: Re: Help! JMP out of range?
Date: Mon, 22 Nov 2021 11:16:26 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 34
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <0282b5a2-5299-4c7c-8f57-ab4dbd60eb7fn@googlegroups.com>
References: <sfrlrr4eeoc57@corp.supernews.com> <sfs1057jeoc120@corp.supernews.com>#1/1>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Mon, 22 Nov 2021 19:16:27 +0000
Injection-Info: reader02.eternal-september.org; posting-host="f8051d7cfc68e9b06884aa5b33529d00";
logging-data="3622"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HCmGVPOs/62i2xfL1qxs/pBMScy93oJI="
User-Agent: G2/1.0
Cancel-Lock: sha1:puMZsbw9atbibZ9nXCDMQAPaqg4=
View all headers
Pe miercuri, 19 aprilie 2000, la 10:00:00 UTC+3, Alexei A. Frounze a scris:
Conditional jumps such as JZ or JNC, etc are limited to 127/128 bytes. You cant
jump over 127 or 128 bytes backward or forward.
If you had:
------8<-------
JZ label1
------8<-------
you should make it like this:
------8<-------
JNZ label2
JMP label1
label2:
------8<-------
this solves your problem.
Good Luck
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror: http://members.xoom.com/alexfru
vassone wrote:

Can someone please explain why MASM is reporting "Jump out of range by
130(bytes)

What does this means?

Any help would be very much appreciated..

Vassone

mailto:vas...@hotmail.com

I like your games :)



Subject: Re: Help! JMP out of range?
From: wolfgang kern
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Tue, 23 Nov 2021 06:40 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nowh...@nospicedham.nevernet.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Help! JMP out of range?
Date: Tue, 23 Nov 2021 07:40:41 +0100
Organization: Aioe.org NNTP Server
Lines: 17
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <sni2d9$14pv$1@gioia.aioe.org>
References: <sfrlrr4eeoc57@corp.supernews.com>
<sfs1057jeoc120@corp.supernews.com>
<0282b5a2-5299-4c7c-8f57-ab4dbd60eb7fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="ffcee0e475cadc024bc937d8786eb09f";
logging-data="21137"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dqlIltm5HopTBuK8AHHaLNuQ0qhWlQKE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:jTOw+pR+DnD60uxwzjoh7ONf60I=
View all headers
On 22/11/2021 20:16, Nicolae Nasturica posted:
---
Can someone please explain why MASM is reporting "Jump out of range by
130(bytes)

because the range is a signed byte (+127..-128) and because MASM don't know about long CC-instructions (perhaps it knows with hint "long"):

0F 8x 43 21  jmp cc rel+4+2143

versus short:
7x 12        jmp cc rel+2+12

both variants use signed values relative to the address after the jump.
__
wolfgang



Subject: Re: Help! JMP out of range?
From: Kerr-Mudd, John
Newsgroups: comp.lang.asm.x86
Organization: Dis
Date: Wed, 24 Nov 2021 14:27 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@nospicedham.127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.asm.x86
Subject: Re: Help! JMP out of range?
Date: Wed, 24 Nov 2021 14:27:03 +0000
Organization: Dis
Lines: 35
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <20211124142703.9f0ccf3e37234794c5b13803@127.0.0.1>
References: <sfrlrr4eeoc57@corp.supernews.com>
<sfs1057jeoc120@corp.supernews.com>
<0282b5a2-5299-4c7c-8f57-ab4dbd60eb7fn@googlegroups.com>
<sni2d9$14pv$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d83daf319f348a42a1c88cc96b7f7fee";
logging-data="25858"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1827RUDnk/Tjq4lGzoioIdylzgtgBGZSwo="
Cancel-Lock: sha1:/Gd+PMnGxzMHrdu3HEcuA2nckNg=
View all headers
On Tue, 23 Nov 2021 07:40:41 +0100
wolfgang kern <nowhere@nospicedham.nevernet.at> wrote:

On 22/11/2021 20:16, Nicolae Nasturica posted:
---
Can someone please explain why MASM is reporting "Jump out of
range by 130(bytes)

because the range is a signed byte (+127..-128) and because MASM
don't know about long CC-instructions (perhaps it knows with hint
"long"):

0F 8x 43 21  jmp cc rel+4+2143

There are also the unconditional jmps
E9 xx xx     jmp 
EB xx        jmp near[/short]
has the same +127-128 range, but means a slightly increased jmp
forward, ability as the jmp is from the address of the next op code.

versus short:
7x 12        jmp cc rel+2+12

both variants use signed values relative to the address after the
jump. __
wolfgang


It might be useful to someone here; but Alexei answered Vassone's
question back in 2000.


--
Bah, and indeed Humbug.



Subject: Re: Help! JMP out of range?
From: Terje Mathisen
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Wed, 24 Nov 2021 15:22 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: terje.ma...@nospicedham.tmsw.no (Terje Mathisen)
Newsgroups: comp.lang.asm.x86
Subject: Re: Help! JMP out of range?
Date: Wed, 24 Nov 2021 16:22:57 +0100
Organization: Aioe.org NNTP Server
Lines: 66
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <snllci$1ovs$1@gioia.aioe.org>
References: <sfrlrr4eeoc57@corp.supernews.com>
<sfs1057jeoc120@corp.supernews.com>
<0282b5a2-5299-4c7c-8f57-ab4dbd60eb7fn@googlegroups.com>
<sni2d9$14pv$1@gioia.aioe.org>
<20211124142703.9f0ccf3e37234794c5b13803@127.0.0.1>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d83daf319f348a42a1c88cc96b7f7fee";
logging-data="22150"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ernt53z9IjX1zIv4xsO+O3ietEunIapM="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101
Firefox/68.0 SeaMonkey/2.53.10
Cancel-Lock: sha1:05RY6hI+iFyFO2ziacvLRteuR4I=
View all headers
Kerr-Mudd, John wrote:
On Tue, 23 Nov 2021 07:40:41 +0100
wolfgang kern <nowhere@nospicedham.nevernet.at> wrote:

On 22/11/2021 20:16, Nicolae Nasturica posted:
---
Can someone please explain why MASM is reporting "Jump out of
range by 130(bytes)

because the range is a signed byte (+127..-128) and because MASM
don't know about long CC-instructions (perhaps it knows with hint
"long"):

0F 8x 43 21  jmp cc rel+4+2143

There are also the unconditional jmps
E9 xx xx     jmp
EB xx        jmp near[/short]
has the same +127-128 range, but means a slightly increased jmp
forward, ability as the jmp is from the address of the next op code.

versus short:
7x 12        jmp cc rel+2+12

both variants use signed values relative to the address after the
jump. __
wolfgang


It might be useful to someone here; but Alexei answered Vassone's
question back in 2000.

2000?

You young wippersnappers! :-)

This particular issue came up regularly even before the 808x was invented, the solution was always the same, i.e. use some other method for the far jump and a short branch past this code to avoid it.

TASM (maybe around 1986?) had options to handle this automatically: By starting with the long jump macro at every branch location and then make one or a couple of passes, nearly all of them could be converted to the short form.

By starting with the long form

Long branch on Greater to target
   jle $+3
   jmp target

and then for each target checking the offset and if in the -128 to +127 range, convert to the two-byte form, no previously converted branch can go out of range, so the process is stable. After 2 or 3 iterations you'll probably find that either all of them are now short, or that no more can be converted.

I think there were other assemblers which did the same trick.

Terje


--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"



Subject: Re: Help! JMP out of range?
From: Kerr-Mudd, John
Newsgroups: comp.lang.asm.x86
Organization: Dis
Date: Wed, 24 Nov 2021 17:21 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: adm...@nospicedham.127.0.0.1 (Kerr-Mudd, John)
Newsgroups: comp.lang.asm.x86
Subject: Re: Help! JMP out of range?
Date: Wed, 24 Nov 2021 17:21:20 +0000
Organization: Dis
Lines: 77
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <20211124172120.850d74c1726f8d1e31f5bda3@127.0.0.1>
References: <sfrlrr4eeoc57@corp.supernews.com>
<sfs1057jeoc120@corp.supernews.com>
<0282b5a2-5299-4c7c-8f57-ab4dbd60eb7fn@googlegroups.com>
<sni2d9$14pv$1@gioia.aioe.org>
<20211124142703.9f0ccf3e37234794c5b13803@127.0.0.1>
<snllci$1ovs$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="d83daf319f348a42a1c88cc96b7f7fee";
logging-data="14224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Uv/bWh0YY11W4y3dSSGZ5Y00maT2gzHI="
Cancel-Lock: sha1:/EtzR9Ujj6bkZAjdvhoKTOjMgn8=
View all headers
On Wed, 24 Nov 2021 16:22:57 +0100
Terje Mathisen <terje.mathisen@nospicedham.tmsw.no> wrote:

Kerr-Mudd, John wrote:
On Tue, 23 Nov 2021 07:40:41 +0100
wolfgang kern <nowhere@nospicedham.nevernet.at> wrote:

On 22/11/2021 20:16, Nicolae Nasturica posted:
---
Can someone please explain why MASM is reporting "Jump out of
range by 130(bytes)

because the range is a signed byte (+127..-128) and because MASM
don't know about long CC-instructions (perhaps it knows with hint
"long"):

0F 8x 43 21  jmp cc rel+4+2143

There are also the unconditional jmps
E9 xx xx     jmp
EB xx        jmp near[/short]
has the same +127-128 range, but means a slightly increased jmp
forward, ability as the jmp is from the address of the next op code.

versus short:
7x 12        jmp cc rel+2+12

both variants use signed values relative to the address after the
jump. __
wolfgang


It might be useful to someone here; but Alexei answered Vassone's
question back in 2000.

2000?

You young wippersnappers! :-)

This particular issue came up regularly even before the 808x was
invented, the solution was always the same, i.e. use some other
method for the far jump and a short branch past this code to avoid it.

TASM (maybe around 1986?) had options to handle this automatically:
By starting with the long jump macro at every branch location and
then make one or a couple of passes, nearly all of them could be
converted to the short form.

By starting with the long form

Long branch on Greater to target
   jle $+3
   jmp target

I presume the 2nd jmp is the 3 byte version.


and then for each target checking the offset and if in the -128 to
+127 range, convert to the two-byte form, no previously converted
branch can go out of range, so the process is stable. After 2 or 3
iterations you'll probably find that either all of them are now
short, or that no more can be converted.

I think there were other assemblers which did the same trick.

Nasm does; if I spot this I try re-ordering my code to remove them.


--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"



--
Bah, and indeed Humbug.



1
rocksolid light 0.7.2
clearneti2ptor