Author Topic: Why does not go to the address?  (Read 215 times)

alex-rudenkiy

  • Regular Member
  • *
  • Posts: 21
Why does not go to the address?
« on: July 02, 2017, 08:42:03 AM »
Why does an error occur during compilation? :
       "Instruction does not allow NEAR indirect addressing"
The address to which the jump occurs is correct
« Last Edit: July 02, 2017, 07:08:49 PM by alex-rudenkiy »

jj2007

  • Member
  • *****
  • Posts: 7548
  • Assembler is fun ;-)
    • MasmBasic
Re: Why does not go to the address?
« Reply #1 on: July 02, 2017, 08:57:00 AM »
My crystal ball is not working right now, but it might help if you posted at least the line that the assembler doesn't like.

mineiro

  • Member
  • ***
  • Posts: 365
Re: Why does not go to the address?
« Reply #2 on: July 02, 2017, 12:04:46 PM »
hello alex-rudenkiy;
please, can you post an example so we can analise that brother.
Masm send as error/warning report line based.
Near to me means so so 128 bytes I think of instruction, 127?, (you start counting from 0 or 1? ) if that address space grow so far way will happen.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Why does not go to the address?
« Reply #3 on: July 02, 2017, 01:44:20 PM »
Jump to a label.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: Why does not go to the address?
« Reply #4 on: July 02, 2017, 06:51:17 PM »
The near jump error sometimes takes place when you try to do a LOOP or a conditional jump for more than a near jump, then you have to change your jump in such a way that the far jump is for unconditional jump "JMP"
En un lugar de la Mancha de cuyo nombre no quiero acordarme

jj2007

  • Member
  • *****
  • Posts: 7548
  • Assembler is fun ;-)
    • MasmBasic
Re: Why does not go to the address?
« Reply #5 on: July 02, 2017, 07:05:51 PM »
I am pleased to see that so many crystal balls are still working :t

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: Why does not go to the address?
« Reply #6 on: July 02, 2017, 07:09:13 PM »
I am pleased to see that so many crystal balls are still working :t
:biggrin: :biggrin:
En un lugar de la Mancha de cuyo nombre no quiero acordarme

alex-rudenkiy

  • Regular Member
  • *
  • Posts: 21
Re: Why does not go to the address?
« Reply #7 on: July 02, 2017, 07:46:44 PM »
Well, I once again tried, like, it turned out, but, as it were, not. Why did the Nops move?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Why does not go to the address?
« Reply #8 on: July 02, 2017, 08:05:51 PM »
My crystal ball is a bit foggy at the moment, try this.

mov eax, address
jmp eax
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

caballero

  • Member
  • ****
  • Posts: 760
    • Abre Ojos Ensamblador
Re: Why does not go to the address?
« Reply #9 on: July 02, 2017, 08:16:01 PM »
You like complicate matters, huh? Instead of code, images. Anyway, if you want to jump somewhere, why not put a label there? It's the simplest way
Code: [Select]
jmp  easy_label
....

easy_label:
nop
nop
nop
En un lugar de la Mancha de cuyo nombre no quiero acordarme

alex-rudenkiy

  • Regular Member
  • *
  • Posts: 21
Re: Why does not go to the address?
« Reply #10 on: July 02, 2017, 08:40:20 PM »
Okay, thanks, I overdid something  :biggrin:

mineiro

  • Member
  • ***
  • Posts: 365
Re: Why does not go to the address?
« Reply #11 on: July 02, 2017, 09:25:36 PM »
.code
start:
call that_addr
that_addr:
pop eax
sub eax, that_addr - start
;...
push start    ;fake call
ret
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

jj2007

  • Member
  • *****
  • Posts: 7548
  • Assembler is fun ;-)
    • MasmBasic
Re: Why does not go to the address?
« Reply #12 on: July 02, 2017, 11:40:02 PM »
if you want to jump somewhere, why not put a label there?

That sounds so easy, but if you don't have the source code, it can be quite difficult.