The MASM Forum

General => The Campus => Topic started by: alex-rudenkiy on July 02, 2017, 08:42:03 AM

Title: Why does not go to the address?
Post by: alex-rudenkiy 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
Title: Re: Why does not go to the address?
Post by: jj2007 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.
Title: Re: Why does not go to the address?
Post by: mineiro 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.
Title: Re: Why does not go to the address?
Post by: hutch-- on July 02, 2017, 01:44:20 PM
Jump to a label.
Title: Re: Why does not go to the address?
Post by: avcaballero 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"
Title: Re: Why does not go to the address?
Post by: jj2007 on July 02, 2017, 07:05:51 PM
I am pleased to see that so many crystal balls are still working :t
Title: Re: Why does not go to the address?
Post by: avcaballero on July 02, 2017, 07:09:13 PM
Quote from: jj2007 on July 02, 2017, 07:05:51 PM
I am pleased to see that so many crystal balls are still working :t
:biggrin: :biggrin:
Title: Re: Why does not go to the address?
Post by: alex-rudenkiy 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?
Title: Re: Why does not go to the address?
Post by: hutch-- 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
Title: Re: Why does not go to the address?
Post by: avcaballero 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

jmp  easy_label
....

easy_label:
nop
nop
nop

Title: Re: Why does not go to the address?
Post by: alex-rudenkiy on July 02, 2017, 08:40:20 PM
Okay, thanks, I overdid something  :biggrin:
Title: Re: Why does not go to the address?
Post by: mineiro 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
Title: Re: Why does not go to the address?
Post by: jj2007 on July 02, 2017, 11:40:02 PM
Quote from: caballero on July 02, 2017, 08:16:01 PMif 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.